Class ProcessSchemePolicySet
java.lang.Object
com.sodius.oslc.server.process.scheme.model.ProcessSchemePolicySet
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 level
ProcessSchemePolicyStore.- Since:
- 3.5.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassPerforms updates in a scheme policy store. -
Method Summary
Modifier and TypeMethodDescriptionstatic ProcessSchemePolicySetfromStore(String schemeIdentifier, ProcessSchemePolicyStore store) Reads existing policies from the store for a given scheme.getFriendPolicy(Friend friend) Returns the existing policy for a friend, if any.getLinkTypePolicy(Friend friend, URI resourceType, URI linkType) Returns the existing policy for the given link type, if any.getResourceTypePolicy(Friend friend, URI resourceType) Returns the existing policy for the given resource type, if any.Returns the existing policy for the scheme, if any.booleanisEmpty()Returnstrueif there's no policies in the store for the underlying scheme.static voidRemoves an action from being notified when aprocess scheme policychanges.static voidRegisters an action to get executed when aprocess scheme policychanges.Returns aProcessSchemePolicySet.PolicyStoreUpdaterto perform updates in the store.voidupdateTo(String newSchemeId, Map<ProcessSchemePolicyStore.PolicyKey, String> newPolicies, List<String> projectAreas) Updates this policy set to a new scheme policies.
-
Method Details
-
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.
-
onProcessSchemePolicyChangeSet
Registers an action to get executed when aprocess scheme policychanges.Changes that occurred before the registration are not notified, registrations should be done at application startup. All actions will be executed on a dedicated thread and no exceptions must be thrown but handled internally.
Actions are all automatically unregistered when the application is
disposed.- Parameters:
action- the action to execute.- Since:
- 3.9.0
-
offProcessSchemePolicyChangeSet
Removes an action from being notified when aprocess scheme policychanges.Actions are all automatically unregistered when the application is
disposed.- Parameters:
action- the action to execute.- Since:
- 3.9.0
-
isEmpty
public boolean isEmpty()Returnstrueif there's no policies in the store for the underlying scheme.- Returns:
trueif there's no policies in the store for the underlying scheme.
-
getSchemePolicy
Returns the existing policy for the scheme, if any.- Returns:
- the existing policy for the scheme, an empty
Optionalif none.
-
getFriendPolicy
Returns the existing policy for a friend, if any.- Parameters:
friend- the friend application.- Returns:
- the existing policy for a friend, an empty
Optionalif none.
-
getResourceTypePolicy
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
Optionalif none.
-
getLinkTypePolicy
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
Optionalif none.
-
storeUpdater
Returns aProcessSchemePolicySet.PolicyStoreUpdaterto perform updates in the store. The same unique updater instance is returned for each call of this method.- Returns:
- the associated updater instance.
-
updateTo
public void updateTo(String newSchemeId, Map<ProcessSchemePolicyStore.PolicyKey, String> newPolicies, List<String> projectAreas) Updates this policy set to a new scheme policies.This is an in-memory update, the store is not affected.
- Parameters:
newSchemeId- the new scheme identifier.newPolicies- the new scheme policies.projectAreas- the impacted project areas.- Since:
- 3.9.0
-