import org.mxchange.jcontacts.model.contact.AdminContactSessionBeanRemote;
import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
-import org.mxchange.jcontacts.model.contact.ContactUtils;
import org.mxchange.jcontacts.model.contact.UserContact;
import org.mxchange.jcontacts.model.contact.title.PersonalTitle;
+import org.mxchange.jcontacts.model.utils.ContactUtils;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jphone.model.phonenumbers.DialableNumber;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
private boolean isLandLineUnlinked;
/**
- * Whether a cmobile entry has been unlinked
+ * Whether a mobile entry has been unlinked
*/
private boolean isMobileNumberUnlinked;
} else if (this.getFamilyName().isEmpty()) {
// Empty string
throw new IllegalStateException("familyName is empty"); //NOI18N
+ } else if (this.getContactCountry() == null) {
+ // Throw NPE
+ throw new NullPointerException("contactCountry is null"); //NOI18N
+ } else if (this.getContactCountry().getCountryId() == null) {
+ // Throw it again
+ throw new NullPointerException("contactCountry.countryId is null"); //NOI18N
+ } else if (this.getContactCountry().getCountryId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("contactCountry.countryId={0} is invalid", this.getContactCountry().getCountryId())); //NOI18N
}
// Generate phone number
contact.setContactId(this.getContactId());
}
- // Add all others
- contact.setContactTitle(this.getAcademicTitle());
- contact.setContactBirthday(this.getBirthday());
- contact.setContactStreet(this.getStreet());
- contact.setContactHouseNumber(this.getHouseNumber());
- contact.setContactZipCode(this.getZipCode());
- contact.setContactCity(this.getCity());
- contact.setContactCountry(this.getContactCountry());
- contact.setContactEmailAddress(this.getEmailAddress());
- contact.setContactBirthday(this.getBirthday());
- contact.setContactComment(this.getComment());
+ // Create new instance
+ final Contact localContact = new UserContact(
+ this.getPersonalTitle(),
+ this.getFirstName(),
+ this.getFamilyName(),
+ this.getContactCountry()
+ );
- // Set ownContact
- contact.setContactOwnContact(Boolean.TRUE);
+ // Add all others
+ localContact.setContactBirthday(this.getBirthday());
+ localContact.setContactCity(this.getCity());
+ localContact.setContactComment(this.getComment());
+ localContact.setContactEmailAddress(this.getEmailAddress());
+ localContact.setContactHouseNumber(this.getHouseNumber());
+ localContact.setContactId(this.getContactId());
+ localContact.setContactStreet(this.getStreet());
+ localContact.setContactTitle(this.getAcademicTitle());
+ localContact.setContactZipCode(this.getZipCode());
// Don't set null or wrong references
if ((landLine instanceof DialableLandLineNumber) && (landLine.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
import org.mxchange.jcontacts.model.contact.Contact;
import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
-import org.mxchange.jcontacts.model.contact.ContactUtils;
import org.mxchange.jcontacts.model.contact.UserContact;
import org.mxchange.jcontacts.model.contact.title.PersonalTitle;
+import org.mxchange.jcontacts.model.utils.ContactUtils;
import org.mxchange.jcountry.model.data.Country;
import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
// Create new contact
- Contact contact = new UserContact(this.getPersonalTitle(), this.getFirstName(), this.getFamilyName());
- contact.setContactStreet(this.getStreet());
- contact.setContactHouseNumber(this.getHouseNumber());
- contact.setContactHouseNumberExtension(this.getHouseNumberExtension());
- contact.setContactZipCode(this.getZipCode());
- contact.setContactCity(this.getCity());
- contact.setContactCountry(this.getCountry());
- contact.setContactEmailAddress(this.getEmailAddress());
- contact.setContactBirthday(this.getBirthday());
- contact.setContactComment(this.getComment());
-
- // Don't set null or wrong references
- if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
- // Now the number must be given
- if (phone.getPhoneAreaCode() == null) {
- // Is null
- throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
- } else if (phone.getPhoneAreaCode() < 1) {
- // Abort here
- throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
- } else if (phone.getPhoneNumber() == null) {
- // Is null
- throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
- } else if (phone.getPhoneNumber() < 1) {
- // Abort here
- throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
- }
-
- // Set phone number
- contact.setContactLandLineNumber(phone);
- }
+ final Contact contact = new UserContact(
+ this.getPersonalTitle(),
+ this.getFirstName(),
+ this.getFamilyName(),
+ this.getCountry()
+ );
// Don't set null or wrong references
if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
<widgets:outputAdminContactDataFormFields />
+<<<<<<< HEAD
<div class="table-footer">
<p:commandButton styleClass="reset divider-right" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
<p:commandButton styleClass="submit" type="submit" id="button_add_contact" value="#{msg.BUTTON_ADMIN_ADD_CONTACT}" action="#{adminContactController.addContact()}" />
</div>
</h:panelGroup>
+=======
+ <f:facet name="footer">
+ <p:panelGrid columns="2" layout="grid">
+ <p:commandButton
+ styleClass="reset"
+ type="reset"
+ value="#{msg.BUTTON_RESET_FORM}"
+ />
+
+ <p:commandButton
+ type="submit"
+ value="#{msg.BUTTON_ADMIN_ADD_CONTACT}"
+ action="#{adminContactController.addContact()}"
+ update="form-list-contacts:contactList"
+ />
+ </p:panelGrid>
+ </f:facet>
+ </p:panelGrid>
+>>>>>>> 2b3f1b133 (Please cherry-pick:)
</h:form>
</ui:define>
</ui:composition>