summaryrefslogtreecommitdiff
path: root/src/main/java/com/p4square/ccbapi/model/UpdateIndividualProfileRequest.java
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2016-03-27 08:02:14 -0700
committerJesse Morgan <jesse@jesterpm.net>2016-03-27 08:02:14 -0700
commit6d987e0dd18ef830484641166a816661f4b16074 (patch)
treeeffaccb0a85cebca64e39ea8aa4545d59306cfc6 /src/main/java/com/p4square/ccbapi/model/UpdateIndividualProfileRequest.java
parentf4cb9e6a44c016c0200a9291f25003c72e2551cd (diff)
Adding the update_individual API
Diffstat (limited to 'src/main/java/com/p4square/ccbapi/model/UpdateIndividualProfileRequest.java')
-rw-r--r--src/main/java/com/p4square/ccbapi/model/UpdateIndividualProfileRequest.java378
1 files changed, 378 insertions, 0 deletions
diff --git a/src/main/java/com/p4square/ccbapi/model/UpdateIndividualProfileRequest.java b/src/main/java/com/p4square/ccbapi/model/UpdateIndividualProfileRequest.java
new file mode 100644
index 0000000..613b678
--- /dev/null
+++ b/src/main/java/com/p4square/ccbapi/model/UpdateIndividualProfileRequest.java
@@ -0,0 +1,378 @@
+package com.p4square.ccbapi.model;
+
+import java.time.LocalDate;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * UpdateIndividualProfileRequest encapsulates a change to an IndividualProfile.
+ *
+ * The only property which must be set is {@link #withIndividualId(int)},
+ * to indicate the profile to update.
+ *
+ * A property can be unset by setting it to null.
+ */
+public class UpdateIndividualProfileRequest {
+
+ /**
+ * The set of all valid custom text field names.
+ */
+ public static final Set<String> CUSTOM_TEXT_FIELD_NAMES =
+ IntStream.rangeClosed(1, 12).mapToObj(x -> "udf_text_" + x).collect(Collectors.toSet());
+
+ /**
+ * The set of all valid custom date field names.
+ */
+ public static final Set<String> CUSTOM_DATE_FIELD_NAMES =
+ IntStream.rangeClosed(1, 6).mapToObj(x -> "udf_date_" + x).collect(Collectors.toSet());
+
+ /**
+ * The set of all valid custom pulldown field names.
+ */
+ public static final Set<String> CUSTOM_PULLDOWN_FIELD_NAMES =
+ IntStream.rangeClosed(1, 6).mapToObj(x -> "udf_pulldown_" + x).collect(Collectors.toSet());
+
+ private int individualId;
+
+ private Integer syncId;
+ private String otherId;
+ private String givingNumber;
+
+ private String firstName;
+ private String lastName;
+ private String middleName;
+ private String legalFirstName;
+ private String salutation;
+ private String suffix;
+
+ private Integer familyId;
+
+ private FamilyPosition familyPosition;
+
+ private MaritalStatus maritalStatus;
+
+ private Gender gender;
+ private LocalDate birthday;
+ private LocalDate anniversary;
+ private LocalDate deceased;
+ private LocalDate membershipDate;
+ private LocalDate membershipEnd;
+
+ private String email;
+
+ private List<Address> addresses;
+ private List<Phone> phones;
+
+ private String emergencyContactName;
+ private String allergies;
+ private Boolean confirmedNoAllergies;
+ private Boolean baptized;
+
+ private Map<String, String> customTextFields = new HashMap<>();
+ private Map<String, LocalDate> customDateFields = new HashMap<>();
+ private Map<String, Integer> customPulldownFields = new HashMap<>();
+
+ private Integer modifiedById;
+
+ public int getIndividualId() {
+ return individualId;
+ }
+
+ public UpdateIndividualProfileRequest withIndividualId(int individualId) {
+ this.individualId = individualId;
+ return this;
+ }
+
+ public Integer getSyncId() {
+ return syncId;
+ }
+
+ public UpdateIndividualProfileRequest withSyncId(Integer syncId) {
+ this.syncId = syncId;
+ return this;
+ }
+
+ public String getOtherId() {
+ return otherId;
+ }
+
+ public UpdateIndividualProfileRequest withOtherId(String otherId) {
+ this.otherId = otherId;
+ return this;
+ }
+
+ public String getGivingNumber() {
+ return givingNumber;
+ }
+
+ public UpdateIndividualProfileRequest withGivingNumber(String givingNumber) {
+ this.givingNumber = givingNumber;
+ return this;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public UpdateIndividualProfileRequest withFirstName(String firstName) {
+ this.firstName = firstName;
+ return this;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public UpdateIndividualProfileRequest withLastName(String lastName) {
+ this.lastName = lastName;
+ return this;
+ }
+
+ public String getMiddleName() {
+ return middleName;
+ }
+
+ public UpdateIndividualProfileRequest withMiddleName(String middleName) {
+ this.middleName = middleName;
+ return this;
+ }
+
+ public String getLegalFirstName() {
+ return legalFirstName;
+ }
+
+ public UpdateIndividualProfileRequest withLegalFirstName(String legalFirstName) {
+ this.legalFirstName = legalFirstName;
+ return this;
+ }
+
+ public String getSalutation() {
+ return salutation;
+ }
+
+ public UpdateIndividualProfileRequest withSalutation(String salutation) {
+ this.salutation = salutation;
+ return this;
+ }
+
+ public String getSuffix() {
+ return suffix;
+ }
+
+ public UpdateIndividualProfileRequest withSuffix(String suffix) {
+ this.suffix = suffix;
+ return this;
+ }
+
+ public Integer getFamilyId() {
+ return familyId;
+ }
+
+ public UpdateIndividualProfileRequest withFamilyId(Integer familyId) {
+ this.familyId = familyId;
+ return this;
+ }
+
+ public FamilyPosition getFamilyPosition() {
+ return familyPosition;
+ }
+
+ public UpdateIndividualProfileRequest withFamilyPosition(FamilyPosition familyPosition) {
+ this.familyPosition = familyPosition;
+ return this;
+ }
+
+ public MaritalStatus getMaritalStatus() {
+ return maritalStatus;
+ }
+
+ public UpdateIndividualProfileRequest withMaritalStatus(MaritalStatus maritalStatus) {
+ this.maritalStatus = maritalStatus;
+ return this;
+ }
+
+ public Gender getGender() {
+ return gender;
+ }
+
+ public UpdateIndividualProfileRequest withGender(Gender gender) {
+ this.gender = gender;
+ return this;
+ }
+
+ public LocalDate getBirthday() {
+ return birthday;
+ }
+
+ public UpdateIndividualProfileRequest withBirthday(LocalDate birthday) {
+ this.birthday = birthday;
+ return this;
+ }
+
+ public LocalDate getAnniversary() {
+ return anniversary;
+ }
+
+ public UpdateIndividualProfileRequest withAnniversary(LocalDate anniversary) {
+ this.anniversary = anniversary;
+ return this;
+ }
+
+ public LocalDate getDeceased() {
+ return deceased;
+ }
+
+ public UpdateIndividualProfileRequest withDeceased(LocalDate deceased) {
+ this.deceased = deceased;
+ return this;
+ }
+
+ public LocalDate getMembershipDate() {
+ return membershipDate;
+ }
+
+ public UpdateIndividualProfileRequest withMembershipDate(LocalDate membershipDate) {
+ this.membershipDate = membershipDate;
+ return this;
+ }
+
+ public LocalDate getMembershipEnd() {
+ return membershipEnd;
+ }
+
+ public UpdateIndividualProfileRequest withMembershipEnd(LocalDate membershipEnd) {
+ this.membershipEnd = membershipEnd;
+ return this;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public UpdateIndividualProfileRequest withEmail(String email) {
+ this.email = email;
+ return this;
+ }
+
+ public List<Address> getAddresses() {
+ return addresses;
+ }
+
+ public UpdateIndividualProfileRequest withAddresses(List<Address> addresses) {
+ this.addresses = addresses;
+ return this;
+ }
+
+ public List<Phone> getPhones() {
+ return phones;
+ }
+
+ public UpdateIndividualProfileRequest withPhones(List<Phone> phones) {
+ this.phones = phones;
+ return this;
+ }
+
+ public String getEmergencyContactName() {
+ return emergencyContactName;
+ }
+
+ public UpdateIndividualProfileRequest withEmergencyContactName(String emergencyContactName) {
+ this.emergencyContactName = emergencyContactName;
+ return this;
+ }
+
+ public String getAllergies() {
+ return allergies;
+ }
+
+ public UpdateIndividualProfileRequest withAllergies(String allergies) {
+ this.allergies = allergies;
+ return this;
+ }
+
+ public Boolean getConfirmedNoAllergies() {
+ return confirmedNoAllergies;
+ }
+
+ public UpdateIndividualProfileRequest withConfirmedNoAllergies(Boolean confirmedNoAllergies) {
+ this.confirmedNoAllergies = confirmedNoAllergies;
+ return this;
+ }
+
+ public Boolean getBaptized() {
+ return baptized;
+ }
+
+ public UpdateIndividualProfileRequest withBaptized(Boolean baptized) {
+ this.baptized = baptized;
+ return this;
+ }
+
+ /**
+ * @return A map of custom field identifiers to text field values.
+ */
+ public Map<String, String> getCustomTextFields() {
+ return customTextFields;
+ }
+
+ public UpdateIndividualProfileRequest withCustomTextField(final String name, final String value) {
+ if (!CUSTOM_TEXT_FIELD_NAMES.contains(name)) {
+ throw new IllegalArgumentException(name + " is not a valid a valid text field name.");
+ }
+ customTextFields.put(name, value);
+ return this;
+ }
+
+ public UpdateIndividualProfileRequest withCustomTextField(final int number, final String value) {
+ return withCustomTextField("udf_text_" + number, value);
+ }
+
+ /**
+ * @return A map of custom field identifiers to date field values.
+ */
+ public Map<String, LocalDate> getCustomDateFields() {
+ return customDateFields;
+ }
+
+ public UpdateIndividualProfileRequest withCustomDateField(final String name, final LocalDate value) {
+ if (!CUSTOM_DATE_FIELD_NAMES.contains(name)) {
+ throw new IllegalArgumentException(name + " is not a valid a valid date field name.");
+ }
+ customDateFields.put(name, value);
+ return this;
+ }
+
+ public UpdateIndividualProfileRequest withCustomDateField(final int number, final LocalDate value) {
+ return withCustomDateField("udf_date_" + number, value);
+ }
+
+ /**
+ * @return A map of custom field identifiers to pulldown field values.
+ */
+ public Map<String, Integer> getCustomPulldownFields() {
+ return customPulldownFields;
+ }
+
+ public UpdateIndividualProfileRequest withCustomPulldownField(final String name, final Integer value) {
+ if (!CUSTOM_PULLDOWN_FIELD_NAMES.contains(name)) {
+ throw new IllegalArgumentException(name + " is not a valid a valid pulldown field name.");
+ }
+ customPulldownFields.put(name, value);
+ return this;
+ }
+
+ public UpdateIndividualProfileRequest withCustomPulldownField(final int number, final Integer value) {
+ return withCustomPulldownField("udf_pulldown_" + number, value);
+ }
+
+ public Integer getModifiedById() {
+ return modifiedById;
+ }
+
+ public UpdateIndividualProfileRequest withModifiedById(Integer modifiedById) {
+ this.modifiedById = modifiedById;
+ return this;
+ }
+
+}