1 | package eu.clarin.sru.server.fcs; |
---|
2 | |
---|
3 | import java.net.URI; |
---|
4 | |
---|
5 | /** |
---|
6 | * This class is used to information about a Layers that is available by the |
---|
7 | * Endpoint. |
---|
8 | */ |
---|
9 | public class Layer { |
---|
10 | /** |
---|
11 | * The content encoding policy for a Layer |
---|
12 | */ |
---|
13 | public enum ContentEncoding { |
---|
14 | /** |
---|
15 | * Value information is encoded as element content in this layer. |
---|
16 | */ |
---|
17 | VALUE, |
---|
18 | /** |
---|
19 | * No additional value information is encoded for this layer. |
---|
20 | */ |
---|
21 | EMPTY |
---|
22 | } |
---|
23 | private final String id; |
---|
24 | private final URI resultId; |
---|
25 | private final String type; |
---|
26 | private final ContentEncoding encoding; |
---|
27 | private final String qualifier; |
---|
28 | private final String altValueInfo; |
---|
29 | private final URI altValueInfoURI; |
---|
30 | |
---|
31 | |
---|
32 | /** |
---|
33 | * Constructor. |
---|
34 | * |
---|
35 | * @param id |
---|
36 | * the identifier of the layer |
---|
37 | * @param resultId |
---|
38 | * the unique URI that used in the Advanced Data View to refer to |
---|
39 | * this layer |
---|
40 | * @param type |
---|
41 | * the type identifier for the layer |
---|
42 | * @param qualifier |
---|
43 | * an optional layer qualifier to be used in FCS-QL to refer to |
---|
44 | * this layer or <code>null</code> |
---|
45 | * @param altValueInfo |
---|
46 | * an additional information about the layer or <code>null</code> |
---|
47 | * @param altValueInfoURI |
---|
48 | * an additional URI for pointing to more information about the |
---|
49 | * layer or <code>null</code> |
---|
50 | */ |
---|
51 | public Layer(String id, URI resultId, String type, |
---|
52 | ContentEncoding encoding, String qualifier, String altValueInfo, |
---|
53 | URI altValueInfoURI) { |
---|
54 | if (id == null) { |
---|
55 | throw new NullPointerException("id == null"); |
---|
56 | } |
---|
57 | this.id = id; |
---|
58 | |
---|
59 | if (resultId == null) { |
---|
60 | throw new NullPointerException("resultId == null"); |
---|
61 | } |
---|
62 | this.resultId = resultId; |
---|
63 | |
---|
64 | if (type == null) { |
---|
65 | throw new NullPointerException("type == null"); |
---|
66 | } |
---|
67 | this.type = type; |
---|
68 | |
---|
69 | if (encoding == null) { |
---|
70 | throw new NullPointerException("encoding == null"); |
---|
71 | } |
---|
72 | this.encoding = encoding; |
---|
73 | |
---|
74 | this.qualifier = qualifier; |
---|
75 | this.altValueInfo = altValueInfo; |
---|
76 | this.altValueInfoURI = altValueInfoURI; |
---|
77 | } |
---|
78 | |
---|
79 | |
---|
80 | /** |
---|
81 | * Constructor. |
---|
82 | * |
---|
83 | * @param id |
---|
84 | * the identifier of the layer |
---|
85 | * @param resultId |
---|
86 | * the unique URI that used in the Advanced Data View to refer to |
---|
87 | * this layer |
---|
88 | * @param type |
---|
89 | * the type identifier for the layer |
---|
90 | */ |
---|
91 | public Layer(String id, URI resultId, String type) { |
---|
92 | this(id, resultId, type, ContentEncoding.VALUE, null, null, null); |
---|
93 | } |
---|
94 | |
---|
95 | |
---|
96 | /** |
---|
97 | * Get the identifier for the layer. |
---|
98 | * |
---|
99 | * @return the identifier for the layer |
---|
100 | */ |
---|
101 | public String getId() { |
---|
102 | return id; |
---|
103 | } |
---|
104 | |
---|
105 | |
---|
106 | /** |
---|
107 | * Get the unique URI that used in the Advanced Data View to refer to this |
---|
108 | * layer |
---|
109 | * |
---|
110 | * @return the URI for referring to this layer in the Advanced Data View |
---|
111 | */ |
---|
112 | public URI getResultId() { |
---|
113 | return resultId; |
---|
114 | } |
---|
115 | |
---|
116 | |
---|
117 | /** |
---|
118 | * Get the type identifier for this layer. |
---|
119 | * |
---|
120 | * @return the type identifier of the layer |
---|
121 | */ |
---|
122 | public String getType() { |
---|
123 | return type; |
---|
124 | } |
---|
125 | |
---|
126 | |
---|
127 | /** |
---|
128 | * Get the content encoding mode for this layer. |
---|
129 | * |
---|
130 | * @return the content encoding mode |
---|
131 | */ |
---|
132 | public ContentEncoding getContentEncoding() { |
---|
133 | return encoding; |
---|
134 | } |
---|
135 | |
---|
136 | |
---|
137 | /** |
---|
138 | * Get the optional layer qualifier to be used in FCS-QL |
---|
139 | * |
---|
140 | * @return the layer qualifier or <code>null</code> |
---|
141 | */ |
---|
142 | public String getQualifier() { |
---|
143 | return qualifier; |
---|
144 | } |
---|
145 | |
---|
146 | |
---|
147 | /** |
---|
148 | * Get the additional information about this layer. |
---|
149 | * |
---|
150 | * @return an additional information about the layer or <code>null</code> |
---|
151 | */ |
---|
152 | public String getAltValueInfo() { |
---|
153 | return altValueInfo; |
---|
154 | } |
---|
155 | |
---|
156 | |
---|
157 | /** |
---|
158 | * Get an additional URI for pointing to more information about this layer. |
---|
159 | * |
---|
160 | * @return an additional URI for pointing to more information about the |
---|
161 | * layer or <code>null</code> |
---|
162 | */ |
---|
163 | public URI getAltValueInfoURI() { |
---|
164 | return altValueInfoURI; |
---|
165 | } |
---|
166 | |
---|
167 | |
---|
168 | @Override |
---|
169 | public String toString() { |
---|
170 | StringBuilder sb = new StringBuilder(); |
---|
171 | sb.append(getClass().getSimpleName()); |
---|
172 | sb.append("["); |
---|
173 | sb.append("id=").append(id); |
---|
174 | sb.append(", result-id=").append(resultId); |
---|
175 | sb.append(", type=").append(type); |
---|
176 | if (qualifier != null) { |
---|
177 | sb.append(", qualifier=").append(qualifier); |
---|
178 | } |
---|
179 | sb.append("]"); |
---|
180 | return sb.toString(); |
---|
181 | } |
---|
182 | |
---|
183 | } // class Layer |
---|