View Javadoc
1   package org.kuali.ole.deliver.bo;
2   
3   import org.apache.commons.collections.CollectionUtils;
4   import org.kuali.ole.deliver.api.OlePatronAffiliationContract;
5   import org.kuali.ole.deliver.api.OlePatronAffiliationDefinition;
6   import org.kuali.rice.kim.api.identity.employment.EntityEmployment;
7   import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationBo;
8   import org.kuali.rice.kim.impl.identity.affiliation.EntityAffiliationTypeBo;
9   import org.kuali.rice.kim.impl.identity.employment.EntityEmploymentBo;
10  import org.kuali.rice.krad.bo.BusinessObjectBase;
11  
12  import java.util.ArrayList;
13  import java.util.List;
14  
15  /**
16   * OlePatronAffiliation provides OlePatronAffiliation information through getter and setter.
17   */
18  public class OlePatronAffiliation extends BusinessObjectBase implements OlePatronAffiliationContract {
19  
20      private String entityAffiliationId;
21  
22      private String entityId;
23  
24      private String affiliationTypeCode;
25  
26      private String campusCode;
27  
28      private boolean defaultValue;
29  
30      private boolean active;
31  
32      private EntityAffiliationTypeBo affiliationType = new EntityAffiliationTypeBo();
33  
34      private List<EntityEmploymentBo> employments = new ArrayList<EntityEmploymentBo>();
35  
36      private Long versionNumber;
37  
38      private String objectId;
39  
40      public OlePatronAffiliation() {
41  
42      }
43  
44      /**
45       * Constructor sets the values to entityAffiliationBo object from OlePatronAffiliation
46       *
47       * @param entityAffiliationBo
48       */
49      public OlePatronAffiliation(EntityAffiliationBo entityAffiliationBo) {
50          this.setEntityAffiliationId(entityAffiliationBo.getId());
51          this.setAffiliationTypeCode(entityAffiliationBo.getAffiliationTypeCode());
52          this.setAffiliationType(entityAffiliationBo.getAffiliationType());
53          this.setCampusCode(entityAffiliationBo.getCampusCode());
54          this.setDefaultValue(entityAffiliationBo.getDefaultValue());
55          this.setActive(entityAffiliationBo.getActive());
56          this.setVersionNumber(entityAffiliationBo.getVersionNumber());
57          this.setObjectId(entityAffiliationBo.getObjectId());
58      }
59  
60      /**
61       * Gets the value of entityAffiliationId property
62       *
63       * @return entityAffiliationId
64       */
65      public String getEntityAffiliationId() {
66          return entityAffiliationId;
67      }
68  
69      /**
70       * Sets the value for entityAffiliationId property
71       *
72       * @param entityAffiliationId
73       */
74      public void setEntityAffiliationId(String entityAffiliationId) {
75          this.entityAffiliationId = entityAffiliationId;
76      }
77  
78      /**
79       * Gets the value of affiliationTypeCode property
80       *
81       * @return affiliationTypeCode
82       */
83      public String getAffiliationTypeCode() {
84          return affiliationTypeCode;
85      }
86  
87      /**
88       * Sets the value for affiliationTypeCode property
89       *
90       * @param affiliationTypeCode
91       */
92      public void setAffiliationTypeCode(String affiliationTypeCode) {
93          this.affiliationTypeCode = affiliationTypeCode;
94      }
95  
96      /**
97       * Gets the value of campusCode property
98       *
99       * @return campusCode
100      */
101     public String getCampusCode() {
102         return campusCode;
103     }
104 
105     /**
106      * Sets the value for campusCode property
107      *
108      * @param campusCode
109      */
110     public void setCampusCode(String campusCode) {
111         this.campusCode = campusCode;
112     }
113 
114     /**
115      * Gets the value of defaultValue property
116      *
117      * @return defaultValue
118      */
119     public boolean isDefaultValue() {
120         return defaultValue;
121     }
122 
123     /**
124      * Sets the value for defaultValue property
125      *
126      * @param defaultValue
127      */
128     public void setDefaultValue(boolean defaultValue) {
129         this.defaultValue = defaultValue;
130     }
131 
132     /**
133      * Gets the value of active property
134      *
135      * @return active
136      */
137     public boolean isActive() {
138         return active;
139     }
140 
141     /**
142      * Sets the value for active property
143      *
144      * @param active
145      */
146     public void setActive(boolean active) {
147         this.active = active;
148     }
149 
150     /**
151      * Gets the value of affiliationType property
152      *
153      * @return affiliationType
154      */
155     public EntityAffiliationTypeBo getAffiliationType() {
156         return affiliationType;
157     }
158 
159     /**
160      * Sets the value for affiliationType property
161      *
162      * @param affiliationType
163      */
164     public void setAffiliationType(EntityAffiliationTypeBo affiliationType) {
165         this.affiliationType = affiliationType;
166     }
167 
168     /**
169      * Gets the value of employments property
170      *
171      * @return employments
172      */
173     public List<EntityEmploymentBo> getEmployments() {
174         return employments;
175     }
176 
177     /**
178      * Sets the value for employments property
179      *
180      * @param employments
181      */
182     public void setEmployments(List<EntityEmploymentBo> employments) {
183         this.employments = employments;
184     }
185 
186     /**
187      * Gets the value of EntityAffiliation property
188      *
189      * @return EntityAffiliation
190      */
191     public EntityAffiliationBo getEntityAffliationBo() {
192         EntityAffiliationBo entityAffiliationBo = new EntityAffiliationBo();
193         entityAffiliationBo.setId(this.getEntityAffiliationId());
194         entityAffiliationBo.setAffiliationTypeCode(this.getAffiliationTypeCode());
195         entityAffiliationBo.setAffiliationType(this.getAffiliationType());
196         entityAffiliationBo.setActive(this.isActive());
197         entityAffiliationBo.setDefaultValue(this.defaultValue);
198         entityAffiliationBo.setCampusCode(this.getCampusCode());
199         entityAffiliationBo.setObjectId(this.getObjectId());
200         entityAffiliationBo.setVersionNumber(this.getVersionNumber());
201         entityAffiliationBo.setEntityId(this.getEntityId());
202         return entityAffiliationBo;
203     }
204 
205     /**
206      * This method converts the PersistableBusinessObjectBase OleBorrowerType into immutable object OlePatronAffiliationDefinition
207      *
208      * @param bo(OlePatronAffiliation)
209      * @return OlePatronAffiliationDefinition
210      */
211     static OlePatronAffiliationDefinition to(OlePatronAffiliation bo) {
212         if (bo == null) {
213             return null;
214         }
215         return OlePatronAffiliationDefinition.Builder.create(bo).build();
216     }
217 
218     /**
219      * This method converts the immutable object OlePatronAffiliationDefinition into PersistableBusinessObjectBase OlePatronAffiliation
220      *
221      * @param im(OlePatronAffiliationDefinition)
222      *
223      * @return bo(OlePatronAffiliation)
224      */
225     static OlePatronAffiliation from(OlePatronAffiliationDefinition im) {
226         if (im == null) {
227             return null;
228         }
229 
230         OlePatronAffiliation bo = new OlePatronAffiliation();
231         bo.entityAffiliationId = im.getEntityAffiliationId();
232         bo.affiliationTypeCode = im.getAffiliationTypeCode();
233         if (im.getAffiliationType() != null) {
234             bo.affiliationType = EntityAffiliationTypeBo.from(im.getAffiliationType());
235         }
236         bo.defaultValue = im.isDefaultValue();
237         bo.active = im.isActive();
238         bo.versionNumber = im.getVersionNumber();
239         bo.entityId = im.getEntityId();
240         bo.objectId = im.getObjectId();
241 
242         if (CollectionUtils.isNotEmpty(im.getEmployments())) {
243             for (EntityEmployment entityEmployment : im.getEmployments()) {
244                 bo.employments.add(EntityEmploymentBo.from(entityEmployment));
245             }
246         }
247         return bo;
248     }
249 
250     @Override
251     public void refresh() {
252         //To change body of implemented methods use File | Settings | File Templates.
253     }
254 
255     /**
256      * Gets the value of entityAffiliationId property
257      *
258      * @return entityAffiliationId
259      */
260     @Override
261     public String getId() {
262         return this.entityAffiliationId;
263     }
264 
265     /**
266      * Gets the value of versionNumber property
267      *
268      * @return versionNumber
269      */
270     @Override
271     public Long getVersionNumber() {
272         return this.versionNumber;
273     }
274 
275     /**
276      * Sets the value for versionNumber property
277      *
278      * @param versionNumber
279      */
280     public void setVersionNumber(Long versionNumber) {
281         this.versionNumber = versionNumber;
282     }
283 
284     /**
285      * Gets the value of objectId property
286      *
287      * @return objectId
288      */
289     public String getObjectId() {
290         return objectId;
291     }
292 
293     /**
294      * Sets the value for objectId property
295      *
296      * @param objectId
297      */
298     public void setObjectId(String objectId) {
299         this.objectId = objectId;
300     }
301 
302     /**
303      * Gets the value of entityId property
304      *
305      * @return entityId
306      */
307     public String getEntityId() {
308         return entityId;
309     }
310 
311     /**
312      * Sets the value for entityId property
313      *
314      * @param entityId
315      */
316     public void setEntityId(String entityId) {
317         this.entityId = entityId;
318     }
319 }