From: Roland Häder Date: Sun, 10 Sep 2017 14:43:25 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4185cb25b452d44836e46cbbc9e6fcb8e3744918;hp=bc8837a28baeea2d4081d67cfe549c02bc42f7a4;p=jcontacts-lib.git Continued: - also moved these remote interfaces to 'model' package Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jcontacts/contact/AdminContactSessionBeanRemote.java b/src/org/mxchange/jcontacts/contact/AdminContactSessionBeanRemote.java deleted file mode 100644 index 77d15ee..0000000 --- a/src/org/mxchange/jcontacts/contact/AdminContactSessionBeanRemote.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2016, 2017 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.jcontacts.contact; - -import java.io.Serializable; -import javax.ejb.Remote; -import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException; -import org.mxchange.jcontacts.exceptions.ContactNotFoundException; - -/** - * A remote interface for administrative contact purposes - *

- * @author Roland Häder - */ -@Remote -public interface AdminContactSessionBeanRemote extends Serializable { - - /** - * Deletes given contact instance - *

- * @param contact Contact instance being deleted - *

- * @throws ContactNotFoundException If the contact is not found - */ - void deleteContactData (final Contact contact) throws ContactNotFoundException; - - /** - * Adds (persists) given contact instance, if not found. If successfull, the - * field contactId contains the running number, otherwise an exception is - * thrown. - * - * @param contact Contact to be added - *

- * @return Updated contact instance - *

- * @throws org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException - * Contact already found - */ - Contact addContact (final Contact contact) throws ContactAlreadyAddedException; - -} diff --git a/src/org/mxchange/jcontacts/contact/ContactSessionBeanRemote.java b/src/org/mxchange/jcontacts/contact/ContactSessionBeanRemote.java deleted file mode 100644 index 6b815e0..0000000 --- a/src/org/mxchange/jcontacts/contact/ContactSessionBeanRemote.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2016, 2017 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.jcontacts.contact; - -import java.io.Serializable; -import java.util.List; -import javax.ejb.Remote; -import org.mxchange.jcontacts.exceptions.ContactNotFoundException; - -/** - * A remote interface for general contact purposes - *

- * @author Roland Häder - */ -@Remote -public interface ContactSessionBeanRemote extends Serializable { - - /** - * Checks whether the given email address is already registered. The email - * address should be validated by EmailAddressValidator before calling this - * method. - *

- * @param emailAddress Email address to check - *

- * @return Whether the email address is already registered - */ - boolean isEmailAddressRegistered (final String emailAddress); - - /** - * Checks if the given contact can be found by checking the whole list. - *

- * @param contact Contact instance to check - *

- * @return Whether the found instance or null - */ - Contact lookupContact (final Contact contact); - - /** - * Updates given contact data - *

- * @param contact Contact data to update - * @param isMobileUnlinked Whether a mobile entry has been unlinked in - * contact instance - * @param isLandlineUnlinked Whether a land-line entry has been unlinked in - * contact instance - * @param isFaxUnlinked Whether a fax entry has been unlinked in contact - * instance - *

- * @return Updated contact instance - */ - Contact updateContactData (final Contact contact, final boolean isMobileUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked); - - /** - * Updates given contact in database. Please note that the id number must be - * set. This method should also make sure that mobile, land-line and fix - * numbers are updated, too. - *

- * @param contact Contact to update - *

- * @return Updated contact instance - */ - Contact updateContactData (final Contact contact); - - /** - * Returns a list of all found contacts - *

- * @return A list of call contacts - */ - List allContacts (); - - /** - * Returns a list of all registered email addresses. - *

- * @return A list of all email addresses - */ - List allEmailAddresses (); - - /** - * Returns a contact instance which has the given id number. - *

- * @param contactId Contact id - *

- * @return Contact instance - *

- * @throws ContactNotFoundException If the contact was not found - */ - Contact findContactById (final Long contactId) throws ContactNotFoundException; - - /** - * Returns a contact instance which has the given email address. - *

- * @param emailAddress Email address - *

- * @return Contact instance - *

- * @throws ContactNotFoundException If the contact was not found - */ - Contact findContactByEmailAddress (final String emailAddress) throws ContactNotFoundException; - -} diff --git a/src/org/mxchange/jcontacts/model/contact/AdminContactSessionBeanRemote.java b/src/org/mxchange/jcontacts/model/contact/AdminContactSessionBeanRemote.java new file mode 100644 index 0000000..e02e2fe --- /dev/null +++ b/src/org/mxchange/jcontacts/model/contact/AdminContactSessionBeanRemote.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2016, 2017 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.jcontacts.model.contact; + +import org.mxchange.jcontacts.model.contact.Contact; +import java.io.Serializable; +import javax.ejb.Remote; +import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException; +import org.mxchange.jcontacts.exceptions.ContactNotFoundException; + +/** + * A remote interface for administrative contact purposes + *

+ * @author Roland Häder + */ +@Remote +public interface AdminContactSessionBeanRemote extends Serializable { + + /** + * Deletes given contact instance + *

+ * @param contact Contact instance being deleted + *

+ * @throws ContactNotFoundException If the contact is not found + */ + void deleteContactData (final Contact contact) throws ContactNotFoundException; + + /** + * Adds (persists) given contact instance, if not found. If successfull, the + * field contactId contains the running number, otherwise an exception is + * thrown. + * + * @param contact Contact to be added + *

+ * @return Updated contact instance + *

+ * @throws org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException + * Contact already found + */ + Contact addContact (final Contact contact) throws ContactAlreadyAddedException; + +} diff --git a/src/org/mxchange/jcontacts/model/contact/ContactSessionBeanRemote.java b/src/org/mxchange/jcontacts/model/contact/ContactSessionBeanRemote.java new file mode 100644 index 0000000..2410c60 --- /dev/null +++ b/src/org/mxchange/jcontacts/model/contact/ContactSessionBeanRemote.java @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2016, 2017 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.jcontacts.model.contact; + +import org.mxchange.jcontacts.model.contact.Contact; +import java.io.Serializable; +import java.util.List; +import javax.ejb.Remote; +import org.mxchange.jcontacts.exceptions.ContactNotFoundException; + +/** + * A remote interface for general contact purposes + *

+ * @author Roland Häder + */ +@Remote +public interface ContactSessionBeanRemote extends Serializable { + + /** + * Checks whether the given email address is already registered. The email + * address should be validated by EmailAddressValidator before calling this + * method. + *

+ * @param emailAddress Email address to check + *

+ * @return Whether the email address is already registered + */ + boolean isEmailAddressRegistered (final String emailAddress); + + /** + * Checks if the given contact can be found by checking the whole list. + *

+ * @param contact Contact instance to check + *

+ * @return Whether the found instance or null + */ + Contact lookupContact (final Contact contact); + + /** + * Updates given contact data + *

+ * @param contact Contact data to update + * @param isMobileUnlinked Whether a mobile entry has been unlinked in + * contact instance + * @param isLandlineUnlinked Whether a land-line entry has been unlinked in + * contact instance + * @param isFaxUnlinked Whether a fax entry has been unlinked in contact + * instance + *

+ * @return Updated contact instance + */ + Contact updateContactData (final Contact contact, final boolean isMobileUnlinked, final boolean isLandlineUnlinked, final boolean isFaxUnlinked); + + /** + * Updates given contact in database. Please note that the id number must be + * set. This method should also make sure that mobile, land-line and fix + * numbers are updated, too. + *

+ * @param contact Contact to update + *

+ * @return Updated contact instance + */ + Contact updateContactData (final Contact contact); + + /** + * Returns a list of all found contacts + *

+ * @return A list of call contacts + */ + List allContacts (); + + /** + * Returns a list of all registered email addresses. + *

+ * @return A list of all email addresses + */ + List allEmailAddresses (); + + /** + * Returns a contact instance which has the given id number. + *

+ * @param contactId Contact id + *

+ * @return Contact instance + *

+ * @throws ContactNotFoundException If the contact was not found + */ + Contact findContactById (final Long contactId) throws ContactNotFoundException; + + /** + * Returns a contact instance which has the given email address. + *

+ * @param emailAddress Email address + *

+ * @return Contact instance + *

+ * @throws ContactNotFoundException If the contact was not found + */ + Contact findContactByEmailAddress (final String emailAddress) throws ContactNotFoundException; + +} diff --git a/src/org/mxchange/jcontacts/model/phone/AdminContactsPhoneSessionBeanRemote.java b/src/org/mxchange/jcontacts/model/phone/AdminContactsPhoneSessionBeanRemote.java new file mode 100644 index 0000000..35ee2b2 --- /dev/null +++ b/src/org/mxchange/jcontacts/model/phone/AdminContactsPhoneSessionBeanRemote.java @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2016, 2017 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.jcontacts.model.phone; + +import java.io.Serializable; +import javax.ejb.Remote; +import org.mxchange.jcontacts.model.contact.Contact; +import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException; +import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException; +import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber; + +/** + * A remote interface for administrative purposes around contact's phone numbers + * (any type). + *

+ * @author Roland Häder + */ +@Remote +public interface AdminContactsPhoneSessionBeanRemote extends Serializable { + + /** + * Links existing fax number with given contact instance. The id number + * should be set. + *

+ * @param contact Contact to link to + * @param faxNumber Fax number to link + *

+ * @return Updated contact + *

+ * @throws PhoneNumberAlreadyLinkedException If a fax number is already + * linked in contact + */ + Contact linkExistingFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException; + + /** + * Links existing land-line number with given contact instance. The id + * number should be set. + *

+ * @param contact Contact to link to + * @param landLineNumber Land-line number to link + *

+ * @return Updated contact + *

+ * @throws PhoneNumberAlreadyLinkedException If a land-line number is + * already linked in contact + */ + Contact linkExistingLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException; + + /** + * Links existing mobile number with given contact instance. The id number + * should be set. + *

+ * @param contact Contact to link to + * @param mobileNumber Mobile number to link + *

+ * @return Updated contact + *

+ * @throws PhoneNumberAlreadyLinkedException If a mobile number is already + * linked in contact + */ + Contact linkExistingMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException; + + /** + * Links new fax number with given contact instance. The id number should + * NOT be set. + *

+ * @param contact Contact to link to + * @param faxNumber Fax number to link + *

+ * @return Updated contact + *

+ * @throws PhoneNumberAlreadyLinkedException If a fax number is already + * linked in contact + */ + Contact linkNewFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException; + + /** + * Links new land-line number with given contact instance. The id number + * should NOT be set. + *

+ * @param contact Contact to link to + * @param landLineNumber Land-line number to link + *

+ * @return Updated contact + *

+ * @throws PhoneNumberAlreadyLinkedException If a land-line number is + * already linked in contact + */ + Contact linkNewLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException; + + /** + * Links new mobile number with given contact instance. The id number should + * NOT be set. + *

+ * @param contact Contact to link to + * @param mobileNumber Mobile number to link + *

+ * @return Updated contact + *

+ * @throws PhoneNumberAlreadyLinkedException If a mobile number is already + * linked in contact + */ + Contact linkNewMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException; + + /** + * Unlinks fax data from given contact and returns the updated (managed) + * version. + *

+ * @param contact Contact to unlink mobile instance + * @param faxNumber Fax number being unlinked + *

+ * @return Updated contact instance + *

+ * @throws PhoneNumberNotLinkedException If a mobile instance is not linked + * (null) with this contact + */ + Contact unlinkFaxDataFromContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberNotLinkedException; + + /** + * Unlinks land-line data from given contact and returns the updated + * (managed) version. + *

+ * @param contact Contact to unlink mobile instance + * @param landLineNumber Land-line number being unlinked + *

+ * @return Updated contact instance + *

+ * @throws PhoneNumberNotLinkedException If a mobile instance is not linked + * (null) with this contact + */ + Contact unlinkLandLineDataFromContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberNotLinkedException; + + /** + * Unlinks mobile data from given contact and returns the updated (managed) + * version. + *

+ * @param contact Contact to unlink mobile instance + * @param mobileNumber Mobile number being unlinked + *

+ * @return Updated contact instance + *

+ * @throws PhoneNumberNotLinkedException If a mobile instance is not linked + * (null) with this contact + */ + Contact unlinkMobileDataFromContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberNotLinkedException; + +} diff --git a/src/org/mxchange/jcontacts/phone/AdminContactsPhoneSessionBeanRemote.java b/src/org/mxchange/jcontacts/phone/AdminContactsPhoneSessionBeanRemote.java deleted file mode 100644 index 615fc57..0000000 --- a/src/org/mxchange/jcontacts/phone/AdminContactsPhoneSessionBeanRemote.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2016, 2017 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.jcontacts.phone; - -import java.io.Serializable; -import javax.ejb.Remote; -import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jphone.exceptions.PhoneNumberAlreadyLinkedException; -import org.mxchange.jphone.exceptions.PhoneNumberNotLinkedException; -import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; - -/** - * A remote interface for administrative purposes around contact's phone numbers - * (any type). - *

- * @author Roland Häder - */ -@Remote -public interface AdminContactsPhoneSessionBeanRemote extends Serializable { - - /** - * Links existing fax number with given contact instance. The id number - * should be set. - *

- * @param contact Contact to link to - * @param faxNumber Fax number to link - *

- * @return Updated contact - *

- * @throws PhoneNumberAlreadyLinkedException If a fax number is already - * linked in contact - */ - Contact linkExistingFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException; - - /** - * Links existing land-line number with given contact instance. The id - * number should be set. - *

- * @param contact Contact to link to - * @param landLineNumber Land-line number to link - *

- * @return Updated contact - *

- * @throws PhoneNumberAlreadyLinkedException If a land-line number is - * already linked in contact - */ - Contact linkExistingLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException; - - /** - * Links existing mobile number with given contact instance. The id number - * should be set. - *

- * @param contact Contact to link to - * @param mobileNumber Mobile number to link - *

- * @return Updated contact - *

- * @throws PhoneNumberAlreadyLinkedException If a mobile number is already - * linked in contact - */ - Contact linkExistingMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException; - - /** - * Links new fax number with given contact instance. The id number should - * NOT be set. - *

- * @param contact Contact to link to - * @param faxNumber Fax number to link - *

- * @return Updated contact - *

- * @throws PhoneNumberAlreadyLinkedException If a fax number is already - * linked in contact - */ - Contact linkNewFaxNumberWithContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberAlreadyLinkedException; - - /** - * Links new land-line number with given contact instance. The id number - * should NOT be set. - *

- * @param contact Contact to link to - * @param landLineNumber Land-line number to link - *

- * @return Updated contact - *

- * @throws PhoneNumberAlreadyLinkedException If a land-line number is - * already linked in contact - */ - Contact linkNewLandLineNumberWithContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberAlreadyLinkedException; - - /** - * Links new mobile number with given contact instance. The id number should - * NOT be set. - *

- * @param contact Contact to link to - * @param mobileNumber Mobile number to link - *

- * @return Updated contact - *

- * @throws PhoneNumberAlreadyLinkedException If a mobile number is already - * linked in contact - */ - Contact linkNewMobileNumberWithContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberAlreadyLinkedException; - - /** - * Unlinks fax data from given contact and returns the updated (managed) - * version. - *

- * @param contact Contact to unlink mobile instance - * @param faxNumber Fax number being unlinked - *

- * @return Updated contact instance - *

- * @throws PhoneNumberNotLinkedException If a mobile instance is not linked - * (null) with this contact - */ - Contact unlinkFaxDataFromContact (final Contact contact, final DialableFaxNumber faxNumber) throws PhoneNumberNotLinkedException; - - /** - * Unlinks land-line data from given contact and returns the updated - * (managed) version. - *

- * @param contact Contact to unlink mobile instance - * @param landLineNumber Land-line number being unlinked - *

- * @return Updated contact instance - *

- * @throws PhoneNumberNotLinkedException If a mobile instance is not linked - * (null) with this contact - */ - Contact unlinkLandLineDataFromContact (final Contact contact, final DialableLandLineNumber landLineNumber) throws PhoneNumberNotLinkedException; - - /** - * Unlinks mobile data from given contact and returns the updated (managed) - * version. - *

- * @param contact Contact to unlink mobile instance - * @param mobileNumber Mobile number being unlinked - *

- * @return Updated contact instance - *

- * @throws PhoneNumberNotLinkedException If a mobile instance is not linked - * (null) with this contact - */ - Contact unlinkMobileDataFromContact (final Contact contact, final DialableMobileNumber mobileNumber) throws PhoneNumberNotLinkedException; - -}