Introduction
The system provides the possibility to add a handler that will be called if an action is called on the document class (adding a document from the process level, from the archive level, etc.). The available actions are visible in the "Administration" tab. -> "Electronic archive" -> "Document classes" -> "Edit" -> "Actions" -> "New Action".
PAfter selecting the Action Type - Run script, it is possible to specify a class in the Script URL field. This class must implement the DocumentEventHandler interface and have a constructor that accepts a parameter of type String, which for some instances of the action will be the value of processId. Example implementation:
package com.suncode.client; import com.plusmpm.enhydra.shark.transaction.WfActivityTransaction; import com.plusmpm.util.documents.DocumentEvent; import com.plusmpm.util.documents.handlers.DocumentEventHandler; import lombok.extern.slf4j.Slf4j; public class CustomDocumentActionHandler implements DocumentEventHandler { private String processId; public CustomDocumentActionHandler( String processId ) { this.processId = processId; } @Override public void handleEvent( WfActivityTransaction st, DocumentEvent de ) throws Exception { // handler execution } }