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.language.NaturalLanguageUsage;
22 import org.kuali.rice.krms.api.repository.language.NaturalLanguageUsageContract;
23
24
25
26
27
28
29 public class NaturalLanguageUsageBo
30 extends PersistableBusinessObjectBase
31 implements NaturalLanguageUsageContract
32 {
33
34 private String name;
35 private String description;
36 private String namespace;
37 private String id;
38 private boolean active;
39 private Long versionNumber;
40 private SequenceAccessorService sequenceAccessorService;
41
42
43
44
45
46 public NaturalLanguageUsageBo() {
47 }
48
49 @Override
50 public String getName() {
51 return this.name;
52 }
53
54 @Override
55 public String getDescription() {
56 return this.description;
57 }
58
59 @Override
60 public String getNamespace() {
61 return this.namespace;
62 }
63
64 @Override
65 public String getId() {
66 return this.id;
67 }
68
69 @Override
70 public boolean isActive() {
71 return this.active;
72 }
73
74 @Override
75 public Long getVersionNumber() {
76 return this.versionNumber;
77 }
78
79
80
81
82
83
84
85 public void setName(String name) {
86 this.name = name;
87 }
88
89
90
91
92
93
94
95 public void setDescription(String description) {
96 this.description = description;
97 }
98
99
100
101
102
103
104
105 public void setNamespace(String namespace) {
106 this.namespace = namespace;
107 }
108
109
110
111
112
113
114
115 public void setId(String id) {
116 this.id = id;
117 }
118
119
120
121
122
123
124
125 public void setActive(boolean active) {
126 this.active = active;
127 }
128
129
130
131
132
133
134
135 public void setVersionNumber(Long versionNumber) {
136 this.versionNumber = versionNumber;
137 }
138
139
140
141
142
143
144
145 public static NaturalLanguageUsage to(NaturalLanguageUsageBo naturalLanguageUsageBo) {
146 if (naturalLanguageUsageBo == null) { return null; }
147 return NaturalLanguageUsage.Builder.create(naturalLanguageUsageBo).build();
148 }
149
150
151
152
153
154
155
156 public static org.kuali.rice.krms.impl.repository.NaturalLanguageUsageBo from(NaturalLanguageUsage naturalLanguageUsage) {
157 if (naturalLanguageUsage == null) return null;
158 NaturalLanguageUsageBo naturalLanguageUsageBo = new NaturalLanguageUsageBo();
159 naturalLanguageUsageBo.setName(naturalLanguageUsage.getName());
160 naturalLanguageUsageBo.setDescription(naturalLanguageUsage.getDescription());
161 naturalLanguageUsageBo.setNamespace(naturalLanguageUsage.getNamespace());
162 naturalLanguageUsageBo.setId(naturalLanguageUsage.getId());
163 naturalLanguageUsageBo.setActive(naturalLanguageUsage.isActive());
164 naturalLanguageUsageBo.setVersionNumber(naturalLanguageUsage.getVersionNumber());
165
166 return naturalLanguageUsageBo;
167 }
168
169
170
171
172
173
174 private String getNewId(String table, Class clazz) {
175 if (sequenceAccessorService == null) {
176 sequenceAccessorService = KRADServiceLocator.getSequenceAccessorService();
177 }
178 Long id = sequenceAccessorService.getNextAvailableSequenceNumber(table, clazz);
179 return id.toString();
180 }
181
182
183
184
185
186
187 public void setSequenceAccessorService(SequenceAccessorService sas) {
188 sequenceAccessorService = sas;
189 }
190
191 public SequenceAccessorService getSequenceAccessorService() {
192 return sequenceAccessorService;
193 }
194
195 }