]> git.mxchange.org Git - jjobs-war.git/commitdiff
Don't cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 21 Apr 2020 23:59:56 +0000 (01:59 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 21 Apr 2020 23:59:56 +0000 (01:59 +0200)
- JJobs has no need for addressbooks, it can be done without them
- renamed backing beans for JJobs
- fixed (maybe?) some JNDI names
- a lot other fixes, still something is not correct, some interfaces have some
  missing methods while they should be there

Signed-off-by: Roland Häder <roland@mxchange.org>
58 files changed:
lib/jaddressbook-core.jar [deleted file]
lib/jaddressbook-lib.jar [deleted file]
nbproject/project.properties
nbproject/project.xml
src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionBean.java [deleted file]
src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionController.java [deleted file]
src/java/org/mxchange/jjobs/beans/business/employee/JobsAdminEmployeeWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/employee/list/FinancialsEmployeeListWebViewBean.java [deleted file]
src/java/org/mxchange/jjobs/beans/business/employee/list/FinancialsEmployeeListWebViewController.java [deleted file]
src/java/org/mxchange/jjobs/beans/business/employee/list/JobsEmployeeListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/business/employee/list/JobsEmployeeListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewBean.java [deleted file]
src/java/org/mxchange/jjobs/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewController.java [deleted file]
src/java/org/mxchange/jjobs/beans/business/opening_time/list/JobsOpeningTimeListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/business/opening_time/list/JobsOpeningTimeListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java [deleted file]
src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsAdminContactMobileWebRequestController.java [deleted file]
src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsContactMobileWebRequestBean.java [deleted file]
src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsContactMobileWebRequestController.java [deleted file]
src/java/org/mxchange/jjobs/beans/contact/mobile/JobsAdminContactMobileWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/contact/mobile/JobsAdminContactMobileWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/contact/mobile/JobsContactMobileWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/contact/mobile/JobsContactMobileWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/contact/phone/action/FinancialsUserActionWebRequestBean.java [deleted file]
src/java/org/mxchange/jjobs/beans/contact/phone/action/FinancialsUserActionWebRequestController.java [deleted file]
src/java/org/mxchange/jjobs/beans/contact/phone/email_address/list/FinancialsEmailChangeListWebViewBean.java [deleted file]
src/java/org/mxchange/jjobs/beans/contact/phone/email_address/list/FinancialsEmailChangeListWebViewController.java [deleted file]
src/java/org/mxchange/jjobs/beans/contact/phone/list/JobsUserListWebViewBean.java
src/java/org/mxchange/jjobs/beans/contact/phone/list/JobsUserListWebViewController.java
src/java/org/mxchange/jjobs/beans/data/JobsDataWebApplicationBean.java
src/java/org/mxchange/jjobs/beans/helper/JobsWebViewHelperBean.java
src/java/org/mxchange/jjobs/beans/mobile/FinancialsAdminMobileWebRequestBean.java
src/java/org/mxchange/jjobs/beans/mobile/FinancialsAdminMobileWebRequestController.java
src/java/org/mxchange/jjobs/beans/mobile/list/FinancialsMobileListWebViewBean.java
src/java/org/mxchange/jjobs/beans/mobile/list/FinancialsMobileListWebViewController.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/jjobs/beans/mobileprovider/list/FinancialsMobileProviderListWebViewBean.java
src/java/org/mxchange/jjobs/beans/mobileprovider/list/FinancialsMobileProviderListWebViewController.java
src/java/org/mxchange/jjobs/beans/phone/JobsAdminPhoneWebRequestBean.java
src/java/org/mxchange/jjobs/beans/phone/list/FinancialsPhoneListWebViewBean.java
src/java/org/mxchange/jjobs/beans/phone/list/FinancialsPhoneListWebViewController.java
src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/action/JobsUserActionWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/user/action/JobssUserActionWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/user/confirmlink/JobsConfirmationLinkWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/email_address/JobsEmailChangeWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/email_address/list/JobsEmailChangeListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/user/email_address/list/JobsEmailChangeListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/user/login/JobsUserLoginWebSessionBean.java
src/java/org/mxchange/jjobs/beans/user/register/JobsUserRegisterWebRequestBean.java
src/java/org/mxchange/jjobs/beans/user/resendlink/JobsResendLinkWebRequestBean.java
src/java/org/mxchange/jjobs/converter/business/company_employee/JobsEmployeeConverter.java
src/java/org/mxchange/jjobs/converter/business/opening_time/JobsCompanyOpeningTimeConverter.java
src/java/org/mxchange/jjobs/converter/fax/JobsFaxNumberConverter.java
src/java/org/mxchange/jjobs/converter/landline/JobsLandLineNumberConverter.java
src/java/org/mxchange/jjobs/converter/mobile/JobsMobileNumberConverter.java
src/java/org/mxchange/jjobs/converter/mobileprovider/JobsMobileProviderConverter.java
src/java/org/mxchange/jjobs/validator/addressbook/JobsAddressbookIdValidator.java [deleted file]

diff --git a/lib/jaddressbook-core.jar b/lib/jaddressbook-core.jar
deleted file mode 100644 (file)
index 6578dc4..0000000
Binary files a/lib/jaddressbook-core.jar and /dev/null differ
diff --git a/lib/jaddressbook-lib.jar b/lib/jaddressbook-lib.jar
deleted file mode 100644 (file)
index 7347bb6..0000000
Binary files a/lib/jaddressbook-lib.jar and /dev/null differ
index a078f2353a2cd610649ef5cb0c53e8fe855177fd..c03f2a43717cd9ac65e209d855bcf68b3b06c0af 100644 (file)
@@ -35,8 +35,6 @@ dist.javadoc.dir=${dist.dir}/javadoc
 dist.war=${dist.dir}/${war.name}
 endorsed.classpath=
 excludes=
-file.reference.jaddressbook-core.jar=lib/jaddressbook-core.jar
-file.reference.jaddressbook-lib.jar=lib/jaddressbook-lib.jar
 file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.jar
 file.reference.jcontacts-business-lib.jar=lib/jcontacts-business-lib.jar
 file.reference.cdi-api.jar=lib/cdi-api.jar
@@ -84,8 +82,6 @@ javac.classpath=\
     ${file.reference.juser-activity-lib.jar}:\
     ${file.reference.jcontacts-business-core.jar}:\
     ${file.reference.jcontacts-business-lib.jar}:\
-    ${file.reference.jaddressbook-core.jar}:\
-    ${file.reference.jaddressbook-lib.jar}:\
     ${reference.jjobs-core.jar}:\
     ${reference.jjobs-lib.jar}:\
     ${file.reference.cdi-api.jar}:\
@@ -154,8 +150,6 @@ source.reference.juser-activity-core.jar=../juser-activity-core/src/
 source.reference.juser-activity-lib.jar=../juser-activity-lib/src/
 source.reference.juser-core.jar=../juser-core/src/
 source.reference.juser-lib.jar=../juser-lib/src/
-source.reference.jaddressbook-core.jar=../jaddressbook-core/src/
-source.reference.jaddressbook-lib.jar=../jaddressbook-lib/src/
 source.reference.juser-login-core.jar=../juser-login-core/src/
 source.reference.juser-login-lib.jar=../juser-login-lib/src/
 source.root=src
index 39d6098d53a7c9eb39f65a167ada175a60f669a3..1d1c7400205392b41a0f4b82a0da2e0dad71d9c6 100644 (file)
                 <library dirs="200">
                     <file>${file.reference.jcontacts-business-lib.jar}</file>
                 </library>
-                <library dirs="200">
-                    <file>${file.reference.jaddressbook-core.jar}</file>
-                </library>
-                <library dirs="200">
-                    <file>${file.reference.jaddressbook-lib.jar}</file>
-                </library>
                 <library dirs="200">
                     <file>${reference.jjobs-core.jar}</file>
                 </library>
diff --git a/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionBean.java
deleted file mode 100644 (file)
index 767b5f8..0000000
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jjobs.beans.addressbook;
-
-import java.text.MessageFormat;
-import java.util.Collections;
-import java.util.Date;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.Any;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote;
-import org.mxchange.jaddressbook.events.addressbook.AddressbookLoadedEvent;
-import org.mxchange.jaddressbook.events.addressbook.ObservableAddressbookLoadedEvent;
-import org.mxchange.jaddressbook.exceptions.AddressbookNameAlreadyUsedException;
-import org.mxchange.jaddressbook.exceptions.AddressbookNotFoundException;
-import org.mxchange.jaddressbook.model.addressbook.Addressbook;
-import org.mxchange.jaddressbook.model.addressbook.UserAddressbook;
-import org.mxchange.jaddressbook.model.addressbook.entry.AddressbookEntry;
-import org.mxchange.jjobs.beans.BaseJobsBean;
-import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController;
-import org.mxchange.jusercore.model.user.User;
-import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent;
-
-/**
- * An address book bean (controller)
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("addressbookController")
-@SessionScoped
-public class JobsAddressbookWebSessionBean extends BaseJobsBean implements JobsAddressbookWebSessionController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 185_781_756_712_969L;
-
-       /**
-        * Address book instance
-        */
-       private Addressbook addressbook;
-
-       /**
-        * Remote address book bean
-        */
-       private AddressbookSessionBeanRemote addressbookBean;
-
-       /**
-        * When this address book has been created
-        */
-       private Date addressbookCreated;
-
-       /**
-        * Address book id number (from URL for example)
-        */
-       private Long addressbookId;
-
-       /**
-        * Name of the address book
-        */
-       private String addressbookName;
-
-       /**
-        * Who owns this address book
-        */
-       private User addressbookUser;
-
-       /**
-        * Event fired when user has logged in
-        */
-       @Inject
-       @Any
-       private Event<ObservableAddressbookLoadedEvent> loadedEvent;
-
-       /**
-        * Login controller
-        */
-       @Inject
-       private JobsUserLoginWebSessionController userLoginController;
-
-       /**
-        * A list of all user's address books
-        */
-       private List<Addressbook> usersAddressbooks;
-
-       /**
-        * Default constructor
-        */
-       public JobsAddressbookWebSessionBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public String addAddressbook () {
-               // Is this name already used?
-               if (!this.userLoginController.isUserLoggedIn()) {
-                       // Not logged in
-                       throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
-               } else if (this.getAddressbookName() == null) {
-                       // Address book name is null
-                       throw new NullPointerException("addressbookName is null"); //NOI18N
-               } else if (this.getAddressbookName().isEmpty()) {
-                       // Address book name is empty
-                       throw new IllegalStateException("addressbookName is empty."); //NOI18N
-               } else if (this.isAddressbookNameUsed(this.getAddressbookName())) {
-                       // Already used by this user
-                       throw new FaceletException(MessageFormat.format("Address book name {0} already used.", this.getAddressbookName())); //NOI18N
-               }
-
-               // Create address book instance with name
-               Addressbook book = new UserAddressbook(this.getAddressbookName(), this.userLoginController.getLoggedInUser());
-
-               try {
-                       // Register this address book
-                       Addressbook updatedAddressbook = this.addressbookBean.createAddressbook(book);
-
-                       // Remove name
-                       this.setAddressbookName(null);
-
-                       // Add address book entry to list
-                       this.usersAddressbooks.add(updatedAddressbook);
-
-                       // All fine
-                       return "login_own_addressbooks"; //NOI18N
-               } catch (final AddressbookNameAlreadyUsedException ex) {
-                       // Throw again as cause
-                       throw new FaceletException(ex);
-               }
-       }
-
-       @Override
-       public void afterAddressbookLoadedEvent (@Observes final ObservableAddressbookLoadedEvent event) {
-               // event should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getAddressbook() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.addressbook is null"); //NOI18N
-               } else if (event.getAddressbook().getAddressbookId() == null) {
-                       // And again a NPE
-                       throw new NullPointerException("event.addressbook.addressbookId is null"); //NOI18N
-               } else if (event.getAddressbook().getAddressbookId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("Address book instance {0} has invalid id number: {1}", event.getAddressbook(), event.getAddressbook().getAddressbookId())); //NOI18N
-               } else if (event.getAddressbook().getAddressbookUser() == null) {
-                       // One more NPE ...
-                       throw new NullPointerException("event.addressbook.addressbookUser is null"); //NOI18N
-               }
-
-               // Get address book instance
-               final Addressbook book = event.getAddressbook();
-
-               // Set address book data
-               this.setAddressbookId(book.getAddressbookId());
-               this.setAddressbookName(book.getAddressbookName());
-               this.setAddressbookUser(book.getAddressbookUser());
-               this.setAddressbookCreated(book.getAddressbookCreated());
-
-               // And instance ...
-               this.setAddressbook(book);
-       }
-
-       @Override
-       public void afterLoginEvent (@Observes final ObservableUserLoggedInEvent event) {
-               // Is the user logged in?
-               if (null == event) {
-                       // Is null
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getLoggedInUser() == null) {
-                       // user is null
-                       throw new NullPointerException("event.user is null"); //NOI18N
-               } else if (!event.getLoggedInUser().equals(this.userLoginController.getLoggedInUser())) {
-                       // Not matching
-                       throw new IllegalStateException("event.user and userLoginController.loggedInUser don't match."); //NOI18N
-               } else if (!this.userLoginController.isUserLoggedIn()) {
-                       // Not logged in
-                       throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
-               }
-
-               // Init user's address book list
-               this.initAddressbookList();
-       }
-
-       @Override
-       public List<Addressbook> allAddressbooks () {
-               // Is the user logged in?
-               if (!this.userLoginController.isUserLoggedIn()) {
-                       // Not logged in
-                       throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
-               }
-
-               return Collections.unmodifiableList(this.usersAddressbooks);
-       }
-
-       @Override
-       public List<AddressbookEntry> allEntries (final Addressbook addressbook) {
-               // Is the user logged in?
-               if (!this.userLoginController.isUserLoggedIn()) {
-                       // Not logged in
-                       throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
-               }
-
-               // Ask the bean
-               return this.addressbookBean.allEntries(addressbook);
-       }
-
-       @Override
-       public int allEntriesSize (final Addressbook addressbook) {
-               // Ask the bean
-               return this.allEntries(addressbook).size();
-       }
-
-       @Override
-       public Addressbook getAddressbook () {
-               return this.addressbook;
-       }
-
-       @Override
-       public void setAddressbook (final Addressbook addressbook) {
-               this.addressbook = addressbook;
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfDateField")
-       public Date getAddressbookCreated () {
-               return this.addressbookCreated;
-       }
-
-       @Override
-       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
-       public void setAddressbookCreated (final Date addressbookCreated) {
-               this.addressbookCreated = addressbookCreated;
-       }
-
-       @Override
-       public Long getAddressbookId () {
-               return this.addressbookId;
-       }
-
-       @Override
-       public void setAddressbookId (final Long addressbookId) {
-               this.addressbookId = addressbookId;
-       }
-
-       @Override
-       public String getAddressbookName () {
-               return this.addressbookName;
-       }
-
-       @Override
-       public void setAddressbookName (final String addressbookName) {
-               this.addressbookName = addressbookName;
-       }
-
-       @Override
-       public User getAddressbookUser () {
-               return this.addressbookUser;
-       }
-
-       @Override
-       public void setAddressbookUser (final User addressbookUser) {
-               this.addressbookUser = addressbookUser;
-       }
-
-       @Override
-       public boolean hasCreatedAddressbooks () {
-               // Is the user logged in?
-               if (!this.userLoginController.isUserLoggedIn()) {
-                       // Not logged in
-                       throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
-               }
-
-               // Check if the list is filled
-               return (!this.usersAddressbooks.isEmpty());
-       }
-
-       /**
-        * Post-initialization of this class
-        */
-       @PostConstruct
-       public void init () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup
-                       this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/jjobs-ejb/jjobs-adr!org.mxchange.jjobs.model.addressbook.JobsAddressbookSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw again
-                       throw new FaceletException(e);
-               }
-
-               // Init list
-               this.usersAddressbooks = new LinkedList<>();
-
-               // Is the user logged-in?
-               if (this.userLoginController.isUserLoggedIn()) {
-                       // Initialize list
-                       this.initAddressbookList();
-               }
-
-               // TODO Initialize list from bean with just one call
-               //this.addressbookBean.getUserCountMap()
-       }
-
-       @Override
-       public boolean isAddressbookLoaded () {
-               return ((this.getAddressbookId() instanceof Long) &&
-                               (this.getAddressbookName() instanceof String) &&
-                               (!this.getAddressbookName().isEmpty()) &&
-                               (this.getAddressbookUser() instanceof User));
-       }
-
-       @Override
-       public boolean isAddressbookNameUsed (final String addressbookName) {
-               // Is it zero size?
-               if (null == addressbookName) {
-                       // Is null
-                       throw new NullPointerException("addressbookName is null"); //NOI18N
-               } else if (this.usersAddressbooks.isEmpty()) {
-                       // Not found!
-                       return false;
-               }
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Check all entries
-               for (final Addressbook book : this.usersAddressbooks) {
-                       // Is the name same?
-                       if (book.getAddressbookName().equals(addressbookName)) {
-                               // Found a match
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return status
-               return isFound;
-       }
-
-       @Override
-       public boolean isOtherAddressbook () {
-               // Just call the other method and invert it
-               return (!this.isOwnAddressbook());
-       }
-
-       @Override
-       public boolean isOwnAddressbook () {
-               // Is the user logged in?
-               if (!this.userLoginController.isUserLoggedIn()) {
-                       // No, then no own address book
-                       throw new IllegalStateException("isOwnAddressbook() has been invoked for a guest account"); //NOI18N
-               }
-
-               // Is same user?
-               return Objects.equals(this.getAddressbookUser(), this.userLoginController.getLoggedInUser());
-       }
-
-       @Override
-       public boolean loadAddressbook () {
-               // Check if the id is set
-               if (this.getAddressbookId() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.addressbookId is null");
-               } else if (this.getAddressbookId() < 1) {
-                       // Not valid id
-                       throw new IllegalStateException(MessageFormat.format("this.addressbook={0} is invalid", this.getAddressbookId()));
-               }
-
-               // Default is not found
-               boolean isFound = false;
-
-               try {
-                       // Then try to look it up
-                       Addressbook a = this.addressbookBean.getAddressbookById(this.getAddressbookId());
-
-                       // Fire event here
-                       this.loadedEvent.fire(new AddressbookLoadedEvent(a));
-
-                       // Found it
-                       isFound = true;
-               } catch (final AddressbookNotFoundException ex) {
-                       // Not found!
-                       throw new FaceletException(ex);
-               }
-
-               // Return status
-               return isFound;
-       }
-
-       /**
-        * Initializes the user user's address book list
-        */
-       private void initAddressbookList () {
-               // Get user instance
-               User user = this.userLoginController.getLoggedInUser();
-
-               // Fill list with entries
-               this.usersAddressbooks = this.addressbookBean.getUsersAddressbookList(user);
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionController.java b/src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionController.java
deleted file mode 100644 (file)
index ff7db6a..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jjobs.beans.addressbook;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-import org.mxchange.jaddressbook.events.addressbook.ObservableAddressbookLoadedEvent;
-import org.mxchange.jaddressbook.model.addressbook.Addressbook;
-import org.mxchange.jaddressbook.model.addressbook.entry.AddressbookEntry;
-import org.mxchange.jusercore.model.user.User;
-import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent;
-
-/**
- * An interface for address book beans
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface JobsAddressbookWebSessionController extends Serializable {
-
-       /**
-        * Checks whether the user has created addressbooks. For this method to work
-        * it is vital that the user is logged into his/her account.
-        * <p>
-        * @return Whether the user has created at least one addressbook
-        */
-       boolean hasCreatedAddressbooks ();
-
-       /**
-        * Creates a new address book with a name and redirects to proper target.
-        * For this method to work it is vital that the user is logged into his/her
-        * account.
-        * <p>
-        * @return Target to redirect to
-        */
-       String addAddressbook ();
-
-       /**
-        * Getter for address book name
-        * <p>
-        * @return Address book name
-        */
-       String getAddressbookName ();
-
-       /**
-        * Setter for address book name
-        * <p>
-        * @param addressbookName Address book name
-        */
-       void setAddressbookName (final String addressbookName);
-
-       /**
-        * Checks if the given address book name is already used by the user.
-        * <p>
-        * @param addressbookName Address book name to check
-        * <p>
-        * @return Whether the name has already been used by the user
-        */
-       boolean isAddressbookNameUsed (final String addressbookName);
-
-       /**
-        * Returns all address books with this user
-        * <p>
-        * @return A list of all address books by this user
-        */
-       List<Addressbook> allAddressbooks ();
-
-       /**
-        * Returns a list of all address book entries for given address book
-        * <p>
-        * @param addressbook Address book instance
-        * <p>
-        * @return List of all entries
-        */
-       List<AddressbookEntry> allEntries (final Addressbook addressbook);
-
-       /**
-        * Size of all entries in given address book
-        * <p>
-        * @param addressbook Address book instance
-        * <p>
-        * @return Size of the entries in address book
-        */
-       int allEntriesSize (final Addressbook addressbook);
-
-       /**
-        * Getter for address book id number
-        * <p>
-        * @return Address book id number
-        */
-       Long getAddressbookId ();
-
-       /**
-        * Setter for address book id number
-        * <p>
-        * @param addressbookId Address book id number
-        */
-       void setAddressbookId (final Long addressbookId);
-
-       /**
-        * Getter for address book user (owner)
-        * <p>
-        * @return Address book user (owner)
-        */
-       User getAddressbookUser ();
-
-       /**
-        * Setter for address book user (owner)
-        * <p>
-        * @param addressbookUser Address book user (owner)
-        */
-       void setAddressbookUser (final User addressbookUser);
-
-       /**
-        * Getter for when the address book has been created
-        * <p>
-        * @return When the address book has been created
-        */
-       Date getAddressbookCreated ();
-
-       /**
-        * Setter for when the address book has been created
-        * <p>
-        * @param addressbookCreated When the address book has been created
-        */
-       void setAddressbookCreated (final Date addressbookCreated);
-
-       /**
-        * This method is called when an address book has been successfully loaded
-        * from JPA.
-        * <p>
-        * @param event Event with address book instance
-        */
-       void afterAddressbookLoadedEvent (final ObservableAddressbookLoadedEvent event);
-
-       /**
-        * This method is called when a user has successfully logged in his/her
-        * account.
-        * <p>
-        * @param event
-        */
-       void afterLoginEvent (final ObservableUserLoggedInEvent event);
-
-       /**
-        * Checks if the user is logged in and if so if it matches the current
-        * address book owner.
-        * <p>
-        * @return Whether the owner matches currently logged-in user
-        */
-       boolean isOwnAddressbook ();
-
-       /**
-        * Checks if the owner of the current address book is NOT matching the
-        * logged-in user.
-        * <p>
-        * @return Whether the user does NOT match
-        */
-       boolean isOtherAddressbook ();
-
-       /**
-        * Getter for address book instance
-        * <p>
-        * @return Address book instance
-        */
-       Addressbook getAddressbook ();
-
-       /**
-        * Setter for address book instance
-        * <p>
-        * @param addressbook Address book instance
-        */
-       void setAddressbook (final Addressbook addressbook);
-
-       /**
-        * Checks weather an address book has been loaded by checking the id number.
-        * <p>
-        * @return Whether the address book is loaded
-        */
-       boolean isAddressbookLoaded ();
-
-       /**
-        * Loads address book from current id
-        * <p>
-        * @return Whether the address book was found
-        */
-       boolean loadAddressbook ();
-}
index 2fb6b2fbe070de344117809f960607e721b839ef..baa66ec8ced2912980eb2dddda4bd7007668ac5b 100644 (file)
@@ -40,7 +40,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jfinancials.beans.business.employee.list.FinancialsEmployeeListWebViewController;
+import org.mxchange.jjobs.beans.business.employee.list.JobsEmployeeListWebViewController;
 
 /**
  * A request-scoped bean for administrative purposes for administrative employee
@@ -74,7 +74,7 @@ public class JobsAdminEmployeeWebRequestBean extends BaseJobsBean implements Job
         * Administrative list-all-employees controller
         */
        @Inject
-       private FinancialsEmployeeListWebViewController adminEmployeeListController;
+       private JobsEmployeeListWebViewController adminEmployeeListController;
 
        /**
         * Assigned basic data instance
diff --git a/src/java/org/mxchange/jjobs/beans/business/employee/list/FinancialsEmployeeListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/business/employee/list/FinancialsEmployeeListWebViewBean.java
deleted file mode 100644 (file)
index 966e432..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2017 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.business.employee.list;
-
-import fish.payara.cdi.jsr107.impl.NamedCache;
-import java.text.MessageFormat;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
-import javax.ejb.EJB;
-import javax.enterprise.event.Observes;
-import javax.faces.view.ViewScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.mxchange.jcontactsbusiness.events.employee.added.ObservableEmployeeAddedEvent;
-import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
-import org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-
-/**
- * A view-scoped bean for listing purposes for e.g. administrative employee
- * purposes.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("employeeListController")
-@ViewScoped
-public class FinancialsEmployeeListWebViewBean extends BaseFinancialsBean implements FinancialsEmployeeListWebViewController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 12_886_968_547_362L;
-
-       /**
-        * List of all employees
-        */
-       private final List<Employable> allEmployees;
-
-       /**
-        * EJB for general company employee purposes
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/employee!org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote")
-       private EmployeeSessionBeanRemote employeeBean;
-
-       /**
-        * List of all company employees
-        */
-       @Inject
-       @NamedCache (cacheName = "companyEmployeeCache")
-       private transient Cache<Long, Employable> employeeCache;
-
-       /**
-        * A list of filtered employees
-        */
-       private List<Employable> filteredEmployees;
-
-       /**
-        * Currently selected employee
-        */
-       private Employable selectedEmployee;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsEmployeeListWebViewBean () {
-               // Call super constructor
-               super();
-
-               // Init list
-               this.allEmployees = new LinkedList<>();
-       }
-
-       /**
-        * Observes events being fired when an employee has been added
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterEmployeeAddedEvent (@Observes final ObservableEmployeeAddedEvent event) {
-               // Validate parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getEmployee() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.employee is null"); //NOI18N
-               } else if (event.getEmployee().getEmployeeId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.employee.employeeId is null"); //NOI18N
-               } else if (event.getEmployee().getEmployeeId() < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("event.employee.employeeId={0} is invalid", event.getEmployee().getEmployeeId())); //NOI18N
-               }
-
-               // Add employee to cache and list
-               this.employeeCache.put(event.getEmployee().getEmployeeId(), event.getEmployee());
-               this.getAllEmployees().add(event.getEmployee());
-       }
-
-       @Override
-       public Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException {
-               // Validate parameter
-               if (null == employeeId) {
-                       // Throw NPE
-                       throw new NullPointerException("employeeId is null"); //NOI18N
-               } else if (employeeId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("employeeId={0} is invalid", employeeId)); //NOI18N
-               } else if (!this.employeeCache.containsKey(employeeId)) {
-                       // Not found
-                       throw new EmployeeNotFoundException(employeeId);
-               }
-
-               // Get it from cache
-               final Employable employee = this.employeeCache.get(employeeId);
-
-               // Return it
-               return employee;
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Employable> getAllEmployees () {
-               return this.allEmployees;
-       }
-
-       /**
-        * Getter for filtered list of employees
-        * <p>
-        * @return Filtered list of employees
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Employable> getFilteredEmployees () {
-               return this.filteredEmployees;
-       }
-
-       /**
-        * Getter for filtered list of employees
-        * <p>
-        * @param filteredEmployees Filtered list of employees
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredEmployees (final List<Employable> filteredEmployees) {
-               this.filteredEmployees = filteredEmployees;
-       }
-
-       /**
-        * Getter for currently selected employee
-        * <p>
-        * @return Currently selected employee
-        */
-       public Employable getSelectedEmployee () {
-               return this.selectedEmployee;
-       }
-
-       /**
-        * Setter for currently selected employee
-        * <p>
-        * @param selectedEmployee Currently selected employee
-        */
-       public void setSelectedEmployee (final Employable selectedEmployee) {
-               this.selectedEmployee = selectedEmployee;
-       }
-
-       /**
-        * Initialization method
-        */
-       @PostConstruct
-       public void initializeList () {
-               // Is cache there?
-               if (!this.employeeCache.iterator().hasNext()) {
-                       // Add all
-                       for (final Employable employee : this.employeeBean.fetchAllEmployees()) {
-                               // Add it to cache
-                               this.employeeCache.put(employee.getEmployeeId(), employee);
-                       }
-               }
-
-               // Is cache filled and list is empty
-               if ((this.employeeCache.iterator().hasNext()) && (this.getAllEmployees().isEmpty())) {
-                       // Build up list
-                       for (final Cache.Entry<Long, Employable> currentEntry : this.employeeCache) {
-                               // Add to list
-                               this.getAllEmployees().add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.getAllEmployees().sort(new Comparator<Employable>() {
-                               @Override
-                               public int compare (final Employable employee1, final Employable employee2) {
-                                       return employee1.getEmployeeId() > employee2.getEmployeeId() ? 1 : employee1.getEmployeeId() < employee2.getEmployeeId() ? -1 : 0;
-                               }
-                       });
-               }
-       }
-
-       @Override
-       public Boolean isEmailAddressRegistered (final String emailAddress) {
-               // Validate parameter
-               if (null == emailAddress) {
-                       // Throw NPE
-                       throw new NullPointerException("emailAddress is null"); //NOI18N
-               } else if (emailAddress.isEmpty()) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
-               }
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Check all entries
-               for (final Employable basicData : this.getAllEmployees()) {
-                       // Is email address used?
-                       if (Objects.equals(basicData.getEmployeeEmailAddress(), emailAddress)) {
-                               // Found it
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/business/employee/list/FinancialsEmployeeListWebViewController.java b/src/java/org/mxchange/jjobs/beans/business/employee/list/FinancialsEmployeeListWebViewController.java
deleted file mode 100644 (file)
index 306bb46..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2017 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.business.employee.list;
-
-import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
-
-/**
- * An interface for request-scoped administrative company employee beans
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface FinancialsEmployeeListWebViewController extends Serializable {
-
-       /**
-        * Returns a list of all company employees
-        * <p>
-        * @return List of all company employees
-        */
-       List<Employable> getAllEmployees ();
-
-       /**
-        * Validates if given email address is already in use by an employee
-        * <p>
-        * @param emailAddress Email address to be validated
-        * <p>
-        * @return Whether the email address is already used
-        */
-       Boolean isEmailAddressRegistered (final String emailAddress);
-
-       /**
-        * Finds a company employee by given employee id
-        * <p>
-        * @param employeeId Employable id to find company employee instance for
-        * <p>
-        * @return Company employee instance
-        * <p>
-        * @throws EmployeeNotFoundException If the company employee was not found
-        */
-       Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException;
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/business/employee/list/JobsEmployeeListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/business/employee/list/JobsEmployeeListWebViewBean.java
new file mode 100644 (file)
index 0000000..aba7e3a
--- /dev/null
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.business.employee.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontactsbusiness.events.employee.added.ObservableEmployeeAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+
+/**
+ * A view-scoped bean for listing purposes for e.g. administrative employee
+ * purposes.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("employeeListController")
+@ViewScoped
+public class JobsEmployeeListWebViewBean extends BaseJobsBean implements JobsEmployeeListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 12_886_968_547_362L;
+
+       /**
+        * List of all employees
+        */
+       private final List<Employable> allEmployees;
+
+       /**
+        * EJB for general company employee purposes
+        */
+       @EJB (lookup = "java:global/jjobs-ejb/employee!org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote")
+       private EmployeeSessionBeanRemote employeeBean;
+
+       /**
+        * List of all company employees
+        */
+       @Inject
+       @NamedCache (cacheName = "companyEmployeeCache")
+       private transient Cache<Long, Employable> employeeCache;
+
+       /**
+        * A list of filtered employees
+        */
+       private List<Employable> filteredEmployees;
+
+       /**
+        * Currently selected employee
+        */
+       private Employable selectedEmployee;
+
+       /**
+        * Default constructor
+        */
+       public JobsEmployeeListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allEmployees = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being fired when an employee has been added
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterEmployeeAddedEvent (@Observes final ObservableEmployeeAddedEvent event) {
+               // Validate parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getEmployee() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.employee is null"); //NOI18N
+               } else if (event.getEmployee().getEmployeeId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.employee.employeeId is null"); //NOI18N
+               } else if (event.getEmployee().getEmployeeId() < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("event.employee.employeeId={0} is invalid", event.getEmployee().getEmployeeId())); //NOI18N
+               }
+
+               // Add employee to cache and list
+               this.employeeCache.put(event.getEmployee().getEmployeeId(), event.getEmployee());
+               this.getAllEmployees().add(event.getEmployee());
+       }
+
+       @Override
+       public Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException {
+               // Validate parameter
+               if (null == employeeId) {
+                       // Throw NPE
+                       throw new NullPointerException("employeeId is null"); //NOI18N
+               } else if (employeeId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("employeeId={0} is invalid", employeeId)); //NOI18N
+               } else if (!this.employeeCache.containsKey(employeeId)) {
+                       // Not found
+                       throw new EmployeeNotFoundException(employeeId);
+               }
+
+               // Get it from cache
+               final Employable employee = this.employeeCache.get(employeeId);
+
+               // Return it
+               return employee;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Employable> getAllEmployees () {
+               return this.allEmployees;
+       }
+
+       /**
+        * Getter for filtered list of employees
+        * <p>
+        * @return Filtered list of employees
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Employable> getFilteredEmployees () {
+               return this.filteredEmployees;
+       }
+
+       /**
+        * Getter for filtered list of employees
+        * <p>
+        * @param filteredEmployees Filtered list of employees
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredEmployees (final List<Employable> filteredEmployees) {
+               this.filteredEmployees = filteredEmployees;
+       }
+
+       /**
+        * Getter for currently selected employee
+        * <p>
+        * @return Currently selected employee
+        */
+       public Employable getSelectedEmployee () {
+               return this.selectedEmployee;
+       }
+
+       /**
+        * Setter for currently selected employee
+        * <p>
+        * @param selectedEmployee Currently selected employee
+        */
+       public void setSelectedEmployee (final Employable selectedEmployee) {
+               this.selectedEmployee = selectedEmployee;
+       }
+
+       /**
+        * Initialization method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.employeeCache.iterator().hasNext()) {
+                       // Add all
+                       for (final Employable employee : this.employeeBean.fetchAllEmployees()) {
+                               // Add it to cache
+                               this.employeeCache.put(employee.getEmployeeId(), employee);
+                       }
+               }
+
+               // Is cache filled and list is empty
+               if ((this.employeeCache.iterator().hasNext()) && (this.getAllEmployees().isEmpty())) {
+                       // Build up list
+                       for (final Cache.Entry<Long, Employable> currentEntry : this.employeeCache) {
+                               // Add to list
+                               this.getAllEmployees().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllEmployees().sort(new Comparator<Employable>() {
+                               @Override
+                               public int compare (final Employable employee1, final Employable employee2) {
+                                       return employee1.getEmployeeId() > employee2.getEmployeeId() ? 1 : employee1.getEmployeeId() < employee2.getEmployeeId() ? -1 : 0;
+                               }
+                       });
+               }
+       }
+
+       @Override
+       public Boolean isEmailAddressRegistered (final String emailAddress) {
+               // Validate parameter
+               if (null == emailAddress) {
+                       // Throw NPE
+                       throw new NullPointerException("emailAddress is null"); //NOI18N
+               } else if (emailAddress.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
+               }
+
+               // Default is not found
+               boolean isFound = false;
+
+               // Check all entries
+               for (final Employable basicData : this.getAllEmployees()) {
+                       // Is email address used?
+                       if (Objects.equals(basicData.getEmployeeEmailAddress(), emailAddress)) {
+                               // Found it
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/business/employee/list/JobsEmployeeListWebViewController.java b/src/java/org/mxchange/jjobs/beans/business/employee/list/JobsEmployeeListWebViewController.java
new file mode 100644 (file)
index 0000000..b6e9838
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.business.employee.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+
+/**
+ * An interface for request-scoped administrative company employee beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsEmployeeListWebViewController extends Serializable {
+
+       /**
+        * Returns a list of all company employees
+        * <p>
+        * @return List of all company employees
+        */
+       List<Employable> getAllEmployees ();
+
+       /**
+        * Validates if given email address is already in use by an employee
+        * <p>
+        * @param emailAddress Email address to be validated
+        * <p>
+        * @return Whether the email address is already used
+        */
+       Boolean isEmailAddressRegistered (final String emailAddress);
+
+       /**
+        * Finds a company employee by given employee id
+        * <p>
+        * @param employeeId Employable id to find company employee instance for
+        * <p>
+        * @return Company employee instance
+        * <p>
+        * @throws EmployeeNotFoundException If the company employee was not found
+        */
+       Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException;
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewBean.java
deleted file mode 100644 (file)
index d82c040..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (C) 2017 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.business.opening_time.list;
-
-import fish.payara.cdi.jsr107.impl.NamedCache;
-import java.text.MessageFormat;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
-import javax.ejb.EJB;
-import javax.enterprise.event.Observes;
-import javax.faces.view.ViewScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.mxchange.jcontactsbusiness.events.opening_time.added.ObservableOpeningTimeAddedEvent;
-import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
-import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
-import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-
-/**
- * A general bean for opening times
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("openingTimeListController")
-@ViewScoped
-public class FinancialsOpeningTimeListWebViewBean extends BaseFinancialsBean implements FinancialsOpeningTimeListWebViewController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 5_028_697_360_467L;
-
-       /**
-        * A list of all opening times
-        */
-       private final List<OpeningTime> allOpeningTimes;
-
-       /**
-        * A list of filtered opening times
-        */
-       private List<OpeningTime> filteredOpeningTimes;
-
-       /**
-        * EJB for administrative purposes
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/openingTimes!org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote")
-       private OpeningTimeSessionBeanRemote openingTimesBean;
-
-       /**
-        * A list of all opening times (globally)
-        */
-       @Inject
-       @NamedCache (cacheName = "openingTimesCache")
-       private transient Cache<Long, OpeningTime> openingTimesCache;
-
-       /**
-        * Selected opening-time instance
-        */
-       private OpeningTime selectedOpeningTime;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsOpeningTimeListWebViewBean () {
-               // Call super constructor
-               super();
-
-               // Init list
-               this.allOpeningTimes = new LinkedList<>();
-       }
-
-       /**
-        * Observes events being thrown when a new opening time has been added
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterOpeningTimeAddedEvent (@Observes final ObservableOpeningTimeAddedEvent event) {
-               // Validate parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null");
-               } else if (event.getOpeningTime() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.openingTime is null");
-               } else if (event.getOpeningTime().getOpeningTimeId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.openingTime.openingTimeId is null");
-               } else if (event.getOpeningTime().getOpeningTimeId() < 1) {
-                       // Throw it again
-                       throw new NullPointerException(MessageFormat.format("event.openingTime.openingTimeId={0} is invalid", event.getOpeningTime().getOpeningTimeId()));
-               }
-
-               // Add to cache and list
-               this.openingTimesCache.put(event.getOpeningTime().getOpeningTimeId(), event.getOpeningTime());
-               this.getAllOpeningTimes().add(event.getOpeningTime());
-       }
-
-       @Override
-       public OpeningTime findOpeningTimeById (final Long openingTimeId) throws OpeningTimeNotFoundException {
-               // Validate parameter
-               if (null == openingTimeId) {
-                       // Throw NPE
-                       throw new NullPointerException("openingTimeId is null"); //NOI18N
-               } else if (openingTimeId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("openingTimeId=" + openingTimeId + " is invalid"); //NOI18N
-               } else if (!this.openingTimesCache.containsKey(openingTimeId)) {
-                       // Not found
-                       throw new OpeningTimeNotFoundException(openingTimeId);
-               }
-
-               // Get it from cache
-               final OpeningTime opening = this.openingTimesCache.get(openingTimeId);
-
-               // Return it
-               return opening;
-       }
-
-       /**
-        * Returns a list of all opening times
-        * <p>
-        * @return A list of all opening times
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<OpeningTime> getAllOpeningTimes () {
-               return this.allOpeningTimes;
-       }
-
-       /**
-        * Getter for a list of filtered opening times
-        * <p>
-        * @return Filtered opening times
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<OpeningTime> getFilteredOpeningTimes () {
-               return this.filteredOpeningTimes;
-       }
-
-       /**
-        * Setter for a list of filtered opening times
-        * <p>
-        * @param filteredOpeningTimes Filtered opening times
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredOpeningTimes (final List<OpeningTime> filteredOpeningTimes) {
-               this.filteredOpeningTimes = filteredOpeningTimes;
-       }
-
-       /**
-        * Getter for selected open-time instance
-        * <p>
-        * @return Selected open-time instance
-        */
-       public OpeningTime getSelectedOpeningTime () {
-               return this.selectedOpeningTime;
-       }
-
-       /**
-        * Setter for selected open-time instance
-        * <p>
-        * @param selectedOpeningTime Selected open-time instance
-        */
-       public void setSelectedOpeningTime (final OpeningTime selectedOpeningTime) {
-               this.selectedOpeningTime = selectedOpeningTime;
-       }
-
-       /**
-        * Initializer method
-        */
-       @PostConstruct
-       public void initializeList () {
-               // Is cache there?
-               if (!this.openingTimesCache.iterator().hasNext()) {
-                       // Add all
-                       for (final OpeningTime openingTime : this.openingTimesBean.fetchAllOpeningTimes()) {
-                               // Add it to cache
-                               this.openingTimesCache.put(openingTime.getOpeningTimeId(), openingTime);
-                       }
-               }
-
-               // Is the list empty, but filled cache?
-               if (this.getAllOpeningTimes().isEmpty() && this.openingTimesCache.iterator().hasNext()) {
-                       // Build up list
-                       for (final Cache.Entry<Long, OpeningTime> currentEntry : this.openingTimesCache) {
-                               // Add to list
-                               this.getAllOpeningTimes().add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.getAllOpeningTimes().sort(new Comparator<OpeningTime>() {
-                               @Override
-                               public int compare (final OpeningTime openingTime1, final OpeningTime openingTime2) {
-                                       return openingTime1.getOpeningTimeId() > openingTime2.getOpeningTimeId() ? 1 : openingTime1.getOpeningTimeId() < openingTime2.getOpeningTimeId() ? -1 : 0;
-                               }
-                       }
-                       );
-               }
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewController.java b/src/java/org/mxchange/jjobs/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewController.java
deleted file mode 100644 (file)
index cadae50..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2017 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.business.opening_time.list;
-
-import java.io.Serializable;
-import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
-import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
-
-/**
- * An interface for general opening times controller
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface FinancialsOpeningTimeListWebViewController extends Serializable {
-
-       /**
-        * Retrieves a single opening-time entity for given id number or throws a
-        * proper exception if not found.
-        * <p>
-        * @param openingTimeId Opening time id to lookup
-        * <p>
-        * @return Company department instance
-        * <p>
-        * @throws OpeningTimeNotFoundException If the id number could not be looked
-        * up and solved into an entity
-        */
-       OpeningTime findOpeningTimeById (final Long openingTimeId) throws OpeningTimeNotFoundException;
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/business/opening_time/list/JobsOpeningTimeListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/business/opening_time/list/JobsOpeningTimeListWebViewBean.java
new file mode 100644 (file)
index 0000000..a9c1f9e
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.business.opening_time.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontactsbusiness.events.opening_time.added.ObservableOpeningTimeAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+
+/**
+ * A general bean for opening times
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("openingTimeListController")
+@ViewScoped
+public class JobsOpeningTimeListWebViewBean extends BaseJobsBean implements JobsOpeningTimeListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_028_697_360_467L;
+
+       /**
+        * A list of all opening times
+        */
+       private final List<OpeningTime> allOpeningTimes;
+
+       /**
+        * A list of filtered opening times
+        */
+       private List<OpeningTime> filteredOpeningTimes;
+
+       /**
+        * EJB for administrative purposes
+        */
+       @EJB (lookup = "java:global/jjobs-ejb/openingTimes!org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote")
+       private OpeningTimeSessionBeanRemote openingTimesBean;
+
+       /**
+        * A list of all opening times (globally)
+        */
+       @Inject
+       @NamedCache (cacheName = "openingTimesCache")
+       private transient Cache<Long, OpeningTime> openingTimesCache;
+
+       /**
+        * Selected opening-time instance
+        */
+       private OpeningTime selectedOpeningTime;
+
+       /**
+        * Default constructor
+        */
+       public JobsOpeningTimeListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allOpeningTimes = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being thrown when a new opening time has been added
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterOpeningTimeAddedEvent (@Observes final ObservableOpeningTimeAddedEvent event) {
+               // Validate parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null");
+               } else if (event.getOpeningTime() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.openingTime is null");
+               } else if (event.getOpeningTime().getOpeningTimeId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.openingTime.openingTimeId is null");
+               } else if (event.getOpeningTime().getOpeningTimeId() < 1) {
+                       // Throw it again
+                       throw new NullPointerException(MessageFormat.format("event.openingTime.openingTimeId={0} is invalid", event.getOpeningTime().getOpeningTimeId()));
+               }
+
+               // Add to cache and list
+               this.openingTimesCache.put(event.getOpeningTime().getOpeningTimeId(), event.getOpeningTime());
+               this.getAllOpeningTimes().add(event.getOpeningTime());
+       }
+
+       @Override
+       public OpeningTime findOpeningTimeById (final Long openingTimeId) throws OpeningTimeNotFoundException {
+               // Validate parameter
+               if (null == openingTimeId) {
+                       // Throw NPE
+                       throw new NullPointerException("openingTimeId is null"); //NOI18N
+               } else if (openingTimeId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("openingTimeId=" + openingTimeId + " is invalid"); //NOI18N
+               } else if (!this.openingTimesCache.containsKey(openingTimeId)) {
+                       // Not found
+                       throw new OpeningTimeNotFoundException(openingTimeId);
+               }
+
+               // Get it from cache
+               final OpeningTime opening = this.openingTimesCache.get(openingTimeId);
+
+               // Return it
+               return opening;
+       }
+
+       /**
+        * Returns a list of all opening times
+        * <p>
+        * @return A list of all opening times
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<OpeningTime> getAllOpeningTimes () {
+               return this.allOpeningTimes;
+       }
+
+       /**
+        * Getter for a list of filtered opening times
+        * <p>
+        * @return Filtered opening times
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<OpeningTime> getFilteredOpeningTimes () {
+               return this.filteredOpeningTimes;
+       }
+
+       /**
+        * Setter for a list of filtered opening times
+        * <p>
+        * @param filteredOpeningTimes Filtered opening times
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredOpeningTimes (final List<OpeningTime> filteredOpeningTimes) {
+               this.filteredOpeningTimes = filteredOpeningTimes;
+       }
+
+       /**
+        * Getter for selected open-time instance
+        * <p>
+        * @return Selected open-time instance
+        */
+       public OpeningTime getSelectedOpeningTime () {
+               return this.selectedOpeningTime;
+       }
+
+       /**
+        * Setter for selected open-time instance
+        * <p>
+        * @param selectedOpeningTime Selected open-time instance
+        */
+       public void setSelectedOpeningTime (final OpeningTime selectedOpeningTime) {
+               this.selectedOpeningTime = selectedOpeningTime;
+       }
+
+       /**
+        * Initializer method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.openingTimesCache.iterator().hasNext()) {
+                       // Add all
+                       for (final OpeningTime openingTime : this.openingTimesBean.fetchAllOpeningTimes()) {
+                               // Add it to cache
+                               this.openingTimesCache.put(openingTime.getOpeningTimeId(), openingTime);
+                       }
+               }
+
+               // Is the list empty, but filled cache?
+               if (this.getAllOpeningTimes().isEmpty() && this.openingTimesCache.iterator().hasNext()) {
+                       // Build up list
+                       for (final Cache.Entry<Long, OpeningTime> currentEntry : this.openingTimesCache) {
+                               // Add to list
+                               this.getAllOpeningTimes().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllOpeningTimes().sort(new Comparator<OpeningTime>() {
+                               @Override
+                               public int compare (final OpeningTime openingTime1, final OpeningTime openingTime2) {
+                                       return openingTime1.getOpeningTimeId() > openingTime2.getOpeningTimeId() ? 1 : openingTime1.getOpeningTimeId() < openingTime2.getOpeningTimeId() ? -1 : 0;
+                               }
+                       }
+                       );
+               }
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/business/opening_time/list/JobsOpeningTimeListWebViewController.java b/src/java/org/mxchange/jjobs/beans/business/opening_time/list/JobsOpeningTimeListWebViewController.java
new file mode 100644 (file)
index 0000000..016ea00
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.business.opening_time.list;
+
+import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+
+/**
+ * An interface for general opening times controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsOpeningTimeListWebViewController extends Serializable {
+
+       /**
+        * Retrieves a single opening-time entity for given id number or throws a
+        * proper exception if not found.
+        * <p>
+        * @param openingTimeId Opening time id to lookup
+        * <p>
+        * @return Company department instance
+        * <p>
+        * @throws OpeningTimeNotFoundException If the id number could not be looked
+        * up and solved into an entity
+        */
+       OpeningTime findOpeningTimeById (final Long openingTimeId) throws OpeningTimeNotFoundException;
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java
deleted file mode 100644 (file)
index bde080e..0000000
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.contact.mobile;
-
-import java.text.MessageFormat;
-import java.util.Date;
-import javax.ejb.EJB;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.Any;
-import javax.faces.application.FacesMessage;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
-import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
-import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
-import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
-import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
-import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jfinancials.beans.phone.FinancialsAdminPhoneWebRequestController;
-import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
-import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
-import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
-import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
-import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
-
-/**
- * An administrative contact mobile controller (bean)
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("adminContactMobileController")
-@RequestScoped
-public class FinancialsAdminContactMobileWebRequestBean extends BaseFinancialsBean implements FinancialsAdminContactMobileWebRequestController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 542_145_347_919L;
-
-       /**
-        * Administrative EJB for phone number
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/adminContactPhone!org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote")
-       private AdminContactsPhoneSessionBeanRemote adminContactPhoneBean;
-
-       /**
-        * Event being fired when a mobile number has been linked
-        */
-       @Inject
-       @Any
-       private Event<ObservableAdminLinkedMobileNumberEvent> adminLinkedMobileNumberEvent;
-
-       /**
-        * Administrative phone controller
-        */
-       @Inject
-       private FinancialsAdminPhoneWebRequestController adminPhoneController;
-
-       /**
-        * Contact instance
-        */
-       private Contact contact;
-
-       /**
-        * When mobile number has been created
-        */
-       private Date mobileEntryCreated;
-
-       /**
-        * When mobile number has been updated
-        */
-       private Date mobileEntryUpdated;
-
-       /**
-        * Phone id (primary key)
-        */
-       private Long mobileId;
-
-       /**
-        * Mobile number
-        */
-       private Long mobileNumber;
-
-       /**
-        * Event being fired when administrator unlinks mobile from contact
-        */
-       @Inject
-       @Any
-       private Event<ObservableAdminUnlinkedMobileNumberEvent> mobileNumberUnlinkedEvent;
-
-       /**
-        * Mobile provider
-        */
-       private MobileProvider mobileProvider;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsAdminContactMobileWebRequestBean () {
-               // Call super constructor
-               super();
-
-               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName());
-               // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller));
-       }
-
-       /**
-        * Observes events being fired when an administrator has added a new
-        * contact.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
-               // The event must be valid
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getAddedContact() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.addedContact is null"); //NOI18N
-               } else if (event.getAddedContact().getContactId() == null) {
-                       // ... and again
-                       throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
-               } else if (event.getAddedContact().getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
-               }
-
-               // Clear this bean
-               this.clear();
-       }
-
-       /**
-        * Event observer for newly added users by administrator
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
-               // Event and contained entity instance should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getAddedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.addedUser is null"); //NOI18N
-               } else if (event.getAddedUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
-               } else if (event.getAddedUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
-               }
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Event observer for updated contact data by administrators
-        * <p>
-        * @param event Updated contact data event
-        */
-       public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) {
-               // Event and contained entity instance should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getUpdatedContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
-               } else if (event.getUpdatedContact().getContactId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
-               } else if (event.getUpdatedContact().getContactId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
-               }
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Observer for events being fired when a bean helper has successfully
-        * created a contact instance.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterCreatedContactEvent (@Observes final ObservableCreatedContactEvent event) {
-               // Log message
-               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminContactController::afterCreatedContactEvent(): contact={0} - CALLED!", contact)); //NOI18N
-
-               // The event instance must be valid
-               if (null == event) {
-                       // Throw NPE again
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getCreatedContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.createdContact is null"); //NOI18N //NOI18N
-               } else if (event.getCreatedContact().getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N //NOI18N
-               } else if (event.getCreatedContact().getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalStateException(MessageFormat.format("event.createdContact.contactId={0} is not valid.", event.getCreatedContact().getContactId())); //NOI18N
-               }
-
-               // Set it here
-               this.setContact(event.getCreatedContact());
-       }
-
-       /**
-        * Observes events being fired when a bean helper has successfully created a
-        * mobile number instance.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
-               // The event instance must be valid
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
-               } else if (event.getMobileNumber().getMobileId() == null) {
-                       // Throw NPE yet again
-                       throw new NullPointerException("event.mobileNumber.mobileId is null"); //NOI18N
-               } else if (event.getMobileNumber().getMobileId() < 1) {
-                       // Throw NPE yet again
-                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.mobileId={0} is invalid", event.getMobileNumber().getMobileId())); //NOI18N
-               }
-
-               // Get fax number from event
-               final DialableMobileNumber number = event.getMobileNumber();
-
-               // Copy all data to this bean
-               this.setMobileId(number.getMobileId());
-               this.setMobileProvider(number.getMobileProvider());
-               this.setMobileNumber(number.getMobileNumber());
-               this.setMobileEntryCreated(number.getMobileEntryCreated());
-               this.setMobileEntryUpdated(number.getMobileEntryUpdated());
-       }
-
-       /**
-        * Links mobile number to contact from bean helper as "main mobile number".
-        * <p>
-        * @return Redirect outcome
-        */
-       public String doLinkMainMobileNumber () {
-               // Get contact from helper
-               final Contact targetContact = this.getContact();
-
-               // Is all data properly set?
-               if (null == targetContact) {
-                       // Throw NPE
-                       throw new NullPointerException("targetContact is null"); //NOI18N
-               } else if (targetContact.getContactId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("targetContact.contactId is null"); //NOI18N
-               } else if (targetContact.getContactId() < 1) {
-                       // Is not valid
-                       throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N
-               } else if (this.getMobileProvider() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.mobileProvider is null"); //NOI18N
-               } else if (this.getMobileProvider().getProviderId() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.mobileProvider.providerId is null"); //NOI18N
-               } else if (this.getMobileProvider().getProviderId() < 1) {
-                       // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("this.mobileProvider.providerId={0} is invalid", this.getMobileProvider().getProviderId())); //NOI18N
-               } else if (this.getMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("this.mobileNumber is null"); //NOI18N
-               } else if (this.getMobileNumber() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber={0} is invalid", this.getMobileNumber())); //NOI18N
-               }
-
-               // Init instance
-               final Contact updatedContact;
-               final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
-
-               // Try it again
-               try {
-                       // Link it, too
-                       updatedContact = this.adminContactPhoneBean.linkNewMobileNumberWithContact(targetContact, number);
-               } catch (final PhoneNumberAlreadyLinkedException ex) {
-                       // Throw again as cause
-                       this.showFacesMessage("form_add_contact_mobile:mobileNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
-                       return ""; //NOI18N
-               }
-
-               // Fire event
-               this.adminLinkedMobileNumberEvent.fire(new AdminLinkedMobileNumberEvent(updatedContact, number));
-
-               // Return to contact profile
-               return "admin_show_contact"; //NOI18N
-       }
-
-       /**
-        * Getter for contact instance
-        * <p>
-        * @return Contact instance
-        */
-       public Contact getContact () {
-               return this.contact;
-       }
-
-       /**
-        * Setter for contact instance
-        * <p>
-        * @param contact Contact instance
-        */
-       public void setContact (final Contact contact) {
-               this.contact = contact;
-       }
-
-       /**
-        * Setter for phone id
-        * <p>
-        * @return Phone id
-        */
-       public Long getMobileId () {
-               return this.mobileId;
-       }
-
-       /**
-        * Getter for phone id
-        * <p>
-        * @param mobileId Phone id
-        */
-       public void setMobileId (final Long mobileId) {
-               this.mobileId = mobileId;
-       }
-
-       /**
-        * Getter for mobile number
-        * <p>
-        * @return Mobile number
-        */
-       public Long getMobileNumber () {
-               return this.mobileNumber;
-       }
-
-       /**
-        * Setter for mobile number
-        * <p>
-        * @param mobileNumber Mobile number
-        */
-       public void setMobileNumber (final Long mobileNumber) {
-               this.mobileNumber = mobileNumber;
-       }
-
-       /**
-        * Getter for mobile provider
-        * <p>
-        * @return Mobile provider
-        */
-       public MobileProvider getMobileProvider () {
-               return this.mobileProvider;
-       }
-
-       /**
-        * Setter for mobile provider
-        * <p>
-        * @param mobileProvider Mobile provider
-        */
-       public void setMobileProvider (final MobileProvider mobileProvider) {
-               this.mobileProvider = mobileProvider;
-       }
-
-       /**
-        * Unlinks mobile data with current contact
-        * <p>
-        * @return Redirect outcome
-        */
-       public String unlinkMobileContactData () {
-               // Create fax number instance
-               final DialableMobileNumber number = this.createMobileNumber();
-
-               // Is all data set
-               if (number == null) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("number is null"); //NOI18N
-               } else if (number.getMobileId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("number.phoneId is null"); //NOI18N
-               } else if (number.getMobileId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getMobileId())); //NOI18N
-               } else if (number.getMobileProvider() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("number.mobileProvider is null"); //NOI18N
-               } else if (number.getMobileProvider().getProviderId() == null) {
-                       // ... throw again
-                       throw new NullPointerException("number.mobileProvider.providerId is null"); //NOI18N
-               } else if (number.getMobileProvider().getProviderId() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("number.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
-               } else if (number.getMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("number.phoneNumber is null"); //NOI18N
-               } else if (number.getMobileNumber() < 1) {
-                       // Throw it again ...
-                       throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getMobileNumber())); //NOI18N
-               } else if (this.getContact() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("this.contact is null"); //NOI18N
-               } else if (this.getContact().getContactId() == null) {
-                       // ... and again ...
-                       throw new NullPointerException("this.contact.contactId is null"); //NOI18N
-               } else if (this.getContact().getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N
-               }
-
-               // Init contact instance
-               final Contact updatedContact;
-
-               try {
-                       // Unlink it and return contact without mobile instance
-                       updatedContact = this.adminContactPhoneBean.unlinkMobileDataFromContact(this.getContact(), number);
-               } catch (final PhoneNumberNotLinkedException ex) {
-                       // Did not work
-                       this.showFacesMessage("form_unlink_contact_mobile:mobileNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
-                       return ""; //NOI18N
-               }
-
-               // Fire event
-               this.mobileNumberUnlinkedEvent.fire(new AdminUnlinkedMobileNumberEvent(updatedContact, number));
-
-               // All fine here
-               return "admin_show_contact"; //NOI18N
-       }
-
-       /**
-        * Clears this bean
-        */
-       private void clear () {
-               // Clear all data
-       }
-
-       /**
-        * Returns an instance of a DialableMobileNumber from all fields stored in
-        * this bean.
-        * <p>
-        * @return An instance of a DialableMobileNumber class
-        */
-       private DialableMobileNumber createMobileNumber () {
-               // Initialize it
-               final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
-
-               // Add all other data
-               number.setMobileEntryCreated(this.getMobileEntryCreated());
-               number.setMobileEntryUpdated(this.getMobileEntryUpdated());
-
-               // Is id number set?
-               if (this.getMobileId() instanceof Long) {
-                       // Set it
-                       number.setMobileId(this.getMobileId());
-               }
-
-               // Return it
-               return number;
-       }
-
-       /**
-        * Getter for mobile entry created
-        * <p>
-        * @return Mobile entry created
-        */
-       @SuppressWarnings ("ReturnOfDateField")
-       private Date getMobileEntryCreated () {
-               return this.mobileEntryCreated;
-       }
-
-       /**
-        * Setter for mobile entry created
-        * <p>
-        * @param mobileEntryCreated Mobile entry created
-        */
-       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
-       private void setMobileEntryCreated (final Date mobileEntryCreated) {
-               this.mobileEntryCreated = mobileEntryCreated;
-       }
-
-       /**
-        * Getter for mobile entry updated
-        * <p>
-        * @return Mobile entry updated
-        */
-       @SuppressWarnings ("ReturnOfDateField")
-       private Date getMobileEntryUpdated () {
-               return this.mobileEntryUpdated;
-       }
-
-       /**
-        * Setter for mobile entry updated
-        * <p>
-        * @param mobileEntryUpdated Mobile entry updated
-        */
-       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
-       private void setMobileEntryUpdated (final Date mobileEntryUpdated) {
-               this.mobileEntryUpdated = mobileEntryUpdated;
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsAdminContactMobileWebRequestController.java b/src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsAdminContactMobileWebRequestController.java
deleted file mode 100644 (file)
index 0e0f0b2..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.contact.mobile;
-
-import org.mxchange.jfinancials.beans.contact.phone.*;
-import java.io.Serializable;
-
-/**
- * An interface for user beans
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface FinancialsAdminContactMobileWebRequestController extends Serializable {
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsContactMobileWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsContactMobileWebRequestBean.java
deleted file mode 100644 (file)
index a3ef276..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.contact.mobile;
-
-import java.text.MessageFormat;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
-import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
-import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jfinancials.beans.contact.list.FinancialsContactListWebViewController;
-import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
-import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
-
-/**
- * A general contact bean (controller)
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("contactMobileController")
-@RequestScoped
-public class FinancialsContactMobileWebRequestBean extends BaseFinancialsBean implements FinancialsContactMobileWebRequestController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 542_145_347_916L;
-
-       /**
-        * An instance of a contact-list controller
-        */
-       @Inject
-       private FinancialsContactListWebViewController contactListController;
-
-       /**
-        * Chosen mobile number
-        */
-       private DialableMobileNumber mobileNumber;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsContactMobileWebRequestBean () {
-               // Call super constructor
-               super();
-       }
-
-       /**
-        * Observes events being fired when an administrator has added a new
-        * contact.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
-               // The event must be valid
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getAddedContact() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.addedContact is null"); //NOI18N
-               } else if (event.getAddedContact().getContactId() == null) {
-                       // ... and again
-                       throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
-               } else if (event.getAddedContact().getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
-               }
-
-               // Clear this bean
-               this.clear();
-       }
-
-       /**
-        * Event observer for newly added users by administrator
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
-               // Event and contained entity instance should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getAddedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.addedUser is null"); //NOI18N
-               } else if (event.getAddedUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
-               } else if (event.getAddedUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
-               }
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Event observer for updated contact data by administrators
-        * <p>
-        * @param event Updated contact data event
-        */
-       public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) {
-               // Event and contained entity instance should not be null
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getUpdatedContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
-               } else if (event.getUpdatedContact().getContactId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
-               } else if (event.getUpdatedContact().getContactId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
-               }
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Observes events being fired when a bean helper has successfully created a
-        * mobile number instance.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
-               // The event instance must be valid
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
-               } else if (event.getMobileNumber().getMobileId() == null) {
-                       // Throw NPE yet again
-                       throw new NullPointerException("event.mobileNumber.mobileId is null"); //NOI18N
-               } else if (event.getMobileNumber().getMobileId() < 1) {
-                       // Throw NPE yet again
-                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.mobileId={0} is invalid", event.getMobileNumber().getMobileId())); //NOI18N
-               }
-
-               // Set it here
-               this.setMobileNumber(event.getMobileNumber());
-       }
-
-       /**
-        * Getter for all contacts having current mobile number linked
-        * <p>
-        * @return List of all linked contacts
-        */
-       public List<Contact> allCurrentMobileNumberContacts () {
-               // Get id
-               final DialableMobileNumber dialableMobileNumber = this.getMobileNumber();
-
-               // Init list
-               final List<Contact> contacts = new LinkedList<>();
-
-               // "Walk" through all contacts
-               for (final Contact contact : this.contactListController.getAllContacts()) {
-                       // Is mobile instance the same?
-                       if (Objects.equals(contact.getContactMobileNumber(), dialableMobileNumber)) {
-                               // Found one
-                               contacts.add(contact);
-                       }
-               }
-
-               // Return now-cached list
-               return contacts;
-       }
-
-       /**
-        * Getter for chosen mobile number
-        * <p>
-        * @return mobile number
-        */
-       public DialableMobileNumber getMobileNumber () {
-               return this.mobileNumber;
-       }
-
-       /**
-        * Setter for chosen mobile number
-        * <p>
-        * @param mobileNumber mobile number
-        */
-       public void setMobileNumber (final DialableMobileNumber mobileNumber) {
-               this.mobileNumber = mobileNumber;
-       }
-
-       /**
-        * Clears this bean
-        */
-       private void clear () {
-               // Clear all data
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsContactMobileWebRequestController.java b/src/java/org/mxchange/jjobs/beans/contact/mobile/FinancialsContactMobileWebRequestController.java
deleted file mode 100644 (file)
index 1501a46..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.contact.mobile;
-
-import org.mxchange.jfinancials.beans.contact.phone.*;
-import java.io.Serializable;
-
-/**
- * An interface for user beans
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface FinancialsContactMobileWebRequestController extends Serializable {
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/mobile/JobsAdminContactMobileWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/contact/mobile/JobsAdminContactMobileWebRequestBean.java
new file mode 100644 (file)
index 0000000..5d5a480
--- /dev/null
@@ -0,0 +1,524 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.contact.mobile;
+
+import java.text.MessageFormat;
+import java.util.Date;
+import javax.ejb.EJB;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+import javax.faces.application.FacesMessage;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
+import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
+import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEvent;
+import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
+import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
+import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+
+/**
+ * An administrative contact mobile controller (bean)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminContactMobileController")
+@RequestScoped
+public class JobsAdminContactMobileWebRequestBean extends BaseJobsBean implements JobsAdminContactMobileWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 542_145_347_919L;
+
+       /**
+        * Administrative EJB for phone number
+        */
+       @EJB (lookup = "java:global/jjobs-ejb/adminContactPhone!org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote")
+       private AdminContactsPhoneSessionBeanRemote adminContactPhoneBean;
+
+       /**
+        * Event being fired when a mobile number has been linked
+        */
+       @Inject
+       @Any
+       private Event<ObservableAdminLinkedMobileNumberEvent> adminLinkedMobileNumberEvent;
+
+       /**
+        * Contact instance
+        */
+       private Contact contact;
+
+       /**
+        * When mobile number has been created
+        */
+       private Date mobileEntryCreated;
+
+       /**
+        * When mobile number has been updated
+        */
+       private Date mobileEntryUpdated;
+
+       /**
+        * Phone id (primary key)
+        */
+       private Long mobileId;
+
+       /**
+        * Mobile number
+        */
+       private Long mobileNumber;
+
+       /**
+        * Event being fired when administrator unlinks mobile from contact
+        */
+       @Inject
+       @Any
+       private Event<ObservableAdminUnlinkedMobileNumberEvent> mobileNumberUnlinkedEvent;
+
+       /**
+        * Mobile provider
+        */
+       private MobileProvider mobileProvider;
+
+       /**
+        * Default constructor
+        */
+       public JobsAdminContactMobileWebRequestBean () {
+               // Call super constructor
+               super();
+
+               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName());
+               // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller));
+       }
+
+       /**
+        * Observes events being fired when an administrator has added a new
+        * contact.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
+               // The event must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.addedContact is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() == null) {
+                       // ... and again
+                       throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
+               }
+
+               // Clear this bean
+               this.clear();
+       }
+
+       /**
+        * Event observer for newly added users by administrator
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.addedUser is null"); //NOI18N
+               } else if (event.getAddedUser().getUserId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
+               } else if (event.getAddedUser().getUserId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Event observer for updated contact data by administrators
+        * <p>
+        * @param event Updated contact data event
+        */
+       public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observer for events being fired when a bean helper has successfully
+        * created a contact instance.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterCreatedContactEvent (@Observes final ObservableCreatedContactEvent event) {
+               // Log message
+               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminContactController::afterCreatedContactEvent(): contact={0} - CALLED!", contact)); //NOI18N
+
+               // The event instance must be valid
+               if (null == event) {
+                       // Throw NPE again
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getCreatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.createdContact is null"); //NOI18N //NOI18N
+               } else if (event.getCreatedContact().getContactId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N //NOI18N
+               } else if (event.getCreatedContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalStateException(MessageFormat.format("event.createdContact.contactId={0} is not valid.", event.getCreatedContact().getContactId())); //NOI18N
+               }
+
+               // Set it here
+               this.setContact(event.getCreatedContact());
+       }
+
+       /**
+        * Observes events being fired when a bean helper has successfully created a
+        * mobile number instance.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
+               // The event instance must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() == null) {
+                       // Throw NPE yet again
+                       throw new NullPointerException("event.mobileNumber.mobileId is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() < 1) {
+                       // Throw NPE yet again
+                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.mobileId={0} is invalid", event.getMobileNumber().getMobileId())); //NOI18N
+               }
+
+               // Get fax number from event
+               final DialableMobileNumber number = event.getMobileNumber();
+
+               // Copy all data to this bean
+               this.setMobileId(number.getMobileId());
+               this.setMobileProvider(number.getMobileProvider());
+               this.setMobileNumber(number.getMobileNumber());
+               this.setMobileEntryCreated(number.getMobileEntryCreated());
+               this.setMobileEntryUpdated(number.getMobileEntryUpdated());
+       }
+
+       /**
+        * Links mobile number to contact from bean helper as "main mobile number".
+        * <p>
+        * @return Redirect outcome
+        */
+       public String doLinkMainMobileNumber () {
+               // Get contact from helper
+               final Contact targetContact = this.getContact();
+
+               // Is all data properly set?
+               if (null == targetContact) {
+                       // Throw NPE
+                       throw new NullPointerException("targetContact is null"); //NOI18N
+               } else if (targetContact.getContactId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("targetContact.contactId is null"); //NOI18N
+               } else if (targetContact.getContactId() < 1) {
+                       // Is not valid
+                       throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N
+               } else if (this.getMobileProvider() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.mobileProvider is null"); //NOI18N
+               } else if (this.getMobileProvider().getProviderId() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.mobileProvider.providerId is null"); //NOI18N
+               } else if (this.getMobileProvider().getProviderId() < 1) {
+                       // Throw NPE
+                       throw new NullPointerException(MessageFormat.format("this.mobileProvider.providerId={0} is invalid", this.getMobileProvider().getProviderId())); //NOI18N
+               } else if (this.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("this.mobileNumber is null"); //NOI18N
+               } else if (this.getMobileNumber() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber={0} is invalid", this.getMobileNumber())); //NOI18N
+               }
+
+               // Init instance
+               final Contact updatedContact;
+               final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+
+               // Try it again
+               try {
+                       // Link it, too
+                       updatedContact = this.adminContactPhoneBean.linkNewMobileNumberWithContact(targetContact, number);
+               } catch (final PhoneNumberAlreadyLinkedException ex) {
+                       // Throw again as cause
+                       this.showFacesMessage("form_add_contact_mobile:mobileNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
+                       return ""; //NOI18N
+               }
+
+               // Fire event
+               this.adminLinkedMobileNumberEvent.fire(new AdminLinkedMobileNumberEvent(updatedContact, number));
+
+               // Return to contact profile
+               return "admin_show_contact"; //NOI18N
+       }
+
+       /**
+        * Getter for contact instance
+        * <p>
+        * @return Contact instance
+        */
+       public Contact getContact () {
+               return this.contact;
+       }
+
+       /**
+        * Setter for contact instance
+        * <p>
+        * @param contact Contact instance
+        */
+       public void setContact (final Contact contact) {
+               this.contact = contact;
+       }
+
+       /**
+        * Setter for phone id
+        * <p>
+        * @return Phone id
+        */
+       public Long getMobileId () {
+               return this.mobileId;
+       }
+
+       /**
+        * Getter for phone id
+        * <p>
+        * @param mobileId Phone id
+        */
+       public void setMobileId (final Long mobileId) {
+               this.mobileId = mobileId;
+       }
+
+       /**
+        * Getter for mobile number
+        * <p>
+        * @return Mobile number
+        */
+       public Long getMobileNumber () {
+               return this.mobileNumber;
+       }
+
+       /**
+        * Setter for mobile number
+        * <p>
+        * @param mobileNumber Mobile number
+        */
+       public void setMobileNumber (final Long mobileNumber) {
+               this.mobileNumber = mobileNumber;
+       }
+
+       /**
+        * Getter for mobile provider
+        * <p>
+        * @return Mobile provider
+        */
+       public MobileProvider getMobileProvider () {
+               return this.mobileProvider;
+       }
+
+       /**
+        * Setter for mobile provider
+        * <p>
+        * @param mobileProvider Mobile provider
+        */
+       public void setMobileProvider (final MobileProvider mobileProvider) {
+               this.mobileProvider = mobileProvider;
+       }
+
+       /**
+        * Unlinks mobile data with current contact
+        * <p>
+        * @return Redirect outcome
+        */
+       public String unlinkMobileContactData () {
+               // Create fax number instance
+               final DialableMobileNumber number = this.createMobileNumber();
+
+               // Is all data set
+               if (number == null) {
+                       // Not set, throw NPE
+                       throw new NullPointerException("number is null"); //NOI18N
+               } else if (number.getMobileId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("number.phoneId is null"); //NOI18N
+               } else if (number.getMobileId() < 1) {
+                       // Invalid number
+                       throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getMobileId())); //NOI18N
+               } else if (number.getMobileProvider() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("number.mobileProvider is null"); //NOI18N
+               } else if (number.getMobileProvider().getProviderId() == null) {
+                       // ... throw again
+                       throw new NullPointerException("number.mobileProvider.providerId is null"); //NOI18N
+               } else if (number.getMobileProvider().getProviderId() < 1) {
+                       // Id not valid
+                       throw new IllegalArgumentException(MessageFormat.format("number.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
+               } else if (number.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("number.phoneNumber is null"); //NOI18N
+               } else if (number.getMobileNumber() < 1) {
+                       // Throw it again ...
+                       throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getMobileNumber())); //NOI18N
+               } else if (this.getContact() == null) {
+                       // ... and throw again
+                       throw new NullPointerException("this.contact is null"); //NOI18N
+               } else if (this.getContact().getContactId() == null) {
+                       // ... and again ...
+                       throw new NullPointerException("this.contact.contactId is null"); //NOI18N
+               } else if (this.getContact().getContactId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N
+               }
+
+               // Init contact instance
+               final Contact updatedContact;
+
+               try {
+                       // Unlink it and return contact without mobile instance
+                       updatedContact = this.adminContactPhoneBean.unlinkMobileDataFromContact(this.getContact(), number);
+               } catch (final PhoneNumberNotLinkedException ex) {
+                       // Did not work
+                       this.showFacesMessage("form_unlink_contact_mobile:mobileNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
+                       return ""; //NOI18N
+               }
+
+               // Fire event
+               this.mobileNumberUnlinkedEvent.fire(new AdminUnlinkedMobileNumberEvent(updatedContact, number));
+
+               // All fine here
+               return "admin_show_contact"; //NOI18N
+       }
+
+       /**
+        * Clears this bean
+        */
+       private void clear () {
+               // Clear all data
+       }
+
+       /**
+        * Returns an instance of a DialableMobileNumber from all fields stored in
+        * this bean.
+        * <p>
+        * @return An instance of a DialableMobileNumber class
+        */
+       private DialableMobileNumber createMobileNumber () {
+               // Initialize it
+               final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+
+               // Add all other data
+               number.setMobileEntryCreated(this.getMobileEntryCreated());
+               number.setMobileEntryUpdated(this.getMobileEntryUpdated());
+
+               // Is id number set?
+               if (this.getMobileId() instanceof Long) {
+                       // Set it
+                       number.setMobileId(this.getMobileId());
+               }
+
+               // Return it
+               return number;
+       }
+
+       /**
+        * Getter for mobile entry created
+        * <p>
+        * @return Mobile entry created
+        */
+       @SuppressWarnings ("ReturnOfDateField")
+       private Date getMobileEntryCreated () {
+               return this.mobileEntryCreated;
+       }
+
+       /**
+        * Setter for mobile entry created
+        * <p>
+        * @param mobileEntryCreated Mobile entry created
+        */
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       private void setMobileEntryCreated (final Date mobileEntryCreated) {
+               this.mobileEntryCreated = mobileEntryCreated;
+       }
+
+       /**
+        * Getter for mobile entry updated
+        * <p>
+        * @return Mobile entry updated
+        */
+       @SuppressWarnings ("ReturnOfDateField")
+       private Date getMobileEntryUpdated () {
+               return this.mobileEntryUpdated;
+       }
+
+       /**
+        * Setter for mobile entry updated
+        * <p>
+        * @param mobileEntryUpdated Mobile entry updated
+        */
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       private void setMobileEntryUpdated (final Date mobileEntryUpdated) {
+               this.mobileEntryUpdated = mobileEntryUpdated;
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/mobile/JobsAdminContactMobileWebRequestController.java b/src/java/org/mxchange/jjobs/beans/contact/mobile/JobsAdminContactMobileWebRequestController.java
new file mode 100644 (file)
index 0000000..de54b87
--- /dev/null
@@ -0,0 +1,30 @@
+
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.contact.mobile;
+
+import org.mxchange.jjobs.beans.contact.phone.*;
+import java.io.Serializable;
+
+/**
+ * An interface for user beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsAdminContactMobileWebRequestController extends Serializable {
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/mobile/JobsContactMobileWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/contact/mobile/JobsContactMobileWebRequestBean.java
new file mode 100644 (file)
index 0000000..25c0af4
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.contact.mobile;
+
+import java.text.MessageFormat;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.contact.list.JobsContactListWebViewController;
+import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+
+/**
+ * A general contact bean (controller)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("contactMobileController")
+@RequestScoped
+public class JobsContactMobileWebRequestBean extends BaseJobsBean implements JobsContactMobileWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 542_145_347_916L;
+
+       /**
+        * An instance of a contact-list controller
+        */
+       @Inject
+       private JobsContactListWebViewController contactListController;
+
+       /**
+        * Chosen mobile number
+        */
+       private DialableMobileNumber mobileNumber;
+
+       /**
+        * Default constructor
+        */
+       public JobsContactMobileWebRequestBean () {
+               // Call super constructor
+               super();
+       }
+
+       /**
+        * Observes events being fired when an administrator has added a new
+        * contact.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
+               // The event must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.addedContact is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() == null) {
+                       // ... and again
+                       throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
+               }
+
+               // Clear this bean
+               this.clear();
+       }
+
+       /**
+        * Event observer for newly added users by administrator
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.addedUser is null"); //NOI18N
+               } else if (event.getAddedUser().getUserId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.addedUser.userId is null"); //NOI18N
+               } else if (event.getAddedUser().getUserId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Event observer for updated contact data by administrators
+        * <p>
+        * @param event Updated contact data event
+        */
+       public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) {
+               // Event and contained entity instance should not be null
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when a bean helper has successfully created a
+        * mobile number instance.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
+               // The event instance must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() == null) {
+                       // Throw NPE yet again
+                       throw new NullPointerException("event.mobileNumber.mobileId is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() < 1) {
+                       // Throw NPE yet again
+                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.mobileId={0} is invalid", event.getMobileNumber().getMobileId())); //NOI18N
+               }
+
+               // Set it here
+               this.setMobileNumber(event.getMobileNumber());
+       }
+
+       /**
+        * Getter for all contacts having current mobile number linked
+        * <p>
+        * @return List of all linked contacts
+        */
+       public List<Contact> allCurrentMobileNumberContacts () {
+               // Get id
+               final DialableMobileNumber dialableMobileNumber = this.getMobileNumber();
+
+               // Init list
+               final List<Contact> contacts = new LinkedList<>();
+
+               // "Walk" through all contacts
+               for (final Contact contact : this.contactListController.getAllContacts()) {
+                       // Is mobile instance the same?
+                       if (Objects.equals(contact.getContactMobileNumber(), dialableMobileNumber)) {
+                               // Found one
+                               contacts.add(contact);
+                       }
+               }
+
+               // Return now-cached list
+               return contacts;
+       }
+
+       /**
+        * Getter for chosen mobile number
+        * <p>
+        * @return mobile number
+        */
+       public DialableMobileNumber getMobileNumber () {
+               return this.mobileNumber;
+       }
+
+       /**
+        * Setter for chosen mobile number
+        * <p>
+        * @param mobileNumber mobile number
+        */
+       public void setMobileNumber (final DialableMobileNumber mobileNumber) {
+               this.mobileNumber = mobileNumber;
+       }
+
+       /**
+        * Clears this bean
+        */
+       private void clear () {
+               // Clear all data
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/mobile/JobsContactMobileWebRequestController.java b/src/java/org/mxchange/jjobs/beans/contact/mobile/JobsContactMobileWebRequestController.java
new file mode 100644 (file)
index 0000000..696dfaf
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.contact.mobile;
+
+import org.mxchange.jjobs.beans.contact.phone.*;
+import java.io.Serializable;
+
+/**
+ * An interface for user beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsContactMobileWebRequestController extends Serializable {
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/phone/action/FinancialsUserActionWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/contact/phone/action/FinancialsUserActionWebRequestBean.java
deleted file mode 100644 (file)
index effde46..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.user.action;
-
-import java.text.MessageFormat;
-import javax.ejb.EJB;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Any;
-import javax.faces.FacesException;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jfinancials.beans.contact.FinancialsContactWebRequestController;
-import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController;
-import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController;
-import org.mxchange.jusercore.events.user.update.post.ObservablePostUserPersonalDataUpdatedEvent;
-import org.mxchange.jusercore.events.user.update.post.PostUserPersonalDataUpdatedEvent;
-import org.mxchange.jusercore.events.user.update.pre.ObservablePreUserPersonalDataUpdatedEvent;
-import org.mxchange.jusercore.events.user.update.pre.PreUserPersonalDataUpdatedEvent;
-import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
-import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException;
-
-/**
- * A user action bean (controller)
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("userActionController")
-@RequestScoped
-public class FinancialsUserActionWebRequestBean extends BaseFinancialsBean implements FinancialsUserActionWebRequestController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 542_145_347_920L;
-
-       /**
-        * General contact controller
-        */
-       @Inject
-       private FinancialsContactWebRequestController contactController;
-
-       /**
-        * Features controller
-        */
-       @Inject
-       private FinancialsFeaturesWebApplicationController featureController;
-
-       /**
-        * Event being fired when user updated personal data
-        */
-       @Inject
-       @Any
-       private Event<ObservablePostUserPersonalDataUpdatedEvent> postUpdatedPersonalDataEvent;
-
-       /**
-        * Event being fired when user updated personal data
-        */
-       @Inject
-       @Any
-       private Event<ObservablePreUserPersonalDataUpdatedEvent> preUpdatedPersonalDataEvent;
-
-       /**
-        * Remote user bean
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
-       private UserSessionBeanRemote userBean;
-
-       /**
-        * Login controller (bean)
-        */
-       @Inject
-       private FinancialsUserLoginWebSessionController userLoginController;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsUserActionWebRequestBean () {
-               // Call super constructor
-               super();
-       }
-
-       @Override
-       public String doChangePersonalData () {
-               // This method shall only be called if the user is logged-in
-               if (!this.userLoginController.isUserLoggedIn()) {
-                       // Not logged-in
-                       throw new IllegalStateException("User is not logged-in"); //NOI18N
-               } else if (!this.contactController.isRequiredChangePersonalDataSet()) {
-                       // Not all required fields are set
-                       throw new FacesException("Not all required fields are set."); //NOI18N
-               } else if (!this.userLoginController.ifCurrentPasswordMatches()) {
-                       // Password not matching
-                       throw new FacesException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()));
-               } else if (!this.featureController.isFeatureEnabled("change_user_personal_data")) { //NOI18N
-                       // Editing is not allowed
-                       throw new IllegalStateException("User tried to edit personal data."); //NOI18N
-               }
-
-               // Get user instance
-               final User user = this.userLoginController.getLoggedInUser();
-
-               // Fire pre-update event
-               this.preUpdatedPersonalDataEvent.fire(new PreUserPersonalDataUpdatedEvent(user));
-
-               // It should be there, so run some tests on it
-               assert (user instanceof User) : "Instance userLoginController.loggedInUser is null"; //NOI18N
-               assert (user.getUserId() instanceof Long) : "Instance userLoginController.loggedInUser.userId is null"; //NOI18N
-               assert (user.getUserId() > 0) : MessageFormat.format("userLoginController.loggedInUser.userId={0} is invalid", user.getUserId()); //NOI18N
-               assert (user.getUserContact() instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null"; //NOI18N
-               assert (user.getUserContact().getContactId() instanceof Long) : "Instance userLoginController.userContact.contactId is null"; //NOI18N
-               assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N
-
-               // Send it to the EJB
-               final User updatedUser = this.userBean.updateUserPersonalData(user);
-
-               // Fire post-update event
-               this.postUpdatedPersonalDataEvent.fire(new PostUserPersonalDataUpdatedEvent(updatedUser));
-
-               // All fine
-               return "user_contact_data_saved"; //NOI18N
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/phone/action/FinancialsUserActionWebRequestController.java b/src/java/org/mxchange/jjobs/beans/contact/phone/action/FinancialsUserActionWebRequestController.java
deleted file mode 100644 (file)
index ed6cd2d..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.user.action;
-
-import java.io.Serializable;
-
-/**
- * An interface for user beans
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface FinancialsUserActionWebRequestController extends Serializable {
-
-       /**
-        * Minimum password length
-        * <p>
-        * @deprecated Better set as context parameter
-        */
-       @Deprecated
-       public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
-
-       /**
-        * Changes logged-in user's personal data if the current password matches
-        * and TAC + privacy statement has been accepted.
-        * <p>
-        * @return New target page
-        */
-       String doChangePersonalData ();
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/phone/email_address/list/FinancialsEmailChangeListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/contact/phone/email_address/list/FinancialsEmailChangeListWebViewBean.java
deleted file mode 100644 (file)
index 7c79cdf..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.user.email_address.list;
-
-import fish.payara.cdi.jsr107.impl.NamedCache;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
-import javax.ejb.EJB;
-import javax.faces.view.ViewScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController;
-import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
-import org.mxchange.jusercore.model.user.email_address.UserEmailChangeSessionBeanRemote;
-
-/**
- * A view-scoped bean for listing email address changes
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("emailChangeListController")
-@ViewScoped
-public class FinancialsEmailChangeListWebViewBean extends BaseFinancialsBean implements FinancialsEmailChangeListWebViewController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 186_078_724_659_154L;
-
-       /**
-        * A list of all mobile numbers
-        */
-       private final List<ChangeableEmailAddress> allEmailAddressChanges;
-
-       /**
-        * Remote email change bean
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/userEmailChange!org.mxchange.jusercore.model.user.email_address.UserEmailChangeSessionBeanRemote")
-       private UserEmailChangeSessionBeanRemote emailChangeBean;
-
-       /**
-        * Features controller
-        */
-       @Inject
-       private FinancialsFeaturesWebApplicationController featureController;
-
-       /**
-        * A list of filtered mobile numbers
-        */
-       private List<ChangeableEmailAddress> filteredEmailAddressChanges;
-
-       /**
-        * Local list of already queued email addresses
-        */
-       @Inject
-       @NamedCache (cacheName = "queuedEmailCache")
-       private transient Cache<Long, ChangeableEmailAddress> queuedEmailCache;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsEmailChangeListWebViewBean () {
-               // Call super constructor
-               super();
-
-               // Initialize list
-               this.allEmailAddressChanges = new LinkedList<>();
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<ChangeableEmailAddress> getAllEmailAddressChanges () {
-               return this.allEmailAddressChanges;
-       }
-
-       /**
-        * Getter for filtered email address changed
-        * <p>
-        * @return Filtered email address changed
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<ChangeableEmailAddress> getFilteredEmailAddressChanges () {
-               return this.filteredEmailAddressChanges;
-       }
-
-       /**
-        * Setter for filtered email address changed
-        * <p>
-        * @param filteredEmailAddressChanges Filtered email address changed
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredEmailAddressChanges (final List<ChangeableEmailAddress> filteredEmailAddressChanges) {
-               this.filteredEmailAddressChanges = filteredEmailAddressChanges;
-       }
-
-       /**
-        * Post-construction
-        */
-       @PostConstruct
-       public void initializeList () {
-               // Is cache there?
-               if (!this.queuedEmailCache.iterator().hasNext()) {
-                       // Add all
-                       for (final ChangeableEmailAddress currentEmailAddress : this.emailChangeBean.fetchAllQueuedAddressChanges()) {
-                               // Add it to cache
-                               this.queuedEmailCache.put(currentEmailAddress.getEmailChangeId(), currentEmailAddress);
-                       }
-               }
-
-               // Is cache filled and list is empty
-               if ((this.queuedEmailCache.iterator().hasNext()) && (this.getAllEmailAddressChanges().isEmpty())) {
-                       // Build up list
-                       for (final Cache.Entry<Long, ChangeableEmailAddress> currentEntry : this.queuedEmailCache) {
-                               // Add to list
-                               this.getAllEmailAddressChanges().add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.getAllEmailAddressChanges().sort(new Comparator<ChangeableEmailAddress>() {
-                               @Override
-                               public int compare (final ChangeableEmailAddress queuedEmail1, final ChangeableEmailAddress queuedEmail2) {
-                                       return queuedEmail1.getEmailChangeId() > queuedEmail2.getEmailChangeId() ? 1 : queuedEmail1.getEmailChangeId() < queuedEmail2.getEmailChangeId() ? -1 : 0;
-                               }
-                       });
-
-                       // Set full list
-                       this.setFilteredEmailAddressChanges(this.getAllEmailAddressChanges());
-               }
-       }
-
-       @Override
-       public boolean isEmailAddressQueued (final String emailAddress) {
-               // Check if parameter is valid
-               if (null == emailAddress) {
-                       // Throw NPE
-                       throw new NullPointerException("emailAddress is null"); //NOI18N
-               } else if (emailAddress.isEmpty()) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("emailAddress is empty."); //NOI18N
-               }
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Iterate through whole list
-               for (final ChangeableEmailAddress address : this.getAllEmailAddressChanges()) {
-                       // Does current match?
-                       if (emailAddress.equals(address.getEmailAddress())) {
-                               // Yes, set flag and abort iteration
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
-       }
-
-}
diff --git a/src/java/org/mxchange/jjobs/beans/contact/phone/email_address/list/FinancialsEmailChangeListWebViewController.java b/src/java/org/mxchange/jjobs/beans/contact/phone/email_address/list/FinancialsEmailChangeListWebViewController.java
deleted file mode 100644 (file)
index ca0fa54..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jfinancials.beans.user.email_address.list;
-
-import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
-
-/**
- * An interface for an email change controller
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface FinancialsEmailChangeListWebViewController extends Serializable {
-
-       /**
-        * Returns a list of all email address changes. For performance reasons, the
-        * controller (bean) should be view-scoped as from user to user nothing
-        * changes. And the controller's post-construct method should load all
-        * numbers and cache it in the controller.
-        * <p>
-        * @return List of all mobile numbers
-        */
-       List<ChangeableEmailAddress> getAllEmailAddressChanges ();
-
-       /**
-        * Checks if given email address has already been queued. First a local list
-        * is being checked, if not found, the EJB is called. Only if found, the
-        * result is "cached" in the list.
-        * <p>
-        * @param emailAddress Email address to verify
-        * <p>
-        * @return Whether the email address in field emailAddress is already queued
-        */
-       boolean isEmailAddressQueued (final String emailAddress);
-
-}
index 232cbf58590da94056a5a04b2237904088049fa8..945c09c4fdde65fbe843918c9d129b7537a1a833 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.user.list;
+package org.mxchange.jjobs.beans.user.list;
 
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
@@ -29,7 +29,7 @@ import javax.enterprise.event.Observes;
 import javax.faces.view.ViewScoped;
 import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jfinancials.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent;
 import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
@@ -77,7 +77,7 @@ public class JobsUserListWebViewBean extends BaseJobsBean implements JobsUserLis
        /**
         * Remote user bean
         */
-       @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
+       @EJB (lookup = "java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
        private UserSessionBeanRemote userBean;
 
        /**
index 82ef7df7d9c590f78fc7f54e812a730a44c2d395..b76a562cd88d97368ef0f59c1f7dc9b2896aa827 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.user.list;
+package org.mxchange.jjobs.beans.user.list;
 
 import java.io.Serializable;
 import java.util.List;
index 0bfeb8b88ff53f091d08292d3b505c59c433347b..c8eed4386bf3b749c66ff02fde81974c87eea6fa 100644 (file)
@@ -19,9 +19,8 @@ package org.mxchange.jjobs.beans.data;
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Named;
 import org.mxchange.jcontacts.model.contact.title.PersonalTitle;
-import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
-import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jcoreee.dates.DayOfTheWeek;
+import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 
@@ -69,6 +68,7 @@ public class JobsDataWebApplicationBean extends BaseJobsBean {
         * Returns an array of all profile modes <p <p>
         * @
         *
+        *
         * return An array of all profile modes
         */
        public ProfileMode[] getProfileModes () {
index ac672e7917ce11711a4a30edd0e4178041c87407..c811a4247f2b7f734f3f6a643cafde175ce6fc1a 100644 (file)
@@ -32,8 +32,8 @@ import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.contact.list.JobsContactListWebViewController;
 import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController;
-import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
 import org.mxchange.jphone.events.fax.created.CreatedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
 import org.mxchange.jphone.events.landline.created.CreatedLandLineNumberEvent;
@@ -78,7 +78,7 @@ public class JobsWebViewHelperBean extends BaseJobsBean implements JobsWebViewHe
         * Regular user controller
         */
        @Inject
-       private FinancialsContactListWebViewController contactListController;
+       private JobsContactListWebViewController contactListController;
 
        /**
         * Fax number
index 8851f6324416fd07f0b3fa902934c5cb81800a0f..e6cbd863a45e9ecd0b950d3a1779ddff25bfb4b9 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.mobile;
+package org.mxchange.jjobs.beans.mobile;
 
 import java.text.MessageFormat;
 import java.util.Date;
@@ -28,8 +28,8 @@ import javax.enterprise.inject.Any;
 import javax.faces.application.FacesMessage;
 import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jfinancials.beans.mobile.list.FinancialsMobileListWebViewController;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.mobile.list.FinancialsMobileListWebViewController;
 import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
 import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
 import org.mxchange.jphone.events.mobile.deleted.AdminMobileNumberDeletedEvent;
@@ -49,7 +49,7 @@ import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
  */
 @Named ("adminMobileController")
 @RequestScoped
-public class FinancialsAdminMobileWebRequestBean extends BaseFinancialsBean implements FinancialsAdminMobileWebRequestController {
+public class FinancialsAdminMobileWebRequestBean extends BaseJobsBean implements FinancialsAdminMobileWebRequestController {
 
        /**
         * Serial number
@@ -59,7 +59,7 @@ public class FinancialsAdminMobileWebRequestBean extends BaseFinancialsBean impl
        /**
         * Remote EJB for phone number (administrative)
         */
-       @EJB (lookup = "java:global/jfinancials-ejb/adminMobile!org.mxchange.jphone.model.phonenumbers.mobile.AdminMobileSessionBeanRemote")
+       @EJB (lookup = "java:global/jjobs-ejb/adminMobile!org.mxchange.jphone.model.phonenumbers.mobile.AdminMobileSessionBeanRemote")
        private AdminMobileSessionBeanRemote adminMobileBean;
 
        /**
index 3a5a8f7f324441abea2404d1e9dbec5ef444d9f1..269629dfd89d97321e73832ee46b948952c34e90 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.mobile;
+package org.mxchange.jjobs.beans.mobile;
 
 import java.io.Serializable;
 
index 5c6a03f033e387511fb93521e1fbc96fa53ad15c..fdc286b3671b0828b0558ffaa124d6a7c571724b 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.mobile.list;
+package org.mxchange.jjobs.beans.mobile.list;
 
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
@@ -33,7 +33,7 @@ import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEven
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
 import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
 import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
 import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
 import org.mxchange.jphone.exceptions.mobile.MobileEntityNotFoundException;
@@ -48,7 +48,7 @@ import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
  */
 @Named ("mobileListController")
 @ViewScoped
-public class FinancialsMobileListWebViewBean extends BaseFinancialsBean implements FinancialsMobileListWebViewController {
+public class FinancialsMobileListWebViewBean extends BaseJobsBean implements FinancialsMobileListWebViewController {
 
        /**
         * Serial number
@@ -68,7 +68,7 @@ public class FinancialsMobileListWebViewBean extends BaseFinancialsBean implemen
        /**
         * General EJB for mobile numbers
         */
-       @EJB (lookup = "java:global/jfinancials-ejb/mobile!org.mxchange.jphone.model.phonenumbers.mobile.MobileSessionBeanRemote")
+       @EJB (lookup = "java:global/jjobs-ejb/mobile!org.mxchange.jphone.model.phonenumbers.mobile.MobileSessionBeanRemote")
        private MobileSessionBeanRemote mobileBean;
 
        /**
index 18a38fb62084a0324e65cdebd5d6b142782ece71..1b45c3ab47b19baf402f3c30069a975640d68910 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.mobile.list;
+package org.mxchange.jjobs.beans.mobile.list;
 
 import java.io.Serializable;
 import java.util.List;
index cc7067a88938e70a3e3260ce74666a8b91969414..f8e4b26275465fbf40cb1c6ef1632df37cb08099 100644 (file)
@@ -27,7 +27,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsBean;
-import org.mxchange.jfinancials.beans.mobileprovider.list.FinancialsMobileProviderListWebViewController;
+import org.mxchange.jjobs.beans.mobileprovider.list.FinancialsMobileProviderListWebViewController;
 import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
 import org.mxchange.jphone.events.mobileprovider.added.AdminMobileProviderAddedEvent;
 import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderAlreadyAddedException;
index 8a5e1f16e10f2bededd2e6bb62ef81397d65fc96..ab20ff8876f2ee8fa2f00aaee83385dae41918d4 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.mobileprovider.list;
+package org.mxchange.jjobs.beans.mobileprovider.list;
 
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
@@ -28,7 +28,7 @@ import javax.enterprise.event.Observes;
 import javax.faces.view.ViewScoped;
 import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
 import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
@@ -41,7 +41,7 @@ import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingl
  */
 @Named ("mobileProviderListController")
 @ViewScoped
-public class FinancialsMobileProviderListWebViewBean extends BaseFinancialsBean implements FinancialsMobileProviderListWebViewController {
+public class FinancialsMobileProviderListWebViewBean extends BaseJobsBean implements FinancialsMobileProviderListWebViewController {
 
        /**
         * Serial number
@@ -61,7 +61,7 @@ public class FinancialsMobileProviderListWebViewBean extends BaseFinancialsBean
        /**
         * Remote EJB for mobile providers (regular)
         */
-       @EJB (lookup = "java:global/jfinancials-ejb/mobileProvider!org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote")
+       @EJB (lookup = "java:global/jjobs-ejb/mobileProvider!org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote")
        private MobileProviderSingletonBeanRemote mobileProviderBean;
 
        /**
index fa03552826c0e92e2e2d5dd740470ed4a378f541..f1e4568e281519d486f176f0318e69bbc1ff253c 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.mobileprovider.list;
+package org.mxchange.jjobs.beans.mobileprovider.list;
 
 import java.io.Serializable;
 import java.util.List;
index 9901d763cd155d2f8b71cdc6257b2136edaa675f..07edf159b39fc2569c73939de181c4d066e1b5d4 100644 (file)
@@ -30,7 +30,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsBean;
-import org.mxchange.jfinancials.beans.phone.list.FinancialsPhoneListWebViewController;
+import org.mxchange.jjobs.beans.phone.list.FinancialsPhoneListWebViewController;
 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.deleted.AdminFaxNumberDeletedEvent;
index 58642aed5f5e3a81d05cf1b8d79379d3db5e3785..8c68bcdb378ff6f56b30d86c487a12e18c44948d 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.phone.list;
+package org.mxchange.jjobs.beans.phone.list;
 
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
@@ -34,7 +34,7 @@ import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContac
 import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
 import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
 import org.mxchange.jcontacts.model.contact.Contact;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
 import org.mxchange.jphone.events.landline.deleted.AdminDeletedLandLineNumberEvent;
@@ -51,7 +51,7 @@ import org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote;
  */
 @Named ("phoneListController")
 @ViewScoped
-public class FinancialsPhoneListWebViewBean extends BaseFinancialsBean implements FinancialsPhoneListWebViewController {
+public class FinancialsPhoneListWebViewBean extends BaseJobsBean implements FinancialsPhoneListWebViewController {
 
        /**
         * Serial number
@@ -95,7 +95,7 @@ public class FinancialsPhoneListWebViewBean extends BaseFinancialsBean implement
        /**
         * General EJB for phone numbers
         */
-       @EJB (lookup = "java:global/jfinancials-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote")
+       @EJB (lookup = "java:global/jjobs-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote")
        private PhoneSessionBeanRemote phoneBean;
 
        /**
index 24176e8f67609f8981e369507488d50c1e44b648..421c57231cc331e20bb075d5021e862d0d3cce59 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-package org.mxchange.jfinancials.beans.phone.list;
+package org.mxchange.jjobs.beans.phone.list;
 
 import java.io.Serializable;
 import java.util.List;
index fb90141593521af674899712f8c1c922536a738a..2e75075673570ef6b8c4e9a407690fce921f07dc 100644 (file)
@@ -27,7 +27,6 @@ import javax.enterprise.inject.Any;
 import javax.faces.FacesException;
 import javax.faces.application.FacesMessage;
 import javax.faces.context.FacesContext;
-import javax.faces.view.facelets.FaceletException;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontacts.model.contact.Contact;
@@ -36,6 +35,7 @@ import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jjobs.beans.contact.JobsAdminContactWebRequestController;
 import org.mxchange.jjobs.beans.contact.JobsContactWebRequestController;
 import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController;
+import org.mxchange.jjobs.beans.user.list.JobsUserListWebViewController;
 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
@@ -48,6 +48,7 @@ import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent;
 import org.mxchange.jusercore.events.user.unlocked.AdminUnlockedUserEvent;
 import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent;
 import org.mxchange.jusercore.events.user.update.post.AdminPostUserDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.post.ObservableAdminPostUserDataUpdatedEvent;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
@@ -64,7 +65,6 @@ import org.mxchange.juserlogincore.container.login.UserLoginContainer;
 import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent;
 import org.mxchange.juserlogincore.exceptions.UserPasswordRepeatMismatchException;
 import org.mxchange.juserlogincore.login.UserLoginUtils;
-import org.mxchange.jusercore.events.user.update.post.ObservableAdminPostUserDataUpdatedEvent;
 
 /**
  * A user controller (bean)
diff --git a/src/java/org/mxchange/jjobs/beans/user/action/JobsUserActionWebRequestController.java b/src/java/org/mxchange/jjobs/beans/user/action/JobsUserActionWebRequestController.java
new file mode 100644 (file)
index 0000000..788e716
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.user.action;
+
+import java.io.Serializable;
+
+/**
+ * An interface for user beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsUserActionWebRequestController extends Serializable {
+
+       /**
+        * Minimum password length
+        * <p>
+        * @deprecated Better set as context parameter
+        */
+       @Deprecated
+       public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
+
+       /**
+        * Changes logged-in user's personal data if the current password matches
+        * and TAC + privacy statement has been accepted.
+        * <p>
+        * @return New target page
+        */
+       String doChangePersonalData ();
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/user/action/JobssUserActionWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/action/JobssUserActionWebRequestBean.java
new file mode 100644 (file)
index 0000000..faace20
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.user.action;
+
+import java.text.MessageFormat;
+import javax.ejb.EJB;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.faces.FacesException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.contact.JobsContactWebRequestController;
+import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController;
+import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController;
+import org.mxchange.jusercore.events.user.update.post.ObservablePostUserPersonalDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.post.PostUserPersonalDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.pre.ObservablePreUserPersonalDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.pre.PreUserPersonalDataUpdatedEvent;
+import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
+import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException;
+
+/**
+ * A user action bean (controller)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("userActionController")
+@RequestScoped
+public class JobssUserActionWebRequestBean extends BaseJobsBean implements JobsUserActionWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 542_145_347_920L;
+
+       /**
+        * General contact controller
+        */
+       @Inject
+       private JobsContactWebRequestController contactController;
+
+       /**
+        * Features controller
+        */
+       @Inject
+       private JobsFeaturesWebApplicationController featureController;
+
+       /**
+        * Event being fired when user updated personal data
+        */
+       @Inject
+       @Any
+       private Event<ObservablePostUserPersonalDataUpdatedEvent> postUpdatedPersonalDataEvent;
+
+       /**
+        * Event being fired when user updated personal data
+        */
+       @Inject
+       @Any
+       private Event<ObservablePreUserPersonalDataUpdatedEvent> preUpdatedPersonalDataEvent;
+
+       /**
+        * Remote user bean
+        */
+       @EJB (lookup = "java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
+       private UserSessionBeanRemote userBean;
+
+       /**
+        * Login controller (bean)
+        */
+       @Inject
+       private JobsUserLoginWebSessionController userLoginController;
+
+       /**
+        * Default constructor
+        */
+       public JobssUserActionWebRequestBean () {
+               // Call super constructor
+               super();
+       }
+
+       @Override
+       public String doChangePersonalData () {
+               // This method shall only be called if the user is logged-in
+               if (!this.userLoginController.isUserLoggedIn()) {
+                       // Not logged-in
+                       throw new IllegalStateException("User is not logged-in"); //NOI18N
+               } else if (!this.contactController.isRequiredChangePersonalDataSet()) {
+                       // Not all required fields are set
+                       throw new FacesException("Not all required fields are set."); //NOI18N
+               } else if (!this.userLoginController.ifCurrentPasswordMatches()) {
+                       // Password not matching
+                       throw new FacesException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()));
+               } else if (!this.featureController.isFeatureEnabled("change_user_personal_data")) { //NOI18N
+                       // Editing is not allowed
+                       throw new IllegalStateException("User tried to edit personal data."); //NOI18N
+               }
+
+               // Get user instance
+               final User user = this.userLoginController.getLoggedInUser();
+
+               // Fire pre-update event
+               this.preUpdatedPersonalDataEvent.fire(new PreUserPersonalDataUpdatedEvent(user));
+
+               // It should be there, so run some tests on it
+               assert (user instanceof User) : "Instance userLoginController.loggedInUser is null"; //NOI18N
+               assert (user.getUserId() instanceof Long) : "Instance userLoginController.loggedInUser.userId is null"; //NOI18N
+               assert (user.getUserId() > 0) : MessageFormat.format("userLoginController.loggedInUser.userId={0} is invalid", user.getUserId()); //NOI18N
+               assert (user.getUserContact() instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null"; //NOI18N
+               assert (user.getUserContact().getContactId() instanceof Long) : "Instance userLoginController.userContact.contactId is null"; //NOI18N
+               assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N
+
+               // Send it to the EJB
+               final User updatedUser = this.userBean.updateUserPersonalData(user);
+
+               // Fire post-update event
+               this.postUpdatedPersonalDataEvent.fire(new PostUserPersonalDataUpdatedEvent(updatedUser));
+
+               // All fine
+               return "user_contact_data_saved"; //NOI18N
+       }
+
+}
index 34da8b172e13259cf5876df60eb27d8227f05b11..c03ac3ca6e0186022e763f0941493cd465f0ff11 100644 (file)
@@ -29,7 +29,7 @@ import org.mxchange.jcoreee.events.helper.clear.HelperCleanupEvent;
 import org.mxchange.jcoreee.events.helper.clear.ObservableHelperCleanupEvent;
 import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jjobs.beans.BaseJobsBean;
-import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
+import org.mxchange.jjobs.beans.user.list.JobsUserListWebViewController;
 import org.mxchange.jusercore.events.user.created.CreatedUserEvent;
 import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
 import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
index 519a869a792d43c5814af7dec76d1d0e10c450f2..89238fcbdc130ec3e9437f3f5ed8e3a8a1dd7abe 100644 (file)
@@ -28,6 +28,7 @@ import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController;
+import org.mxchange.jjobs.beans.user.email_address.list.JobsEmailChangeListWebViewController;
 import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController;
 import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
 import org.mxchange.jusercore.model.email_address.EmailAddressChange;
@@ -69,13 +70,13 @@ public class JobsEmailChangeWebRequestBean extends BaseJobsBean implements JobsE
         * Controller for listing email address changes
         */
        @Inject
-       private FinancialsEmailChangeListWebViewController emailChangeListController;
+       private JobsEmailChangeListWebViewController emailChangeListController;
 
        /**
         * Features controller
         */
        @Inject
-       private FinancialsFeaturesWebApplicationController featureController;
+       private JobsFeaturesWebApplicationController featureController;
 
        /**
         * Login controller (bean)
diff --git a/src/java/org/mxchange/jjobs/beans/user/email_address/list/JobsEmailChangeListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/user/email_address/list/JobsEmailChangeListWebViewBean.java
new file mode 100644 (file)
index 0000000..a5691a1
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.user.email_address.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController;
+import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
+import org.mxchange.jusercore.model.user.email_address.UserEmailChangeSessionBeanRemote;
+
+/**
+ * A view-scoped bean for listing email address changes
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("emailChangeListController")
+@ViewScoped
+public class JobsEmailChangeListWebViewBean extends BaseJobsBean implements JobsEmailChangeListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 186_078_724_659_154L;
+
+       /**
+        * A list of all mobile numbers
+        */
+       private final List<ChangeableEmailAddress> allEmailAddressChanges;
+
+       /**
+        * Remote email change bean
+        */
+       @EJB (lookup = "java:global/jjobs-ejb/userEmailChange!org.mxchange.jusercore.model.user.email_address.UserEmailChangeSessionBeanRemote")
+       private UserEmailChangeSessionBeanRemote emailChangeBean;
+
+       /**
+        * Features controller
+        */
+       @Inject
+       private JobsFeaturesWebApplicationController featureController;
+
+       /**
+        * A list of filtered mobile numbers
+        */
+       private List<ChangeableEmailAddress> filteredEmailAddressChanges;
+
+       /**
+        * Local list of already queued email addresses
+        */
+       @Inject
+       @NamedCache (cacheName = "queuedEmailCache")
+       private transient Cache<Long, ChangeableEmailAddress> queuedEmailCache;
+
+       /**
+        * Default constructor
+        */
+       public JobsEmailChangeListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Initialize list
+               this.allEmailAddressChanges = new LinkedList<>();
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<ChangeableEmailAddress> getAllEmailAddressChanges () {
+               return this.allEmailAddressChanges;
+       }
+
+       /**
+        * Getter for filtered email address changed
+        * <p>
+        * @return Filtered email address changed
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<ChangeableEmailAddress> getFilteredEmailAddressChanges () {
+               return this.filteredEmailAddressChanges;
+       }
+
+       /**
+        * Setter for filtered email address changed
+        * <p>
+        * @param filteredEmailAddressChanges Filtered email address changed
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredEmailAddressChanges (final List<ChangeableEmailAddress> filteredEmailAddressChanges) {
+               this.filteredEmailAddressChanges = filteredEmailAddressChanges;
+       }
+
+       /**
+        * Post-construction
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.queuedEmailCache.iterator().hasNext()) {
+                       // Add all
+                       for (final ChangeableEmailAddress currentEmailAddress : this.emailChangeBean.fetchAllQueuedAddressChanges()) {
+                               // Add it to cache
+                               this.queuedEmailCache.put(currentEmailAddress.getEmailChangeId(), currentEmailAddress);
+                       }
+               }
+
+               // Is cache filled and list is empty
+               if ((this.queuedEmailCache.iterator().hasNext()) && (this.getAllEmailAddressChanges().isEmpty())) {
+                       // Build up list
+                       for (final Cache.Entry<Long, ChangeableEmailAddress> currentEntry : this.queuedEmailCache) {
+                               // Add to list
+                               this.getAllEmailAddressChanges().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllEmailAddressChanges().sort(new Comparator<ChangeableEmailAddress>() {
+                               @Override
+                               public int compare (final ChangeableEmailAddress queuedEmail1, final ChangeableEmailAddress queuedEmail2) {
+                                       return queuedEmail1.getEmailChangeId() > queuedEmail2.getEmailChangeId() ? 1 : queuedEmail1.getEmailChangeId() < queuedEmail2.getEmailChangeId() ? -1 : 0;
+                               }
+                       });
+
+                       // Set full list
+                       this.setFilteredEmailAddressChanges(this.getAllEmailAddressChanges());
+               }
+       }
+
+       @Override
+       public boolean isEmailAddressQueued (final String emailAddress) {
+               // Check if parameter is valid
+               if (null == emailAddress) {
+                       // Throw NPE
+                       throw new NullPointerException("emailAddress is null"); //NOI18N
+               } else if (emailAddress.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("emailAddress is empty."); //NOI18N
+               }
+
+               // Default is not found
+               boolean isFound = false;
+
+               // Iterate through whole list
+               for (final ChangeableEmailAddress address : this.getAllEmailAddressChanges()) {
+                       // Does current match?
+                       if (emailAddress.equals(address.getEmailAddress())) {
+                               // Yes, set flag and abort iteration
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/user/email_address/list/JobsEmailChangeListWebViewController.java b/src/java/org/mxchange/jjobs/beans/user/email_address/list/JobsEmailChangeListWebViewController.java
new file mode 100644 (file)
index 0000000..9c90b24
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.user.email_address.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
+
+/**
+ * An interface for an email change controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsEmailChangeListWebViewController extends Serializable {
+
+       /**
+        * Returns a list of all email address changes. For performance reasons, the
+        * controller (bean) should be view-scoped as from user to user nothing
+        * changes. And the controller's post-construct method should load all
+        * numbers and cache it in the controller.
+        * <p>
+        * @return List of all mobile numbers
+        */
+       List<ChangeableEmailAddress> getAllEmailAddressChanges ();
+
+       /**
+        * Checks if given email address has already been queued. First a local list
+        * is being checked, if not found, the EJB is called. Only if found, the
+        * result is "cached" in the list.
+        * <p>
+        * @param emailAddress Email address to verify
+        * <p>
+        * @return Whether the email address in field emailAddress is already queued
+        */
+       boolean isEmailAddressQueued (final String emailAddress);
+
+}
index 09aae44857f1ef4b950dd4cbff050c8c5ca83850..b088ae803024b6fa6b58f5edca6b6285ee13a92d 100644 (file)
@@ -31,9 +31,10 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
-import org.mxchange.jusercore.exceptions.UserNotFoundException;
-import org.mxchange.jusercore.exceptions.UserStatusLockedException;
-import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
+import org.mxchange.jjobs.beans.user.list.JobsUserListWebViewController;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
+import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
 import org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote;
@@ -104,7 +105,7 @@ public class JobsUserLoginWebSessionBean extends BaseJobsBean implements JobsUse
         * Administrative user-list controller
         */
        @Inject
-       private FinancialsUserListWebViewController userListController;
+       private JobsUserListWebViewController userListController;
 
        /**
         * Flag whether the user has logged-in, set only from inside
index fa9db99136cc6ab6569f6cc2a0f7d431ba2277cb..114e0ec729f5e212b08486e365ca95366d68fcdc 100644 (file)
@@ -32,11 +32,9 @@ import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 import org.mxchange.jjobs.beans.contact.JobsContactWebRequestController;
 import org.mxchange.jjobs.beans.features.JobsFeaturesWebApplicationController;
+import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController;
 import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
-import org.mxchange.jusercore.events.user.clear.password.ClearUserPasswordEvent;
-import org.mxchange.jusercore.events.user.clear.password.ObservableClearUserPasswordEvent;
-import org.mxchange.jusercore.events.user.clear.username.ClearUserNameEvent;
-import org.mxchange.jusercore.events.user.clear.username.ObservableClearUserNameEvent;
+import org.mxchange.jjobs.beans.user.list.JobsUserListWebViewController;
 import org.mxchange.jusercore.exceptions.DataRepeatMismatchException;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
@@ -84,7 +82,7 @@ public class JobsUserRegisterWebRequestBean extends BaseJobsBean implements Jobs
         * Localization controller
         */
        @Inject
-       private FinancialsLocalizationSessionController localizationController;
+       private JobsLocalizationSessionController localizationController;
 
        /**
         * Remote register session-scoped bean
@@ -96,7 +94,7 @@ public class JobsUserRegisterWebRequestBean extends BaseJobsBean implements Jobs
         * User list controller
         */
        @Inject
-       private FinancialsUserListWebViewController userListController;
+       private JobsUserListWebViewController userListController;
 
        /**
         * User name
@@ -328,7 +326,7 @@ public class JobsUserRegisterWebRequestBean extends BaseJobsBean implements Jobs
                                return ""; //NOI18N
                        } else if (this.ifBothPasswordsEmptyAllowed()) {
                                // Both passwords are left empty and is allowed, then generate a random password
-                               final String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH);
+                               final String randomPassword = UserLoginUtils.createRandomPassword(JobsUserWebRequestController.MINIMUM_PASSWORD_LENGTH);
 
                                // Generate (ignored) password-history
                                final PasswordHistory passwordHistory = new UserPasswordHistory(randomPassword, user);
@@ -492,7 +490,7 @@ public class JobsUserRegisterWebRequestBean extends BaseJobsBean implements Jobs
                        this.setUserProfileMode(ProfileMode.INVISIBLE);
 
                        // Generate random password
-                       final String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH);
+                       final String randomPassword = UserLoginUtils.createRandomPassword(JobsUserWebRequestController.MINIMUM_PASSWORD_LENGTH);
 
                        // Set random password
                        this.setUserPassword(randomPassword);
index cb8626ecf1ab9a41c145590b994be8d19c9459cd..0d8a6707d485e152cae9fc9b490f9cc3dc02c7fb 100644 (file)
@@ -25,6 +25,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController;
 import org.mxchange.jjobs.beans.user.JobsUserWebRequestController;
 import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
index 590cd203b87aa3eb4a3c605802700090c1487f33..19fdaa216ec73931f033849d4d5d756bfa76890b 100644 (file)
@@ -24,8 +24,8 @@ import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
-import org.mxchange.jjobs.beans.business.employee.JobsEmployeeWebRequestBean;
-import org.mxchange.jjobs.beans.business.employee.JobsEmployeeWebRequestController;
+import org.mxchange.jjobs.beans.business.employee.list.JobsEmployeeListWebViewBean;
+import org.mxchange.jjobs.beans.business.employee.list.JobsEmployeeListWebViewController;
 
 /**
  * Converter for converting company employee to and from id number
@@ -38,7 +38,7 @@ public class JobsEmployeeConverter implements Converter<Employable> {
        /**
         * Employable EJB
         */
-       private static FinancialsEmployeeListWebViewController EMPLOYEE_LIST_CONTROLLER;
+       private static JobsEmployeeListWebViewController EMPLOYEE_LIST_CONTROLLER;
 
        @Override
        public Employable getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
@@ -58,7 +58,7 @@ public class JobsEmployeeConverter implements Converter<Employable> {
                        // Is the instance there?
                        if (null == EMPLOYEE_LIST_CONTROLLER) {
                                // Get bean from CDI directly
-                               EMPLOYEE_LIST_CONTROLLER = CDI.current().select(FinancialsEmployeeListWebViewBean.class).get();
+                               EMPLOYEE_LIST_CONTROLLER = CDI.current().select(JobsEmployeeListWebViewBean.class).get();
                        }
 
                        // Try to get user instance from it
index 26e6db1b35c73b76fbbef5bb66eba942a3650e55..2d0a0c3266d41a1b21eaca358cbfabafb1f0b7b0 100644 (file)
@@ -24,8 +24,8 @@ import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
-import org.mxchange.jjobs.beans.business.opening_time.JobsOpeningTimeWebRequestBean;
-import org.mxchange.jjobs.beans.business.opening_time.JobsOpeningTimeWebRequestController;
+import org.mxchange.jjobs.beans.business.opening_time.list.JobsOpeningTimeListWebViewBean;
+import org.mxchange.jjobs.beans.business.opening_time.list.JobsOpeningTimeListWebViewController;
 
 /**
  * Converter for opening time id <-> instance
@@ -38,7 +38,7 @@ public class JobsCompanyOpeningTimeConverter implements Converter<OpeningTime> {
        /**
         * Opening time backing bean
         */
-       private static JobsOpeningTimeWebRequestController OPENING_TIMES_LIST_CONTROLLER;
+       private static JobsOpeningTimeListWebViewController OPENING_TIMES_LIST_CONTROLLER;
 
        @Override
        public OpeningTime getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
@@ -59,13 +59,13 @@ public class JobsCompanyOpeningTimeConverter implements Converter<OpeningTime> {
                        final Long openingTimeId = Long.valueOf(submittedValue);
 
                        // Is the instance there?
-                       if (null == OPENING_TIME_LIST_CONTROLLER) {
+                       if (null == OPENING_TIMES_LIST_CONTROLLER) {
                                // Get bean from CDI directly
-                               OPENING_TIME_LIST_CONTROLLER = CDI.current().select(FinancialsOpeningTimeListWebViewBean.class).get();
+                               OPENING_TIMES_LIST_CONTROLLER = CDI.current().select(JobsOpeningTimeListWebViewBean.class).get();
                        }
 
                        // Try to get user instance from it
-                       openingTime = OPENING_TIME_LIST_CONTROLLER.findOpeningTimeById(openingTimeId);
+                       openingTime = OPENING_TIMES_LIST_CONTROLLER.findOpeningTimeById(openingTimeId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index b2e43c3931b46a1496cde0a7cd1b012862381f0f..c5f3f1b9169e1dba21b3a1403a374d87e0b94a21 100644 (file)
@@ -22,8 +22,6 @@ import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
-import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestBean;
-import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController;
 import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 
@@ -38,7 +36,7 @@ public class JobsFaxNumberConverter implements Converter<DialableFaxNumber> {
        /**
         * Phone EJB
         */
-       private static JobsPhoneWebRequestController PHONE_LIST_CONTROLLER;
+       private static JobsPhoneListWebViewController PHONE_LIST_CONTROLLER;
 
        @Override
        public DialableFaxNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
@@ -58,7 +56,7 @@ public class JobsFaxNumberConverter implements Converter<DialableFaxNumber> {
                        // Is the instance there?
                        if (null == PHONE_LIST_CONTROLLER) {
                                // Get bean from CDI directly
-                               PHONE_LIST_CONTROLLER = CDI.current().select(FinancialsPhoneListWebViewBean.class).get();
+                               PHONE_LIST_CONTROLLER = CDI.current().select(JobsPhoneListWebViewBean.class).get();
                        }
 
                        // Try to get mobile instance from it
index 73ad9e160a57c99e20fe5deab9bc0053919d137f..2a64a37a535f643608d9995b6c4280fd8220d519 100644 (file)
@@ -22,8 +22,6 @@ import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
-import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestBean;
-import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController;
 import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 
@@ -38,7 +36,7 @@ public class JobsLandLineNumberConverter implements Converter<DialableLandLineNu
        /**
         * Phone EJB
         */
-       private static JobsPhoneWebRequestController PHONE_LIST_CONTROLLER;
+       private static JobsPhoneListWebViewController PHONE_LIST_CONTROLLER;
 
        @Override
        public DialableLandLineNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
@@ -58,7 +56,7 @@ public class JobsLandLineNumberConverter implements Converter<DialableLandLineNu
                        // Is the instance there?
                        if (null == PHONE_LIST_CONTROLLER) {
                                // Get bean from CDI directly
-                               PHONE_LIST_CONTROLLER = CDI.current().select(FinancialsPhoneListWebViewBean.class).get();
+                               PHONE_LIST_CONTROLLER = CDI.current().select(JobsPhoneListWebViewBean.class).get();
                        }
 
                        // Try to get mobile instance from it
index 8d237daf7bcf94e52879136da6a4ceee9ee64e57..69472ec4d79509fc9b19fc9e5b5832a48d93460d 100644 (file)
@@ -22,9 +22,6 @@ import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
-import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestBean;
-import org.mxchange.jjobs.beans.phone.JobsPhoneWebRequestController;
-import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 
 /**
@@ -38,7 +35,7 @@ public class JobsMobileNumberConverter implements Converter<DialableMobileNumber
        /**
         * Phone EJB
         */
-       private static JobsPhoneWebRequestController PHONE_LIST_CONTROLLER;
+       private static JobsMobileListWebViewController MOBILE_LIST_CONTROLLER;
 
        @Override
        public DialableMobileNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
@@ -58,7 +55,7 @@ public class JobsMobileNumberConverter implements Converter<DialableMobileNumber
                        // Is the instance there?
                        if (null == MOBILE_LIST_CONTROLLER) {
                                // Get bean from CDI directly
-                               MOBILE_LIST_CONTROLLER = CDI.current().select(FinancialsMobileListWebViewBean.class).get();
+                               MOBILE_LIST_CONTROLLER = CDI.current().select(JobsMobileListWebViewBean.class).get();
                        }
 
                        // Try to get mobile instance from it
index 8ec5284d2d722ba9f619309a57e164f6054c9e7b..c70f90591a351d7f9e9af31490eca91e9f5cb93e 100644 (file)
@@ -22,8 +22,6 @@ import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
-import org.mxchange.jjobs.beans.mobileprovider.JobsMobileProviderWebRequestBean;
-import org.mxchange.jjobs.beans.mobileprovider.JobsMobileProviderWebRequestController;
 import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 
@@ -38,7 +36,7 @@ public class JobsMobileProviderConverter implements Converter<MobileProvider> {
        /**
         * Mobile provider backing bean
         */
-       private static JobsMobileProviderWebRequestController MOBILE_PROVIDER_LIST_CONTROLLER;
+       private static JobsMobileProviderListWebViewController MOBILE_PROVIDER_LIST_CONTROLLER;
 
        @Override
        public MobileProvider getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
@@ -59,7 +57,7 @@ public class JobsMobileProviderConverter implements Converter<MobileProvider> {
                        // Is the instance there?
                        if (null == MOBILE_PROVIDER_LIST_CONTROLLER) {
                                // Get bean from CDI directly
-                               MOBILE_PROVIDER_LIST_CONTROLLER = CDI.current().select(FinancialsMobileProviderListWebViewBean.class).get();
+                               MOBILE_PROVIDER_LIST_CONTROLLER = CDI.current().select(JobsMobileProviderListWebViewBean.class).get();
                        }
 
                        // Lookup of mobile provider
diff --git a/src/java/org/mxchange/jjobs/validator/addressbook/JobsAddressbookIdValidator.java b/src/java/org/mxchange/jjobs/validator/addressbook/JobsAddressbookIdValidator.java
deleted file mode 100644 (file)
index 5b4df98..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jjobs.validator.addressbook;
-
-import java.text.MessageFormat;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.FacesValidator;
-import javax.faces.validator.ValidatorException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote;
-import org.mxchange.jaddressbook.exceptions.AddressbookNotFoundException;
-import org.mxchange.jaddressbook.model.addressbook.Addressbook;
-import org.mxchange.jcoreee.validator.number.BaseNumberValidator;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
-
-/**
- * A validator for address book id verification
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@FacesValidator ("AddressbookIdValidator")
-public class JobsAddressbookIdValidator extends BaseNumberValidator {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 158_768_467_186_951_809L;
-
-       /**
-        * Remote bean
-        */
-       private AddressbookSessionBeanRemote addressbookBean;
-
-       /**
-        * Logger instance
-        */
-       @Log
-       private LoggerBeanLocal loggerBeanLocal;
-
-       /**
-        * Public consutructor
-        */
-       public JobsAddressbookIdValidator () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Lookup logger
-                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
-
-                       // ... and user controller
-                       this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/jjobs-ejb/jjobs-adr!org.mxchange.jjobs.model.addressbook.JobsAddressbookSessionBeanRemote"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
-       }
-
-       @Override
-       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Trace message
-               this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
-               // All accepted, required fields
-               String[] requiredFields = {"addressbookId"}; //NOI18N
-
-               // Pre-validation (example: not null, not a string, empty string ...)
-               super.preValidate(context, component, value, requiredFields, false);
-
-               // Cast to long
-               Long addressbookId = (Long) value;
-
-               // Is the address book id valid?
-               if (!this.addressbookBean.isAddressbookIdUsed(addressbookId)) {
-                       // Is not valid
-                       throw new ValidatorException(new FacesMessage(MessageFormat.format("No address book found with id {0}. Please check your link.", addressbookId))); //NOI18N
-               }
-
-               // Init variable
-               Addressbook addressbook;
-
-               // Try it
-               try {
-                       // Get full data
-                       addressbook = this.addressbookBean.getAddressbookById(addressbookId);
-
-                       // Is it set?
-                       if (null == addressbook) {
-                               // Is null?!
-                               throw new NullPointerException(MessageFormat.format("addressbook for id={0} is null", addressbookId)); //NOI18N
-                       }
-               } catch (final AddressbookNotFoundException ex) {
-                       // Continue to throw
-                       throw new ValidatorException(new FacesMessage(MessageFormat.format("Cannot find address book with id {0}", addressbookId)), ex); //NOI18N
-               }
-
-               // Trace message
-               this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N
-       }
-}