/*
- * Copyright (C) 2016 Roland Häder
+ * Copyright (C) 2016, 2017 Roland Häder
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
import org.mxchange.jcontacts.contact.AdminContactSessionBeanRemote;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jcontacts.contact.ContactSessionBeanRemote;
+import org.mxchange.jcontacts.contact.ContactUtils;
import org.mxchange.jcontacts.contact.UserContact;
-import org.mxchange.jcontacts.contact.gender.Gender;
-import org.mxchange.jcontacts.contact.utils.ContactUtils;
+import org.mxchange.jcontacts.contact.title.PersonalTitle;
import org.mxchange.jcontacts.events.contact.add.AdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
import org.mxchange.jcontacts.events.contact.update.AdminUpdatedContactEvent;
*/
private static final long serialVersionUID = 542_145_347_916L;
+ /**
+ * Academic academicTitle
+ */
+ private String academicTitle;
+
/**
* An event fired when the administrator has added a new contact
*/
*/
private String firstName;
- /**
- * Gender instance
- */
- private Gender gender;
-
/**
* House number
*/
private MobileProvider mobileProvider;
/**
- * Street
+ * PersonalTitle instance
*/
- private String street;
+ private PersonalTitle personalTitle;
/**
- * Title
+ * Street
*/
- private String title;
+ private String street;
/**
* An event fired when the administrator has updated contact data
@Override
public String addContact () {
// Are all minimum fields set?
- if (this.getGender() == null) {
+ if (this.getPersonalTitle() == null) {
// Throw NPE
- throw new NullPointerException("gender is null"); //NOI18N
+ throw new NullPointerException("personalTitle is null"); //NOI18N
} else if (this.getFirstName() == null) {
// Throw NPE
throw new NullPointerException("firstName is null"); //NOI18N
// Set all fields: contact
this.setContactId(contact.getContactId());
- this.setTitle(contact.getContactTitle());
+ this.setAcademicTitle(contact.getContactTitle());
this.setBirthday(contact.getContactBirthday());
this.setCity(contact.getContactCity());
this.setComment(contact.getContactComment());
this.setEmailAddress(contact.getContactEmailAddress());
this.setFamilyName(contact.getContactFamilyName());
this.setFirstName(contact.getContactFirstName());
- this.setGender(contact.getContactGender());
+ this.setPersonalTitle(contact.getContactPersonalTitle());
this.setHouseNumber(contact.getContactHouseNumber());
this.setHouseNumberExtension(contact.getContactHouseNumberExtension());
this.setStreet(contact.getContactStreet());
@Override
public Contact createContactInstance () {
// Are all minimum fields set?
- if (this.getGender() == null) {
+ if (this.getPersonalTitle() == null) {
// Throw NPE
- throw new NullPointerException("gender is null"); //NOI18N
+ throw new NullPointerException("personalTitle is null"); //NOI18N
} else if (this.getFirstName() == null) {
// Throw NPE
throw new NullPointerException("firstName is null"); //NOI18N
DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
// Create new instance
- Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
+ Contact contact = new UserContact(this.getPersonalTitle(), this.getFirstName(), this.getFamilyName());
// Add all others
+ contact.setContactTitle(this.getAcademicTitle());
contact.setContactBirthday(this.getBirthday());
contact.setContactStreet(this.getStreet());
contact.setContactHouseNumber(this.getHouseNumber());
return number;
}
+ @Override
+ public String getAcademicTitle () {
+ return this.academicTitle;
+ }
+
+ @Override
+ public void setAcademicTitle (final String academicTitle) {
+ this.academicTitle = academicTitle;
+ }
+
@Override
@SuppressWarnings ("ReturnOfDateField")
public Date getBirthday () {
this.firstName = firstName;
}
- @Override
- public Gender getGender () {
- return this.gender;
- }
-
- @Override
- public void setGender (final Gender gender) {
- this.gender = gender;
- }
-
@Override
public Short getHouseNumber () {
return this.houseNumber;
}
@Override
- public String getStreet () {
- return this.street;
+ public PersonalTitle getPersonalTitle () {
+ return this.personalTitle;
}
@Override
- public void setStreet (final String street) {
- this.street = street;
+ public void setPersonalTitle (final PersonalTitle personalTitle) {
+ this.personalTitle = personalTitle;
}
@Override
- public String getTitle () {
- return this.title;
+ public String getStreet () {
+ return this.street;
}
@Override
- public void setTitle (final String title) {
- this.title = title;
+ public void setStreet (final String street) {
+ this.street = street;
}
@Override
}
@Override
- public boolean isGenderRequired () {
+ public boolean isPersonalTitleRequired () {
// Get context parameter
- String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_admin_gender_enabled"); //NOI18N
+ String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_admin_personal_title_enabled"); //NOI18N
// Is it set?
boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
private void clear () {
// Clear all data
// - personal data
- this.setTitle(null);
+ this.setAcademicTitle(null);
this.setFirstName(null);
this.setFamilyName(null);
this.setStreet(null);
}
// Update all fields
- contact.setContactGender(this.getGender());
- contact.setContactTitle(this.getTitle());
+ contact.setContactPersonalTitle(this.getPersonalTitle());
+ contact.setContactTitle(this.getAcademicTitle());
contact.setContactFirstName(this.getFirstName());
contact.setContactFamilyName(this.getFamilyName());
contact.setContactStreet(this.getStreet());