]> git.mxchange.org Git - jfinancials-mailer-ejb.git/commitdiff
Continued with cell phone numbers: (please cherry-pick)
authorRoland Häder <roland@mxchange.org>
Wed, 10 Aug 2016 10:53:17 +0000 (12:53 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 16 Aug 2016 19:40:19 +0000 (21:40 +0200)
- implemented deleteCellphoneData() which may work this way
- maybe still a mail might be sent

src/java/org/mxchange/jcontacts/phone/AddressbookAdminContactPhoneSessionBean.java

index c4d37f087cd400a3ca08137ba559d502f8c01e0e..bd159b623e611c0632bfd9cc17ca3d668c831047 100644 (file)
@@ -35,6 +35,45 @@ public class AddressbookAdminContactPhoneSessionBean extends BaseAddressbookData
         */
        private static final long serialVersionUID = 189_217_561_460_237_108L;
 
+       @Override
+       public void deleteCellphoneData (final DialableCellphoneNumber cellPhoneNumber) {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteCellphoneData: cellPhoneNumber={1} - CALLED!", this.getClass().getSimpleName(), cellPhoneNumber));
+
+               // Is all data set
+               if (null == cellPhoneNumber) {
+                       // Not set, throw NPE
+                       throw new NullPointerException("cellphoneNumber is null"); //NOI18N
+               } else if (cellPhoneNumber.getPhoneId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("cellphoneNumber.phoneId is null"); //NOI18N
+               } else if (cellPhoneNumber.getPhoneId() < 1) {
+                       // Invalid number
+                       throw new IllegalArgumentException(MessageFormat.format("cellphoneNumber.phoneId={0} is not valid", cellPhoneNumber.getPhoneId())); //NOI18N
+               } else if (cellPhoneNumber.getCellphoneProvider() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("cellphoneNumber.cellphoneProvider is null"); //NOI18N
+               } else if (cellPhoneNumber.getCellphoneProvider().getProviderId() == null) {
+                       // ... throw again
+                       throw new NullPointerException("cellphoneNumber.cellphoneProvider.providerId is null"); //NOI18N
+               } else if (cellPhoneNumber.getCellphoneProvider().getProviderId() < 1) {
+                       // Id not valid
+                       throw new IllegalArgumentException(MessageFormat.format("cellphoneNumber.cellphoneProvider.providerId={0} is not valid.", cellPhoneNumber.getCellphoneProvider().getProviderId())); //NOI18N
+               } else if (cellPhoneNumber.getPhoneNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("cellphoneNumber.phoneNumber is null"); //NOI18N
+               } else if (cellPhoneNumber.getPhoneNumber() < 1) {
+                       // Throw NPE again
+                       throw new NullPointerException(MessageFormat.format("cellphoneNumber.phoneNumber={0} is not valid.", cellPhoneNumber.getPhoneNumber())); //NOI18N
+               }
+
+               // Remove it from database
+               this.getEntityManager().remove(cellPhoneNumber);
+
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.deleteCellphoneData: EXIT!", this.getClass().getSimpleName()));
+       }
+
        @Override
        public DialableCellphoneNumber updateCellphoneData (final DialableCellphoneNumber cellPhoneNumber) {
                // Trace message