1 package org.kuali.ole.deliver.bo;
2
3 import org.apache.commons.lang3.StringUtils;
4 import org.kuali.ole.deliver.api.OlePatronLocalIdentificationContract;
5 import org.kuali.ole.deliver.api.OlePatronLocalIdentificationDefinition;
6 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
7 import org.kuali.rice.krad.service.KRADServiceLocator;
8
9 import java.util.HashMap;
10 import java.util.Map;
11
12
13
14
15
16 public class OlePatronLocalIdentificationBo extends PersistableBusinessObjectBase implements OlePatronLocalIdentificationContract {
17
18 private String patronLocalSeqId;
19 private String localId;
20 private String olePatronId;
21 private OlePatronDocument olePatronDocument;
22
23
24
25
26
27
28 public String getPatronLocalSeqId() {
29 return patronLocalSeqId;
30 }
31
32
33
34
35
36
37 public void setPatronLocalSeqId(String patronLocalSeqId) {
38 this.patronLocalSeqId = patronLocalSeqId;
39 }
40
41
42
43
44
45
46 public String getLocalId() {
47 return localId;
48 }
49
50
51
52
53
54
55 public void setLocalId(String localId) {
56 this.localId = localId;
57 }
58
59
60
61
62
63
64 public String getOlePatronId() {
65 return olePatronId;
66 }
67
68
69
70
71
72
73 public void setOlePatronId(String olePatronId) {
74 this.olePatronId = olePatronId;
75 }
76
77
78
79
80
81
82 public OlePatronDocument getOlePatronDocument() {
83 if (null == olePatronDocument) {
84 String patronId = getOlePatronId();
85 if (StringUtils.isNotEmpty(patronId)) {
86 Map<String, String> parameterMap = new HashMap<>();
87 parameterMap.put("olePatronId", patronId);
88 olePatronDocument = KRADServiceLocator.getBusinessObjectService().findByPrimaryKey(OlePatronDocument.class, parameterMap);
89 }
90 }
91 return olePatronDocument;
92 }
93
94
95
96
97
98
99 public void setOlePatronDocument(OlePatronDocument olePatronDocument) {
100 this.olePatronDocument = olePatronDocument;
101 }
102
103
104
105
106
107
108
109 public static OlePatronLocalIdentificationDefinition to(org.kuali.ole.deliver.bo.OlePatronLocalIdentificationBo bo) {
110 if (bo == null) {
111 return null;
112 }
113 return OlePatronLocalIdentificationDefinition.Builder.create(bo).build();
114 }
115
116
117
118
119
120
121
122 public static org.kuali.ole.deliver.bo.OlePatronLocalIdentificationBo from(OlePatronLocalIdentificationDefinition imOleAddressDefinition) {
123 if (imOleAddressDefinition == null) {
124 return null;
125 }
126
127 org.kuali.ole.deliver.bo.OlePatronLocalIdentificationBo bo = new org.kuali.ole.deliver.bo.OlePatronLocalIdentificationBo();
128 bo.patronLocalSeqId = imOleAddressDefinition.getPatronLocalSeqId();
129 bo.olePatronId = imOleAddressDefinition.getOlePatronId();
130 bo.localId = imOleAddressDefinition.getLocalId();
131 bo.versionNumber = imOleAddressDefinition.getVersionNumber();
132
133 return bo;
134 }
135
136 @Override
137 public String getId() {
138 return this.patronLocalSeqId;
139 }
140 }