Class ProcessSchemePolicySet
- java.lang.Object
-
- com.sodius.oslc.server.process.scheme.model.ProcessSchemePolicySet
-
public class ProcessSchemePolicySet extends Object
Provides facilities to lookup existing scheme policies from the store and to perform updates. Developer is recommended to use this class whenever possible, rather than interacting with the lower levelProcessSchemePolicyStore
.- Since:
- 3.5.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ProcessSchemePolicySet.PolicyStoreUpdater
Performs updates in a scheme policy store.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProcessSchemePolicySet
fromStore(String schemeIdentifier, ProcessSchemePolicyStore store)
Reads existing policies from the store for a given scheme.Optional<FriendPolicy>
getFriendPolicy(Friend friend)
Returns the existing policy for a friend, if any.Optional<LinkTypePolicy>
getLinkTypePolicy(Friend friend, URI resourceType, URI linkType)
Returns the existing policy for the given link type, if any.Optional<ResourceTypePolicy>
getResourceTypePolicy(Friend friend, URI resourceType)
Returns the existing policy for the given resource type, if any.Optional<ProcessSchemePolicy>
getSchemePolicy()
Returns the existing policy for the scheme, if any.boolean
isEmpty()
Returnstrue
if there's no policies in the store for the underlying scheme.ProcessSchemePolicySet.PolicyStoreUpdater
storeUpdater()
Returns aProcessSchemePolicySet.PolicyStoreUpdater
to perform updates in the store.
-
-
-
Method Detail
-
fromStore
public static ProcessSchemePolicySet fromStore(String schemeIdentifier, ProcessSchemePolicyStore store) throws ProcessSchemeStoreException
Reads existing policies from the store for a given scheme.- Parameters:
schemeIdentifier
- the identifier of the scheme of interest.store
- the scheme policy store.- Returns:
- the existing scheme policies.
- Throws:
ProcessSchemeStoreException
- if the policies cannot be read from the store.
-
isEmpty
public boolean isEmpty()
Returnstrue
if there's no policies in the store for the underlying scheme.- Returns:
true
if there's no policies in the store for the underlying scheme.
-
getSchemePolicy
public Optional<ProcessSchemePolicy> getSchemePolicy()
Returns the existing policy for the scheme, if any.- Returns:
- the existing policy for the scheme, an empty
Optional
if none.
-
getFriendPolicy
public Optional<FriendPolicy> getFriendPolicy(Friend friend)
Returns the existing policy for a friend, if any.- Parameters:
friend
- the friend application.- Returns:
- the existing policy for a friend, an empty
Optional
if none.
-
getResourceTypePolicy
public Optional<ResourceTypePolicy> getResourceTypePolicy(Friend friend, URI resourceType)
Returns the existing policy for the given resource type, if any.- Parameters:
friend
- the friend application.resourceType
- the resource type- Returns:
- the existing policy for the given resource type, an empty
Optional
if none.
-
getLinkTypePolicy
public Optional<LinkTypePolicy> getLinkTypePolicy(Friend friend, URI resourceType, URI linkType)
Returns the existing policy for the given link type, if any.- Parameters:
friend
- the friend application.resourceType
- the resource typelinkType
- the link type- Returns:
- the existing policy for the given link type, an empty
Optional
if none.
-
storeUpdater
public ProcessSchemePolicySet.PolicyStoreUpdater storeUpdater()
Returns aProcessSchemePolicySet.PolicyStoreUpdater
to perform updates in the store. The same unique updater instance is returned for each call of this method.- Returns:
- the associated updater instance.
-
-