source: FCSSimpleEndpoint/tags/FCSSimpleEndpoint-1.3.0/src/main/java/eu/clarin/sru/server/fcs/Layer.java @ 6957

Last change on this file since 6957 was 6957, checked in by Oliver Schonefeld, 8 years ago
  • tag version 1.3.0
  • Property svn:eol-style set to native
File size: 5.3 KB
Line 
1/**
2 * This software is copyright (c) 2013-2016 by
3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
4 * This is free software. You can redistribute it
5 * and/or modify it under the terms described in
6 * the GNU General Public License v3 of which you
7 * should have received a copy. Otherwise you can download
8 * it from
9 *
10 *   http://www.gnu.org/licenses/gpl-3.0.txt
11 *
12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
13 *
14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
15 *  GNU General Public License v3
16 */
17package eu.clarin.sru.server.fcs;
18
19import java.net.URI;
20
21/**
22 * This class is used to information about a Layers that is available by the
23 * Endpoint.
24 */
25public class Layer {
26    /**
27     * The content encoding policy for a Layer
28     */
29    public enum ContentEncoding {
30        /**
31         * Value information is encoded as element content in this layer.
32         */
33        VALUE,
34        /**
35         * No additional value information is encoded for this layer.
36         */
37        EMPTY
38    }
39    private final String id;
40    private final URI resultId;
41    private final String type;
42    private final ContentEncoding encoding;
43    private final String qualifier;
44    private final String altValueInfo;
45    private final URI altValueInfoURI;
46
47
48    /**
49     * Constructor.
50     *
51     * @param id
52     *            the identifier of the layer
53     * @param resultId
54     *            the unique URI that used in the Advanced Data View to refer to
55     *            this layer
56     * @param type
57     *            the type identifier for the layer
58     * @param encoding
59     *            the content encoding for this layer
60     * @param qualifier
61     *            an optional layer qualifier to be used in FCS-QL to refer to
62     *            this layer or <code>null</code>
63     * @param altValueInfo
64     *            an additional information about the layer or <code>null</code>
65     * @param altValueInfoURI
66     *            an additional URI for pointing to more information about the
67     *            layer or <code>null</code>
68     */
69    public Layer(String id, URI resultId, String type,
70            ContentEncoding encoding, String qualifier, String altValueInfo,
71            URI altValueInfoURI) {
72        if (id == null) {
73            throw new NullPointerException("id == null");
74        }
75        this.id = id;
76
77        if (resultId == null) {
78            throw new NullPointerException("resultId == null");
79        }
80        this.resultId = resultId;
81
82        if (type == null) {
83            throw new NullPointerException("type == null");
84        }
85        this.type = type;
86
87        if (encoding == null) {
88            throw new NullPointerException("encoding == null");
89        }
90        this.encoding = encoding;
91
92        this.qualifier       = qualifier;
93        this.altValueInfo    = altValueInfo;
94        this.altValueInfoURI = altValueInfoURI;
95    }
96
97
98    /**
99     * Constructor.
100     *
101     * @param id
102     *            the identifier of the layer
103     * @param resultId
104     *            the unique URI that used in the Advanced Data View to refer to
105     *            this layer
106     * @param type
107     *            the type identifier for the layer
108     */
109    public Layer(String id, URI resultId, String type) {
110        this(id, resultId, type, ContentEncoding.VALUE, null, null, null);
111    }
112
113
114    /**
115     * Get the identifier for the layer.
116     *
117     * @return the identifier for the layer
118     */
119    public String getId() {
120        return id;
121    }
122
123
124    /**
125     * Get the unique URI that used in the Advanced Data View to refer to this
126     * layer
127     *
128     * @return the URI for referring to this layer in the Advanced Data View
129     */
130    public URI getResultId() {
131        return resultId;
132    }
133
134
135    /**
136     * Get the type identifier for this layer.
137     *
138     * @return the type identifier of the layer
139     */
140    public String getType() {
141        return type;
142    }
143
144
145    /**
146     * Get the content encoding mode for this layer.
147     *
148     * @return the content encoding mode
149     */
150    public ContentEncoding getContentEncoding() {
151        return encoding;
152    }
153
154
155    /**
156     * Get the optional layer qualifier to be used in FCS-QL
157     *
158     * @return the layer qualifier or <code>null</code>
159     */
160    public String getQualifier() {
161        return qualifier;
162    }
163
164
165    /**
166     * Get the additional information about this layer.
167     *
168     * @return an additional information about the layer or <code>null</code>
169     */
170    public String getAltValueInfo() {
171        return altValueInfo;
172    }
173
174
175    /**
176     * Get an additional URI for pointing to more information about this layer.
177     *
178     * @return an additional URI for pointing to more information about the
179     *         layer or <code>null</code>
180     */
181    public URI getAltValueInfoURI() {
182        return altValueInfoURI;
183    }
184
185
186    @Override
187    public String toString() {
188        StringBuilder sb = new StringBuilder();
189        sb.append(getClass().getSimpleName());
190        sb.append("[");
191        sb.append("id=").append(id);
192        sb.append(", result-id=").append(resultId);
193        sb.append(", type=").append(type);
194        if (qualifier != null) {
195            sb.append(", qualifier=").append(qualifier);
196        }
197        sb.append("]");
198        return sb.toString();
199    }
200
201} // class Layer
Note: See TracBrowser for help on using the repository browser.