import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException;
import org.mxchange.jcountry.data.Country;
import org.mxchange.jjobs.beans.BaseJobsController;
+import org.mxchange.jjobs.beans.helper.JobsWebRequestController;
+import org.mxchange.jphone.phonenumbers.DialableNumber;
import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
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.landline.LandLineNumber;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
-import org.mxchange.jjobs.beans.helper.JobsWebRequestController;
/**
* An administrative user bean (controller)
*/
private String street;
+ /**
+ * Title
+ */
+ private String title;
+
/**
* An event fired when the administrator has updated contact data
*/
// Set all fields: contact
this.setContactId(contact.getContactId());
+ this.setTitle(contact.getContactTitle());
this.setBirthday(contact.getContactBirthday());
this.setCity(contact.getContactCity());
this.setComment(contact.getContactComment());
this.setFirstName(contact.getContactFirstName());
this.setGender(contact.getContactGender());
this.setHouseNumber(contact.getContactHouseNumber());
+ this.setHouseNumberExtension(contact.getContactHouseNumberExtension());
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());
+ if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
+ 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());
+ if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
+ 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());
+ if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
+ this.setLandLineId(contact.getContactLandLineNumber().getPhoneId());
+ this.setPhoneAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
+ this.setPhoneCountry(contact.getContactLandLineNumber().getPhoneCountry());
+ this.setPhoneNumber(contact.getContactLandLineNumber().getPhoneNumber());
+ }
}
@Override
return "admin_list_contact"; //NOI18N
}
+ @Override
+ public String generateCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) {
+ // Is it null?
+ if (null == cellphoneNumber) {
+ // Return null
+ return null;
+ }
+
+ // Get all data
+ String number = String.format(
+ "%s%d%d", //NOI18N
+ cellphoneNumber.getCellphoneProvider().getProviderCountry().getCountryExternalDialPrefix(),
+ cellphoneNumber.getCellphoneProvider().getProviderDialPrefix(),
+ cellphoneNumber.getPhoneNumber()
+ );
+
+ // Return it
+ return number;
+ }
+
+ @Override
+ public String generatePhoneNumber (final DialableNumber phoneNumber) {
+ // Is it null?
+ if (null == phoneNumber) {
+ // Return null
+ return null;
+ }
+
+ // Generate it
+ String number = String.format(
+ "%s%d%d", //NOI18N
+ phoneNumber.getPhoneCountry().getCountryExternalDialPrefix(),
+ phoneNumber.getPhoneAreaCode(),
+ phoneNumber.getPhoneNumber()
+ );
+
+ // Return it
+ return number;
+ }
+
@Override
@SuppressWarnings ("ReturnOfDateField")
public Date getBirthday () {
this.street = street;
}
+ @Override
+ public String getTitle () {
+ return this.title;
+ }
+
+ @Override
+ public void setTitle (final String title) {
+ this.title = title;
+ }
+
@Override
public Integer getZipCode () {
return this.zipCode;
private void clear () {
// Clear all data
// - personal data
- this.setGender(Gender.UNKNOWN);
+ this.setGender(null);
+ this.setTitle(null);
this.setFirstName(null);
this.setFamilyName(null);
this.setStreet(null);
this.setHouseNumber(null);
+ this.setHouseNumberExtension(null);
this.setZipCode(null);
this.setCity(null);
this.setCountry(null);
// Update all fields
contact.setContactGender(this.getGender());
+ contact.setContactTitle(this.getTitle());
contact.setContactFirstName(this.getFirstName());
contact.setContactFamilyName(this.getFamilyName());
contact.setContactStreet(this.getStreet());