Class AutomationTool


  • public class AutomationTool
    extends Object
    Utility methods to launch automation routines from inside an automation script
    Since:
    8.1.1
    Author:
    Marco Meschieri - LogicalDOC
    • Constructor Detail

      • AutomationTool

        public AutomationTool()
    • Method Detail

      • execute

        public String execute​(String routine,
                              long tenantId,
                              Map<String,​Object> dictionary,
                              Map<String,​Object> parameters)
        Executes a routine in the same execution thread. Returns the routine result
        Parameters:
        routine - name of the routine to execute
        tenantId - identifier of the tenant
        dictionary - the dictionary to pass to the routine
        parameters - the parameters to pass to the routine
        Returns:
        the result of the routine's execution
      • execute

        public String execute​(String routine,
                              long tenantId,
                              Map<String,​Object> dictionary)
        Executes a routine in the same execution thread. Returns the routine result
        Parameters:
        routine - name of the routine to execute
        tenantId - identifier of the tenant
        dictionary - the dictionary to pass to the routine
        Returns:
        the result of the routine's execution
      • fork

        public void fork​(String routine,
                         long tenantId,
                         Map<String,​Object> dictionary,
                         Map<String,​Object> parameters)
        Executes a routine in a new execution thread
        Parameters:
        routine - name of the routine to execute
        tenantId - identifier of the tenant
        dictionary - the dictionary to pass to the routine
        parameters - the parameters to pass to the routine
      • fork

        public void fork​(String routine,
                         long tenantId,
                         Map<String,​Object> dictionary)
        Executes a routine in a new execution thread
        Parameters:
        routine - name of the routine to execute
        tenantId - identifier of the tenant
        dictionary - the dictionary to pass to the routine
      • saveTrigger

        public void saveTrigger​(AutomationTrigger trigger)
                         throws com.logicaldoc.core.PersistenceException
        Stores into the database the given automation trigger
        Parameters:
        trigger - the trigger to save / update
        Throws:
        com.logicaldoc.core.PersistenceException - error in the database
      • removeTrigger

        public void removeTrigger​(long triggerId)
                           throws com.logicaldoc.core.PersistenceException
        Deletes an automation trigger
        Parameters:
        triggerId - identifier of the trigger to delete
        Throws:
        com.logicaldoc.core.PersistenceException - error in the database
      • newTrigger

        public AutomationTrigger newTrigger​(long tenantId,
                                            String events,
                                            Date date,
                                            String cron)
                                     throws com.logicaldoc.core.PersistenceException
        Creates a new automation trigger
        Parameters:
        tenantId - the current tenant
        events - comma separated list of events, if this is an event-driven trigger
        date - the exact time to fire this trigger, if this is a time-driven trigger
        cron - the cron expression to fire this trigger, if this is a time-driven trigger
        Returns:
        the created trigger
        Throws:
        com.logicaldoc.core.PersistenceException - error in the database