]> git.mxchange.org Git - addressbook-lib.git/blobdiff - src/org/mxchange/addressbook/model/addressbook/shared/AddressbookShare.java
resorted members + added this.
[addressbook-lib.git] / src / org / mxchange / addressbook / model / addressbook / shared / AddressbookShare.java
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;
-       }
 }