Interface IExecutionResultDescriptor

    • Method Detail

      • getAlwaysValueDescriptor

        default IValueDescriptor<?,​? extends IValueBuilder<?>> getAlwaysValueDescriptor​(IValueDescriptorFactory factory)
        Creates the value descriptor for that data that is made available to the workflow when the node is executed, regardless of whether is succeeded or failed. The default implementation returns IValueDescriptorFactory.voidish(), i.e. no additional result.
        Parameters:
        factory - Factory that may be used for creating the descriptor. You may also use ValueDescriptorFactory.getInstance() if you wish to cache the descriptor in a static or instance field.
        Returns:
        The value descriptor for that data that is made available to the workflow when the node is executed, regardless of whether is succeeded or failed.
      • getAttachmentValueDescriptor

        default IAttachmentValueDescriptor getAttachmentValueDescriptor()
        Creates the descriptor for the attachment or attachments that are created when the node is executed. Should return null when the node never creates attachments.
        Returns:
        The descriptor for the attachment or attachments made available after the node was executed.
      • getCurrentAttachmentValueDescriptor

        default IAttachmentValueDescriptor getCurrentAttachmentValueDescriptor()
        Creates the descriptor for the attachment or attachments that are created and made available to other actions while the node is being executed. Should return null when the node provides no attachments.
        Returns:
        The descriptor for the attachment or attachment made available while the node is being executed.
      • getCurrentFileValueDescriptor

        default IFileValueDescriptor getCurrentFileValueDescriptor()
        Creates the descriptor for the file or files that are created and made available to other actions while the node is being executed. Should return null when the node provides no files.
        Returns:
        The descriptor for the file or files made available while the node is being executed.
      • getCurrentValueDescriptor

        default IValueDescriptor<?,​? extends IValueBuilder<?>> getCurrentValueDescriptor​(IValueDescriptorFactory factory)
        Creates the value descriptor for the data that is made available to the workflow while the node is being executed.
        Parameters:
        factory - Factory that may be used for creating the descriptor. Instead of the factory passed in to this method, you may also use ValueDescriptorFactory.getInstance() if you wish to cache the descriptor in a static or instance field.
        Returns:
        The descriptor for data published by the node while it is being executed.
      • getErrorValueDescriptor

        @Deprecated
        default IUnionValueDescriptor getErrorValueDescriptor​(IValueDescriptorFactory factory)
        The union descriptor for the different error types that may occur when the node is executed. Each discriminator of the union represents an error or exception type.
         factory.recordBuilder() //
             .requiredProperty("errorCode", factory.integer()) //
             .requiredProperty("errorMessage", factory.string()) //
             .requiredProperty("localizedMessage", factory.integer());
         return factory.add("CONNECT_TIMEOUT", error) //
             .add("READ_TIMEOUT", error);
         
        The example above uses the same data type for each error, but you can return different data depending on the error type.

        Note that you do not have to include a general error code. When the execute method of a node handler throws an unhandled (runtime) exception, the error code CmnConst.Workflow.ERROR_CODE_GENERAL is set automatically.

        Parameters:
        factory - Factory that may be used for creating the descriptor. You may also use ValueDescriptorFactory.getInstance() if you wish to cache the descriptor in a static or instance field.
        Returns:
        The value descriptor for the data that is made available to the workflow when the execution of the node failed (such as by throwing an exception).
      • getErrorValueDescriptors

        default Map<String,​IValueDescriptor<?,​?>> getErrorValueDescriptors​(IValueDescriptorFactory factory)
        The descriptors for the different error types that may occur when the node is executed. Each discriminator of the union represents an error or exception type.
         var connectTimeoutError = factory.recordBuilder().requiredProperty("connectTimeoutMs", factory.integer());
         var readTimeoutError = factory.recordBuilder().requiredProperty("readTimeoutMs", factory.integer());
         return Map.of("CONNECT_TIMEOUT", connectTimeoutError, "READ_TIMEOUT", readTimeoutError);
         
        The example above uses a different set of data each type of error.

        Note that you do not have to include a general error code. When the execute method of a node handler throws an unhandled (runtime) exception, the error code CmnConst.Workflow.ERROR_CODE_GENERAL is set automatically.

        Parameters:
        factory - Factory that may be used for creating the descriptor. You may also use ValueDescriptorFactory.getInstance() if you wish to cache the descriptor in a static or instance field.
        Returns:
        The value descriptor for the data that is made available to the workflow when the execution of the node failed (such as by throwing an exception).
        Since:
        8.5.0
      • getFileValueDescriptor

        default IFileValueDescriptor getFileValueDescriptor()
        Creates the descriptor for the file or files that are created and made available to other actions when the node is executed. Should return null when the node provides node files.
        Returns:
        The descriptor for the file or files made available after the node was executed.
      • getSoftErrorValueDescriptor

        @Deprecated
        default IUnionValueDescriptor getSoftErrorValueDescriptor​(IValueDescriptorFactory factory)
        The union descriptor for the different soft error types that may occur when the node is executed. Each discriminator of the union represents an error or exception type.
         factory.recordBuilder() //
             .requiredProperty("errorCode", factory.integer()) //
             .requiredProperty("errorMessage", factory.string()) //
             .requiredProperty("localizedMessage", factory.integer());
         return factory.add("MISSING_UPLOAD", error) //
             .add("CLIENT_ERROR", error);
         
        The example above uses the same data type for each error, but you can return different data depending on the error type.
        Parameters:
        factory - Factory that may be used for creating the descriptor. You may also use ValueDescriptorFactory.getInstance() if you wish to cache the descriptor in a static or instance field.
        Returns:
        The value descriptor for the data that is made available to the workflow when the execution of the node was successful, but contains one or more soft errors.
        Since:
        7.0.7
      • getSoftErrorValueDescriptors

        default Map<String,​IValueDescriptor<?,​?>> getSoftErrorValueDescriptors​(IValueDescriptorFactory factory)
        The descriptors for the different soft error types that may occur when the node is executed. Each discriminator of the union represents an error or exception type.
         var missingUploadError = factory.recordBuilder().requiredProperty("elementName", factory.string());
         var clientError = factory.recordBuilder().requiredProperty("statusCode", factory.integer());
         return Map.of("MISSING_UPLOAD", missingUploadError, "CLIENT_ERROR", clientError);
         
        The example above uses a different data type for each type of error.

        @implNote This interface provides a default implementation for backwards compatibility so as not to break existing implementations. However, all existing implementations are strongly advised to override and implement this method. The default implementation may be removed at some point.

        Parameters:
        factory - Factory that may be used for creating the descriptor. You may also use ValueDescriptorFactory.getInstance() if you wish to cache the descriptor in a static or instance field.
        Returns:
        The value descriptor for the data that is made available to the workflow when the execution of the node was successful, but contains one or more soft errors.
        Since:
        8.5.0
      • getSuccessValueDescriptor

        IValueDescriptor<?,​? extends IValueBuilder<?>> getSuccessValueDescriptor​(IValueDescriptorFactory factory)
        Creates the value descriptor for the data that is made available to the workflow when the node was executed successfully.
        Parameters:
        factory - Factory that may be used for creating the descriptor. Instead of the factory passed in to this method, you may also use ValueDescriptorFactory.getInstance() if you wish to cache the descriptor in a static or instance field.
        Returns:
        The data provided by the node after having been executed successfully.