View Javadoc
1   package org.kuali.ole.deliver.api;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.kuali.rice.core.api.CoreConstants;
5   import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
6   import org.kuali.rice.core.api.mo.ModelBuilder;
7   import org.kuali.rice.kim.api.KimConstants;
8   import org.w3c.dom.Element;
9   
10  import javax.xml.bind.annotation.*;
11  import java.io.Serializable;
12  import java.util.Collection;
13  
14  /**
15   * Created with IntelliJ IDEA.
16   * User: ?
17   * Date: 5/24/12
18   * Time: 8:26 PM
19   * To change this template use File | Settings | File Templates.
20   */
21  @XmlRootElement(name = org.kuali.ole.deliver.api.OlePatronLocalIdentificationDefinition.Constants.ROOT_ELEMENT_NAME)
22  @XmlAccessorType(XmlAccessType.NONE)
23  @XmlType(name = org.kuali.ole.deliver.api.OlePatronLocalIdentificationDefinition.Constants.TYPE_NAME, propOrder = {
24          org.kuali.ole.deliver.api.OlePatronLocalIdentificationDefinition.Elements.OLE_PTRN_LOCAL_SEQ_ID,
25          org.kuali.ole.deliver.api.OlePatronLocalIdentificationDefinition.Elements.OLE_PTRN_ID,
26          org.kuali.ole.deliver.api.OlePatronLocalIdentificationDefinition.Elements.LOCAL_ID,
27          //OlePatronDefinition.Elements.OLE_BORROWER_TYPE,
28          //OlePatronDefinition.Elements.ENTITY,
29  
30          CoreConstants.CommonElements.VERSION_NUMBER,
31          CoreConstants.CommonElements.OBJECT_ID,
32          CoreConstants.CommonElements.FUTURE_ELEMENTS
33  })
34  public class OlePatronLocalIdentificationDefinition extends AbstractDataTransferObject implements org.kuali.ole.deliver.api.OlePatronLocalIdentificationContract {
35  
36      private static final long serialVersionUID = 1L;
37  
38  
39      @XmlElement(name = Elements.OLE_PTRN_LOCAL_SEQ_ID, required = false)
40      private final String patronLocalSeqId;
41  
42      @XmlElement(name = Elements.OLE_PTRN_ID, required = false)
43      private final String olePatronId;
44  
45      @XmlElement(name = Elements.LOCAL_ID, required = false)
46      private final String localId;
47  
48      @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
49      private final Long versionNumber;
50  
51      @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
52      private final String objectId;
53  
54  
55      @SuppressWarnings("unused")
56      @XmlAnyElement
57      private final Collection<Element> _futureElements = null;
58  
59      public OlePatronLocalIdentificationDefinition() {
60          this.patronLocalSeqId = null;
61          this.olePatronId = null;
62          this.localId = null;
63          this.versionNumber = null;
64          this.objectId = null;
65      }
66  
67  
68      private OlePatronLocalIdentificationDefinition(Builder builder) {
69          this.patronLocalSeqId = builder.getPatronLocalSeqId();
70          this.olePatronId = builder.getOlePatronId();
71          this.localId = builder.getLocalId();
72          this.versionNumber = builder.getVersionNumber();
73          this.objectId = builder.getObjectId();
74      }
75  
76  
77      @Override
78      public String getPatronLocalSeqId() {
79          return this.patronLocalSeqId;
80      }
81  
82      @Override
83      public String getLocalId() {
84          return this.localId;
85      }
86  
87      @Override
88      public String getOlePatronId() {
89          return this.olePatronId;
90      }
91  
92      @Override
93      public String getObjectId() {
94          return this.objectId;
95      }
96  
97      @Override
98      public Long getVersionNumber() {
99          return this.versionNumber;
100     }
101 
102     @Override
103     public String getId() {
104         return this.patronLocalSeqId;
105     }
106 
107     public static class Builder
108             implements Serializable, ModelBuilder, org.kuali.ole.deliver.api.OlePatronLocalIdentificationContract {
109         private String patronLocalSeqId;
110         private String localId;
111         private String olePatronId;
112         private Long versionNumber;
113         private String objectId;
114 
115         private Builder() {
116         }
117 
118         public static Builder create() {
119             return new Builder();
120         }
121 
122         public static Builder create(OlePatronLocalIdentificationContract contract) {
123             if (contract == null) {
124                 throw new IllegalArgumentException("contract was null");
125             }
126             Builder builder = create();
127             if (contract.getPatronLocalSeqId() != null) {
128                 builder.setPatronLocalSeqId(contract.getPatronLocalSeqId());
129             }
130             if (contract.getLocalId() != null) {
131                 builder.setLocalId(contract.getLocalId());
132             }
133             if (contract.getOlePatronId() != null) {
134                 builder.setOlePatronId(contract.getOlePatronId());
135             }
136 
137             builder.setObjectId(contract.getObjectId());
138             builder.setVersionNumber(contract.getVersionNumber());
139             builder.setId(contract.getId());
140             return builder;
141         }
142 
143 
144         public org.kuali.ole.deliver.api.OlePatronLocalIdentificationDefinition build() {
145             return new org.kuali.ole.deliver.api.OlePatronLocalIdentificationDefinition(this);
146         }
147 
148         public String getPatronLocalSeqId() {
149             return patronLocalSeqId;
150         }
151 
152         public void setPatronLocalSeqId(String patronLocalSeqId) {
153             this.patronLocalSeqId = patronLocalSeqId;
154         }
155 
156         public String getLocalId() {
157             return localId;
158         }
159 
160         public void setLocalId(String localId) {
161             this.localId = localId;
162         }
163 
164         public String getOlePatronId() {
165             return this.olePatronId;
166         }
167 
168         public void setOlePatronId(String olePatronId) {
169             this.olePatronId = olePatronId;
170         }
171 
172         @Override
173         public String getId() {
174             return this.patronLocalSeqId;
175         }
176 
177 
178         public void setId(String id) {
179             if (StringUtils.isWhitespace(id)) {
180                 throw new IllegalArgumentException("id is blank");
181             }
182             this.patronLocalSeqId = id;
183         }
184 
185         public Long getVersionNumber() {
186             return this.versionNumber;
187         }
188 
189         public void setVersionNumber(Long versionNumber) {
190             this.versionNumber = versionNumber;
191         }
192 
193         public String getObjectId() {
194             return objectId;
195         }
196 
197         public void setObjectId(String objectId) {
198             this.objectId = objectId;
199         }
200     }
201 
202     static class Constants {
203 
204         final static String ROOT_ELEMENT_NAME = "olePatronLocalIdentification";
205         final static String TYPE_NAME = "OlePatronLocalIdentificationType";
206         final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[]{CoreConstants.CommonElements.FUTURE_ELEMENTS};
207     }
208 
209     static class Elements {
210         final static String OLE_PTRN_LOCAL_SEQ_ID = "patronLocalSeqId";
211         final static String LOCAL_ID = "localId";
212         final static String OLE_PTRN_ID = "olePatronId";
213     }
214 
215     public static class Cache {
216         public static final String NAME = KimConstants.Namespaces.KIM_NAMESPACE_2_0 + "/" + Constants.TYPE_NAME;
217     }
218 }