Wstęp

System daje możliwość dodania handlera, który zostanie wywołany, jeżeli na klasie dokumentów zostanie wywołana akcja (dodanie dokumentu z poziomu procesu, z poziomu archiwum itd.). Dostępne akcje widoczne są w zakładce "Administracja" -> "Elektroniczne archiwum" -> "Klasy dokumentów" -> "Edytuj" -> "Akcje" -> "Nowa akcja".

Po wybraniu Typ akcjiUruchomienie skryptu możliwe jest określenie klasy w polu Adres URL skryptu. Klasa ta musi implementować interfejs DocumentEventHandler oraz posiadać konstruktor przyjmujący parametr typu String, który dla niektórych przypadków akcji będzie wartością processId. Przykładowa implementacja:

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
    {
        // wykonanie handlera
    }
}

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
    }
}