import org.mxchange.jcontacts.contact.gender.Gender;
import org.mxchange.jcontacts.events.contact.AdminAddedContactEvent;
import org.mxchange.jcountry.data.Country;
+import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
/**
@Override
public void copyContactToController (final Contact contact) {
+ // Log message
+ System.out.println(MessageFormat.format("AdminContactController::copyContactToController(): contact={0} - CALLED!", contact)); //NOI18N
+
// The contact instance must be valid
if (null == contact) {
// Throw NPE again
- throw new NullPointerException("this.user.userContact is null");
+ throw new NullPointerException("this.user.userContact is null"); //NOI18N
} else if (contact.getContactId() < 1) {
// Not valid
- throw new IllegalStateException(MessageFormat.format("this.user.userContact.contactId={0} is not valid.", contact.getContactId()));
+ throw new IllegalStateException(MessageFormat.format("this.user.userContact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
}
// Set all fields: contact
this.setStreet(contact.getContactStreet());
this.setZipCode(contact.getContactZipCode());
- // ... cellphone data
- this.setCellphoneId(contact.getContactCellphoneNumber().getPhoneId());
- this.setCellphoneCarrier(contact.getContactCellphoneNumber().getCellphoneProvider());
- this.setCellphoneNumber(contact.getContactCellphoneNumber().getPhoneNumber());
-
- // ... fax data
- this.setFaxId(contact.getContactFaxNumber().getPhoneId());
- this.setFaxAreaCode(contact.getContactFaxNumber().getPhoneAreaCode());
- this.setFaxCountry(contact.getContactFaxNumber().getPhoneCountry());
- this.setFaxNumber(contact.getContactFaxNumber().getPhoneNumber());
-
- // .. land-line data
- this.setLandLineId(contact.getContactLandLineNumber().getPhoneId());
- this.setPhoneAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
- this.setPhoneCountry(contact.getContactLandLineNumber().getPhoneCountry());
- this.setPhoneNumber(contact.getContactLandLineNumber().getPhoneNumber());
+ // Is the cell phone set?
+ if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
+ // ... cellphone data
+ this.setCellphoneId(contact.getContactCellphoneNumber().getPhoneId());
+ this.setCellphoneCarrier(contact.getContactCellphoneNumber().getCellphoneProvider());
+ this.setCellphoneNumber(contact.getContactCellphoneNumber().getPhoneNumber());
+ }
+
+ // Is the fax set?
+ if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
+ // ... fax data
+ this.setFaxId(contact.getContactFaxNumber().getPhoneId());
+ this.setFaxAreaCode(contact.getContactFaxNumber().getPhoneAreaCode());
+ this.setFaxCountry(contact.getContactFaxNumber().getPhoneCountry());
+ this.setFaxNumber(contact.getContactFaxNumber().getPhoneNumber());
+ }
+
+ // Is the land-line number set?
+ if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
+ // .. land-line data
+ this.setLandLineId(contact.getContactLandLineNumber().getPhoneId());
+ this.setPhoneAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
+ this.setPhoneCountry(contact.getContactLandLineNumber().getPhoneCountry());
+ this.setPhoneNumber(contact.getContactLandLineNumber().getPhoneNumber());
+ }
+
+ // Log message
+ System.out.println("AdminContactController::copyContactToController(): EXIT!"); //NOI18N
}
@Override
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.pizzaapplication.beans.contact.PizzaAdminContactWebRequestController;
import org.mxchange.jusercore.model.user.User;
+import org.mxchange.pizzaapplication.beans.contact.PizzaAdminContactWebRequestController;
import org.mxchange.pizzaapplication.beans.user.PizzaAdminUserWebRequestController;
/**
@Override
public void copyUserToController () {
+ // Log message
+ System.out.println("AdminHelper::copyUserToController - CALLED!"); //NOI18N
+
// Validate user instance
if (this.getUser() == null) {
// Throw NPE
- throw new NullPointerException("this.user is null");
+ throw new NullPointerException("this.user is null"); //NOI18N
} else if (this.getUser().getUserId() == null) {
// Throw NPE again
- throw new NullPointerException("this.user.userId is null");
+ throw new NullPointerException("this.user.userId is null"); //NOI18N
} else if (this.getUser().getUserId() < 1) {
// Not valid
- throw new IllegalStateException(MessageFormat.format("this.user.userId={0} is not valid.", this.getUser().getUserId()));
+ throw new IllegalStateException(MessageFormat.format("this.user.userId={0} is not valid.", this.getUser().getUserId())); //NOI18N
}
// Set all fields: user
// Call contact controller
this.adminContactController.copyContactToController(contact);
+
+ // Log message
+ System.out.println("AdminHelper::copyUserToController - EXIT!"); //NOI18N
}
@Override