public class ProcessScope extends Object implements Predicate<Object>
An OSLC application may not necessarily support all available associations and links.
For example LinkType.TRACKS_WORK_ITEM
relates to planning
and may not make sense for all Change Management applications.
An application can restrict the supported associations and links to a subset of available ones
by changing the ProcessScope
at initialization time, using following code:
ProcessScope.setInstance(ProcessScope.builder() .association(AssociationType.RELATED_TO) .link(LinkType.RELATED_CHANGE_REQUEST) .build());
This class implements Predicate
so that an association or link types Stream
can easily be filtered with a ProcessScope
instance.
AssociationType
,
LinkType
Modifier and Type | Class and Description |
---|---|
static class |
ProcessScope.Builder
Enables configuring and creating a
ProcessScope instance. |
Modifier and Type | Method and Description |
---|---|
static ProcessScope.Builder |
builder()
Creates a builder to configure and build a new
ProcessScope instance. |
boolean |
contains(AssociationType type)
Determines if the given association type is supported by this scope instance.
|
boolean |
contains(LinkType type)
Determines if the given link type is supported by this scope instance.
|
static ProcessScope |
getInstance()
Returns the current scope instance.
|
static void |
setInstance(ProcessScope scope)
Replaces the current scope with the given one.
|
boolean |
test(Object object)
Determines if the given association type or link type is supported by this scope instance.
|
public static ProcessScope getInstance()
setInstance(ProcessScope)
public static void setInstance(ProcessScope scope)
scope
- the new scope.public static ProcessScope.Builder builder()
ProcessScope
instance.public boolean contains(AssociationType type)
type
- an association type to test.true
if the link type is part of the scope, false
otherwise.public boolean contains(LinkType type)
type
- a link type to test.true
if the link type is part of the scope, false
otherwise.public boolean test(Object object)
test
in interface Predicate<Object>
object
- an object to test, which is expected to either be an AssociationType
or LinkType
.true
if the association type or link type is part of the scope,
false
otherwise or if the object is neither an AssociationType
nor a LinkType
instance.