]> git.mxchange.org Git - jjobs-war.git/blobdiff - src/java/org/mxchange/jjobs/beans/addressbook/JobsAddressbookWebSessionBean.java
Please cherry-pick:
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / addressbook / JobsAddressbookWebSessionBean.java
index e232ee8d1dda0be77e0663e53a7ef0282159a5dc..baf73ea962c9c10d9b3760c5b59c7767ff7d556d 100644 (file)
@@ -41,6 +41,7 @@ import org.mxchange.jaddressbookcore.exceptions.AddressbookNotFoundException;
 import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
 import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook;
 import org.mxchange.jaddressbookcore.model.addressbook.entry.AddressbookEntry;
+import org.mxchange.jjobs.beans.BaseJobsController;
 import org.mxchange.jjobs.beans.login.JobsUserLoginWebSessionController;
 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
 import org.mxchange.jusercore.model.user.User;
@@ -52,7 +53,7 @@ import org.mxchange.jusercore.model.user.User;
  */
 @Named ("addressbookController")
 @SessionScoped
-public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionController {
+public class JobsAddressbookWebSessionBean extends BaseJobsController implements JobsAddressbookWebSessionController {
 
        /**
         * Serial number
@@ -100,7 +101,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
         * Login controller
         */
        @Inject
-       private JobsUserLoginWebSessionController loginController;
+       private JobsUserLoginWebSessionController userLoginController;
 
        /**
         * A list of all user's address books
@@ -127,7 +128,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
        @Override
        public String addAddressbook () {
                // Is this name already used?
-               if (!this.loginController.isUserLoggedIn()) {
+               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) {
@@ -142,7 +143,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
                }
 
                // Create address book instance with name
-               Addressbook book = new UserAddressbook(this.getAddressbookName(), this.loginController.getLoggedInUser());
+               Addressbook book = new UserAddressbook(this.getAddressbookName(), this.userLoginController.getLoggedInUser());
 
                try {
                        // Register this address book
@@ -163,7 +164,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
        }
 
        @Override
-       public void afterAddressbookLoadedEvent (final @Observes AddressbookLoadedEvent event) {
+       public void afterAddressbookLoadedEvent (@Observes final AddressbookLoadedEvent event) {
                // event should not be null
                if (null == event) {
                        // Throw NPE
@@ -196,7 +197,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
        }
 
        @Override
-       public void afterLoginEvent (final @Observes UserLoggedInEvent event) {
+       public void afterLoginEvent (@Observes final UserLoggedInEvent event) {
                // Is the user logged in?
                if (null == event) {
                        // Is null
@@ -204,10 +205,10 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
                } else if (event.getLoggedInUser()== null) {
                        // user is null
                        throw new NullPointerException("event.user is null"); //NOI18N
-               } else if (!event.getLoggedInUser().equals(this.loginController.getLoggedInUser())) {
+               } else if (!event.getLoggedInUser().equals(this.userLoginController.getLoggedInUser())) {
                        // Not matching
-                       throw new IllegalStateException("event.user and loginController.loggedInUser don't match."); //NOI18N
-               } else if (!this.loginController.isUserLoggedIn()) {
+                       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
                }
@@ -219,7 +220,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
        @Override
        public List<Addressbook> allAddressbooks () {
                // Is the user logged in?
-               if (!this.loginController.isUserLoggedIn()) {
+               if (!this.userLoginController.isUserLoggedIn()) {
                        // Not logged in
                        throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
                }
@@ -230,7 +231,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
        @Override
        public List<AddressbookEntry> allEntries (final Addressbook addressbook) {
                // Is the user logged in?
-               if (!this.loginController.isUserLoggedIn()) {
+               if (!this.userLoginController.isUserLoggedIn()) {
                        // Not logged in
                        throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
                }
@@ -256,11 +257,13 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
        }
 
        @Override
+       @SuppressWarnings ("ReturnOfDateField")
        public Calendar getAddressbookCreated () {
                return this.addressbookCreated;
        }
 
        @Override
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
        public void setAddressbookCreated (final Calendar addressbookCreated) {
                this.addressbookCreated = addressbookCreated;
        }
@@ -298,7 +301,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
        @Override
        public boolean hasCreatedAddressbooks () {
                // Is the user logged in?
-               if (!this.loginController.isUserLoggedIn()) {
+               if (!this.userLoginController.isUserLoggedIn()) {
                        // Not logged in
                        throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
                }
@@ -316,7 +319,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
                this.usersAddressbooks = new LinkedList<>();
 
                // Is the user logged-in?
-               if (this.loginController.isUserLoggedIn()) {
+               if (this.userLoginController.isUserLoggedIn()) {
                        // Initialize list
                        this.initAddressbookList();
                }
@@ -370,13 +373,13 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
        @Override
        public boolean isOwnAddressbook () {
                // Is the user logged in?
-               if (!this.loginController.isUserLoggedIn()) {
+               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.loginController.getLoggedInUser());
+               return Objects.equals(this.getAddressbookUser(), this.userLoginController.getLoggedInUser());
        }
 
        @Override
@@ -416,7 +419,7 @@ public class JobsAddressbookWebSessionBean implements JobsAddressbookWebSessionC
         */
        private void initAddressbookList () {
                // Get user instance
-               User user = this.loginController.getLoggedInUser();
+               User user = this.userLoginController.getLoggedInUser();
 
                // Fill list with entries
                this.usersAddressbooks = this.addressbookBean.getUsersAddressbookList(user);