]> git.mxchange.org Git - jaddressbook-share-core.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Mon, 9 May 2016 09:36:52 +0000 (11:36 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 9 May 2016 09:36:52 +0000 (11:36 +0200)
- used interface for target entities
- added missing annotations (as these warnings are not being fixed)

src/org/mxchange/jaddressbookcore/model/addressbook/UserAddressbook.java
src/org/mxchange/jaddressbookcore/model/addressbook/entry/UserAddressbookEntry.java
src/org/mxchange/jaddressbookcore/model/addressbook/shared/AddressbookShare.java

index 766ceaa0d1504dcb68aa99dcf1e20d1b72fff20a..d765b2e8cf9f46a51a046aaf5ab246250dd5b2ca 100644 (file)
@@ -36,7 +36,6 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import org.mxchange.jaddressbookcore.model.addressbook.status.AddressbokStatus;
-import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
 
 /**
@@ -109,7 +108,7 @@ public class UserAddressbook implements Addressbook {
         * Connection to "users" table
         */
        @JoinColumn (name = "addressbook_user_id", nullable = false)
-       @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
+       @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false)
        private User addressbookUser;
 
        /**
index 73a51f00b350df3e4b918b358b3e8eaa23c23b14..aa005448522233b5cb7ca89bf5785545d820b799 100644 (file)
@@ -32,12 +32,9 @@ import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
+import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
 import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.contact.UserContact;
 import org.mxchange.jcontactsbusiness.BusinessContact;
-import org.mxchange.jcontactsbusiness.CompanyContact;
-import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
-import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook;
 
 /**
  * A POJO for address book entries
@@ -51,6 +48,7 @@ import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook;
                                name = "SearchUsersAddressbookEntries",
                                query = "SELECT e FROM addressbook_entries AS e INNER JOIN addressbooks AS a ON e.addressbookId = a WHERE e.addressbookId = :addressbook AND a.addressbookUser = :owner ORDER BY e.addressbookEntryId ASC")
 )
+@SuppressWarnings ("PersistenceUnitPresent")
 public class UserAddressbookEntry implements AddressbookEntry {
 
        /**
@@ -62,7 +60,7 @@ public class UserAddressbookEntry implements AddressbookEntry {
         * Connection to table "business_contacts" (commercial contacts)
         */
        @JoinColumn (name = "entry_business_contact_id", updatable = false)
-       @OneToOne (targetEntity = CompanyContact.class, cascade = CascadeType.REFRESH)
+       @OneToOne (targetEntity = BusinessContact.class, cascade = CascadeType.REFRESH)
        private BusinessContact addressbookEntryBusinessContact;
 
        /**
@@ -85,14 +83,14 @@ public class UserAddressbookEntry implements AddressbookEntry {
         * Connection to table "contacts" (private contacts)
         */
        @JoinColumn (name = "entry_private_contact_id", updatable = false)
-       @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH)
+       @OneToOne (targetEntity = Contact.class, cascade = CascadeType.REFRESH)
        private Contact addressbookEntryPrivateContact;
 
        /**
         * Connection to table "addressbooks"
         */
        @JoinColumn (name = "entry_addressbook_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = UserAddressbook.class, cascade = CascadeType.REFRESH, optional = false)
+       @OneToOne (targetEntity = Addressbook.class, cascade = CascadeType.REFRESH, optional = false)
        private Addressbook addressbookId;
 
        @Override
@@ -119,9 +117,11 @@ public class UserAddressbookEntry implements AddressbookEntry {
        @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;
        }
 
@@ -136,11 +136,13 @@ public class UserAddressbookEntry implements AddressbookEntry {
        }
 
        @Override
+       @SuppressWarnings ("ReturnOfDateField")
        public Calendar getAddressbookEntryCreated () {
                return this.addressbookEntryCreated;
        }
 
        @Override
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
        public void setAddressbookEntryCreated (final Calendar addressbookEntryCreated) {
                this.addressbookEntryCreated = addressbookEntryCreated;
        }
index 29536db23be0b0b3e3045e65c924d5558ff3cc6f..f42eb9a8b47fbc6a243bed21344dad7c52f80d8f 100644 (file)
@@ -35,7 +35,6 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import org.mxchange.jaddressbookcore.model.addressbook.Addressbook;
 import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook;
-import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
 
 /**
@@ -91,14 +90,14 @@ public class AddressbookShare implements ShareableAddressbook {
         * User who is owning the share
         */
        @JoinColumn (name = "share_owner_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
+       @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false)
        private User shareUserOwner;
 
        /**
         * User the address book is shared with
         */
        @JoinColumn (name = "share_sharee_id", nullable = false, updatable = false)
-       @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
+       @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false)
        private User shareUserSharee;
 
        /**