Interface WorkflowSchemeManager

All Superinterfaces:
SchemeManager
All Known Implementing Classes:
DefaultWorkflowSchemeManager, EagerWorkflowSchemeManager

public interface WorkflowSchemeManager extends SchemeManager
  • Method Details

    • getEntities

      List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme) throws org.ofbiz.core.entity.GenericEntityException
      Get all Scheme entity records for a particular scheme. Inherited from SchemeManager.
      Specified by:
      getEntities in interface SchemeManager
      Parameters:
      scheme - The scheme that the entities belong to
      Returns:
      List of (GenericValue) entities
      Throws:
      org.ofbiz.core.entity.GenericEntityException - If a DB error occurs
    • getEntities

      List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId) throws org.ofbiz.core.entity.GenericEntityException
      Deprecated.
      Workflows have a String ID. Since v6.4.
      Inherited from SchemeManager.
      Specified by:
      getEntities in interface SchemeManager
      Throws:
      org.ofbiz.core.entity.GenericEntityException
    • getEntities

      List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String entityTypeId) throws org.ofbiz.core.entity.GenericEntityException
      Inherited from SchemeManager.
      Specified by:
      getEntities in interface SchemeManager
      Throws:
      org.ofbiz.core.entity.GenericEntityException
    • getEntities

      List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, Long entityTypeId, String parameter) throws org.ofbiz.core.entity.GenericEntityException
      Deprecated.
      Workflows have a String ID. Since v6.4.
      Inherited from SchemeManager.
      Specified by:
      getEntities in interface SchemeManager
      Throws:
      org.ofbiz.core.entity.GenericEntityException
    • getEntities

      List<org.ofbiz.core.entity.GenericValue> getEntities(org.ofbiz.core.entity.GenericValue scheme, String type, Long entityTypeId) throws org.ofbiz.core.entity.GenericEntityException
      Deprecated.
      Workflows have a String ID. Since v6.4.
      Inherited from SchemeManager.
      Specified by:
      getEntities in interface SchemeManager
      Throws:
      org.ofbiz.core.entity.GenericEntityException
    • getSchemeEntityName

      String getSchemeEntityName()
    • getEntityName

      String getEntityName()
    • getAssociationType

      String getAssociationType()
    • getSchemeDesc

      String getSchemeDesc()
    • getWorkflowScheme

      org.ofbiz.core.entity.GenericValue getWorkflowScheme(org.ofbiz.core.entity.GenericValue project) throws org.ofbiz.core.entity.GenericEntityException
      Throws:
      org.ofbiz.core.entity.GenericEntityException
    • getWorkflowScheme

      org.ofbiz.core.entity.GenericValue getWorkflowScheme(Project project) throws org.ofbiz.core.entity.GenericEntityException
      Throws:
      org.ofbiz.core.entity.GenericEntityException
    • getDefaultEntity

      org.ofbiz.core.entity.GenericValue getDefaultEntity(org.ofbiz.core.entity.GenericValue scheme) throws org.ofbiz.core.entity.GenericEntityException
      Throws:
      org.ofbiz.core.entity.GenericEntityException
    • getDefaultWorkflowScheme

      AssignableWorkflowScheme getDefaultWorkflowScheme()
    • getNonDefaultEntities

      List<org.ofbiz.core.entity.GenericValue> getNonDefaultEntities(org.ofbiz.core.entity.GenericValue scheme) throws org.ofbiz.core.entity.GenericEntityException
      Throws:
      org.ofbiz.core.entity.GenericEntityException
    • getActiveWorkflowNames

      Collection<String> getActiveWorkflowNames() throws org.ofbiz.core.entity.GenericEntityException, WorkflowException
      Returns:
      A collection of all workflow names currently active (ie assigned to schemes & associated with projects).
      Throws:
      org.ofbiz.core.entity.GenericEntityException
      WorkflowException
    • addWorkflowToScheme

      void addWorkflowToScheme(org.ofbiz.core.entity.GenericValue scheme, String workflowName, String issueTypeId) throws org.ofbiz.core.entity.GenericEntityException
      Throws:
      org.ofbiz.core.entity.GenericEntityException
    • updateSchemesForRenamedWorkflow

      void updateSchemesForRenamedWorkflow(String oldWorkflowName, String newWorkflowName)
      Updates Workflow Schemes's such that schemes associated to the workflow with name oldWorkflowName will be changed to newWorkflowName.

      Note: There is no validation performed by this method to determine if the provided oldWorkflowName or newWorkflowName are valid workflow names or if the workflow is active/inactive. These validations must be done by the caller.

      Parameters:
      oldWorkflowName - name of the workflow to re-assign all its associated schemes from
      newWorkflowName - name of the workflow to assign all the schemes associated to targetWorkflow
    • getSchemesForWorkflow

      Collection<org.ofbiz.core.entity.GenericValue> getSchemesForWorkflow(JiraWorkflow workflow)
      Returns all workflow schemes that the passed workflow is assigned to, not including draft schemes.
      Parameters:
      workflow - the workflow whose schemes must be returned
      Returns:
      workflow schemes that the passed workflow is assigned to, not including draft schemes.
    • getSchemesForWorkflowIncludingDrafts

      Iterable<WorkflowScheme> getSchemesForWorkflowIncludingDrafts(JiraWorkflow workflow)
      Returns all workflow schemes that the passed workflow is assigned to, including draft schemes.
      Parameters:
      workflow - the workflow whose schemes must be returned
      Returns:
      workflow schemes that the passed workflow is assigned to, including draft schemes.
    • clearWorkflowCache

      void clearWorkflowCache()
    • getWorkflowMap

      Map<String,String> getWorkflowMap(Project project)
      Returns a map representation of a workflow scheme for a passed project. The returned map stores {issuetype -> workflowName}. A null issuetype points out the default workflow for the scheme.
      Parameters:
      project - the project whose scheme should be returned.
      Returns:
      the map representation of a workflow scheme. Each key represents an issuetype which its associated value the name of the workflow assigned to that issue type. A null issuetype points out the default workflow for that scheme.
    • getWorkflowName

      String getWorkflowName(Project project, String issueTypeId)
      Get the name of the workflow associated with the passed project and issue type.
      Parameters:
      project - the project used in the search.
      issueTypeId - the ID of issue type used in the search.
      Returns:
      the name of the workflow associated with the passed project and issue type.
    • getWorkflowName

      String getWorkflowName(org.ofbiz.core.entity.GenericValue scheme, String issueTypeId)
      Get the name of the workflow from the passed scheme associated with the passed issue type.
      Parameters:
      scheme - the scheme to search.
      issueTypeId - the ID of issue type used in the search.
      Returns:
      the name of the workflow associated with the scheme and issue type.
    • isUsingDefaultScheme

      boolean isUsingDefaultScheme(Project project)
      Tells the caller if the passed project is using the default workflow scheme.
      Parameters:
      project - the project to check.
      Returns:
      true if the passed project is using the default scheme, false otherwise.
    • hasDraft

      boolean hasDraft(@Nonnull AssignableWorkflowScheme workflowScheme)
      Tells the caller if the passed workflow scheme has a draft.
      Parameters:
      workflowScheme - the workflow scheme to check. It is illegal to pass a draft workflow scheme to this method.
      Returns:
      true if the passed workflow has a draft false otherwise.
    • assignableBuilder

      Return a builder that can be used to create a new AssignableWorkflowScheme.
      Returns:
      the builder that can be used to create the new workflow scheme.
    • draftBuilder

      Return a builder that can be used to create a new DraftWorkflowScheme for the passed workflow scheme.
      Returns:
      the builder that can be used to create the new workflow scheme.
    • createScheme

      @Nonnull AssignableWorkflowScheme createScheme(@Nonnull AssignableWorkflowScheme workflowScheme)
      Create a new workflow scheme.
      Parameters:
      workflowScheme - the workflow scheme to create a draft of. It cannot be a draft, the default scheme, a scheme that already has a draft or a scheme that is not already in the database (i.e. does not have an ID).
      Returns:
      the new draft scheme.
    • createDraftOf

      @Nonnull DraftWorkflowScheme createDraftOf(ApplicationUser creator, @Nonnull AssignableWorkflowScheme workflowScheme)
      Create a draft for the passed workflow scheme. It is illegal to pass:
      • A scheme that already has a draft.
      • A scheme that is not currently in the database.
      • The default workflow scheme
      • A draft workflow scheme.
      Parameters:
      creator - the user that is going to create the draft. This user is recorded as the person who last modified the new draftscheme.
      workflowScheme - the workflow scheme to create a draft of. It cannot be a draft, the default scheme, a scheme that already has a draft or a scheme that is not already in the database (i.e. does not have an ID).
      Returns:
      the new draft scheme.
    • createDraft

      @Nonnull DraftWorkflowScheme createDraft(ApplicationUser creator, @Nonnull DraftWorkflowScheme workflowScheme)
      Create the passed draft workflow scheme. A draft can be created using the draftBuilder(AssignableWorkflowScheme) method.

      • A scheme that already has a draft.
      • A scheme that is not currently in the database.
      • The default workflow scheme
      • A draft workflow scheme.
      Parameters:
      creator - the user that is going to create the draft. This user is recorded as the person who last modified the new draftscheme.
      workflowScheme - the workflow scheme to create.
      Returns:
      the new draft scheme.
    • getAssignableSchemes

      @Nonnull Iterable<AssignableWorkflowScheme> getAssignableSchemes()
      Return all the assignable workflow schemes.
      Returns:
      a list of all the assignable workflow schemes.
    • getWorkflowSchemeObj

      @Nullable AssignableWorkflowScheme getWorkflowSchemeObj(long id)
      Return the workflow scheme with the passed id.
      Parameters:
      id - the id to search.
      Returns:
      the workflow scheme with the given id or null if no such scheme exists.
    • getWorkflowSchemeObj

      @Nullable AssignableWorkflowScheme getWorkflowSchemeObj(String name)
      Return the workflow scheme with the passed name.
      Parameters:
      name - the name to search.
      Returns:
      the workflow scheme with the given name or null if no such scheme exists.
    • getWorkflowSchemeObj

      @Nonnull AssignableWorkflowScheme getWorkflowSchemeObj(@Nonnull Project project)
      Return the workflow scheme associated with the passed project.
      Parameters:
      project - the project whose scheme is to be returned.
      Returns:
      the scheme the passed project is using. Never null.
    • getDraftForParent

      DraftWorkflowScheme getDraftForParent(@Nonnull AssignableWorkflowScheme workflowScheme)
      Return the draft workflow scheme for the passed workflow scheme.
      Parameters:
      workflowScheme - the workflow scheme whose draft is being sought.
      Returns:
      the draft of the passed workflow scheme or null if it does not exist.
    • getDraft

      DraftWorkflowScheme getDraft(long id)
      Return the draft workflow scheme with the given id.
      Parameters:
      id - the id of the draft workflow scheme to be returned
      Returns:
      the draft with the given id or null if it does not exist.
    • getParentForDraft

      AssignableWorkflowScheme getParentForDraft(long draftSchemeId)
      Return the original workflow scheme for the passed draft workflow scheme.
      Parameters:
      draftSchemeId - the id of the draft workflow scheme whose parent is being sought.
      Returns:
      the parent of the passed draft workflow scheme.
    • isActive

      boolean isActive(@Nonnull WorkflowScheme workflowScheme)
      Return true if the passed workflow scheme is being used by a project.
      Parameters:
      workflowScheme - the workflow scheme to test.
      Returns:
      true if the passed workflow scheme us being used by a project; false otherwise.
    • deleteWorkflowScheme

      boolean deleteWorkflowScheme(@Nonnull WorkflowScheme scheme)
      Delete the passed workflow scheme. It is illegal to delete an active scheme, the default scheme or a scheme that is not already in the database.
      Parameters:
      scheme - the scheme to delete. Cannot be the default scheme, active scheme or a scheme that is not already in the database.
      Returns:
      true if the scheme was deleted; false otherwise.
    • updateDraftWorkflowScheme

      DraftWorkflowScheme updateDraftWorkflowScheme(ApplicationUser user, @Nonnull DraftWorkflowScheme scheme)
      Save changes to the passed draft workflow scheme.
      Parameters:
      user - the user making the changes.
      scheme - the draft scheme to change.
      Returns:
      the draft scheme as now stored in the database.
    • updateWorkflowScheme

      AssignableWorkflowScheme updateWorkflowScheme(@Nonnull AssignableWorkflowScheme scheme)
      Save changes to the passed workflow scheme.
      Parameters:
      scheme - the scheme to change.
      Returns:
      the scheme that is now stored in the database.
    • getProjectsUsing

      @Nonnull List<Project> getProjectsUsing(@Nonnull AssignableWorkflowScheme workflowScheme)
      Return the list of projects that use the passed workflow scheme.
      Parameters:
      workflowScheme - the workflow scheme to check.
      Returns:
      the list of projects that use the passed workflow scheme.
    • cleanUpSchemeDraft

      AssignableWorkflowScheme cleanUpSchemeDraft(Project project, ApplicationUser user)
      If the project's workflow scheme is only used by one project and if this scheme has a draft, then the draft is copied to a separate scheme and deleted.
      Parameters:
      project - project who's workflow scheme draft is to be copied to a separate scheme.
      user - the user making the changes.
      Returns:
      copied scheme or null if it was not created.
    • copyDraft

      AssignableWorkflowScheme copyDraft(DraftWorkflowScheme draft, ApplicationUser user, String newDescription)
    • replaceSchemeWithDraft

      void replaceSchemeWithDraft(DraftWorkflowScheme draft)
    • waitForUpdatesToFinishAndExecute

      <T> T waitForUpdatesToFinishAndExecute(AssignableWorkflowScheme scheme, Callable<T> task) throws Exception
      If the passed workflow scheme is currently being edited, then this method blocks until the editing is finished. Executes the passed Callable task in the end and returns its result. Workflow scheme editing will be blocked until the task execution finishes.
      Type Parameters:
      T - return type of the task.
      Parameters:
      scheme - the workflow scheme.
      task - task to execute.
      Returns:
      the value returned by the passed task.
      Throws:
      Exception - any exception occurred during task execution.