1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.impl.repository;
17
18 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
19 import org.kuali.rice.krad.service.KRADServiceLocator;
20 import org.kuali.rice.krad.service.SequenceAccessorService;
21 import org.kuali.rice.krms.api.repository.reference.ReferenceObjectBinding;
22 import org.kuali.rice.krms.api.repository.reference.ReferenceObjectBindingContract;
23
24
25
26
27
28
29 public class ReferenceObjectBindingBo
30 extends PersistableBusinessObjectBase
31 implements ReferenceObjectBindingContract
32 {
33
34 private String collectionName;
35 private String krmsDiscriminatorType;
36 private String krmsObjectId;
37 private String namespace;
38 private String referenceDiscriminatorType;
39 private String referenceObjectId;
40 private String id;
41 private boolean active;
42 private Long versionNumber;
43 private SequenceAccessorService sequenceAccessorService;
44
45
46
47
48
49 public ReferenceObjectBindingBo() {
50 }
51
52 @Override
53 public String getCollectionName() {
54 return this.collectionName;
55 }
56
57 @Override
58 public String getKrmsDiscriminatorType() {
59 return this.krmsDiscriminatorType;
60 }
61
62 @Override
63 public String getKrmsObjectId() {
64 return this.krmsObjectId;
65 }
66
67 @Override
68 public String getNamespace() {
69 return this.namespace;
70 }
71
72 @Override
73 public String getReferenceDiscriminatorType() {
74 return this.referenceDiscriminatorType;
75 }
76
77 @Override
78 public String getReferenceObjectId() {
79 return this.referenceObjectId;
80 }
81
82 @Override
83 public String getId() {
84 return this.id;
85 }
86
87 @Override
88 public boolean isActive() {
89 return this.active;
90 }
91
92 @Override
93 public Long getVersionNumber() {
94 return this.versionNumber;
95 }
96
97
98
99
100
101
102
103 public void setCollectionName(String collectionName) {
104 this.collectionName = collectionName;
105 }
106
107
108
109
110
111
112
113 public void setKrmsDiscriminatorType(String krmsDiscriminatorType) {
114 this.krmsDiscriminatorType = krmsDiscriminatorType;
115 }
116
117
118
119
120
121
122
123 public void setKrmsObjectId(String krmsObjectId) {
124 this.krmsObjectId = krmsObjectId;
125 }
126
127
128
129
130
131
132
133 public void setNamespace(String namespace) {
134 this.namespace = namespace;
135 }
136
137
138
139
140
141
142
143 public void setReferenceDiscriminatorType(String referenceDiscriminatorType) {
144 this.referenceDiscriminatorType = referenceDiscriminatorType;
145 }
146
147
148
149
150
151
152
153 public void setReferenceObjectId(String referenceObjectId) {
154 this.referenceObjectId = referenceObjectId;
155 }
156
157
158
159
160
161
162
163 public void setId(String id) {
164 this.id = id;
165 }
166
167
168
169
170
171
172
173 public void setActive(boolean active) {
174 this.active = active;
175 }
176
177
178
179
180
181
182
183 public void setVersionNumber(Long versionNumber) {
184 this.versionNumber = versionNumber;
185 }
186
187
188
189
190
191
192
193 public static ReferenceObjectBinding to(ReferenceObjectBindingBo referenceObjectBindingBo) {
194 if (referenceObjectBindingBo == null) { return null; }
195 return ReferenceObjectBinding.Builder.create(referenceObjectBindingBo).build();
196 }
197
198
199
200
201
202
203
204 public static org.kuali.rice.krms.impl.repository.ReferenceObjectBindingBo from(ReferenceObjectBinding referenceObjectBinding) {
205 if (referenceObjectBinding == null) return null;
206 ReferenceObjectBindingBo referenceObjectBindingBo = new ReferenceObjectBindingBo();
207 referenceObjectBindingBo.setCollectionName(referenceObjectBinding.getCollectionName());
208 referenceObjectBindingBo.setKrmsDiscriminatorType(referenceObjectBinding.getKrmsDiscriminatorType());
209 referenceObjectBindingBo.setKrmsObjectId(referenceObjectBinding.getKrmsObjectId());
210 referenceObjectBindingBo.setNamespace(referenceObjectBinding.getNamespace());
211 referenceObjectBindingBo.setReferenceDiscriminatorType(referenceObjectBinding.getReferenceDiscriminatorType());
212 referenceObjectBindingBo.setReferenceObjectId(referenceObjectBinding.getReferenceObjectId());
213 referenceObjectBindingBo.setId(referenceObjectBinding.getId());
214 referenceObjectBindingBo.setActive(referenceObjectBinding.isActive());
215 referenceObjectBindingBo.setVersionNumber(referenceObjectBinding.getVersionNumber());
216
217 return referenceObjectBindingBo;
218 }
219
220
221
222
223
224
225 private String getNewId(String table, Class clazz) {
226 if (sequenceAccessorService == null) {
227 sequenceAccessorService = KRADServiceLocator.getSequenceAccessorService();
228 }
229 Long id = sequenceAccessorService.getNextAvailableSequenceNumber(table, clazz);
230 return id.toString();
231 }
232
233
234
235
236
237
238 public void setSequenceAccessorService(SequenceAccessorService sas) {
239 sequenceAccessorService = sas;
240 }
241
242 public SequenceAccessorService getSequenceAccessorService() {
243 return sequenceAccessorService;
244 }
245
246 }