Class ProcessSchemeStore
- java.lang.Object
-
- com.sodius.oslc.server.process.scheme.ProcessSchemeStore
-
public abstract class ProcessSchemeStore extends Object
Manages access to process schemes.Subclasses need to ensure that the first time the store is accessed, a default scheme is automatically created if none yet exists.
- Since:
- 3.5.0
-
-
Constructor Summary
Constructors Constructor Description ProcessSchemeStore()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addScheme(ProcessScheme scheme)
Adds a new scheme.static ProcessSchemeStore
getInstance()
Returns the current store instance.abstract String
getProjectAreaScheme(String projectAreaIdentifier)
Resolves the scheme identifier to which the given project area is associated.abstract Optional<ProcessScheme>
getScheme(String identifier)
Resolves a scheme by identifier.abstract Collection<String>
getSchemeProjectAreas(String schemeIdentifier)
Resolves the identifiers of the project areas associated to the given scheme.abstract Collection<ProcessScheme>
getSchemes()
Resolves the registered schemes.abstract void
removeScheme(String identifier)
Removes the scheme of given identifier.static void
setInstance(ProcessSchemeStore store)
Replaces the current store instance with the given one.abstract void
setProjectAreaScheme(String projectAreaIdentifier, String schemeIdentifier)
Replaces the scheme associated with the given project area.abstract void
updateScheme(ProcessScheme scheme)
Updates a scheme.
-
-
-
Method Detail
-
getInstance
public static ProcessSchemeStore getInstance()
Returns the current store instance.- Returns:
- the current instance.
- See Also:
setInstance(ProcessSchemeStore)
-
setInstance
public static void setInstance(ProcessSchemeStore store)
Replaces the current store instance with the given one.- Parameters:
store
- the new store.
-
getSchemes
public abstract Collection<ProcessScheme> getSchemes() throws ProcessSchemeStoreException
Resolves the registered schemes. Implementation needs to ensure a default scheme is created if none yet exists.- Returns:
- the registered schemes.
- Throws:
ProcessSchemeStoreException
- if an error prevents schemes from being retrieved.
-
getScheme
public abstract Optional<ProcessScheme> getScheme(String identifier) throws ProcessSchemeStoreException
Resolves a scheme by identifier.- Parameters:
identifier
- the given identifier.- Returns:
- the scheme for the given identifier, an empty
Optional
if none - Throws:
ProcessSchemeStoreException
- if an error prevents the scheme from being retrieved.
-
addScheme
public abstract void addScheme(ProcessScheme scheme) throws ProcessSchemeStoreException
Adds a new scheme.- Parameters:
scheme
- the scheme to add- Throws:
ProcessSchemeStoreException
- if an error prevents the scheme from being added.
-
removeScheme
public abstract void removeScheme(String identifier) throws ProcessSchemeStoreException
Removes the scheme of given identifier.- Parameters:
identifier
- the given identifier.- Throws:
ProcessSchemeStoreException
- if an error prevents the scheme from being removed.
-
updateScheme
public abstract void updateScheme(ProcessScheme scheme) throws ProcessSchemeStoreException
Updates a scheme.- Parameters:
scheme
- the scheme to update- Throws:
ProcessSchemeStoreException
- if an error prevents the scheme from being updated.
-
getSchemeProjectAreas
public abstract Collection<String> getSchemeProjectAreas(String schemeIdentifier) throws ProcessSchemeStoreException
Resolves the identifiers of the project areas associated to the given scheme.- Parameters:
schemeIdentifier
- the identifier of a scheme- Returns:
- the list of project areas identifiers which are bound to the given scheme
- Throws:
ProcessSchemeStoreException
- if an error prevents the associations from being read.
-
getProjectAreaScheme
public abstract String getProjectAreaScheme(String projectAreaIdentifier) throws ProcessSchemeStoreException
Resolves the scheme identifier to which the given project area is associated. Subclasses needs to ensure the project is always associated to a given scheme, which can be the default scheme.- Parameters:
projectAreaIdentifier
- the identifier of a project area- Returns:
- the identifier of the scheme to which the given project area is associated.
- Throws:
ProcessSchemeStoreException
- if an error prevents the association from being read.
-
setProjectAreaScheme
public abstract void setProjectAreaScheme(String projectAreaIdentifier, String schemeIdentifier) throws ProcessSchemeStoreException
Replaces the scheme associated with the given project area.- Parameters:
projectAreaIdentifier
- the identifier of the project areaschemeIdentifier
- the identifier of the new scheme to assign- Throws:
ProcessSchemeStoreException
- if an error prevents the association from being created.
-
-