1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.api.repository;
17
18 import org.kuali.rice.core.api.CoreConstants;
19 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
20 import org.kuali.rice.core.api.mo.ModelBuilder;
21 import org.kuali.rice.krms.api.KrmsConstants;
22 import org.w3c.dom.Element;
23
24 import javax.xml.bind.annotation.XmlAccessType;
25 import javax.xml.bind.annotation.XmlAccessorType;
26 import javax.xml.bind.annotation.XmlAnyElement;
27 import javax.xml.bind.annotation.XmlElement;
28 import javax.xml.bind.annotation.XmlRootElement;
29 import javax.xml.bind.annotation.XmlType;
30 import java.io.Serializable;
31 import java.util.Collection;
32
33
34
35
36
37
38
39 @XmlRootElement(name = NaturalLanguage.Constants.ROOT_ELEMENT_NAME)
40 @XmlAccessorType(XmlAccessType.NONE)
41 @XmlType(name = NaturalLanguage.Constants.TYPE_NAME, propOrder = {
42 NaturalLanguage.Elements.KRMS_OBJECT_ID,
43 NaturalLanguage.Elements.NATURAL_LANGUAGE,
44 CoreConstants.CommonElements.FUTURE_ELEMENTS
45 })
46 public class NaturalLanguage extends AbstractDataTransferObject implements NaturalLanguageContract {
47
48 private static final long serialVersionUID = 6112385261827152719L;
49
50 @XmlElement(name = NaturalLanguage.Elements.KRMS_OBJECT_ID, required = false)
51 private String krmsObjectId;
52 @XmlElement(name = NaturalLanguage.Elements.NATURAL_LANGUAGE, required = false)
53 private String naturalLanguage;
54 @SuppressWarnings("unused")
55 @XmlAnyElement
56 private final Collection<Element> _futureElements = null;
57
58
59
60
61
62 public NaturalLanguage() {
63 this.krmsObjectId = null;
64 this.naturalLanguage = null;
65 }
66
67 @Override
68 public String getKrmsObjectId() {
69 return krmsObjectId;
70 }
71
72 @Override
73 public String getNaturalLanguage() {
74 return naturalLanguage;
75 }
76
77
78
79
80
81
82
83 private NaturalLanguage(Builder builder) {
84 this.krmsObjectId = builder.getKrmsObjectId();
85 this.naturalLanguage = builder.getNaturalLanguage();
86 }
87
88
89
90
91
92 public static class Builder implements NaturalLanguageContract, ModelBuilder, Serializable {
93
94 private static final long serialVersionUID = -2354545388959879306L;
95
96 private String krmsObjectId;
97 private String naturalLanguage;
98
99
100
101
102
103 private Builder() {
104 }
105
106
107
108
109
110 private Builder(String naturalLanguage, String krmsObjectId) {
111 setNaturalLanguage(naturalLanguage);
112 setKrmsObjectId(krmsObjectId);
113 }
114
115 @Override
116 public String getKrmsObjectId() {
117 return krmsObjectId;
118 }
119
120 public void setKrmsObjectId(String krmsObjectId) {
121 this.krmsObjectId = krmsObjectId;
122 }
123
124 @Override
125 public String getNaturalLanguage() {
126 return naturalLanguage;
127 }
128
129 public void setNaturalLanguage(String naturalLanguage) {
130 this.naturalLanguage = naturalLanguage;
131 }
132
133
134
135
136
137
138
139
140
141 public static NaturalLanguage.Builder create() {
142 NaturalLanguage.Builder builder = new NaturalLanguage.Builder();
143 return builder;
144 }
145
146
147
148
149
150
151
152
153
154 public static NaturalLanguage.Builder create(NaturalLanguageContract contract) {
155 if (contract == null) {
156 throw new IllegalArgumentException("contract is null");
157 }
158 NaturalLanguage.Builder builder = new NaturalLanguage.Builder(contract.getNaturalLanguage(), contract.getKrmsObjectId());
159
160 return builder;
161 }
162
163
164
165
166
167
168
169 @Override
170 public NaturalLanguage build() {
171 return new NaturalLanguage(this);
172 }
173 }
174
175
176
177
178 public static class Constants {
179
180 final static String ROOT_ELEMENT_NAME = "naturalLanguage";
181 final static String TYPE_NAME = "NaturalLanguageType";
182 final static String[] HASH_CODE_EQUALS_EXCLUDE = {"_futureElements"};
183 public final static String EVENT = "Event";
184 }
185
186
187
188
189
190 public static class Elements {
191
192 final static String KRMS_OBJECT_ID = "krmsObjectId";
193 final static String NATURAL_LANGUAGE = "naturalLanguage";
194 }
195
196 public static class Cache {
197
198 public static final String NAME = KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0 + "/" + NaturalLanguage.Constants.TYPE_NAME;
199 }
200 }