From 8ebe9439ad91fc870c37651f3e17085c146d3903 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 27 Apr 2017 14:27:04 +0200 Subject: [PATCH] this has been moved out from jaddressbook-core MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- build.xml | 6 +- nbproject/build-impl.xml | 10 +- nbproject/project.properties | 9 +- nbproject/project.xml | 2 +- .../addressbook/AddressbookLoadedEvent.java | 51 ---- .../ObservableAddressbookLoadedEvent.java | 35 --- .../AddressbookNameAlreadyUsedException.java | 43 ---- .../AddressbookNotFoundException.java | 43 ---- .../model/addressbook/Addressbook.java | 135 ---------- .../model/addressbook/UserAddressbook.java | 238 ------------------ .../addressbook/entry/AddressbookEntry.java | 108 -------- .../entry/UserAddressbookEntry.java | 185 -------------- .../addressbook/status/AddressbokStatus.java | 61 ----- .../sharing/EndedAddressbookSharingEvent.java | 6 +- .../ObservableAddressbookSharingEvent.java | 6 +- .../StartedAddressbookSharingEvent.java | 6 +- .../events/sharing/type/SharingType.java | 2 +- ...serAlreadySharingAddressbookException.java | 4 +- .../addressbook/shared/AddressbookShare.java | 6 +- .../shared/ShareableAddressbook.java | 4 +- 20 files changed, 32 insertions(+), 928 deletions(-) delete mode 100644 src/org/mxchange/jaddressbookcore/events/addressbook/AddressbookLoadedEvent.java delete mode 100644 src/org/mxchange/jaddressbookcore/events/addressbook/ObservableAddressbookLoadedEvent.java delete mode 100644 src/org/mxchange/jaddressbookcore/exceptions/AddressbookNameAlreadyUsedException.java delete mode 100644 src/org/mxchange/jaddressbookcore/exceptions/AddressbookNotFoundException.java delete mode 100644 src/org/mxchange/jaddressbookcore/model/addressbook/Addressbook.java delete mode 100644 src/org/mxchange/jaddressbookcore/model/addressbook/UserAddressbook.java delete mode 100644 src/org/mxchange/jaddressbookcore/model/addressbook/entry/AddressbookEntry.java delete mode 100644 src/org/mxchange/jaddressbookcore/model/addressbook/entry/UserAddressbookEntry.java delete mode 100644 src/org/mxchange/jaddressbookcore/model/addressbook/status/AddressbokStatus.java rename src/org/mxchange/{jaddressbookcore => jaddressbookshare}/events/sharing/EndedAddressbookSharingEvent.java (87%) rename src/org/mxchange/{jaddressbookcore => jaddressbookshare}/events/sharing/ObservableAddressbookSharingEvent.java (84%) rename src/org/mxchange/{jaddressbookcore => jaddressbookshare}/events/sharing/StartedAddressbookSharingEvent.java (87%) rename src/org/mxchange/{jaddressbookcore => jaddressbookshare}/events/sharing/type/SharingType.java (93%) rename src/org/mxchange/{jaddressbookcore => jaddressbookshare}/exceptions/UserAlreadySharingAddressbookException.java (93%) rename src/org/mxchange/{jaddressbookcore => jaddressbookshare}/model/addressbook/shared/AddressbookShare.java (97%) rename src/org/mxchange/{jaddressbookcore => jaddressbookshare}/model/addressbook/shared/ShareableAddressbook.java (94%) diff --git a/build.xml b/build.xml index 69c0ac1..6748516 100644 --- a/build.xml +++ b/build.xml @@ -7,8 +7,8 @@ - - Builds, tests, and runs the project jaddressbook-core. + + Builds, tests, and runs the project jaddressbook-share-core. - + @@ -474,7 +474,7 @@ is divided into following sections: - + @@ -625,7 +625,7 @@ is divided into following sections: - + @@ -917,7 +917,7 @@ is divided into following sections: - + @@ -1402,7 +1402,7 @@ is divided into following sections: - + diff --git a/nbproject/project.properties b/nbproject/project.properties index 413a0d3..b7f0a3c 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -3,7 +3,7 @@ annotation.processing.enabled.in.editor=true annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=jaddressbook-core +application.title=jaddressbook-share-core application.vendor=Roland H\u00e4der auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml build.classes.dir=${build.dir}/classes @@ -26,10 +26,11 @@ debug.test.classpath=\ dist.archive.excludes= # This directory is removed when the project is cleaned: dist.dir=dist -dist.jar=${dist.dir}/jaddressbook-core.jar +dist.jar=${dist.dir}/jaddressbook-share-core.jar dist.javadoc.dir=${dist.dir}/javadoc endorsed.classpath= excludes= +file.reference.jaddressbook-core.jar=lib/jaddressbook-core.jar file.reference.jcontacts-business-core.jar=lib/jcontacts-business-core.jar file.reference.jcontacts-core.jar=lib/jcontacts-core.jar file.reference.juser-core.jar=lib/juser-core.jar @@ -41,6 +42,7 @@ javac.classpath=\ ${file.reference.juser-core.jar}:\ ${file.reference.jcontacts-core.jar}:\ ${file.reference.jcontacts-business-core.jar}:\ + ${file.reference.jaddressbook-core.jar}:\ ${libs.jpa20-persistence.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked -Xlint:deprecation @@ -65,7 +67,7 @@ javadoc.private=true javadoc.splitindex=true javadoc.use=true javadoc.version=true -javadoc.windowtitle=JAddressbookCore +javadoc.windowtitle=Addressbook-Share Model jnlp.codebase.type=no.codebase jnlp.descriptor=application jnlp.enabled=false @@ -98,6 +100,7 @@ run.test.classpath=\ ${javac.test.classpath}:\ ${build.test.classes.dir} source.encoding=UTF-8 +source.reference.jaddressbook-core.jar=../jaddressbook-core/src/ source.reference.jcontacts-business-core.jar=../jcontacts-business-core/src/ source.reference.jcontacts-core.jar=../jcontacts-core/src/ source.reference.juser-core.jar=../juser-core/src/ diff --git a/nbproject/project.xml b/nbproject/project.xml index 7d531d5..2270728 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -3,7 +3,7 @@ org.netbeans.modules.java.j2seproject - jaddressbook-core + jaddressbook-share-core diff --git a/src/org/mxchange/jaddressbookcore/events/addressbook/AddressbookLoadedEvent.java b/src/org/mxchange/jaddressbookcore/events/addressbook/AddressbookLoadedEvent.java deleted file mode 100644 index 93438f7..0000000 --- a/src/org/mxchange/jaddressbookcore/events/addressbook/AddressbookLoadedEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jaddressbookcore.events.addressbook; - -import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; - -/** - * An event fired when an address book has been loaded - *

- * @author Roland Häder - */ -public class AddressbookLoadedEvent implements ObservableAddressbookLoadedEvent { - - /** - * Serial number - */ - private static final long serialVersionUID = 48_305_823_537_427_713L; - - /** - * Adress book instance causing this event - */ - private final Addressbook addressbook; - - /** - * Constructor with address book instance - *

- * @param addressbook Address book instance - */ - public AddressbookLoadedEvent (final Addressbook addressbook) { - this.addressbook = addressbook; - } - - @Override - public Addressbook getAddressbook () { - return this.addressbook; - } -} diff --git a/src/org/mxchange/jaddressbookcore/events/addressbook/ObservableAddressbookLoadedEvent.java b/src/org/mxchange/jaddressbookcore/events/addressbook/ObservableAddressbookLoadedEvent.java deleted file mode 100644 index 292d28b..0000000 --- a/src/org/mxchange/jaddressbookcore/events/addressbook/ObservableAddressbookLoadedEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jaddressbookcore.events.addressbook; - -import java.io.Serializable; -import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; - -/** - * An interface for an event if an address book has been loaded - *

- * @author Roland Häder - */ -public interface ObservableAddressbookLoadedEvent extends Serializable { - - /** - * Getter for address book instance - *

- * @return Address book instance - */ - Addressbook getAddressbook (); -} diff --git a/src/org/mxchange/jaddressbookcore/exceptions/AddressbookNameAlreadyUsedException.java b/src/org/mxchange/jaddressbookcore/exceptions/AddressbookNameAlreadyUsedException.java deleted file mode 100644 index bc5cb3d..0000000 --- a/src/org/mxchange/jaddressbookcore/exceptions/AddressbookNameAlreadyUsedException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jaddressbookcore.exceptions; - -import java.text.MessageFormat; -import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; - -/** - * An exception thrown when the user has already used the name. - *

- * @author Roland Häder - */ -public class AddressbookNameAlreadyUsedException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 58_169_748_928_767_381L; - - /** - * Constructor with address book instance - *

- * @param addressbook Address book instance - */ - public AddressbookNameAlreadyUsedException (final Addressbook addressbook) { - super(MessageFormat.format("User {0} has already used the name {1}.", addressbook.getAddressbookUser(), addressbook.getAddressbookName())); //NOI18N - } - -} diff --git a/src/org/mxchange/jaddressbookcore/exceptions/AddressbookNotFoundException.java b/src/org/mxchange/jaddressbookcore/exceptions/AddressbookNotFoundException.java deleted file mode 100644 index 815a024..0000000 --- a/src/org/mxchange/jaddressbookcore/exceptions/AddressbookNotFoundException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jaddressbookcore.exceptions; - -import java.text.MessageFormat; - -/** - * An exception thrown when the address book's id number is not valid, so no - * address book can be found. - *

- * @author Roland Häder - */ -public class AddressbookNotFoundException extends Exception { - - /** - * Serial number - */ - private static final long serialVersionUID = 14_986_976_417_658_920L; - - /** - * Creates an exception with given id number that could not be found. - *

- * @param addressbookId Address book id number - */ - public AddressbookNotFoundException (final Long addressbookId) { - super(MessageFormat.format("Address book with id number {0} does not exist.", addressbookId)); - } - -} diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/Addressbook.java b/src/org/mxchange/jaddressbookcore/model/addressbook/Addressbook.java deleted file mode 100644 index e4312fa..0000000 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/Addressbook.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jaddressbookcore.model.addressbook; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jaddressbookcore.model.addressbook.status.AddressbokStatus; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJI for addressbooks - *

- * @author Roland Häder - */ -public interface Addressbook extends Serializable { - - /** - * Getter for id number - *

- * @return Id number - */ - Long getAddressbookId (); - - /** - * Setter for id number - *

- * @param addressbookId Id number - */ - void setAddressbookId (final Long addressbookId); - - /** - * Getter for addressbook creation timestamp - *

- * @return Addressbook creation timestamp - */ - Calendar getAddressbookCreated (); - - /** - * Setter for addressbook creation timestamp - *

- * @param addressbookCreated Addressbook creation timestamp - */ - void setAddressbookCreated (final Calendar addressbookCreated); - - /** - * Getter for addressbook's name - *

- * @return Addressbook's name - */ - String getAddressbookName (); - - /** - * Setter for addressbook's name - *

- * @param addressbookName Addressbook's name - */ - void setAddressbookName (final String addressbookName); - - /** - * Getter for addressbook status - *

- * @return Addressbook status - */ - AddressbokStatus getAddressbookStatus (); - - /** - * Setter for addressbook status - *

- * @param addressbookStatus Addressbook status - */ - void setAddressbookStatus (final AddressbokStatus addressbookStatus); - - /** - * Getter for addressbook's user (owner) - *

- * @return Addressbook's user (owner) - */ - User getAddressbookUser (); - - /** - * Setter for addressbook's user (owner) - *

- * @param addressbookUser Addressbook's user (owner) - */ - void setAddressbookUser (final User addressbookUser); - - /** - * Getter for last locked timestamp - *

- * @return Last locked timestamp - */ - Calendar getAddressbookLastLocked (); - - /** - * Setter for last locked timestamp - *

- * @param addressbookLastLocked Last locked timestamp - */ - void setAddressbookLastLocked (final Calendar addressbookLastLocked); - - /** - * Getter for last locked reason - *

- * @return Last locked reason - */ - String getAddressbookLastLockedReason (); - - /** - * Getter for last locked reason - *

- * @param addressbookLastLockedReason Last locked reason - */ - void setAddressbookLastLockedReason (final String addressbookLastLockedReason); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/UserAddressbook.java b/src/org/mxchange/jaddressbookcore/model/addressbook/UserAddressbook.java deleted file mode 100644 index 49f7b62..0000000 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/UserAddressbook.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jaddressbookcore.model.addressbook; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; -import javax.persistence.OneToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jaddressbookcore.model.addressbook.status.AddressbokStatus; -import org.mxchange.jusercore.model.user.LoginUser; -import org.mxchange.jusercore.model.user.User; - -/** - * A POJO for user addressbooks - *

- * @author Roland Häder - */ -@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"), - @NamedQuery (name = "SearchUserAddressbookName", query = "SELECT a FROM addressbooks AS a WHERE a.addressbookUser = :user AND LOWER(a.addressbookName) LIKE LOWER(:name)"), - @NamedQuery (name = "SearchAddressbookById", query = "SELECT a FROM addressbooks AS a WHERE a.addressbookId = :id") - } -) -@SuppressWarnings ("PersistenceUnitPresent") -public class UserAddressbook implements Addressbook { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 176_573_148_678_169L; - - /** - * When this address book has been created - */ - @Basic (optional = false) - @Temporal (value = TemporalType.TIMESTAMP) - @Column (name = "addressbook_created", nullable = false, updatable = false) - private Calendar addressbookCreated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "addressbook_id", 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 - */ - @Basic (optional = false) - @Column (name = "addressbook_name", length = 50, nullable = false) - private String addressbookName; - - /** - * Adress book status - */ - @Basic (optional = false) - @Enumerated (EnumType.STRING) - @Column (name = "addressbook_status", nullable = false, length = 10) - private AddressbokStatus addressbookStatus; - - /** - * Connection to "users" table - */ - @JoinColumn (name = "addressbook_user_id", nullable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) - private User addressbookUser; - - /** - * Public constructor with address book name - *

- * @param addressbookName Address book name - * @param addressbookUser User instance - */ - public UserAddressbook (final String addressbookName, final User addressbookUser) { - // Call default constructor - this(); - - // Set name and user instance - this.addressbookName = addressbookName; - this.addressbookUser = addressbookUser; - } - - /** - * Default constructor - */ - public UserAddressbook () { - // Set status to UNLOCKED - this.addressbookStatus = AddressbokStatus.UNLOCKED; - } - - @Override - public boolean equals (final Object object) { - if (null == object) { - 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; - } - - @Override - public void setAddressbookCreated (final Calendar addressbookCreated) { - this.addressbookCreated = addressbookCreated; - } - - @Override - public Long getAddressbookId () { - return this.addressbookId; - } - - @Override - public void setAddressbookId (final Long addressbookId) { - this.addressbookId = addressbookId; - } - - @Override - public Calendar getAddressbookLastLocked () { - return this.addressbookLastLocked; - } - - @Override - public void setAddressbookLastLocked (final Calendar addressbookLastLocked) { - this.addressbookLastLocked = addressbookLastLocked; - } - - @Override - public String getAddressbookLastLockedReason () { - return this.addressbookLastLockedReason; - } - - @Override - public void setAddressbookLastLockedReason (final String addressbookLastLockedReason) { - this.addressbookLastLockedReason = addressbookLastLockedReason; - } - - @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; - } - -} diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/entry/AddressbookEntry.java b/src/org/mxchange/jaddressbookcore/model/addressbook/entry/AddressbookEntry.java deleted file mode 100644 index 0927ed7..0000000 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/entry/AddressbookEntry.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jaddressbookcore.model.addressbook.entry; - -import java.io.Serializable; -import java.util.Calendar; -import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontactsbusiness.BusinessContact; - -/** - * A POJI for addressbook entries - *

- * @author Roland Häder - */ -public interface AddressbookEntry extends Serializable { - - /** - * Getter for id number - *

- * @return Id number - */ - Long getAddressbookEntryId (); - - /** - * Setter for id number - *

- * @param addressbookEntryId Id number - */ - void setAddressbookEntryId (final Long addressbookEntryId); - - /** - * Getter for business contact - *

- * @return Business contact - */ - BusinessContact getAddressbookEntryBusinessContact (); - - /** - * Setter for business contact - *

- * @param addressbookEntryBusinessContact Business contact - */ - void setAddressbookEntryBusinessContact (final BusinessContact addressbookEntryBusinessContact); - - /** - * Getter for entry created timestamp - *

- * @return Entry created timestamp - */ - Calendar getAddressbookEntryCreated (); - - /** - * Setter for entry created timestamp - *

- * @param addressbookEntryCreated Entry created timestamp - */ - void setAddressbookEntryCreated (final Calendar addressbookEntryCreated); - - /** - * Getter for private contact - *

- * @return Private contact - */ - Contact getAddressbookEntryPrivateContact (); - - /** - * Setter for private contact - *

- * @param addressbookEntryPrivateContact Private contact - */ - void setAddressbookEntryPrivateContact (final Contact addressbookEntryPrivateContact); - - /** - * Getter for address book - *

- * @return Address book - */ - Addressbook getAddressbookId (); - - /** - * Setter for address book - *

- * @param addressbookId Address book - */ - void setAddressbookId (final Addressbook addressbookId); - - @Override - boolean equals (final Object object); - - @Override - int hashCode (); - -} diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/entry/UserAddressbookEntry.java b/src/org/mxchange/jaddressbookcore/model/addressbook/entry/UserAddressbookEntry.java deleted file mode 100644 index 5007393..0000000 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/entry/UserAddressbookEntry.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jaddressbookcore.model.addressbook.entry; - -import java.util.Calendar; -import java.util.Objects; -import javax.persistence.Basic; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.Entity; -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; -import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; -import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.UserContact; -import org.mxchange.jcontactsbusiness.BusinessContact; -import org.mxchange.jcontactsbusiness.CompanyContact; - -/** - * A POJO for address book entries - *

- * @author Roland Häder - */ -@Entity (name = "addressbook_entries") -@Table (name = "addressbook_entries") -@NamedQueries ( - @NamedQuery ( - 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 { - - /** - * Serial number - */ - @Transient - private static final long serialVersionUID = 178_581_768_581_960L; - - /** - * Connection to table "business_contacts" (commercial contacts) - */ - @JoinColumn (name = "entry_business_contact_id", updatable = false) - @OneToOne (targetEntity = CompanyContact.class, cascade = CascadeType.REFRESH) - private BusinessContact addressbookEntryBusinessContact; - - /** - * When this address book entry has been created - */ - @Basic (optional = false) - @Temporal (TemporalType.TIMESTAMP) - @Column (name = "entry_created", nullable = false, updatable = false) - private Calendar addressbookEntryCreated; - - /** - * Id number - */ - @Id - @GeneratedValue (strategy = GenerationType.IDENTITY) - @Column (name = "entry_id", nullable = false, updatable = false) - private Long addressbookEntryId; - - /** - * Connection to table "contacts" (private contacts) - */ - @JoinColumn (name = "entry_private_contact_id", updatable = false) - @OneToOne (targetEntity = UserContact.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) - private Addressbook addressbookId; - - @Override - public boolean equals (final Object object) { - if (null == object) { - return false; - } else if (this.getClass() != object.getClass()) { - return false; - } - - final AddressbookEntry other = (AddressbookEntry) object; - - if (!Objects.equals(this.getAddressbookEntryBusinessContact(), other.getAddressbookEntryBusinessContact())) { - return false; - } else if (!Objects.equals(this.getAddressbookEntryPrivateContact(), other.getAddressbookEntryPrivateContact())) { - return false; - } else if (!Objects.equals(this.getAddressbookId(), other.getAddressbookId())) { - return false; - } - - 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; - } - - @Override - public void setAddressbookEntryBusinessContact (final BusinessContact addressbookEntryBusinessContact) { - this.addressbookEntryBusinessContact = addressbookEntryBusinessContact; - } - - @Override - @SuppressWarnings ("ReturnOfDateField") - public Calendar getAddressbookEntryCreated () { - return this.addressbookEntryCreated; - } - - @Override - @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setAddressbookEntryCreated (final Calendar addressbookEntryCreated) { - this.addressbookEntryCreated = addressbookEntryCreated; - } - - @Override - public Long getAddressbookEntryId () { - return this.addressbookEntryId; - } - - @Override - public void setAddressbookEntryId (final Long addressbookEntryId) { - this.addressbookEntryId = addressbookEntryId; - } - - @Override - public Contact getAddressbookEntryPrivateContact () { - return this.addressbookEntryPrivateContact; - } - - @Override - public void setAddressbookEntryPrivateContact (final Contact addressbookEntryPrivateContact) { - this.addressbookEntryPrivateContact = addressbookEntryPrivateContact; - } - - @Override - public Addressbook getAddressbookId () { - return this.addressbookId; - } - - @Override - public void setAddressbookId (final Addressbook addressbookId) { - this.addressbookId = addressbookId; - } - -} diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/status/AddressbokStatus.java b/src/org/mxchange/jaddressbookcore/model/addressbook/status/AddressbokStatus.java deleted file mode 100644 index 544ebe6..0000000 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/status/AddressbokStatus.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2016 Roland Häder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.mxchange.jaddressbookcore.model.addressbook.status; - -import java.io.Serializable; - -/** - * An enumeration for the addressbook status - *

- * @author Roland Häder - */ -public enum AddressbokStatus implements Serializable { - - /** - * When the addressbook is unlocked - */ - UNLOCKED("ADDRESSBOOK_STATUS_UNLOCKED"), //NOI18N - - /** - * When the addressbook is locked by administrator - */ - LOCKED("ADDRESSBOOK_STATUS_LOCKED"); //NOI18N - - /** - * Message key - */ - private final String messageKey; - - /** - * Constructor - *

- * @param messageKey Message key for this enum - */ - private AddressbokStatus (final String messageKey) { - this.messageKey = messageKey; - } - - /** - * Getter for message key - *

- * @return Message key - */ - public String getMessageKey () { - return this.messageKey; - } - -} diff --git a/src/org/mxchange/jaddressbookcore/events/sharing/EndedAddressbookSharingEvent.java b/src/org/mxchange/jaddressbookshare/events/sharing/EndedAddressbookSharingEvent.java similarity index 87% rename from src/org/mxchange/jaddressbookcore/events/sharing/EndedAddressbookSharingEvent.java rename to src/org/mxchange/jaddressbookshare/events/sharing/EndedAddressbookSharingEvent.java index 34876f9..19b2eb3 100644 --- a/src/org/mxchange/jaddressbookcore/events/sharing/EndedAddressbookSharingEvent.java +++ b/src/org/mxchange/jaddressbookshare/events/sharing/EndedAddressbookSharingEvent.java @@ -14,10 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jaddressbookcore.events.sharing; +package org.mxchange.jaddressbookshare.events.sharing; -import org.mxchange.jaddressbookcore.events.sharing.type.SharingType; -import org.mxchange.jaddressbookcore.model.addressbook.shared.ShareableAddressbook; +import org.mxchange.jaddressbookshare.events.sharing.type.SharingType; +import org.mxchange.jaddressbookshare.model.addressbook.shared.ShareableAddressbook; /** * An event fired when a user ends sharing address books diff --git a/src/org/mxchange/jaddressbookcore/events/sharing/ObservableAddressbookSharingEvent.java b/src/org/mxchange/jaddressbookshare/events/sharing/ObservableAddressbookSharingEvent.java similarity index 84% rename from src/org/mxchange/jaddressbookcore/events/sharing/ObservableAddressbookSharingEvent.java rename to src/org/mxchange/jaddressbookshare/events/sharing/ObservableAddressbookSharingEvent.java index 70eb008..6796045 100644 --- a/src/org/mxchange/jaddressbookcore/events/sharing/ObservableAddressbookSharingEvent.java +++ b/src/org/mxchange/jaddressbookshare/events/sharing/ObservableAddressbookSharingEvent.java @@ -14,11 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jaddressbookcore.events.sharing; +package org.mxchange.jaddressbookshare.events.sharing; import java.io.Serializable; -import org.mxchange.jaddressbookcore.events.sharing.type.SharingType; -import org.mxchange.jaddressbookcore.model.addressbook.shared.ShareableAddressbook; +import org.mxchange.jaddressbookshare.events.sharing.type.SharingType; +import org.mxchange.jaddressbookshare.model.addressbook.shared.ShareableAddressbook; /** * An interface for address book sharing events diff --git a/src/org/mxchange/jaddressbookcore/events/sharing/StartedAddressbookSharingEvent.java b/src/org/mxchange/jaddressbookshare/events/sharing/StartedAddressbookSharingEvent.java similarity index 87% rename from src/org/mxchange/jaddressbookcore/events/sharing/StartedAddressbookSharingEvent.java rename to src/org/mxchange/jaddressbookshare/events/sharing/StartedAddressbookSharingEvent.java index 709065f..16c9b60 100644 --- a/src/org/mxchange/jaddressbookcore/events/sharing/StartedAddressbookSharingEvent.java +++ b/src/org/mxchange/jaddressbookshare/events/sharing/StartedAddressbookSharingEvent.java @@ -14,10 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jaddressbookcore.events.sharing; +package org.mxchange.jaddressbookshare.events.sharing; -import org.mxchange.jaddressbookcore.events.sharing.type.SharingType; -import org.mxchange.jaddressbookcore.model.addressbook.shared.ShareableAddressbook; +import org.mxchange.jaddressbookshare.events.sharing.type.SharingType; +import org.mxchange.jaddressbookshare.model.addressbook.shared.ShareableAddressbook; /** * An event fired when a user starts sharing address books diff --git a/src/org/mxchange/jaddressbookcore/events/sharing/type/SharingType.java b/src/org/mxchange/jaddressbookshare/events/sharing/type/SharingType.java similarity index 93% rename from src/org/mxchange/jaddressbookcore/events/sharing/type/SharingType.java rename to src/org/mxchange/jaddressbookshare/events/sharing/type/SharingType.java index 81e21ff..51a5b93 100644 --- a/src/org/mxchange/jaddressbookcore/events/sharing/type/SharingType.java +++ b/src/org/mxchange/jaddressbookshare/events/sharing/type/SharingType.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jaddressbookcore.events.sharing.type; +package org.mxchange.jaddressbookshare.events.sharing.type; /** * An enumeration for sharing types diff --git a/src/org/mxchange/jaddressbookcore/exceptions/UserAlreadySharingAddressbookException.java b/src/org/mxchange/jaddressbookshare/exceptions/UserAlreadySharingAddressbookException.java similarity index 93% rename from src/org/mxchange/jaddressbookcore/exceptions/UserAlreadySharingAddressbookException.java rename to src/org/mxchange/jaddressbookshare/exceptions/UserAlreadySharingAddressbookException.java index 6031de3..d6bfe5a 100644 --- a/src/org/mxchange/jaddressbookcore/exceptions/UserAlreadySharingAddressbookException.java +++ b/src/org/mxchange/jaddressbookshare/exceptions/UserAlreadySharingAddressbookException.java @@ -14,10 +14,10 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jaddressbookcore.exceptions; +package org.mxchange.jaddressbookshare.exceptions; import java.text.MessageFormat; -import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; +import org.mxchange.jaddressbook.model.addressbook.Addressbook; import org.mxchange.jusercore.model.user.User; /** diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/shared/AddressbookShare.java b/src/org/mxchange/jaddressbookshare/model/addressbook/shared/AddressbookShare.java similarity index 97% rename from src/org/mxchange/jaddressbookcore/model/addressbook/shared/AddressbookShare.java rename to src/org/mxchange/jaddressbookshare/model/addressbook/shared/AddressbookShare.java index 7b379f3..b5b6f4e 100644 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/shared/AddressbookShare.java +++ b/src/org/mxchange/jaddressbookshare/model/addressbook/shared/AddressbookShare.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jaddressbookcore.model.addressbook.shared; +package org.mxchange.jaddressbookshare.model.addressbook.shared; import java.text.MessageFormat; import java.util.Calendar; @@ -34,8 +34,8 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; -import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; -import org.mxchange.jaddressbookcore.model.addressbook.UserAddressbook; +import org.mxchange.jaddressbook.model.addressbook.Addressbook; +import org.mxchange.jaddressbook.model.addressbook.UserAddressbook; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; diff --git a/src/org/mxchange/jaddressbookcore/model/addressbook/shared/ShareableAddressbook.java b/src/org/mxchange/jaddressbookshare/model/addressbook/shared/ShareableAddressbook.java similarity index 94% rename from src/org/mxchange/jaddressbookcore/model/addressbook/shared/ShareableAddressbook.java rename to src/org/mxchange/jaddressbookshare/model/addressbook/shared/ShareableAddressbook.java index b8f3855..1683e63 100644 --- a/src/org/mxchange/jaddressbookcore/model/addressbook/shared/ShareableAddressbook.java +++ b/src/org/mxchange/jaddressbookshare/model/addressbook/shared/ShareableAddressbook.java @@ -14,11 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jaddressbookcore.model.addressbook.shared; +package org.mxchange.jaddressbookshare.model.addressbook.shared; import java.io.Serializable; import java.util.Calendar; -import org.mxchange.jaddressbookcore.model.addressbook.Addressbook; +import org.mxchange.jaddressbook.model.addressbook.Addressbook; import org.mxchange.jusercore.model.user.User; /** -- 2.39.5