From: Roland Haeder Date: Fri, 9 Oct 2015 12:20:26 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=68b81ac2a90af4ca3733bc6148eca4c62018fc37;p=jfinancials-lib.git Continued: - added persistence jar - added juser-core - added POJO/POJIs for address book handling - added remote interface for address book handling - removed mindmap as it should only stay in one place (better in main project) - updated jars Signed-off-by:Roland Häder --- diff --git a/docs/mindmaps/Addressbook Application.mm b/docs/mindmaps/Addressbook Application.mm deleted file mode 100644 index 677e988..0000000 --- a/docs/mindmaps/Addressbook Application.mm +++ /dev/null @@ -1,681 +0,0 @@ - - - - - - - - - -

- Addressbook Application -

-

- Version: 1.0 -

- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/lib/jcontacts-business-core.jar b/lib/jcontacts-business-core.jar index bf2dfa2..1d48fff 100644 Binary files a/lib/jcontacts-business-core.jar and b/lib/jcontacts-business-core.jar differ diff --git a/lib/jcore.jar b/lib/jcore.jar index b3bed2d..8385969 100644 Binary files a/lib/jcore.jar and b/lib/jcore.jar differ diff --git a/lib/jpa20-persistence/javax.persistence-2.1.0-doc.zip b/lib/jpa20-persistence/javax.persistence-2.1.0-doc.zip new file mode 100644 index 0000000..fd55e6e Binary files /dev/null and b/lib/jpa20-persistence/javax.persistence-2.1.0-doc.zip differ diff --git a/lib/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar b/lib/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar new file mode 100644 index 0000000..841d2e1 Binary files /dev/null and b/lib/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar differ diff --git a/lib/juser-core.jar b/lib/juser-core.jar new file mode 100644 index 0000000..0923bea Binary files /dev/null and b/lib/juser-core.jar differ diff --git a/nbproject/project.properties b/nbproject/project.properties index cd344ff..1d739ec 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -35,6 +35,7 @@ file.reference.jcontacts-core.jar=lib/jcontacts-core.jar file.reference.jcore-logger-lib.jar=lib/jcore-logger-lib.jar file.reference.jcore-swing.jar=lib/jcore-swing.jar file.reference.jcore.jar=lib/jcore.jar +file.reference.juser-core.jar=lib\\juser-core.jar includes=** jar.archive.disabled=${jnlp.enabled} jar.compress=false @@ -45,7 +46,9 @@ javac.classpath=\ ${file.reference.jcore-logger-lib.jar}:\ ${file.reference.jcontacts-core.jar}:\ ${file.reference.jcontacts-business-core.jar}:\ - ${libs.javaee-api-7.0.classpath} + ${file.reference.juser-core.jar}:\ + ${libs.javaee-api-7.0.classpath}:\ + ${libs.jpa20-persistence.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint:deprecation -Xlint:unchecked javac.deprecation=true @@ -99,5 +102,6 @@ source.reference.jcontacts-core.jar=../jcontacts-core/src/ source.reference.jcore-logger-lib.jar=../jcore-logger-lib/src/ source.reference.jcore-swing.jar=../jcore-swing/src source.reference.jcore.jar=../jcore/src +source.reference.juser-core.jar=../juser-core/src/ src.dir=src test.src.dir=test diff --git a/src/org/mxchange/addressbook/model/addressbook/Addressbook.java b/src/org/mxchange/addressbook/model/addressbook/Addressbook.java new file mode 100644 index 0000000..26a60b1 --- /dev/null +++ b/src/org/mxchange/addressbook/model/addressbook/Addressbook.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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.addressbook.model.addressbook; + +import java.io.Serializable; + +/** + * A POJI for addressbooks + *

+ * @author Roland Haeder + */ +public interface Addressbook extends Serializable { + + /** + * Getter for id number + *

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

+ * @param addressbookId Id number + */ + public void setAddressbookId (final Long addressbookId); + +} diff --git a/src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java b/src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java new file mode 100644 index 0000000..d0806bd --- /dev/null +++ b/src/org/mxchange/addressbook/model/addressbook/AddressbookSessionBeanRemote.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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.addressbook.model.addressbook; + +import java.io.Serializable; +import javax.ejb.Remote; + +/** + * A remote session interface for addressbook handling + *

+ * @author Roland Haeder + */ +@Remote +public interface AddressbookSessionBeanRemote extends Serializable { +} diff --git a/src/org/mxchange/addressbook/model/addressbook/UserAddressbook.java b/src/org/mxchange/addressbook/model/addressbook/UserAddressbook.java new file mode 100644 index 0000000..b2d8ee4 --- /dev/null +++ b/src/org/mxchange/addressbook/model/addressbook/UserAddressbook.java @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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.addressbook.model.addressbook; + +import java.util.Calendar; +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.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import org.mxchange.addressbook.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 Haeder + */ +@Entity (name = "addressbooks") +@Table (name = "addressbooks") +public class UserAddressbook implements Addressbook, Comparable { + + /** + * Serial number + */ + private static final long serialVersionUID = 176_573_148_678_169L; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "addressbook_id", length = 20, nullable = false, updatable = false) + private Long addressbookId; + + /** + * Connection to "users" table + */ + @JoinColumn (name = "addressbook_user_id", nullable = false) + @OneToOne (targetEntity = LoginUser.class, optional = false, cascade = CascadeType.ALL) + private User addressbookUser; + + /** + * When this address book has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "addressbook_created", nullable = false, updatable = false) + private Calendar addressbookCreated; + + /** + * Adress book status + */ + @Basic (optional = false) + @Enumerated (EnumType.STRING) + @Column (name = "addressbook_status", nullable = false, length = 10) + private AddressbokStatus addressbookStatus; + + /** + * Name for this address book + */ + @Basic (optional = false) + @Column (name = "addressbook_name", length = 50, nullable = false) + private String addressbookName; + + @Override + public int compareTo (final Addressbook addressbook) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public Long getAddressbookId () { + return this.addressbookId; + } + + @Override + public void setAddressbookId (final Long addressbookId) { + this.addressbookId = addressbookId; + } + +} diff --git a/src/org/mxchange/addressbook/model/addressbook/entry/AddressbookEntry.java b/src/org/mxchange/addressbook/model/addressbook/entry/AddressbookEntry.java new file mode 100644 index 0000000..6984d6f --- /dev/null +++ b/src/org/mxchange/addressbook/model/addressbook/entry/AddressbookEntry.java @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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.addressbook.model.addressbook.entry; + +import java.io.Serializable; +import java.util.Calendar; +import java.util.List; +import org.mxchange.addressbook.model.addressbook.Addressbook; +import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcontactsbusiness.BusinessContact; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJI for addressbook entries + *

+ * @author Roland Haeder + */ +public interface AddressbookEntry extends Serializable { + + /** + * Getter for id number + *

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

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

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

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

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

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

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

+ * @param addressbookEntryPrivateContact Private contact + */ + public void setAddressbookEntryPrivateContact (final Contact addressbookEntryPrivateContact); + + /** + * Getter for user who has added this entry to his/her addressbook + *

+ * @return User who has added this entry + */ + public List getAddressbookEntryUserAddedList (); + + /** + * Setter for user who has added this entry to his/her addressbook + *

+ * @param addressbookEntryUserAdded User who has added this entry + */ + public void setAddressbookEntryUserAddedList (final List addressbookEntryUserAdded); + + /** + * Getter for user who has initially created the address book entry + *

+ * @return User who has created initially this address book entry + */ + public List getAddressbookEntryUserOriginList (); + + /** + * Setter for user who has initially created the address book entry + *

+ * @param addressbookEntryUserOrigin User who has created initially this + * address book entry + */ + public void setAddressbookEntryUserOriginList (final List addressbookEntryUserOrigin); + + /** + * Getter for address book + *

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

+ * @param addressbookId Address book + */ + public void setAddressbookId (final Addressbook addressbookId); + +} diff --git a/src/org/mxchange/addressbook/model/addressbook/entry/UserAddressbookEntry.java b/src/org/mxchange/addressbook/model/addressbook/entry/UserAddressbookEntry.java new file mode 100644 index 0000000..a2d543d --- /dev/null +++ b/src/org/mxchange/addressbook/model/addressbook/entry/UserAddressbookEntry.java @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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.addressbook.model.addressbook.entry; + +import java.util.Calendar; +import java.util.List; +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.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import org.mxchange.addressbook.model.addressbook.Addressbook; +import org.mxchange.addressbook.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; +import org.mxchange.jusercore.model.user.LoginUser; +import org.mxchange.jusercore.model.user.User; + +/** + * A POJO for address book entries + *

+ * @author Roland Haeder + */ +@Entity (name = "addressbook_entries") +@Table (name = "addressbook_entries") +public class UserAddressbookEntry implements AddressbookEntry, Comparable { + + /** + * Serial number + */ + private static final long serialVersionUID = 178_581_768_581_960L; + + /** + * Id number + */ + @Id + @GeneratedValue (strategy = GenerationType.IDENTITY) + @Column (name = "addressbook_entry_id", nullable = false, updatable = false) + private Long addressbookEntryId; + + /** + * When this address book entry has been created + */ + @Basic (optional = false) + @Temporal (TemporalType.TIMESTAMP) + @Column (name = "addressbook_entry_created", nullable = false, updatable = false) + private Calendar addressbookEntryCreated; + + /** + * Connection to table "addressbooks" + */ + @JoinColumn (name = "addressbook_id", nullable = false, updatable = false) + @OneToOne (targetEntity = UserAddressbook.class, optional = false, cascade = CascadeType.ALL) + private Addressbook addressbookId; + + /** + * Connection to table "users" (who has initially created this entry + */ + @JoinColumn (name = "addressbook_entry_origin_user_id", nullable = false, updatable = false) + @ManyToOne (targetEntity = LoginUser.class, optional = false, cascade = CascadeType.ALL) + private List addressbookEntryUserOriginList; + + /** + * Connection to table "users" (who has added this entry) + */ + @JoinColumn (name = "addressbook_entry_added_user_id", updatable = false) + @OneToMany (targetEntity = LoginUser.class, cascade = CascadeType.ALL) + private List addressbookEntryUserAddedList; + + /** + * Connection to table "contacts" (private contacts) + */ + @JoinColumn (name = "addressbook_entry_private_contact_id", updatable = false) + @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL) + private Contact addressbookEntryPrivateContact; + + /** + * Connection to table "business_contacts" (commercial contacts) + */ + @JoinColumn (name = "addressbook_entry_business_contact_id", updatable = false) + @OneToOne (targetEntity = CompanyContact.class, cascade = CascadeType.ALL) + private BusinessContact addressbookEntryBusinessContact; + + @Override + public int compareTo (final AddressbookEntry addressbookEntry) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public BusinessContact getAddressbookEntryBusinessContact () { + return this.addressbookEntryBusinessContact; + } + + @Override + public void setAddressbookEntryBusinessContact (final BusinessContact addressbookEntryBusinessContact) { + this.addressbookEntryBusinessContact = addressbookEntryBusinessContact; + } + + @Override + public Calendar getAddressbookEntryCreated () { + return this.addressbookEntryCreated; + } + + @Override + 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 List getAddressbookEntryUserAddedList () { + return this.addressbookEntryUserAddedList; + } + + @Override + public void setAddressbookEntryUserAddedList (final List addressbookEntryUserAddedList) { + this.addressbookEntryUserAddedList = addressbookEntryUserAddedList; + } + + @Override + public List getAddressbookEntryUserOriginList () { + return this.addressbookEntryUserOriginList; + } + + @Override + public void setAddressbookEntryUserOriginList (final List addressbookEntryUserOriginList) { + this.addressbookEntryUserOriginList = addressbookEntryUserOriginList; + } + + @Override + public Addressbook getAddressbookId () { + return this.addressbookId; + } + + @Override + public void setAddressbookId (final Addressbook addressbookId) { + this.addressbookId = addressbookId; + } + +} diff --git a/src/org/mxchange/addressbook/model/addressbook/status/AddressbokStatus.java b/src/org/mxchange/addressbook/model/addressbook/status/AddressbokStatus.java new file mode 100644 index 0000000..14be56f --- /dev/null +++ b/src/org/mxchange/addressbook/model/addressbook/status/AddressbokStatus.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * 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.addressbook.model.addressbook.status; + +import java.io.Serializable; + +/** + * An enum for the addressbook status + *

+ * @author Roland Haeder + */ +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/addressbook/model/addressbooks/AddressbookSessionBeanRemote.java b/src/org/mxchange/addressbook/model/addressbooks/AddressbookSessionBeanRemote.java deleted file mode 100644 index 93e6bb3..0000000 --- a/src/org/mxchange/addressbook/model/addressbooks/AddressbookSessionBeanRemote.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2015 Roland Haeder - * - * 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.addressbook.model.addressbooks; - -import java.io.Serializable; -import javax.ejb.Remote; - -/** - * A remote session interface for addressbook handling - *

- * @author Roland Haeder - */ -@Remote -public interface AddressbookSessionBeanRemote extends Serializable { -}