Class ProcessScope
- java.lang.Object
-
- com.sodius.oslc.core.process.model.ProcessScope
-
public class ProcessScope extends Object implements Predicate<Object>
The scope of supported association types and link types.An OSLC application may not necessarily support all available resource types, associations and links. For example
LinkType.TRACKS_WORK_ITEM
relates to planning and may not make sense for all Change Management applications. The application is also likely to support locally only a subset of available OSLC resource types.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() // .resourceType(ResourceType.CHANGE_REQUEST) // .association(AssociationType.RELATED_TO) // .link(LinkType.RELATED_CHANGE_REQUEST) // .build());
This class implements
Predicate
so that a domain, resource type, association or link typesStream
can easily be filtered with aProcessScope
instance.- Since:
- 1.9.0
- See Also:
AssociationType
,LinkType
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProcessScope.Builder
Enables configuring and creating aProcessScope
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProcessScope.Builder
builder()
Creates a builder to configure and build a newProcessScope
instance.boolean
contains(AssociationType type)
Determines if the given association type is supported by this scope instance.boolean
contains(Domain domain)
Determines if the given domain is supported by this scope instance, meaning one that defines a type of artifact that the local application enables managing.boolean
contains(LinkType type)
Determines if the given link type is supported by this scope instance.boolean
contains(ResourceType type)
Determines if the given resource type is supported by this scope instance, meaning one whose artifacts can be managed by that the local application.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 domain, resource type, association type or link type is supported by this scope instance.
-
-
-
Method Detail
-
getInstance
public static ProcessScope getInstance()
Returns the current scope instance. Default instance supports all available resource types, associations and links.- Returns:
- the current instance.
- See Also:
setInstance(ProcessScope)
-
setInstance
public static void setInstance(ProcessScope scope)
Replaces the current scope with the given one.- Parameters:
scope
- the new scope.
-
builder
public static ProcessScope.Builder builder()
Creates a builder to configure and build a newProcessScope
instance.- Returns:
- a scope builder.
-
contains
public boolean contains(Domain domain)
Determines if the given domain is supported by this scope instance, meaning one that defines a type of artifact that the local application enables managing.- Parameters:
domain
- the domain- Returns:
true
if the domain is part of the scope,false
otherwise.- Since:
- 3.5.0
-
contains
public boolean contains(ResourceType type)
Determines if the given resource type is supported by this scope instance, meaning one whose artifacts can be managed by that the local application.- Parameters:
type
- the resource type- Returns:
true
if the resource type is part of the scope,false
otherwise.- Since:
- 3.5.0
-
contains
public boolean contains(AssociationType type)
Determines if the given association type is supported by this scope instance.- Parameters:
type
- an association type to test.- Returns:
true
if the link type is part of the scope,false
otherwise.
-
contains
public boolean contains(LinkType type)
Determines if the given link type is supported by this scope instance.- Parameters:
type
- a link type to test.- Returns:
true
if the link type is part of the scope,false
otherwise.
-
test
public boolean test(Object object)
Determines if the given domain, resource type, association type or link type is supported by this scope instance.
-
-