Class WorkflowDocumentFactory

java.lang.Object
org.kuali.rice.kew.api.WorkflowDocumentFactory

public final class WorkflowDocumentFactory extends Object
Factory which manufactures WorkflowDocuments. This is the main entry point for interaction with the Kuali Enterprise Workflow System. The WorkflowDocumentFactory uses the org.kuali.rice.kew.impl.document.WorkflowDocumentProvider SPI as a strategy for creating WorkflowDocument instances. The provider class is specified in the following file in the class loader: "META-INF/services/org.kuali.rice.kew.api.WorkflowDocument", and should implement the WorkflowDocumentProvider interface.
  • Constructor Details

    • WorkflowDocumentFactory

      public WorkflowDocumentFactory()
  • Method Details

    • createDocument

      public static WorkflowDocument createDocument(String principalId, String documentTypeName)
      Creates a new workflow document of the given type with the given initiator.
      Parameters:
      principalId - the document initiator
      documentTypeName - the document type
      Returns:
      a WorkflowDocument object through which to interact with the new workflow document
      Throws:
      IllegalArgumentException - if principalId is null or blank
      IllegalArgumentException - if documentTypeName is null or blank
      IllegalDocumentTypeException - if the document type does not allow for creation of a document, this can occur when the given document type is used only as a parent and has no route path configured
      InvalidActionTakenException - if the caller is not allowed to execute this action
    • createDocument

      public static WorkflowDocument createDocument(String principalId, String documentTypeName, String title)
      Creates a new workflow document of the given type with the given initiator.
      Parameters:
      principalId - the document initiator
      documentTypeName - the document type
      title - the title of the new document
      Returns:
      a WorkflowDocument object through which to interact with the new workflow document
      Throws:
      IllegalArgumentException - if principalId is null or blank
      IllegalArgumentException - if documentTypeName is null or blank
      IllegalDocumentTypeException - if documentTypeName does not represent a valid document type
    • createDocument

      public static WorkflowDocument createDocument(String principalId, String documentTypeName, DocumentUpdate documentUpdate, DocumentContentUpdate documentContentUpdate)
      Creates a new workflow document of the given type with the given initiator.
      Parameters:
      principalId - the document initiator
      documentTypeName - the document type
      documentUpdate - pre-constructed state with which to initialize the document
      documentContentUpdate - pre-constructed document content with which to initialize the document
      Returns:
      a WorkflowDocument object through which to interact with the new workflow document
      Throws:
      IllegalArgumentException - if principalId is null or blank
      IllegalArgumentException - if documentTypeName is null or blank
      IllegalDocumentTypeException - if documentTypeName does not represent a valid document type
      See Also:
      • org.kuali.rice.kew.impl.document.WorkflowDocumentProvider#createDocument(String, String, DocumentUpdate, DocumentContentUpdate)
    • loadDocument

      public static WorkflowDocument loadDocument(String principalId, String documentId)
      Loads an existing workflow document.
      Parameters:
      principalId - the principal id under which to perform document actions
      documentId - the id of the document to load
      Returns:
      a WorkflowDocument object through which to interact with the loaded workflow document
      Throws:
      IllegalArgumentException - if principalId is null or blank
      IllegalArgumentException - if documentTypeName is null or blank
      IllegalDocumentTypeException - if the specified document type is not active
      IllegalDocumentTypeException - if the specified document type does not support document creation (in other words, it's a document type that is only used as a parent)
      InvalidActionTakenException - if the supplied principal is not allowed to execute this action
      See Also:
      • org.kuali.rice.kew.impl.document.WorkflowDocumentProvider#loadDocument(String, String)