Interface AutoFlowService


  • public interface AutoFlowService
    The service to automatically create process flows based on a mapping from process flow definition element attributes to the attributes of an AutoFlowLaunchable object. An example of an AutoFlowLaunchable object is a TLF.

    NOTE: To successfully create an auto flow, these requirements must be met:

    • The process flow definition must be active (not suspended).
    • The process flow definition mapping must be enabled for auto flow.
    • The process flow definition mapping must be complete, which means that all required element attributes for process flow activation have been defined.
    • The auto flow source (for example, a TLF) must be enabled for auto flow.
    • No active or suspended process flow is associated with the auto flow source. A source can have only one associated process flow.

    Assuming that the process flow definition is active and the element mapping is complete, the next step is to enable the TLF for auto flow and specify values for the TLF attributes that are mapped. First, get the study TLF from which you would like to create a process flow. For this example, get the first one in the list.

     
         StudyTlfInfo tlfInfo = studyTlfService.getTlfs(study.getId(), standard.getBaseStandardTypeInfo().getName(),
                 standard.getModelId());
         List<Tlf> tlfs = tlfInfo.getTlfs();
         Tlf tlf = tlfs.iterator().next();
     
     
    Then, update the TLF attribute values with those values to populate the created process flow. In this example, a user is specified for the attribute "User Assignment 1".
     
     
         tlf.setEnableAutoFlow(true);    
         List<AttributeValue> attributeValues = tlf.getAttributes();
         UserDescriptor userA = getUser("userA");
         attributeValues.add(new AttributeValue("User Assignment 1", userA));
         tlf.setAttributes(attributeValues);
         tlfInfo = studyTlfService.setTlfs(tlfInfo);
     
    Once you have enabled auto flow and specified all of your attribute values, you can create the auto flow:
     
         ProcessFlowDescriptor processFlow = autoFlowService.createAutoFlow(study.getId(),
                 processDefinition.getProcessDefinitionKey(), AutoFlowType.TLF, "autoFlowPrefix_", tlf.getId());
     
     
    The created process flow is created and activated with the values that are specified in the TLF attributes.
    Since:
    2.4
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      ProcessFlowDescriptor createAutoFlow​(java.lang.String contextId, java.lang.String processDefinitionKey, AutoFlowType autoFlowType, java.lang.String namePrefix, java.lang.String sourceId)
      Automatically create a process flow based on a process flow definition whose elements have been mapped to source (for example, TLF) metadata.
    • Method Detail

      • createAutoFlow

        ProcessFlowDescriptor createAutoFlow​(java.lang.String contextId,
                                             java.lang.String processDefinitionKey,
                                             AutoFlowType autoFlowType,
                                             java.lang.String namePrefix,
                                             java.lang.String sourceId)
                                      throws AutoFlowSetupException,
                                             AutoFlowException
        Automatically create a process flow based on a process flow definition whose elements have been mapped to source (for example, TLF) metadata.
        Parameters:
        contextId - The identifier of the context.
        processDefinitionKey - The process flow definition key.
        autoFlowType - The type from which a process flow can be automatically created.
        namePrefix - The prefix to add to the name (name of source) of the process flow created.
        sourceId - The identifier of the source from which the process flow is created.
        Returns:
        The process flow created.
        Throws:
        AutoFlowSetupException - Thrown when the set up is incomplete to automatically create process flows.
        AutoFlowException - Thrown when there is an issue during process flow creation.