View Javadoc

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