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.jjobs.beans.helper.JobsWebViewHelperController;
import org.mxchange.jphone.phonenumbers.DialableNumber;
-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.mobile.DialableMobileNumber;
import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
private AdminContactSessionBeanRemote adminContactBean;
/**
- * Admin helper instance
+ * Bean helper
*/
@Inject
- private JobsWebRequestController beanHelper;
+ private JobsWebViewHelperController beanHelper;
/**
* Birth day
*/
private Date birthday;
- /**
- * Cellphone number's carrier
- */
- private MobileProvider cellphoneCarrier;
-
- /**
- * Cellphone id number
- */
- private Long cellphoneId;
-
- /**
- * Cellphone number
- */
- private Long cellphoneNumber;
-
/**
* City
*/
private Country faxCountry;
/**
- * Fax id number
+ * Fax number
*/
- private Long faxId;
+ private Long faxNumber;
/**
- * Fax number
+ * Fax id number
*/
- private Long faxNumber;
+ private Long faxNumberId;
/**
* First name
*/
private String houseNumberExtension;
- /**
- * Whether a cellphone entry has been unlinked
- */
- private boolean isCellphoneUnlinked;
-
/**
* Whether a fax entry has been unlinked
*/
*/
private boolean isLandLineUnlinked;
+ /**
+ * Whether a mobile entry has been unlinked
+ */
+ private boolean isMobileUnlinked;
+
+ /**
+ * Land-line number area code
+ */
+ private Integer landLineAreaCode;
+
+ /**
+ * Country instance for land-line number
+ */
+ private Country landLineCountry;
+
/**
* Land-line id number
*/
private Long landLineId;
/**
- * Phone number area code
+ * Land-line number
*/
- private Integer phoneAreaCode;
+ private Long landLineNumber;
/**
- * Country instance for phone number
+ * Mobile number
*/
- private Country phoneCountry;
+ private Long mobileNumber;
/**
- * Phone number
+ * Mobile id number
*/
- private Long phoneNumber;
+ private Long mobileNumberId;
+
+ /**
+ * Mobile provider
+ */
+ private MobileProvider mobileProvider;
/**
* Street
throw new NullPointerException("contact is null"); //NOI18N
} else if (contact.getContactId() == null) {
// Throw NPE again
- throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
+ throw new NullPointerException("contact.contactId is null"); //NOI18N
} else if (contact.getContactId() < 1) {
// Not valid
throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
this.setStreet(contact.getContactStreet());
this.setZipCode(contact.getContactZipCode());
- // ... cellphone data
- if (contact.getContactCellphoneNumber() instanceof DialableCellphoneNumber) {
- this.setCellphoneId(contact.getContactCellphoneNumber().getPhoneId());
- this.setCellphoneCarrier(contact.getContactCellphoneNumber().getCellphoneProvider());
- this.setCellphoneNumber(contact.getContactCellphoneNumber().getPhoneNumber());
+ // ... mobile data
+ if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
+ this.setMobileNumberId(contact.getContactMobileNumber().getPhoneId());
+ this.setMobileProvider(contact.getContactMobileNumber().getMobileProvider());
+ this.setMobileNumber(contact.getContactMobileNumber().getPhoneNumber());
}
// ... fax data
if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
- this.setFaxId(contact.getContactFaxNumber().getPhoneId());
+ this.setFaxNumberId(contact.getContactFaxNumber().getPhoneId());
this.setFaxAreaCode(contact.getContactFaxNumber().getPhoneAreaCode());
this.setFaxCountry(contact.getContactFaxNumber().getPhoneCountry());
this.setFaxNumber(contact.getContactFaxNumber().getPhoneNumber());
// .. land-line data
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());
+ this.setLandLineAreaCode(contact.getContactLandLineNumber().getPhoneAreaCode());
+ this.setLandLineCountry(contact.getContactLandLineNumber().getPhoneCountry());
+ this.setLandLineNumber(contact.getContactLandLineNumber().getPhoneNumber());
}
}
throw new NullPointerException("beanHelper.contact is null"); //NOI18N
} else if (contact.getContactId() == null) {
// Throw NPE again
- throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N //NOI18N
+ throw new NullPointerException("beanHelper.contact.contactId is null"); //NOI18N
} else if (contact.getContactId() < 1) {
// Invalid id
throw new IllegalStateException(MessageFormat.format("beanHelper.contact.contactId={0} is invalid", contact.getContactId())); //NOI18N
this.updateContactData(contact);
// Call EJB for updating contact data
- Contact updatedContact = this.contactBean.updateContactData(contact, this.isCellphoneUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
+ Contact updatedContact = this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
// Fire event
this.updatedContactEvent.fire(new AdminContactUpdatedEvent(updatedContact));
}
@Override
- public String generateCellphoneNumber (final DialableCellphoneNumber cellphoneNumber) {
+ public String generateMobileNumber (final DialableMobileNumber mobileNumber) {
// Is it null?
- if (null == cellphoneNumber) {
+ if (null == mobileNumber) {
// Return null
return null;
}
// Get all data
String number = String.format(
"%s%d%d", //NOI18N
- cellphoneNumber.getCellphoneProvider().getProviderCountry().getCountryExternalDialPrefix(),
- cellphoneNumber.getCellphoneProvider().getProviderDialPrefix(),
- cellphoneNumber.getPhoneNumber()
+ mobileNumber.getMobileProvider().getProviderCountry().getCountryExternalDialPrefix(),
+ mobileNumber.getMobileProvider().getProviderDialPrefix(),
+ mobileNumber.getPhoneNumber()
);
// Return it
this.birthday = birthday;
}
- @Override
- public MobileProvider getCellphoneCarrier () {
- return this.cellphoneCarrier;
- }
-
- @Override
- public void setCellphoneCarrier (final MobileProvider cellphoneCarrier) {
- this.cellphoneCarrier = cellphoneCarrier;
- }
-
- @Override
- public Long getCellphoneId () {
- return this.cellphoneId;
- }
-
- @Override
- public void setCellphoneId (final Long cellphoneId) {
- this.cellphoneId = cellphoneId;
- }
-
- @Override
- public Long getCellphoneNumber () {
- return this.cellphoneNumber;
- }
-
- @Override
- public void setCellphoneNumber (Long cellphoneNumber) {
- this.cellphoneNumber = cellphoneNumber;
- }
-
@Override
public String getCity () {
return this.city;
}
@Override
- public Long getFaxId () {
- return this.faxId;
+ public Long getFaxNumber () {
+ return this.faxNumber;
}
@Override
- public void setFaxId (final Long faxId) {
- this.faxId = faxId;
+ public void setFaxNumber (final Long faxNumber) {
+ this.faxNumber = faxNumber;
}
@Override
- public Long getFaxNumber () {
- return this.faxNumber;
+ public Long getFaxNumberId () {
+ return this.faxNumberId;
}
@Override
- public void setFaxNumber (final Long faxNumber) {
- this.faxNumber = faxNumber;
+ public void setFaxNumberId (final Long faxNumberId) {
+ this.faxNumberId = faxNumberId;
}
@Override
this.houseNumberExtension = houseNumberExtension;
}
+ @Override
+ public Integer getLandLineAreaCode () {
+ return this.landLineAreaCode;
+ }
+
+ @Override
+ public void setLandLineAreaCode (final Integer landLineAreaCode) {
+ this.landLineAreaCode = landLineAreaCode;
+ }
+
+ @Override
+ public Country getLandLineCountry () {
+ return this.landLineCountry;
+ }
+
+ @Override
+ public void setLandLineCountry (final Country landLineCountry) {
+ this.landLineCountry = landLineCountry;
+ }
+
@Override
public Long getLandLineId () {
return this.landLineId;
}
@Override
- public Integer getPhoneAreaCode () {
- return this.phoneAreaCode;
+ public Long getLandLineNumber () {
+ return this.landLineNumber;
+ }
+
+ @Override
+ public void setLandLineNumber (final Long landLineNumber) {
+ this.landLineNumber = landLineNumber;
+ }
+
+ @Override
+ public Long getMobileNumber () {
+ return this.mobileNumber;
}
@Override
- public void setPhoneAreaCode (final Integer phoneAreaCode) {
- this.phoneAreaCode = phoneAreaCode;
+ public void setMobileNumber (Long mobileNumber) {
+ this.mobileNumber = mobileNumber;
}
@Override
- public Country getPhoneCountry () {
- return this.phoneCountry;
+ public Long getMobileNumberId () {
+ return this.mobileNumberId;
}
@Override
- public void setPhoneCountry (final Country phoneCountry) {
- this.phoneCountry = phoneCountry;
+ public void setMobileNumberId (final Long mobileNumberId) {
+ this.mobileNumberId = mobileNumberId;
}
@Override
- public Long getPhoneNumber () {
- return this.phoneNumber;
+ public MobileProvider getMobileProvider () {
+ return this.mobileProvider;
}
@Override
- public void setPhoneNumber (final Long phoneNumber) {
- this.phoneNumber = phoneNumber;
+ public void setMobileProvider (final MobileProvider mobileProvider) {
+ this.mobileProvider = mobileProvider;
}
@Override
// - contact data
this.setEmailAddress(null);
- this.setPhoneCountry(null);
- this.setPhoneAreaCode(null);
- this.setPhoneNumber(null);
- this.setCellphoneCarrier(null);
- this.setCellphoneNumber(null);
+ this.setLandLineCountry(null);
+ this.setLandLineAreaCode(null);
+ this.setLandLineNumber(null);
+ this.setMobileProvider(null);
+ this.setMobileNumber(null);
this.setFaxCountry(null);
this.setFaxAreaCode(null);
this.setFaxNumber(null);
contact.setContactCity(this.getCity());
contact.setContactCountry(this.getCountry());
contact.setContactEmailAddress(this.getEmailAddress());
+ contact.setContactBirthday(this.getBirthday());
+ contact.setContactComment(this.getComment());
- // Update contact's cellphone number
- this.isCellphoneUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getCellphoneCarrier(), this.getCellphoneNumber());
+ // Update contact's mobile number
+ this.isMobileUnlinked = ContactUtils.updateCellPhoneNumber(contact, this.getMobileProvider(), this.getMobileNumber());
// Update contact's land-line number
- this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+ this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
// Update contact's fax number
this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());