This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
/
QmResource.java
179 lines (153 loc) · 5.35 KB
/
QmResource.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
/*******************************************************************************
* Copyright (c) 2012 IBM Corporation.
*
* 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.
*
* Contributors:
*
* Paul McMahan - initial API and implementation
*******************************************************************************/
package org.eclipse.lyo.client.oslc.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.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.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;
/**
* @see <a href="http://open-services.net/bin/view/Main/QmSpecificationV2">http://open-services.net/bin/view/Main/QmSpecificationV2</a>
*/
@Deprecated
public abstract class QmResource
extends AbstractResource
{
private final Set<URI> rdfTypes = new TreeSet<URI>();
private Date created;
private String identifier;
private URI instanceShape;
private Date modified;
private URI serviceProvider;
private String title;
public QmResource()
{
super();
rdfTypes.add(getRdfType());
}
public QmResource(final URI about)
{
super(about);
rdfTypes.add(getRdfType());
}
protected abstract URI getRdfType();
public void addRdfType(final URI rdfType)
{
this.rdfTypes.add(rdfType);
}
@OslcDescription("Timestamp of resource creation.")
@OslcPropertyDefinition(OslcConstants.DCTERMS_NAMESPACE + "created")
@OslcReadOnly
@OslcTitle("Created")
public Date getCreated()
{
return created;
}
@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("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 setCreated(final Date created)
{
this.created = created;
}
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 setServiceProvider(final URI serviceProvider)
{
this.serviceProvider = serviceProvider;
}
public void setTitle(final String title)
{
this.title = title;
}
}