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
/
ParameterInstance.java
169 lines (144 loc) · 5.26 KB
/
ParameterInstance.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
/*******************************************************************************
* 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 <pmcmahan@us.ibm.com> - initial implementation
*******************************************************************************/
package org.eclipse.lyo.oslc4j.client.resources;
import java.net.URI;
import java.util.Arrays;
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.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;
@OslcResourceShape(title = "Parameter Instance Resource Shape", describes = AutomationConstants.TYPE_PARAMETER_INSTANCE)
@OslcNamespace(AutomationConstants.AUTOMATION_NAMESPACE)
/**
* @see http://open-services.net/wiki/automation/OSLC-Automation-Specification-Version-2.0/#Resource_ParameterInstance
*/
public final class ParameterInstance
extends AbstractResource implements Comparable<ParameterInstance>
{
private final Set<URI> rdfTypes = new TreeSet<URI>();
private String name;
private String value;
private String description;
private URI instanceShape;
private URI serviceProvider;
public ParameterInstance()
{
super();
rdfTypes.add(URI.create(AutomationConstants.TYPE_PARAMETER_INSTANCE));
}
public ParameterInstance(final URI about)
{
super(about);
rdfTypes.add(URI.create(AutomationConstants.TYPE_PARAMETER_INSTANCE));
}
protected URI getRdfType() {
return URI.create(AutomationConstants.TYPE_PARAMETER_INSTANCE);
}
public void addRdfType(final URI rdfType)
{
this.rdfTypes.add(rdfType);
}
@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("The name of the parameter instance.")
@OslcOccurs(Occurs.ExactlyOne)
@OslcPropertyDefinition(OslcConstants.OSLC_CORE_NAMESPACE + "name")
@OslcTitle("Name")
public String getName()
{
return name;
}
@OslcDescription("The value of the parameter.")
@OslcOccurs(Occurs.ZeroOrOne)
@OslcPropertyDefinition(OslcConstants.RDF_NAMESPACE + "value")
@OslcTitle("Value")
public String getValue()
{
return value;
}
@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("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;
}
public void setDescription(final String description)
{
this.description = description;
}
public void setName(final String name)
{
this.name = name;
}
public void setValue(final String value)
{
this.value = value;
}
public void setInstanceShape(final URI instanceShape)
{
this.instanceShape = instanceShape;
}
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 int compareTo(ParameterInstance o) {
return o.getName().compareTo(name);
}
}