Class ProjectAreaStore

java.lang.Object
com.sodius.oslc.server.process.ProjectAreaStore

public abstract class ProjectAreaStore extends Object
Manages access to OSLC project areas.

Subclasses usually only need to override getAccessibleProjectAreas(). In addition, they may override getRestrictedProjectAreas() if they have a mean to provide this information.

Since:
3.3.0
  • Constructor Details

    • ProjectAreaStore

      public ProjectAreaStore()
  • Method Details

    • onProjectConfigurationEnabled

      public static void onProjectConfigurationEnabled(Consumer<String> action)
      Registers an action to get executed when a project area is Configuration Management enabled.

      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
    • offProjectConfigurationEnabled

      public static void offProjectConfigurationEnabled(Consumer<String> action)
      Removes an action from being notified when a project area is Configuration Management enabled.

      Actions are all automatically unregistered when the application is disposed.

      Parameters:
      action - the action to execute.
      Since:
      3.9.0
    • getInstance

      public static ProjectAreaStore getInstance()
      Returns the current store instance.
      Returns:
      the current instance.
      See Also:
    • setInstance

      public static void setInstance(ProjectAreaStore store)
      Replaces the current store instance with the given one.
      Parameters:
      store - the new store.
    • getProjectAreas

      public Collection<ProjectArea> getProjectAreas() throws ProjectAreaStoreException
      Gets all the project areas, which is the union of projects accessible by the current user and the ones that are not.

      Implementation must set the title and project identifier. It must not set the service providers.

      Default implementation combines getAccessibleProjectAreas() and getRestrictedProjectAreas()

      Returns:
      the collection of all project areas.
      Throws:
      ProjectAreaStoreException - if an error prevents project areas from being retrieved.
      Since:
      4.0.0
    • getAccessibleProjectAreas

      public abstract Collection<ProjectArea> getAccessibleProjectAreas() throws ProjectAreaStoreException
      Gets project areas accessible by the current user.

      Implementation must set the title and project identifier. It must not set the service providers.

      If the application APIs do not allow access to the project area title for users without a READ permission, then this method should return an empty collection.

      Returns:
      a collection of accessible project areas.
      Throws:
      ProjectAreaStoreException - if an error prevents project areas from being retrieved.
      Since:
      4.0.0
    • getRestrictedProjectAreas

      public Collection<ProjectArea> getRestrictedProjectAreas() throws ProjectAreaStoreException
      Gets project areas not accessible by a current user.

      Implementation must set the title and project identifier. It must not set the service providers.

      If the application APIs do not allow access to the project area title for users without a READ permission, then this method should return an empty collection.

      Default implementation returns an empty collection, as providing restricted project areas is rarely achievable. Subclasses may override if they have a mean to provide this information.

      Returns:
      a collection of restricted project areas.
      Throws:
      ProjectAreaStoreException - if an error prevents project areas from being retrieved.
      Since:
      4.0.0
    • getOslcProjectAreas

      public Collection<ProjectArea> getOslcProjectAreas() throws ProjectAreaStoreException
      Gets all the OSLC enabled project areas.

      Implementation retains OSLC-enabled projects from getProjectAreas().

      Returns:
      the collection of OSLC-enabled project areas.
      Throws:
      ProjectAreaStoreException - if an error prevents project areas from being retrieved.
      Since:
      4.0.0
    • getAccessibleOslcProjectAreas

      public Collection<ProjectArea> getAccessibleOslcProjectAreas() throws ProjectAreaStoreException
      Gets the OSLC enabled project areas accessible by the current user.

      Implementation retains OSLC-enabled projects from getAccessibleProjectAreas().

      Returns:
      a collection of OSLC accessible project areas.
      Throws:
      ProjectAreaStoreException - if an error prevents project areas from being retrieved.
      Since:
      4.0.0
    • getRestrictedOslcProjectAreas

      public Collection<ProjectArea> getRestrictedOslcProjectAreas() throws ProjectAreaStoreException
      Gets the OSLC enabled project areas not accessible by the current user.

      Implementation retains OSLC-enabled projects from getRestrictedProjectAreas().

      Returns:
      a collection of OSLC restricted project areas.
      Throws:
      ProjectAreaStoreException - if an error prevents project areas from being retrieved.
      Since:
      4.0.0
    • isConfigurationManagementEnabled

      public boolean isConfigurationManagementEnabled(String projectAreaId) throws SettingStoreException
      Determines whether Configuration Management is enabled on a given project area.
      Parameters:
      projectAreaId - the given project area id.
      Returns:
      true if Configuration Management is enabled; false otherwise.
      Throws:
      SettingStoreException - if a storage exception occurs.
      Since:
      3.7.0
    • setConfigurationManagementEnabled

      public void setConfigurationManagementEnabled(String projectAreaId, boolean enabled) throws SettingStoreException
      Updates the Configuration Management status on a given project area.
      Parameters:
      projectAreaId - the given project area id.
      enabled - the next Configuration Management status.
      Throws:
      SettingStoreException - if a storage exception occurs.
      Since:
      3.7.0