View Javadoc
1   package org.kuali.ole.deliver.bo;
2   
3   import org.kuali.ole.deliver.api.OleAddressContract;
4   import org.kuali.ole.deliver.api.OleAddressDefinition;
5   import org.kuali.rice.kim.impl.identity.address.EntityAddressBo;
6   import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
7   
8   import java.util.Date;
9   
10  /**
11   * OleAddressBo provides OleAddressBo information through getter and setter.
12   */
13  public class OleAddressBo extends PersistableBusinessObjectBase implements OleAddressContract {
14  
15      private String oleAddressId;
16      private String olePatronId;
17      private String id;
18      private boolean addressVerified;
19      private Date addressValidFrom;
20      private Date addressValidTo;
21      private String addressSource;
22      private String oleAddressSourceName;
23      private OleAddressSourceBo addressSourceBo = new OleAddressSourceBo();
24      private EntityAddressBo entityAddress;
25      private OlePatronDocument olePatronDocument;
26      private boolean deliverAddress;
27  
28      public OleAddressBo() {
29          this.setAddressVerified(true);
30      }
31  
32      /**
33       * Gets the value of olePatronDocument property
34       *
35       * @return olePatronDocument
36       */
37      public OlePatronDocument getOlePatronDocument() {
38          return olePatronDocument;
39      }
40  
41      /**
42       * Sets the value for olePatronDocument property
43       *
44       * @param olePatronDocument
45       */
46      public void setOlePatronDocument(OlePatronDocument olePatronDocument) {
47          this.olePatronDocument = olePatronDocument;
48      }
49  
50      /**
51       * Gets the value of oleAddressId property
52       *
53       * @return oleAddressId
54       */
55      public String getOleAddressId() {
56          return oleAddressId;
57      }
58  
59      /**
60       * Sets the value for oleAddressId property
61       *
62       * @param oleAddressId
63       */
64      public void setOleAddressId(String oleAddressId) {
65          this.oleAddressId = oleAddressId;
66      }
67  
68      /**
69       * Gets the value of addressVerified property
70       *
71       * @return addressVerified
72       */
73      public boolean isAddressVerified() {
74          return addressVerified;
75      }
76  
77      /**
78       * Sets the value for addressVerified property
79       *
80       * @param addressVerified
81       */
82      public void setAddressVerified(boolean addressVerified) {
83          this.addressVerified = addressVerified;
84      }
85  
86      /**
87       * Gets the value of olePatronId property
88       *
89       * @return olePatronId
90       */
91      public String getOlePatronId() {
92          return olePatronId;
93      }
94  
95      /**
96       * Sets the value for olePatronId property
97       *
98       * @param olePatronId
99       */
100     public void setOlePatronId(String olePatronId) {
101         this.olePatronId = olePatronId;
102     }
103 
104     /**
105      * Gets the value of addressValidFrom property
106      *
107      * @return addressValidFrom
108      */
109     public Date getAddressValidFrom() {
110         return addressValidFrom;
111     }
112 
113     /**
114      * Sets the value for addressValidFrom property
115      *
116      * @param addressValidFrom
117      */
118     public void setAddressValidFrom(Date addressValidFrom) {
119         this.addressValidFrom = addressValidFrom;
120     }
121 
122     /**
123      * Gets the value of addressValidTo property
124      *
125      * @return addressValidTo
126      */
127     public Date getAddressValidTo() {
128         return addressValidTo;
129     }
130 
131     /**
132      * Sets the value for addressValidTo property
133      *
134      * @param addressValidTo
135      */
136     public void setAddressValidTo(Date addressValidTo) {
137         this.addressValidTo = addressValidTo;
138     }
139 
140     /**
141      * Gets the value of addressSource property
142      *
143      * @return addressSource
144      */
145     public String getAddressSource() {
146         return addressSource;
147     }
148 
149     /**
150      * Sets the value for addressSource property
151      *
152      * @param addressSource
153      */
154     public void setAddressSource(String addressSource) {
155         this.addressSource = addressSource;
156     }
157 
158     /**
159      * Gets the value of addressSourceBo property
160      *
161      * @return addressSourceBo
162      */
163     public OleAddressSourceBo getAddressSourceBo() {
164         return addressSourceBo;
165     }
166 
167     /**
168      * Sets the value for addressSourceBo property
169      *
170      * @param addressSourceBo
171      */
172     public void setAddressSourceBo(OleAddressSourceBo addressSourceBo) {
173         this.addressSourceBo = addressSourceBo;
174     }
175 
176     /**
177      * Gets the value of entityAddress property
178      *
179      * @return entityAddress
180      */
181     public EntityAddressBo getEntityAddress() {
182         return entityAddress;
183     }
184 
185     /**
186      * Sets the value for entityAddress property
187      *
188      * @param entityAddress
189      */
190     public void setEntityAddress(EntityAddressBo entityAddress) {
191         this.entityAddress = entityAddress;
192     }
193 
194     /**
195      * Gets the value of addressSourceBo property
196      *
197      * @return addressSourceBo
198      */
199     public String getOleAddressSourceName() {
200         if (addressSourceBo != null) {
201             return addressSourceBo.getOleAddressSourceName();
202         }
203         return null;
204 
205     }
206 
207     /**
208      * This method converts the PersistableBusinessObjectBase OleAddressBo into immutable object OleAddressDefinition
209      *
210      * @param bo
211      * @return OleAddressDefinition
212      */
213     public static OleAddressDefinition to(org.kuali.ole.deliver.bo.OleAddressBo bo) {
214         if (bo == null) {
215             return null;
216         }
217         return OleAddressDefinition.Builder.create(bo).build();
218     }
219 
220     /**
221      * This method converts the immutable object OleAddressDefinition into PersistableBusinessObjectBase OleAddressBo
222      *
223      * @param imOleAddressDefinition
224      * @return bo
225      */
226     public static org.kuali.ole.deliver.bo.OleAddressBo from(OleAddressDefinition imOleAddressDefinition) {
227         if (imOleAddressDefinition == null) {
228             return null;
229         }
230 
231         org.kuali.ole.deliver.bo.OleAddressBo bo = new org.kuali.ole.deliver.bo.OleAddressBo();
232         bo.oleAddressId = imOleAddressDefinition.getOleAddressId();
233         bo.olePatronId = imOleAddressDefinition.getOlePatronId();
234         //bo.olePatron = OlePatronDocument.from(im.getOlePatron());
235         bo.id = imOleAddressDefinition.getId();
236         bo.addressVerified = imOleAddressDefinition.isAddressVerified();
237         bo.addressValidFrom = imOleAddressDefinition.getAddressValidFrom();
238         bo.addressValidTo = imOleAddressDefinition.getAddressValidTo();
239         bo.addressSource = imOleAddressDefinition.getAddressSource();
240         bo.versionNumber = imOleAddressDefinition.getVersionNumber();
241         bo.deliverAddress = imOleAddressDefinition.isDeliverAddress();
242         /*if (im.getEntityAddress() != null) {
243             bo.entityAddress = EntityAddressBo.from(im.getEntityAddress());
244         }*/
245         if (imOleAddressDefinition.getAddressSourceBo() != null) {
246             bo.addressSourceBo = OleAddressSourceBo.from(imOleAddressDefinition.getAddressSourceBo());
247         }
248 
249         return bo;
250     }
251 
252     /**
253      * Gets the value of id property
254      *
255      * @return id
256      */
257     public String getId() {
258         return id;
259     }
260 
261     /**
262      * Sets the value for id property
263      *
264      * @param id
265      */
266     public void setId(String id) {
267         this.id = id;
268     }
269 
270     public boolean isDeliverAddress() {
271         return deliverAddress;
272     }
273 
274     public void setDeliverAddress(boolean deliverAddress) {
275         this.deliverAddress = deliverAddress;
276     }
277 }