]> git.mxchange.org Git - addressbook-war.git/commitdiff
Please rename:
authorRoland Häder <roland@mxchange.org>
Mon, 8 Aug 2016 13:22:38 +0000 (15:22 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 8 Aug 2016 17:56:05 +0000 (19:56 +0200)
- this is no longer a contact's land-line/cellphone number controller, it only handles the number data itself
- unlink/link with contact or employees or anything must be done in that specific controller

Signed-off-by: Roland Häder <roland@haeder.net>
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/addressbook/beans/helper/AddressbookWebRequestHelper.java
src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminContactPhoneWebRequestBean.java [deleted file]
src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminContactPhoneWebRequestController.java [deleted file]
src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestController.java [new file with mode: 0644]

index 93c9f60d399661a665a1138b51e6028d7b72e882..ffb7490f4385d8a21cffd38c002f609c1dd6c075 100644 (file)
@@ -21,13 +21,13 @@ import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.addressbook.beans.contact.AddressbookAdminContactWebRequestController;
-import org.mxchange.addressbook.beans.phone.AddressbookAdminContactPhoneWebRequestController;
 import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
 import org.mxchange.jcontacts.contact.Contact;
 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jusercore.model.user.User;
+import org.mxchange.addressbook.beans.phone.AddressbookAdminPhoneWebRequestController;
 
 /**
  * A general helper for beans
@@ -53,7 +53,7 @@ public class AddressbookWebRequestHelper implements AddressbookWebRequestControl
         * Administrative phone controller
         */
        @Inject
-       private AddressbookAdminContactPhoneWebRequestController adminPhoneController;
+       private AddressbookAdminPhoneWebRequestController adminPhoneController;
 
        /**
         * Contact instance
diff --git a/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminContactPhoneWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminContactPhoneWebRequestBean.java
deleted file mode 100644 (file)
index 3284465..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.addressbook.beans.phone;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.enterprise.context.RequestScoped;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Named;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.addressbook.beans.BaseAddressbookController;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-
-/**
- * Administrative bean (controller) for phone numbers
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@Named ("adminPhoneController")
-@RequestScoped
-public class AddressbookAdminContactPhoneWebRequestBean extends BaseAddressbookController implements AddressbookAdminContactPhoneWebRequestController {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 184_598_175_371_269_016L;
-
-       /**
-        * Remote EJB for phone number (administrative)
-        */
-       private AdminContactsPhoneSessionBeanRemote adminRemoteBean;
-
-       /**
-        * Cell phone number
-        */
-       private DialableCellphoneNumber cellPhone;
-
-       /**
-        * Instance of linked contact account
-        * <p>
-        * @deprecated This is a generic phone controller, not just for contact data
-        */
-       @Deprecated
-       private Contact contact;
-
-       /**
-        * "Cache" for contact lists, mostly only one is assigned. So this cache
-        * shouldn't grow beyond control.
-        * <p>
-        * @deprecated This is a generic phone controller, not just for contact data
-        */
-       @Deprecated
-       private final Map<Long, List<Contact>> contacts;
-
-       /**
-        * Fax number
-        */
-       private DialableFaxNumber fax;
-
-       /**
-        * Land-line number
-        */
-       private DialableLandLineNumber landLine;
-
-       /**
-        * Default constructor
-        */
-       public AddressbookAdminContactPhoneWebRequestBean () {
-               // Try it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Try to lookup the beans
-                       this.adminRemoteBean = (AdminContactsPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/admincontactphone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote"); //NOI18N
-               } catch (final NamingException e) {
-                       // Throw it again
-                       throw new FaceletException(e);
-               }
-
-               // Init map
-               this.contacts = new HashMap<>(10);
-       }
-
-       @Override
-       @Deprecated
-       public List<Contact> allCellphoneContacts () {
-               // Get id
-               Long phoneId = this.getCellPhone().getPhoneId();
-
-               // Is cache there?
-               if (this.contacts.containsKey(phoneId)) {
-                       // Return cached version
-                       return this.contacts.get(phoneId);
-               } else {
-                       // Ask bean
-                       List<Contact> list = this.adminRemoteBean.allContacts(this.getCellPhone());
-
-                       // Store result in cache
-                       this.contacts.put(phoneId, list);
-
-                       // Return now-cached list
-                       return list;
-               }
-       }
-
-       @Override
-       public DialableCellphoneNumber getCellPhone () {
-               return this.cellPhone;
-       }
-
-       @Override
-       public void setCellPhone (final DialableCellphoneNumber cellPhone) {
-               this.cellPhone = cellPhone;
-       }
-
-       @Override
-       @Deprecated
-       public Contact getContact () {
-               return this.contact;
-       }
-
-       @Override
-       @Deprecated
-       public void setContact (final Contact contact) {
-               this.contact = contact;
-       }
-
-       @Override
-       public DialableFaxNumber getFax () {
-               return this.fax;
-       }
-
-       @Override
-       public void setFax (final DialableFaxNumber fax) {
-               this.fax = fax;
-       }
-
-       @Override
-       public DialableLandLineNumber getLandLine () {
-               return this.landLine;
-       }
-
-       @Override
-       public void setLandLine (final DialableLandLineNumber landLine) {
-               this.landLine = landLine;
-       }
-
-}
diff --git a/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminContactPhoneWebRequestController.java b/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminContactPhoneWebRequestController.java
deleted file mode 100644 (file)
index 2ef40a6..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.addressbook.beans.phone;
-
-import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
-import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-
-/**
- * An interface for a request web controller (bean) for administrative phone
- * number purposes.
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-public interface AddressbookAdminContactPhoneWebRequestController extends Serializable {
-
-       /**
-        * Getter for all contacts having current cellphone instance linked
-        * <p>
-        * @return List of all linked contacts
-        */
-       @Deprecated
-       List<Contact> allCellphoneContacts ();
-
-       /**
-        * Getter for dialable cellphone number instance
-        * <p>
-        * @return Dialable cellphone number instance
-        */
-       DialableCellphoneNumber getCellPhone ();
-
-       /**
-        * Setter for dialable land-line number instance
-        * <p>
-        * @param landLine Dialable land-line number instance
-        */
-       void setLandLine (final DialableLandLineNumber landLine);
-
-       /**
-        * Getter for dialable land-line number instance
-        * <p>
-        * @return Dialable land-line number instance
-        */
-       DialableLandLineNumber getLandLine ();
-
-       /**
-        * Setter for dialable fax number instance
-        * <p>
-        * @param fax Dialable fax number instance
-        */
-       void setFax (final DialableFaxNumber fax);
-
-       /**
-        * Getter for dialable fax number instance
-        * <p>
-        * @return Dialable fax number instance
-        */
-       DialableFaxNumber getFax ();
-
-       /**
-        * Setter for dialable cellphone number instance
-        * <p>
-        * @param cellPhone Dialable cellphone number instance
-        */
-       void setCellPhone (final DialableCellphoneNumber cellPhone);
-
-       /**
-        * Getter for linked contact account
-        * <p>
-        * @return Linked contact account
-        */
-       @Deprecated
-       Contact getContact ();
-
-       /**
-        * Setter for linked contact account
-        * <p>
-        * @param contact Linked contact account
-        */
-       @Deprecated
-       void setContact (final Contact contact);
-
-}
diff --git a/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestBean.java
new file mode 100644 (file)
index 0000000..97b2aa3
--- /dev/null
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.beans.phone;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.enterprise.context.RequestScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.addressbook.beans.BaseAddressbookController;
+import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote;
+import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+
+/**
+ * Administrative bean (controller) for phone numbers
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("adminPhoneController")
+@RequestScoped
+public class AddressbookAdminPhoneWebRequestBean extends BaseAddressbookController implements AddressbookAdminPhoneWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 184_598_175_371_269_016L;
+
+       /**
+        * Remote EJB for phone number (administrative)
+        */
+       private AdminContactsPhoneSessionBeanRemote adminRemoteBean;
+
+       /**
+        * Cell phone number
+        */
+       private DialableCellphoneNumber cellPhone;
+
+       /**
+        * Instance of linked contact account
+        * <p>
+        * @deprecated This is a generic phone controller, not just for contact data
+        */
+       @Deprecated
+       private Contact contact;
+
+       /**
+        * "Cache" for contact lists, mostly only one is assigned. So this cache
+        * shouldn't grow beyond control.
+        * <p>
+        * @deprecated This is a generic phone controller, not just for contact data
+        */
+       @Deprecated
+       private final Map<Long, List<Contact>> contacts;
+
+       /**
+        * Fax number
+        */
+       private DialableFaxNumber fax;
+
+       /**
+        * Land-line number
+        */
+       private DialableLandLineNumber landLine;
+
+       /**
+        * Default constructor
+        */
+       public AddressbookAdminPhoneWebRequestBean () {
+               // Try it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the beans
+                       this.adminRemoteBean = (AdminContactsPhoneSessionBeanRemote) context.lookup("java:global/addressbook-ejb/admincontactphone!org.mxchange.jcontacts.phone.AdminContactsPhoneSessionBeanRemote"); //NOI18N
+               } catch (final NamingException e) {
+                       // Throw it again
+                       throw new FaceletException(e);
+               }
+
+               // Init map
+               this.contacts = new HashMap<>(10);
+       }
+
+       @Override
+       @Deprecated
+       public List<Contact> allCellphoneContacts () {
+               // Get id
+               Long phoneId = this.getCellPhone().getPhoneId();
+
+               // Is cache there?
+               if (this.contacts.containsKey(phoneId)) {
+                       // Return cached version
+                       return this.contacts.get(phoneId);
+               } else {
+                       // Ask bean
+                       List<Contact> list = this.adminRemoteBean.allContacts(this.getCellPhone());
+
+                       // Store result in cache
+                       this.contacts.put(phoneId, list);
+
+                       // Return now-cached list
+                       return list;
+               }
+       }
+
+       @Override
+       public DialableCellphoneNumber getCellPhone () {
+               return this.cellPhone;
+       }
+
+       @Override
+       public void setCellPhone (final DialableCellphoneNumber cellPhone) {
+               this.cellPhone = cellPhone;
+       }
+
+       @Override
+       @Deprecated
+       public Contact getContact () {
+               return this.contact;
+       }
+
+       @Override
+       @Deprecated
+       public void setContact (final Contact contact) {
+               this.contact = contact;
+       }
+
+       @Override
+       public DialableFaxNumber getFax () {
+               return this.fax;
+       }
+
+       @Override
+       public void setFax (final DialableFaxNumber fax) {
+               this.fax = fax;
+       }
+
+       @Override
+       public DialableLandLineNumber getLandLine () {
+               return this.landLine;
+       }
+
+       @Override
+       public void setLandLine (final DialableLandLineNumber landLine) {
+               this.landLine = landLine;
+       }
+
+}
diff --git a/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestController.java b/src/java/org/mxchange/addressbook/beans/phone/AddressbookAdminPhoneWebRequestController.java
new file mode 100644 (file)
index 0000000..c4d0b84
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.beans.phone;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+
+/**
+ * An interface for a request web controller (bean) for administrative phone
+ * number purposes.
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface AddressbookAdminPhoneWebRequestController extends Serializable {
+
+       /**
+        * Getter for all contacts having current cellphone instance linked
+        * <p>
+        * @return List of all linked contacts
+        */
+       @Deprecated
+       List<Contact> allCellphoneContacts ();
+
+       /**
+        * Getter for dialable cellphone number instance
+        * <p>
+        * @return Dialable cellphone number instance
+        */
+       DialableCellphoneNumber getCellPhone ();
+
+       /**
+        * Setter for dialable land-line number instance
+        * <p>
+        * @param landLine Dialable land-line number instance
+        */
+       void setLandLine (final DialableLandLineNumber landLine);
+
+       /**
+        * Getter for dialable land-line number instance
+        * <p>
+        * @return Dialable land-line number instance
+        */
+       DialableLandLineNumber getLandLine ();
+
+       /**
+        * Setter for dialable fax number instance
+        * <p>
+        * @param fax Dialable fax number instance
+        */
+       void setFax (final DialableFaxNumber fax);
+
+       /**
+        * Getter for dialable fax number instance
+        * <p>
+        * @return Dialable fax number instance
+        */
+       DialableFaxNumber getFax ();
+
+       /**
+        * Setter for dialable cellphone number instance
+        * <p>
+        * @param cellPhone Dialable cellphone number instance
+        */
+       void setCellPhone (final DialableCellphoneNumber cellPhone);
+
+       /**
+        * Getter for linked contact account
+        * <p>
+        * @return Linked contact account
+        */
+       @Deprecated
+       Contact getContact ();
+
+       /**
+        * Setter for linked contact account
+        * <p>
+        * @param contact Linked contact account
+        */
+       @Deprecated
+       void setContact (final Contact contact);
+
+}