diff options
| author | Jesse Morgan <jesse@jesterpm.net> | 2016-04-06 21:25:41 -0700 | 
|---|---|---|
| committer | Jesse Morgan <jesse@jesterpm.net> | 2016-04-06 21:26:19 -0700 | 
| commit | 624e5d995c2fa593fb517a99e4b8b5f775afbeaf (patch) | |
| tree | c6080ebbf909fb45fb055930abe64bbfb62a41f0 /src/main/java/com/p4square/ccbapi/model | |
| parent | 7367968483e4ddfedfa47598c508b343b44fc852 (diff) | |
Adding getLookupTable API.
Diffstat (limited to 'src/main/java/com/p4square/ccbapi/model')
5 files changed, 179 insertions, 0 deletions
| diff --git a/src/main/java/com/p4square/ccbapi/model/CustomField.java b/src/main/java/com/p4square/ccbapi/model/CustomField.java index c9917e4..5b52bb3 100644 --- a/src/main/java/com/p4square/ccbapi/model/CustomField.java +++ b/src/main/java/com/p4square/ccbapi/model/CustomField.java @@ -71,4 +71,13 @@ public class CustomField {      public void setAdminOnly(boolean adminOnly) {          this.adminOnly = adminOnly;      } + +    @Override +    public String toString() { +        return "CustomField::{" + +                "name='" + name + '\'' + +                ", label='" + label + '\'' + +                ", adminOnly=" + adminOnly + +                '}'; +    }  } diff --git a/src/main/java/com/p4square/ccbapi/model/GetLookupTableRequest.java b/src/main/java/com/p4square/ccbapi/model/GetLookupTableRequest.java new file mode 100644 index 0000000..4da877e --- /dev/null +++ b/src/main/java/com/p4square/ccbapi/model/GetLookupTableRequest.java @@ -0,0 +1,27 @@ +package com.p4square.ccbapi.model; + +/** + * GetLookupTableRequest contains the information necessary to get a list of lookup table values. + */ +public class GetLookupTableRequest { + +    private LookupTableType type; + +    public LookupTableType getType() { +        return type; +    } + +    /** +     * Specify the type of lookup table to query. +     * +     * @param type A non-null lookup table type. +     * @return this +     */ +    public GetLookupTableRequest withType(final LookupTableType type) { +        if (type == null) { +            throw new IllegalArgumentException("type may not be null."); +        } +        this.type = type; +        return this; +    } +} diff --git a/src/main/java/com/p4square/ccbapi/model/GetLookupTableResponse.java b/src/main/java/com/p4square/ccbapi/model/GetLookupTableResponse.java new file mode 100644 index 0000000..e1feb1e --- /dev/null +++ b/src/main/java/com/p4square/ccbapi/model/GetLookupTableResponse.java @@ -0,0 +1,37 @@ +package com.p4square.ccbapi.model; + +import javax.xml.bind.annotation.*; +import java.util.ArrayList; +import java.util.List; + +/** + * A GetLookupTableResponse contains a list of lookup table values. + */ +@XmlRootElement(name="response") +@XmlAccessorType(XmlAccessType.NONE) +public class GetLookupTableResponse extends CCBAPIResponse { + +    @XmlElementWrapper(name = "items") +    @XmlElement(name="item") +    private List<LookupTableItem> items; + +    public GetLookupTableResponse() { +        items = new ArrayList<>(); +    } + +    /** +     * @return The list of items in the lookup table. +     */ +    public List<LookupTableItem> getItems() { +        return items; +    } + +    /** +     * Set the list of lookup table items. +     * +     * @param items  The list of items in the lookup table. +     */ +    public void setItems(final List<LookupTableItem> items) { +        this.items = items; +    } +}
\ No newline at end of file diff --git a/src/main/java/com/p4square/ccbapi/model/LookupTableItem.java b/src/main/java/com/p4square/ccbapi/model/LookupTableItem.java new file mode 100644 index 0000000..07b39eb --- /dev/null +++ b/src/main/java/com/p4square/ccbapi/model/LookupTableItem.java @@ -0,0 +1,59 @@ +package com.p4square.ccbapi.model; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * LookupTableItem is the definition of an item in a pulldown list. + */ +@XmlRootElement(name="item") +@XmlAccessorType(XmlAccessType.NONE) +public class LookupTableItem { + +    @XmlElement +    private int id; + +    @XmlElement +    private int order; + +    @XmlElement +    private String name; + +    public int getId() { +        return id; +    } + +    public LookupTableItem setId(final int id) { +        this.id = id; +        return this; +    } + +    public int getOrder() { +        return order; +    } + +    public LookupTableItem setOrder(final int order) { +        this.order = order; +        return this; +    } + +    public String getName() { +        return name; +    } + +    public LookupTableItem setName(final String name) { +        this.name = name; +        return this; +    } + +    @Override +    public String toString() { +        return "LookupTableItem::{" + +                "id=" + id + +                ", order=" + order + +                ", name='" + name + '\'' + +                '}'; +    } +} diff --git a/src/main/java/com/p4square/ccbapi/model/LookupTableType.java b/src/main/java/com/p4square/ccbapi/model/LookupTableType.java new file mode 100644 index 0000000..e80abde --- /dev/null +++ b/src/main/java/com/p4square/ccbapi/model/LookupTableType.java @@ -0,0 +1,47 @@ +package com.p4square.ccbapi.model; + +/** + * A collection of lookup table types supported by CCB. + */ +public enum LookupTableType { +    ABILITY, +    ACTIVITY, +    AGE_BRACKET, +    AREA, +    CHURCH_SERVICE, +    DEPARTMENT, +    EVENT_GROUPING, +    GIFT, +    GROUP_GROUPING, +    GROUP_TYPE, +    HOW_JOINED_CHURCH, +    HOW_THEY_HEARD, +    MEET_DAY, +    MEET_TIME, +    MEMBERSHIP_TYPE, +    PASSION, +    REASON_LEFT_CHURCH, +    SCHOOL, +    SCHOOL_GRADE, +    SIGNIFICANT_EVENT, +    SPIRITUAL_MATURITY, +    STYLE, +    TRANSACTION_GROUPING, +    UDF_GRP_PULLDOWN_1, +    UDF_GRP_PULLDOWN_2, +    UDF_GRP_PULLDOWN_3, +    UDF_IND_PULLDOWN_1, +    UDF_IND_PULLDOWN_2, +    UDF_IND_PULLDOWN_3, +    UDF_IND_PULLDOWN_4, +    UDF_IND_PULLDOWN_5, +    UDF_IND_PULLDOWN_6, +    UDF_RESOURCE_PULLDOWN_1; + +    /** +     * @return the identifier used by the CCB API. +     */ +    public String getIdentifier() { +        return toString().toLowerCase(); +    } +} | 
