This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
ArchitectureResource.java
295 lines (248 loc) · 8.86 KB
/
ArchitectureResource.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
/*
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
*
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-1.0 OR BSD-3-Clause
*/
package org.eclipse.lyo.oslc4j.client.resources;
import java.net.URI;
import java.util.Arrays;
import java.util.Date;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs;
import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
import org.eclipse.lyo.oslc4j.core.annotation.OslcRange;
import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly;
import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType;
import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
import org.eclipse.lyo.oslc4j.core.model.Occurs;
import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
import org.eclipse.lyo.oslc4j.core.model.ValueType;
@Deprecated
@OslcResourceShape(title = "Architecture Management Resource Resource Shape", describes = ArchitectureConstants.TYPE_ARCHITECTURE_RESOURCE)
@OslcNamespace(ArchitectureConstants.ARCHITECTURE_NAMESPACE)
@OslcName(ArchitectureConstants.ARCHITECTURE_RESOURCE)
/**
* @see http://open-services.net/wiki/architecture-management/OSLC-Architecture-Management-Specification-Version-2.0/
*/
public final class ArchitectureResource
extends AbstractResource
{
private final Set<URI> contributors = new TreeSet<URI>();
private final Set<URI> creators = new TreeSet<URI>();
private final Set<String> dctermsTypes = new TreeSet<String>();
private final Set<URI> rdfTypes = new TreeSet<URI>();
private Date created;
private String description;
private String identifier;
private URI source;
private URI instanceShape;
private Date modified;
private URI serviceProvider;
private String title;
public ArchitectureResource()
{
super();
rdfTypes.add(URI.create(ArchitectureConstants.TYPE_ARCHITECTURE_RESOURCE));
}
public ArchitectureResource(final URI about)
{
super(about);
rdfTypes.add(URI.create(ArchitectureConstants.TYPE_ARCHITECTURE_RESOURCE));
}
protected URI getRdfType() {
return URI.create(ArchitectureConstants.TYPE_ARCHITECTURE_RESOURCE);
}
public void addContributor(final URI contributor)
{
this.contributors.add(contributor);
}
public void addCreator(final URI creator)
{
this.creators.add(creator);
}
public void addRdfType(final URI rdfType)
{
this.rdfTypes.add(rdfType);
}
public void addDctermsType(final String dctermsType)
{
this.dctermsTypes.add(dctermsType);
}
@OslcDescription("The person(s) who are responsible for the work needed to complete the automation plan.")
@OslcName("contributor")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "contributor")
@OslcRange(QmConstants.TYPE_PERSON)
@OslcTitle("Contributors")
public URI[] getContributors()
{
return contributors.toArray(new URI[contributors.size()]);
}
@OslcDescription("Timestamp of resource creation.")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "created")
@OslcReadOnly
@OslcTitle("Created")
public Date getCreated()
{
return created;
}
@OslcDescription("Creator or creators of resource.")
@OslcName("creator")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "creator")
@OslcRange(ArchitectureConstants.TYPE_PERSON)
@OslcTitle("Creators")
public URI[] getCreators()
{
return creators.toArray(new URI[creators.size()]);
}
@OslcDescription("Descriptive text (reference: Dublin Core) about resource represented as rich text in XHTML content.")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "description")
@OslcTitle("Description")
@OslcValueType(ValueType.XMLLiteral)
public String getDescription()
{
return description;
}
@OslcDescription("A unique identifier for a resource. Assigned by the service provider when a resource is created. Not intended for end-user display.")
@OslcOccurs(Occurs.ExactlyOne)
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "identifier")
@OslcReadOnly
@OslcTitle("Identifier")
public String getIdentifier()
{
return identifier;
}
@OslcDescription("Resource Shape that provides hints as to resource property value-types and allowed values. ")
@OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "instanceShape")
@OslcRange(OslcConstants.TYPE_RESOURCE_SHAPE)
@OslcTitle("Instance Shape")
public URI getInstanceShape()
{
return instanceShape;
}
@OslcDescription("Timestamp last latest resource modification.")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "modified")
@OslcReadOnly
@OslcTitle("Modified")
public Date getModified()
{
return modified;
}
@OslcDescription("The resource type URIs.")
@OslcName("type")
@OslcPropertyDefinition(OslcConstants.RDF_NAMESPACE + "type")
@OslcTitle("Types")
public URI[] getRdfTypes()
{
return rdfTypes.toArray(new URI[rdfTypes.size()]);
}
@OslcDescription("A short string representation for the type, example 'Defect'.")
@OslcName("type")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "type")
@OslcTitle("DCTerms Types")
public String[] getDctermsTypes()
{
return dctermsTypes.toArray(new String[dctermsTypes.size()]);
}
@OslcDescription("The resource URI a client can perform a get on to obtain the original non-OSLC AM formatted resource that was used to create this resource. ")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "source")
@OslcTitle("Source")
public URI getSource()
{
return source;
}
@OslcDescription("The scope of a resource is a URI for the resource's OSLC Service Provider.")
@OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "serviceProvider")
@OslcRange(OslcConstants.TYPE_SERVICE_PROVIDER)
@OslcTitle("Service Provider")
public URI getServiceProvider()
{
return serviceProvider;
}
@OslcDescription("Title (reference: Dublin Core) or often a single line summary of the resource represented as rich text in XHTML content.")
@OslcOccurs(Occurs.ExactlyOne)
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "title")
@OslcTitle("Title")
@OslcValueType(ValueType.XMLLiteral)
public String getTitle()
{
return title;
}
public void setContributors(final URI[] contributors)
{
this.contributors.clear();
if (contributors != null)
{
this.contributors.addAll(Arrays.asList(contributors));
}
}
public void setCreated(final Date created)
{
this.created = created;
}
public void setCreators(final URI[] creators)
{
this.creators.clear();
if (creators != null)
{
this.creators.addAll(Arrays.asList(creators));
}
}
public void setDescription(final String description)
{
this.description = description;
}
public void setIdentifier(final String identifier)
{
this.identifier = identifier;
}
public void setInstanceShape(final URI instanceShape)
{
this.instanceShape = instanceShape;
}
public void setModified(final Date modified)
{
this.modified = modified;
}
public void setRdfTypes(final URI[] rdfTypes)
{
this.rdfTypes.clear();
if (rdfTypes != null)
{
this.rdfTypes.addAll(Arrays.asList(rdfTypes));
}
}
public void setDctermsTypes(final String[] dctermsTypes)
{
this.dctermsTypes.clear();
if (dctermsTypes != null)
{
this.dctermsTypes.addAll(Arrays.asList(dctermsTypes));
}
}
public void setSource(final URI source)
{
this.source = source;
}
public void setServiceProvider(final URI serviceProvider)
{
this.serviceProvider = serviceProvider;
}
public void setTitle(final String title)
{
this.title = title;
}
}