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
/
RequirementCollection.java
78 lines (65 loc) · 2.35 KB
/
RequirementCollection.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
/*
* 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.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.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;
@Deprecated
@OslcNamespace(RmConstants.REQUIREMENTS_MANAGEMENT_NAMESPACE)
@OslcResourceShape(title = "Requirement Collection Resource Shape", describes = RmConstants.TYPE_REQUIREMENT_COLLECTION)
public final class RequirementCollection
extends Requirement
{
// The only extra field is uses
private final Set<URI> uses = new TreeSet<URI>();
public RequirementCollection()
{
super();
addRdfType(URI.create(RmConstants.TYPE_REQUIREMENT_COLLECTION));
}
public RequirementCollection(final URI about)
{
super(about);
addRdfType(URI.create(RmConstants.TYPE_REQUIREMENT_COLLECTION));
}
public void addUses(final URI uses)
{
this.uses.add(uses);
}
@OslcDescription("A collection uses a resource - the resource is in the requirement collection.")
@OslcName("uses")
@OslcPropertyDefinition(RmConstants.REQUIREMENTS_MANAGEMENT_NAMESPACE + "uses")
@OslcRange(RmConstants.TYPE_REQUIREMENT)
@OslcTitle("Uses")
public URI[] getUses()
{
return uses.toArray(new URI[uses.size()]);
}
public void setUses(final URI[] uses)
{
this.uses.clear();
if (uses != null)
{
this.uses.addAll(Arrays.asList(uses));
}
}
}