]> git.mxchange.org Git - jaddressbook-share-lib.git/commitdiff
resorted members + added this.
authorRoland Haeder <roland@mxchange.org>
Sat, 20 Feb 2016 20:16:43 +0000 (21:16 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 20 Feb 2016 20:16:43 +0000 (21:16 +0100)
src/org/mxchange/addressbook/model/addressbook/UserAddressbook.java
src/org/mxchange/addressbook/model/addressbook/entry/UserAddressbookEntry.java
src/org/mxchange/addressbook/model/addressbook/shared/AddressbookShare.java

index ff3dbfd6c392312b13f46c41aca807bbf1f2a981..80d72641bc8475a1f1dc5a26846a45559caa4806 100644 (file)
@@ -76,6 +76,20 @@ public class UserAddressbook implements Addressbook, Comparable<Addressbook> {
        @Column (name = "addressbook_id", length = 20, nullable = false, updatable = false)
        private Long addressbookId;
 
+       /**
+        * Last locked timestamp
+        */
+       @Temporal (TemporalType.TIMESTAMP)
+       @Column (name = "addressbook_last_locked")
+       private Calendar addressbookLastLocked;
+
+       /**
+        * Last locked timestamp
+        */
+       @Lob
+       @Column (name = "addressbook_last_locked_reason")
+       private String addressbookLastLockedReason;
+
        /**
         * Name for this address book
         */
@@ -98,20 +112,6 @@ public class UserAddressbook implements Addressbook, Comparable<Addressbook> {
        @OneToOne (targetEntity = LoginUser.class, optional = false, cascade = CascadeType.MERGE)
        private User addressbookUser;
 
-       /**
-        * Last locked timestamp
-        */
-       @Temporal (TemporalType.TIMESTAMP)
-       @Column (name = "addressbook_last_locked")
-       private Calendar addressbookLastLocked;
-
-       /**
-        * Last locked timestamp
-        */
-       @Lob
-       @Column (name = "addressbook_last_locked_reason")
-       private String addressbookLastLockedReason;
-
        /**
         * Public constructor with address book name
         * <p>
@@ -137,6 +137,38 @@ public class UserAddressbook implements Addressbook, Comparable<Addressbook> {
                this.addressbookStatus = AddressbokStatus.UNLOCKED;
        }
 
+       @Override
+       public int compareTo (final Addressbook addressbook) {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (this.getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final Addressbook other = (Addressbook) object;
+
+               if (!Objects.equals(this.getAddressbookName(), other.getAddressbookName())) {
+                       return false;
+               } else if (!Objects.equals(this.getAddressbookUser(), other.getAddressbookUser())) {
+                       return false;
+               }
+
+               return true;
+       }
+
+       @Override
+       public int hashCode () {
+               int hash = 7;
+               hash = 59 * hash + Objects.hashCode(this.getAddressbookName());
+               hash = 59 * hash + Objects.hashCode(this.getAddressbookUser());
+               return hash;
+       }
+
        @Override
        public Calendar getAddressbookCreated () {
                return this.addressbookCreated;
@@ -207,35 +239,4 @@ public class UserAddressbook implements Addressbook, Comparable<Addressbook> {
                this.addressbookUser = addressbookUser;
        }
 
-       @Override
-       public int compareTo (final Addressbook addressbook) {
-               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-       }
-
-       @Override
-       public boolean equals (final Object object) {
-               if (object == null) {
-                       return false;
-               } else if (getClass() != object.getClass()) {
-                       return false;
-               }
-
-               final Addressbook other = (Addressbook) object;
-
-               if (!Objects.equals(this.getAddressbookName(), other.getAddressbookName())) {
-                       return false;
-               } else if (!Objects.equals(this.getAddressbookUser(), other.getAddressbookUser())) {
-                       return false;
-               }
-
-               return true;
-       }
-
-       @Override
-       public int hashCode () {
-               int hash = 7;
-               hash = 59 * hash + Objects.hashCode(this.getAddressbookName());
-               hash = 59 * hash + Objects.hashCode(this.getAddressbookUser());
-               return hash;
-       }
 }
index e9a8072ef9fc5b5ab6aaaf13770107ab1f8146a7..b26cb31c59378b71001ea766480156be548cc388 100644 (file)
@@ -104,7 +104,7 @@ public class UserAddressbookEntry implements AddressbookEntry, Comparable<Addres
        public boolean equals (final Object object) {
                if (object == null) {
                        return false;
-               } else if (getClass() != object.getClass()) {
+               } else if (this.getClass() != object.getClass()) {
                        return false;
                }
 
@@ -121,6 +121,15 @@ public class UserAddressbookEntry implements AddressbookEntry, Comparable<Addres
                return true;
        }
 
+       @Override
+       public int hashCode () {
+               int hash = 3;
+               hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryBusinessContact());
+               hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryPrivateContact());
+               hash = 19 * hash + Objects.hashCode(this.getAddressbookId());
+               return hash;
+       }
+
        @Override
        public BusinessContact getAddressbookEntryBusinessContact () {
                return this.addressbookEntryBusinessContact;
@@ -171,13 +180,4 @@ public class UserAddressbookEntry implements AddressbookEntry, Comparable<Addres
                this.addressbookId = addressbookId;
        }
 
-       @Override
-       public int hashCode () {
-               int hash = 3;
-               hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryBusinessContact());
-               hash = 19 * hash + Objects.hashCode(this.getAddressbookEntryPrivateContact());
-               hash = 19 * hash + Objects.hashCode(this.getAddressbookId());
-               return hash;
-       }
-
 }
index 450c8a64a08ca2dfb665db068e666de1c92749eb..33c02920d5481ef185aa600ec0ec7f8db6f0aa7d 100644 (file)
@@ -65,6 +65,21 @@ public class AddressbookShare implements ShareableAddressbook, Comparable<Sharea
         */
        private static final long serialVersionUID = 167_889_678_177_691_690L;
 
+       /**
+        * Address book this share is for
+        */
+       @JoinColumn (name = "share_addressbook_id", nullable = false, updatable = false)
+       @OneToOne (targetEntity = UserAddressbook.class, cascade = CascadeType.MERGE, optional = false)
+       private Addressbook shareAddressbook;
+
+       /**
+        * When this share has been created
+        */
+       @Basic (optional = false)
+       @Temporal (TemporalType.TIMESTAMP)
+       @Column (name = "share_created", nullable = false, updatable = false)
+       private Calendar shareCreated;
+
        /**
         * Id number
         */
@@ -73,13 +88,6 @@ public class AddressbookShare implements ShareableAddressbook, Comparable<Sharea
        @Column (name = "share_id", length = 20, nullable = false, updatable = false)
        private Long shareId;
 
-       /**
-        * Address book this share is for
-        */
-       @JoinColumn (name = "share_addressbook_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = UserAddressbook.class, cascade = CascadeType.MERGE, optional = false)
-       private Addressbook shareAddressbook;
-
        /**
         * User who is owning the share
         */
@@ -94,20 +102,6 @@ public class AddressbookShare implements ShareableAddressbook, Comparable<Sharea
        @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.MERGE, optional = false)
        private User shareUserSharee;
 
-       /**
-        * When this share has been created
-        */
-       @Basic (optional = false)
-       @Temporal (TemporalType.TIMESTAMP)
-       @Column (name = "share_created", nullable = false, updatable = false)
-       private Calendar shareCreated;
-
-       /**
-        * Default constructor for entity manager
-        */
-       protected AddressbookShare () {
-       }
-
        /**
         * Constructor with address book and sharee instance. Both parameters must
         * not be null, their id numbers must be set and the adress book's user
@@ -151,6 +145,12 @@ public class AddressbookShare implements ShareableAddressbook, Comparable<Sharea
                this.shareCreated = new GregorianCalendar();
        }
 
+       /**
+        * Default constructor for entity manager
+        */
+       protected AddressbookShare () {
+       }
+
        @Override
        public int compareTo (final ShareableAddressbook share) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
@@ -160,7 +160,7 @@ public class AddressbookShare implements ShareableAddressbook, Comparable<Sharea
        public boolean equals (final Object object) {
                if (object == null) {
                        return false;
-               } else if (getClass() != object.getClass()) {
+               } else if (this.getClass() != object.getClass()) {
                        return false;
                }
 
@@ -177,6 +177,15 @@ public class AddressbookShare implements ShareableAddressbook, Comparable<Sharea
                return Objects.equals(this.getShareUserSharee(), other.getShareUserSharee());
        }
 
+       @Override
+       public int hashCode () {
+               int hash = 7;
+               hash = 19 * hash + Objects.hashCode(this.getShareAddressbook());
+               hash = 19 * hash + Objects.hashCode(this.getShareUserOwner());
+               hash = 19 * hash + Objects.hashCode(this.getShareUserSharee());
+               return hash;
+       }
+
        @Override
        public Addressbook getShareAddressbook () {
                return this.shareAddressbook;
@@ -227,12 +236,4 @@ public class AddressbookShare implements ShareableAddressbook, Comparable<Sharea
                this.shareUserSharee = shareUserSharee;
        }
 
-       @Override
-       public int hashCode () {
-               int hash = 7;
-               hash = 19 * hash + Objects.hashCode(this.getShareAddressbook());
-               hash = 19 * hash + Objects.hashCode(this.getShareUserOwner());
-               hash = 19 * hash + Objects.hashCode(this.getShareUserSharee());
-               return hash;
-       }
 }