001package org.kuali.ole.deliver.bo; 002 003import org.apache.commons.lang3.StringUtils; 004import org.kuali.ole.deliver.api.OleProxyPatronContract; 005import org.kuali.ole.deliver.api.OleProxyPatronDefinition; 006import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; 007import org.kuali.rice.krad.service.KRADServiceLocator; 008 009import java.util.Date; 010import java.util.HashMap; 011import java.util.Map; 012 013/** 014 * OleProxyPatronDocument provides OleProxyPatronDocument information through getter and setter. 015 */ 016public class OleProxyPatronDocument extends PersistableBusinessObjectBase implements OleProxyPatronContract { 017 018 private String oleProxyPatronDocumentId; 019 private String proxyPatronId; 020 private String olePatronId; 021 private Date proxyPatronExpirationDate; 022 private Date proxyPatronActivationDate; 023 private boolean active; 024 025 private String proxyPatronBarcode; 026 private String proxyPatronFirstName; 027 private String proxyPatronLastName; 028 private String proxyForPatronFirstName; 029 private String proxyForPatronLastName; 030 //private OlePatronDocument proxyPatron; 031 private OlePatronDocument olePatronDocument; 032 033 /** 034 * Gets the value of proxyPatronBarcode property 035 * 036 * @return proxyPatronBarcode 037 */ 038 public String getProxyPatronBarcode() { 039 return proxyPatronBarcode; 040 } 041 042 /** 043 * Sets the value for proxyPatronBarcode property 044 * 045 * @param proxyPatronBarcode 046 */ 047 public void setProxyPatronBarcode(String proxyPatronBarcode) { 048 this.proxyPatronBarcode = proxyPatronBarcode; 049 } 050 051 /** 052 * Gets the value of proxyPatronFirstName property 053 * 054 * @return proxyPatronFirstName 055 */ 056 public String getProxyPatronFirstName() { 057 return proxyPatronFirstName; 058 } 059 060 /** 061 * Sets the value for proxyPatronFirstName property 062 * 063 * @param proxyPatronFirstName 064 */ 065 public void setProxyPatronFirstName(String proxyPatronFirstName) { 066 this.proxyPatronFirstName = proxyPatronFirstName; 067 } 068 069 /** 070 * Gets the value of proxyPatronLastName property 071 * 072 * @return proxyPatronLastName 073 */ 074 public String getProxyPatronLastName() { 075 return proxyPatronLastName; 076 } 077 078 /** 079 * Sets the value for proxyPatronLastName property 080 * 081 * @param proxyPatronLastName 082 */ 083 public void setProxyPatronLastName(String proxyPatronLastName) { 084 this.proxyPatronLastName = proxyPatronLastName; 085 } 086 087 /** 088 * Gets the value of oleProxyPatronDocumentId property 089 * 090 * @return oleProxyPatronDocumentId 091 */ 092 public String getOleProxyPatronDocumentId() { 093 return oleProxyPatronDocumentId; 094 } 095 096 /** 097 * Sets the value for oleProxyPatronDocumentId property 098 * 099 * @param oleProxyPatronDocumentId 100 */ 101 public void setOleProxyPatronDocumentId(String oleProxyPatronDocumentId) { 102 this.oleProxyPatronDocumentId = oleProxyPatronDocumentId; 103 } 104 105 /** 106 * Gets the value of proxyPatronId property 107 * 108 * @return proxyPatronId 109 */ 110 public String getProxyPatronId() { 111 return proxyPatronId; 112 } 113 114 /** 115 * Sets the value for proxyPatronId property 116 * 117 * @param proxyPatronId 118 */ 119 public void setProxyPatronId(String proxyPatronId) { 120 this.proxyPatronId = proxyPatronId; 121 } 122 123 /** 124 * Gets the value of olePatronId property 125 * 126 * @return olePatronId 127 */ 128 public String getOlePatronId() { 129 return olePatronId; 130 } 131 132 /** 133 * Sets the value for olePatronId property 134 * 135 * @param olePatronId 136 */ 137 public void setOlePatronId(String olePatronId) { 138 this.olePatronId = olePatronId; 139 } 140 141 /* public OlePatronDocument getProxyPatron() { 142 return proxyPatron; 143 } 144 145 public void setProxyPatron(OlePatronDocument proxyPatron) { 146 this.proxyPatron = proxyPatron; 147 }*/ 148 149 /** 150 * Gets the value of olePatronDocument property 151 * 152 * @return olePatronDocument 153 */ 154 public OlePatronDocument getOlePatronDocument() { 155 if (null == olePatronDocument) { 156 String patronId = getOlePatronId(); 157 if (StringUtils.isNotEmpty(patronId)) { 158 Map<String, String> parameterMap = new HashMap<>(); 159 parameterMap.put("olePatronId", patronId); 160 olePatronDocument = KRADServiceLocator.getBusinessObjectService().findByPrimaryKey(OlePatronDocument.class, parameterMap); 161 } 162 } 163 return olePatronDocument; 164 } 165 166 /** 167 * Sets the value for olePatronDocument property 168 * 169 * @param olePatronDocument 170 */ 171 public void setOlePatronDocument(OlePatronDocument olePatronDocument) { 172 this.olePatronDocument = olePatronDocument; 173 } 174 175 /** 176 * Gets the value of proxyPatronExpirationDate property 177 * 178 * @return proxyPatronExpirationDate 179 */ 180 public Date getProxyPatronExpirationDate() { 181 return proxyPatronExpirationDate; 182 } 183 184 /** 185 * Sets the value for proxyPatronExpirationDate property 186 * 187 * @param proxyPatronExpirationDate 188 */ 189 public void setProxyPatronExpirationDate(Date proxyPatronExpirationDate) { 190 this.proxyPatronExpirationDate = proxyPatronExpirationDate; 191 } 192 193 /** 194 * Gets the value of proxyPatronActivationDate property 195 * 196 * @return proxyPatronActivationDate 197 */ 198 public Date getProxyPatronActivationDate() { 199 return proxyPatronActivationDate; 200 } 201 202 /** 203 * Sets the value for proxyPatronActivationDate property 204 * 205 * @param proxyPatronActivationDate 206 */ 207 public void setProxyPatronActivationDate(Date proxyPatronActivationDate) { 208 this.proxyPatronActivationDate = proxyPatronActivationDate; 209 } 210 211 /** 212 * Gets the value of active property 213 * 214 * @return active 215 */ 216 public boolean isActive() { 217 return active; 218 } 219 220 /** 221 * Sets the value for active property 222 * 223 * @param active 224 */ 225 public void setActive(boolean active) { 226 this.active = active; 227 } 228 229 /** 230 * Gets the value of proxyForPatronFirstName property 231 * 232 * @return proxyForPatronFirstName 233 */ 234 public String getProxyForPatronFirstName() { 235 return proxyForPatronFirstName; 236 } 237 238 /** 239 * Sets the value for proxyForPatronFirstName property 240 * 241 * @param proxyForPatronFirstName 242 */ 243 public void setProxyForPatronFirstName(String proxyForPatronFirstName) { 244 this.proxyForPatronFirstName = proxyForPatronFirstName; 245 } 246 247 /** 248 * Gets the value of proxyForPatronLastName property 249 * 250 * @return proxyForPatronLastName 251 */ 252 public String getProxyForPatronLastName() { 253 return proxyForPatronLastName; 254 } 255 256 /** 257 * Sets the value for proxyForPatronLastName property 258 * 259 * @param proxyForPatronLastName 260 */ 261 public void setProxyForPatronLastName(String proxyForPatronLastName) { 262 this.proxyForPatronLastName = proxyForPatronLastName; 263 } 264 265 /** 266 * This method converts the PersistableBusinessObjectBase OleProxyPatronDocument into immutable object OleProxyPatronDefinition 267 * 268 * @param bo(OleProxyPatronDefinition) 269 * @return OleProxyPatronDefinition 270 */ 271 static OleProxyPatronDefinition to(org.kuali.ole.deliver.bo.OleProxyPatronDocument bo) { 272 if (bo == null) { 273 return null; 274 } 275 return OleProxyPatronDefinition.Builder.create(bo).build(); 276 } 277 278 /** 279 * This method converts the immutable object OleProxyPatronDefinition into PersistableBusinessObjectBase OleProxyPatronDocument 280 * 281 * @param im(OleProxyPatronDefinition) 282 * @return bo(OlePatronAffiliation) 283 */ 284 public static org.kuali.ole.deliver.bo.OleProxyPatronDocument from(OleProxyPatronDefinition im) { 285 if (im == null) { 286 return null; 287 } 288 289 org.kuali.ole.deliver.bo.OleProxyPatronDocument bo = new org.kuali.ole.deliver.bo.OleProxyPatronDocument(); 290 bo.oleProxyPatronDocumentId = im.getOleProxyPatronDocumentId(); 291 bo.olePatronId = im.getOlePatronId(); 292 bo.proxyPatronId = im.getProxyPatronId(); 293 /* if (im.getOlePatronDocument() != null) { 294 bo.olePatronDocument = OlePatronDocument.from(im.getOlePatronDocument()); 295 }*/ 296 bo.active = im.isActive(); 297 bo.proxyPatronExpirationDate = im.getProxyPatronExpirationDate(); 298 bo.proxyPatronActivationDate = im.getProxyPatronActivationDate(); 299 bo.versionNumber = im.getVersionNumber(); 300 301 302 return bo; 303 } 304 305 306 @Override 307 public String getId() { 308 return this.oleProxyPatronDocumentId; 309 } 310}