1 | |
package org.kuali.rice.ksb.api.registry; |
2 | |
|
3 | |
import java.io.Serializable; |
4 | |
import java.util.Collection; |
5 | |
|
6 | |
import javax.xml.bind.annotation.XmlAccessType; |
7 | |
import javax.xml.bind.annotation.XmlAccessorType; |
8 | |
import javax.xml.bind.annotation.XmlAnyElement; |
9 | |
import javax.xml.bind.annotation.XmlElement; |
10 | |
import javax.xml.bind.annotation.XmlRootElement; |
11 | |
import javax.xml.bind.annotation.XmlType; |
12 | |
|
13 | |
import org.kuali.rice.core.api.CoreConstants; |
14 | |
import org.kuali.rice.core.api.mo.AbstractDataTransferObject; |
15 | |
import org.kuali.rice.core.api.mo.ModelBuilder; |
16 | |
import org.kuali.rice.ksb.api.bus.ServiceConfiguration; |
17 | |
import org.w3c.dom.Element; |
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
@XmlRootElement(name = ServiceDescriptor.Constants.ROOT_ELEMENT_NAME) |
28 | |
@XmlAccessorType(XmlAccessType.NONE) |
29 | |
@XmlType(name = ServiceDescriptor.Constants.TYPE_NAME, propOrder = { |
30 | |
ServiceDescriptor.Elements.ID, |
31 | |
ServiceDescriptor.Elements.DESCRIPTOR, |
32 | |
CoreConstants.CommonElements.VERSION_NUMBER, |
33 | |
CoreConstants.CommonElements.FUTURE_ELEMENTS |
34 | |
}) |
35 | 0 | public final class ServiceDescriptor extends AbstractDataTransferObject |
36 | |
implements ServiceDescriptorContract |
37 | |
{ |
38 | |
|
39 | |
private static final long serialVersionUID = 4555599272613878634L; |
40 | |
|
41 | |
@XmlElement(name = Elements.ID, required = false) |
42 | |
private final String id; |
43 | |
|
44 | |
@XmlElement(name = Elements.DESCRIPTOR, required = false) |
45 | |
private final String descriptor; |
46 | |
|
47 | |
@XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false) |
48 | |
private final Long versionNumber; |
49 | |
|
50 | 0 | @SuppressWarnings("unused") |
51 | |
@XmlAnyElement |
52 | |
private final Collection<Element> _futureElements = null; |
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | 0 | private ServiceDescriptor() { |
59 | 0 | this.id = null; |
60 | 0 | this.descriptor = null; |
61 | 0 | this.versionNumber = null; |
62 | 0 | } |
63 | |
|
64 | 0 | private ServiceDescriptor(Builder builder) { |
65 | 0 | this.id = builder.getId(); |
66 | 0 | this.descriptor = builder.getDescriptor(); |
67 | 0 | this.versionNumber = builder.getVersionNumber(); |
68 | 0 | } |
69 | |
|
70 | |
@Override |
71 | |
public String getId() { |
72 | 0 | return this.id; |
73 | |
} |
74 | |
|
75 | |
@Override |
76 | |
public String getDescriptor() { |
77 | 0 | return this.descriptor; |
78 | |
} |
79 | |
|
80 | |
@Override |
81 | |
public Long getVersionNumber() { |
82 | 0 | return this.versionNumber; |
83 | |
} |
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | 0 | public final static class Builder |
91 | |
implements Serializable, ModelBuilder, ServiceDescriptorContract |
92 | |
{ |
93 | |
|
94 | |
private static final long serialVersionUID = 4439417051199359358L; |
95 | |
|
96 | |
private String id; |
97 | |
private String descriptor; |
98 | |
private Long versionNumber; |
99 | |
|
100 | 0 | private Builder() { |
101 | 0 | } |
102 | |
|
103 | |
public static Builder create() { |
104 | 0 | return new Builder(); |
105 | |
} |
106 | |
|
107 | |
public static Builder create(ServiceDescriptorContract contract) { |
108 | 0 | if (contract == null) { |
109 | 0 | throw new IllegalArgumentException("contract was null"); |
110 | |
} |
111 | 0 | Builder builder = create(); |
112 | 0 | builder.setId(contract.getId()); |
113 | 0 | builder.setDescriptor(contract.getDescriptor()); |
114 | 0 | builder.setVersionNumber(contract.getVersionNumber()); |
115 | 0 | return builder; |
116 | |
} |
117 | |
|
118 | |
public ServiceDescriptor build() { |
119 | 0 | return new ServiceDescriptor(this); |
120 | |
} |
121 | |
|
122 | |
@Override |
123 | |
public String getId() { |
124 | 0 | return this.id; |
125 | |
} |
126 | |
|
127 | |
@Override |
128 | |
public String getDescriptor() { |
129 | 0 | return this.descriptor; |
130 | |
} |
131 | |
|
132 | |
@Override |
133 | |
public Long getVersionNumber() { |
134 | 0 | return this.versionNumber; |
135 | |
} |
136 | |
|
137 | |
public void setId(String id) { |
138 | 0 | this.id = id; |
139 | 0 | } |
140 | |
|
141 | |
public void setDescriptor(String descriptor) { |
142 | 0 | this.descriptor = descriptor; |
143 | 0 | } |
144 | |
|
145 | |
public void setVersionNumber(Long versionNumber) { |
146 | 0 | this.versionNumber = versionNumber; |
147 | 0 | } |
148 | |
|
149 | |
} |
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | 0 | static class Constants { |
157 | |
|
158 | |
final static String ROOT_ELEMENT_NAME = "serviceDescriptor"; |
159 | |
final static String TYPE_NAME = "ServiceDescriptorType"; |
160 | |
} |
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | 0 | static class Elements { |
168 | |
|
169 | |
final static String ID = "id"; |
170 | |
final static String DESCRIPTOR = "descriptor"; |
171 | |
|
172 | |
} |
173 | |
|
174 | |
} |
175 | |
|