Platform Explorer / Nuxeo Platform 5.6

Contribution studio.extensions.nuxeo-routing-default--chains

This contribution is part of XML component studio.extensions.nuxeo-routing-default inside nuxeo-platform-document-routing-default-5.6.jar

Extension point

Extension point chains of component OperationServiceComponent.

Contributed items

  • <chain id="logInAudit">
          <operation id="Audit.Log">
            <param name="event" type="string">expr:NodeVariables["button"] =="reject"?"Document refused":"Document validated"</param>
            <param name="category" type="string">Review workflow</param>
            <param name="comment" type="string">expr:@{nodeLastActor} @{NodeVariables["button"] =="reject"?"Document refused":"validated"} the document with the following comment: @{NodeVariables["assigneeComment"]}</param>
          </operation>
        </chain>
  • <chain id="nextAssignee">
          <operation id="Context.RunScript">
            <param name="script" type="string">if (NodeVariables["button"] == "validate") {
      WorkflowVariables["index"] = WorkflowVariables["index"] + 1;
    }
    else if (NodeVariables["button"] == "reject") {
      WorkflowVariables["index"] = WorkflowVariables["index"] - 1;
    }
    else if (NodeVariables["button"] == "submit") {
      WorkflowVariables["index"] = 0;
    }</param>
          </operation>
        </chain>
  • <chain id="notifyInitiatorEndOfWorkflow">
          <operation id="Context.FetchDocument"/>
          <operation id="Notification.SendMail">
            <param name="from" type="string">contact@noadress.com</param>
            <param name="message" type="string">The document was approved by every participant.</param>
            <param name="subject" type="string">Document approved</param>
            <param name="to" type="stringlist">expr:Fn.getEmail(workflowInitiator)</param>
            <param name="HTML" type="boolean">false</param>
            <param name="viewId" type="string">view_documents</param>
          </operation>
        </chain>
  • <chain id="terminateWorkflow">
          <operation id="Context.FetchDocument"/>
          <operation id="Context.RunOperation">
            <param name="id" type="string">logInAudit</param>
            <param name="isolate" type="boolean">false</param>
          </operation>
          <operation id="Context.RunDocumentOperationInNewTx">
            <param name="id" type="string">notifyInitiatorEndOfWorkflow</param>
            <param name="isolate" type="boolean">false</param>
            <param name="rollbackGlobalOnError" type="boolean">false</param>
          </operation>
          <operation id="Context.RunOperation">
            <param name="id" type="string">expr:WorkflowVariables["validationOrReview"] == "validation"?"validateDocument":"voidChain"</param>
            <param name="isolate" type="boolean">false</param>
          </operation>
          <operation id="Audit.Log">
            <param name="event" type="string">Review completed successfully</param>
            <param name="category" type="string">Review workflow</param>
            <param name="comment" type="string">All the participants of the review have approved the document.</param>
          </operation>
        </chain>
  • <chain id="validateDocument">
          <operation id="Context.FetchDocument"/>
          <operation id="Document.SetLifeCycle">
            <param name="value" type="string">approve</param>
          </operation>
        </chain>
  • <chain id="voidChain">
          <operation id="Context.FetchDocument"/>
        </chain>

XML source

<extension point="chains" target="org.nuxeo.ecm.core.operation.OperationServiceComponent">
    <chain id="logInAudit">
      <operation id="Audit.Log">
        <param name="event" type="string">expr:NodeVariables["button"] =="reject"?"Document refused":"Document validated"</param>
        <param name="category" type="string">Review workflow</param>
        <param name="comment" type="string">expr:@{nodeLastActor} @{NodeVariables["button"] =="reject"?"Document refused":"validated"} the document with the following comment: @{NodeVariables["assigneeComment"]}</param>
      </operation>
    </chain>
    <chain id="nextAssignee">
      <operation id="Context.RunScript">
        <param name="script" type="string">if (NodeVariables["button"] == "validate") {
  WorkflowVariables["index"] = WorkflowVariables["index"] + 1;
}
else if (NodeVariables["button"] == "reject") {
  WorkflowVariables["index"] = WorkflowVariables["index"] - 1;
}
else if (NodeVariables["button"] == "submit") {
  WorkflowVariables["index"] = 0;
}</param>
      </operation>
    </chain>
    <chain id="notifyInitiatorEndOfWorkflow">
      <operation id="Context.FetchDocument"/>
      <operation id="Notification.SendMail">
        <param name="from" type="string">contact@noadress.com</param>
        <param name="message" type="string">The document was approved by every participant.</param>
        <param name="subject" type="string">Document approved</param>
        <param name="to" type="stringlist">expr:Fn.getEmail(workflowInitiator)</param>
        <param name="HTML" type="boolean">false</param>
        <param name="viewId" type="string">view_documents</param>
      </operation>
    </chain>
    <chain id="terminateWorkflow">
      <operation id="Context.FetchDocument"/>
      <operation id="Context.RunOperation">
        <param name="id" type="string">logInAudit</param>
        <param name="isolate" type="boolean">false</param>
      </operation>
      <operation id="Context.RunDocumentOperationInNewTx">
        <param name="id" type="string">notifyInitiatorEndOfWorkflow</param>
        <param name="isolate" type="boolean">false</param>
        <param name="rollbackGlobalOnError" type="boolean">false</param>
      </operation>
      <operation id="Context.RunOperation">
        <param name="id" type="string">expr:WorkflowVariables["validationOrReview"] == "validation"?"validateDocument":"voidChain"</param>
        <param name="isolate" type="boolean">false</param>
      </operation>
      <operation id="Audit.Log">
        <param name="event" type="string">Review completed successfully</param>
        <param name="category" type="string">Review workflow</param>
        <param name="comment" type="string">All the participants of the review have approved the document.</param>
      </operation>
    </chain>
    <chain id="validateDocument">
      <operation id="Context.FetchDocument"/>
      <operation id="Document.SetLifeCycle">
        <param name="value" type="string">approve</param>
      </operation>
    </chain>
    <chain id="voidChain">
      <operation id="Context.FetchDocument"/>
    </chain>
  </extension>