Class CustomFormApi.DocumentActionApi

Object
DocumentActionApi
Enclosing class:
CustomFormApi

public static class CustomFormApi.DocumentActionApi extends Object
Helper class to work with Custom Forms statuses. The custom form status is updated in the database by invoking the submit, withdraw or revoke methods.

Note: no permissions are checked when the custom form status is updated/recalculated.

Example:

 api.customFormApi()
     .withId(customForm.id)
     .documentAction()
     .submit()
 
See Also:
  • Constructor Details

    • DocumentActionApi

      public DocumentActionApi(Long customFormId, CustomFormService customFormService, ValidationVisitor validationVisitor, FormulaEngineContext formulaEngineContext, CustomFormServiceProperties properties, PersistedObjectService objectService)
      Document action constructor, which allows to inject custom validator
    • DocumentActionApi

      public DocumentActionApi(Long customFormId, CustomFormService customFormService, PersistedObjectService objectService, FormulaEngineContext formulaEngineContext, CustomFormServiceProperties properties)
      Default document action constructor with SimpleValidationVisitor hardcoded
  • Method Details

    • withReason

      public CustomFormApi.DocumentActionApi withReason(String reason)
      To pass a String reason to submit() method for the WorkFlow logic.

      Example:

      
       api.customFormApi()
           .withId(customForm.id)
           .documentAction()
           .withReason('some reason')
           .submit()
       
      Parameters:
      reason - String value to be passed to workflow as submit reason, works only with submit()
      Returns:
      a Document Action builder instance
    • withUser

      public CustomFormApi.DocumentActionApi withUser(String loginName)
      To pass a User's login name as the WorkFlow logic submitter.
      NOTE: works only for submit()

      Example:

      
       api.customFormApi()
           .withId(customForm.id)
           .documentAction()
           .withUser('existingUserLoginName')
           .submit()
       
      Parameters:
      loginName - login name to be passed to workflow as the submitter, works only with submit()
      Returns:
      a Document Action builder instance
      Since:
      14.0 - Caribou Lou
      See Also:
    • submit

      public Object submit() throws XExpression
      Finishes the submit operation. When this is executed, the Custom Form will be updated in the database.

      Note: Since 12.0.0, this operation only works in contexts that allow object modification. The previous behaviour can still be achieved by using the 'customFormApiAlwaysAllowsObjectModification' application property.

      Example:
      
       api.customFormApi()
           .withId(customForm.id)
           .documentAction()
           .submit()
       

      Warning: if this operation is used in a custom form logic, and the id of the custom form being submitted is the same as the current custom form, the process could end in an infinite loop.

      Returns:
      an Object containing the data of the submitted Custom Form or null if failed
      Throws:
      XExpression - if the custom form fails submit with the specified data
      See Also:
    • revoke

      public Object revoke() throws XExpression
      Finishes the revoke operation. When this is executed, the Custom Form will be updated in the database.

      Note: Since 12.0.0, this operation only works in contexts that allow object modification. The previous behaviour can still be achieved by using the 'customFormApiAlwaysAllowsObjectModification' application property.

      Example:
      
       api.customFormApi()
           .withId(customForm.id)
           .documentAction()
           .revoke()
       
      Returns:
      an Object containing the data of the revoked Custom Form or null if failed
      Throws:
      XExpression - if the custom form fails revoke with the specified data
      See Also:
    • withdraw

      public Object withdraw() throws XExpression
      Finishes the withdrawal operation. When this is executed, the Custom Form will be updated in the database.

      Note: Since 12.0.0, this operation only works in contexts that allow object modification. The previous behaviour can still be achieved by using the 'customFormApiAlwaysAllowsObjectModification' application property.

      Example:
      
       api.customFormApi()
           .withId(customForm.id)
           .documentAction()
           .withdraw()
       
      Returns:
      an Object containing the data of the withdrawn Custom Form or null if failed
      Throws:
      XExpression - if the custom form fails withdrawal with the specified data
      See Also: