]> git.mxchange.org Git - jfinancials-lib.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Fri, 9 Oct 2015 12:47:36 +0000 (14:47 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 9 Oct 2015 12:47:53 +0000 (14:47 +0200)
- added business method getUsersList()
- exposed all POJO's fields/attributes in its POJI
- added named query for finding user's address books
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/addressbook/model/addressbook/Addressbook.java
src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java
src/org/mxchange/addressbook/model/addressbook/UserAddressbook.java

index 26a60b1df8d2eb5d49380a8844d5bff52e4c721c..9b03baa7c33c9a5271140532da4bd6b6a7c5d42a 100644 (file)
@@ -17,6 +17,9 @@
 package org.mxchange.addressbook.model.addressbook;
 
 import java.io.Serializable;
+import java.util.Calendar;
+import org.mxchange.addressbook.model.addressbook.status.AddressbokStatus;
+import org.mxchange.jusercore.model.user.User;
 
 /**
  * A POJI for addressbooks
@@ -39,4 +42,59 @@ public interface Addressbook extends Serializable {
         */
        public void setAddressbookId (final Long addressbookId);
 
+       /**
+        * Getter for addressbook creation timestamp
+        * <p>
+        * @return Addressbook creation timestamp
+        */
+       public Calendar getAddressbookCreated ();
+
+       /**
+        * Setter for addressbook creation timestamp
+        * <p>
+        * @param addressbookCreated Addressbook creation timestamp
+        */
+       public void setAddressbookCreated (final Calendar addressbookCreated);
+
+       /**
+        * Getter for addressbook's name
+        * <p>
+        * @return Addressbook's name
+        */
+       public String getAddressbookName ();
+
+       /**
+        * Setter for addressbook's name
+        * <p>
+        * @param addressbookName Addressbook's name
+        */
+       public void setAddressbookName (final String addressbookName);
+
+       /**
+        * Getter for addressbook status
+        * <p>
+        * @return Addressbook status
+        */
+       public AddressbokStatus getAddressbookStatus ();
+
+       /**
+        * Setter for addressbook status
+        * <p>
+        * @param addressbookStatus Addressbook status
+        */
+       public void setAddressbookStatus (final AddressbokStatus addressbookStatus);
+
+       /**
+        * Getter for addressbook's user (owner)
+        * <p>
+        * @return Addressbook's user (owner)
+        */
+       public User getAddressbookUser ();
+
+       /**
+        * Setter for addressbook's user (owner)
+        * <p>
+        * @param addressbookUser Addressbook's user (owner)
+        */
+       public void setAddressbookUser (final User addressbookUser);
 }
index d0806bd6cc22b714fe456b338f9d9e500e9c0cda..b8f3c43e86ba7a1acadefa3829e0a196f4c43bc1 100644 (file)
@@ -17,7 +17,9 @@
 package org.mxchange.addressbook.model.addressbook;
 
 import java.io.Serializable;
+import java.util.List;
 import javax.ejb.Remote;
+import org.mxchange.jusercore.model.user.User;
 
 /**
  * A remote session interface for addressbook handling
@@ -26,4 +28,12 @@ import javax.ejb.Remote;
  */
 @Remote
 public interface AddressbookSessionBeanRemote extends Serializable {
+
+       /**
+        * Some "getter" for a list of address books the logged-in user has created
+        * <p>
+        * @param loggedInUser Logged-in user
+        * @return List of all address books
+        */
+       public List<Addressbook> getUsersList (final User loggedInUser);
 }
index b2d8ee4e36e4fbd0eba91e3aaf1cfde9520909e4..730e9498cace4a02aefcdbf49cb17ce4e060726b 100644 (file)
@@ -27,6 +27,8 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
@@ -42,6 +44,11 @@ import org.mxchange.jusercore.model.user.User;
  */
 @Entity (name = "addressbooks")
 @Table (name = "addressbooks")
+@NamedQueries (
+               {
+                       @NamedQuery (name = "AllUsersAddressbooks", query = "SELECT a FROM addressbooks AS a WHERE a.addressbookUser = :param ORDER BY a.addressbookId ASC")
+               }
+)
 public class UserAddressbook implements Addressbook, Comparable<Addressbook> {
 
        /**
@@ -92,6 +99,16 @@ public class UserAddressbook implements Addressbook, Comparable<Addressbook> {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public Calendar getAddressbookCreated () {
+               return this.addressbookCreated;
+       }
+
+       @Override
+       public void setAddressbookCreated (final Calendar addressbookCreated) {
+               this.addressbookCreated = addressbookCreated;
+       }
+
        @Override
        public Long getAddressbookId () {
                return this.addressbookId;
@@ -102,4 +119,33 @@ public class UserAddressbook implements Addressbook, Comparable<Addressbook> {
                this.addressbookId = addressbookId;
        }
 
+       @Override
+       public String getAddressbookName () {
+               return this.addressbookName;
+       }
+
+       @Override
+       public void setAddressbookName (final String addressbookName) {
+               this.addressbookName = addressbookName;
+       }
+
+       @Override
+       public AddressbokStatus getAddressbookStatus () {
+               return this.addressbookStatus;
+       }
+
+       @Override
+       public void setAddressbookStatus (final AddressbokStatus addressbookStatus) {
+               this.addressbookStatus = addressbookStatus;
+       }
+
+       @Override
+       public User getAddressbookUser () {
+               return this.addressbookUser;
+       }
+
+       @Override
+       public void setAddressbookUser (final User addressbookUser) {
+               this.addressbookUser = addressbookUser;
+       }
 }