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 Summary

    Constructors
    Constructor
    Description
    DocumentActionApi(Long id, CustomFormService customFormService, ValidationVisitor validationVisitor, FormulaEngineContext formulaEngineContext, CustomFormServiceProperties properties, PersistedObjectService objectService)
    Document action constructor, which allows to inject custom validator
    DocumentActionApi(Long id, CustomFormService customFormService, PersistedObjectService objectService, FormulaEngineContext formulaEngineContext, CustomFormServiceProperties properties)
    Default document action constructor with SimpleValidationVisitor hardcoded
  • Method Summary

    Modifier and Type
    Method
    Description
    Finishes the revoke operation.
    Finishes the submit operation.
    Finishes the withdrawal operation.
    To pass a String reason to submit() method for the WorkFlow logic.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DocumentActionApi

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

      public DocumentActionApi(Long id, 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 ba passed to workflow as submit reason, works only with submit()
      Returns:
      a Document Action builder instance
    • 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: