Class StateTimerTriggerSetup


  • public final class StateTimerTriggerSetup
    extends Object
    Utility methods for EWorkflowTriggerType.FC_STATE_TIMER. Sets up the quartz listeners for triggering a task after a form record remained in a certain state for a certain amount of time.
    Since:
    7.0.0
    Author:
    XIMA MEDIA GmbH
    • Field Detail

      • LOG

        protected static final org.slf4j.Logger LOG
      • type

        protected final String type
    • Constructor Detail

      • StateTimerTriggerSetup

        protected StateTimerTriggerSetup()
    • Method Detail

      • addProtocolEntryForDeletedJob

        protected void addProtocolEntryForDeletedJob​(IEntityContext ec,
                                                     Locale locale,
                                                     Vorgang formRecord,
                                                     org.quartz.JobDetail jobDetail)
      • findProcessId

        protected String findProcessId​(org.quartz.JobDetail jobDetails)
      • getPreviousFireInstant

        protected Instant getPreviousFireInstant​(org.quartz.JobDetail job,
                                                 org.quartz.Trigger trigger)
      • isNeedToRescheduleJob

        protected boolean isNeedToRescheduleJob​(de.xima.fc.workflow.setup.CheckRescheduleParams<FcStateTimerProps> params)
      • isRemoveJobWhenStateIsDeleted

        protected boolean isRemoveJobWhenStateIsDeleted​(WorkflowState state,
                                                        org.quartz.JobDetail jobDetail)
        Parameters:
        state - State to check.
        jobDetail - Job to check.
        Returns:
        Whether it was scheduled for that state and should be removed when the state is removed.
      • getInstance

        public static StateTimerTriggerSetup getInstance()
        Returns:
        The singleton instance of this setup utility.
      • handlePostDeleteState

        public final void handlePostDeleteState​(IEntityContext ec,
                                                WorkflowState state,
                                                ITriggerHandler<TData> handler)
        Create, updates, or deletes the quartz job(s) for the state timer trigger when a WorkflowState was deleted.
        Parameters:
        handler - Handler for the state timer trigger.
        state - State that was deleted.
        ec - Current entity context for accessing the database.
      • allowsState

        protected final boolean allowsState​(List<UuidEntityRef> states,
                                            UUID currentStateUuid)
        Parameters:
        states - States that are allowed.
        currentStateUuid - UUID of the form's current state.
        Returns:
        true if the states contain the current state or when the states are empty, false otherwise.
      • containsState

        protected final de.xima.cmn.criteria.FilterCriterion containsState​(String statesKey,
                                                                           UUID stateUuid)
        Creates a filter that matches when at least one state search term has a value set to the given state, or when no state search terms exist at all (= no restriction when no state was set).
        Parameters:
        statesKey - Key of the search term
        stateUuid - UUID of the state to match.
        Returns:
        A new filter criterion for matching the given state.
      • createStateFilter

        protected final de.xima.cmn.criteria.FilterCriterion createStateFilter​(List<UuidEntityRef> states)
      • removeJob

        protected final void removeJob​(WorkflowState state)
      • handlePostBulkDeleteFormRecord

        public final <C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding> void handlePostBulkDeleteFormRecord​(IEntityContext ec,
                                                                                                                                                                                      C cm,
                                                                                                                                                                                      ITriggerHandler<TData> handler)
        Create, updates, or deletes the quartz job(s) for the state timer trigger when a Vorgang was deleted.
        Parameters:
        ec - Current entity context for accessing the database.
        cm - Criteria manager for the deleted records.
        handler - Handler for the state timer trigger.
      • handlePostCreateFormRecord

        public final void handlePostCreateFormRecord​(IEntityContext ec,
                                                     Vorgang formRecord,
                                                     ITriggerHandler<TData> handler)
        Create, updates, or deletes the quartz job(s) for the state timer trigger when a Vorgang was created.
        Parameters:
        ec - Current entity context for accessing the database.
        formRecord - Form record that was created.
        handler - Handler for the state timer trigger.
      • handlePostDeleteFormRecord

        public final void handlePostDeleteFormRecord​(IEntityContext ec,
                                                     Vorgang formRecord,
                                                     ITriggerHandler<TData> handler)
        Create, updates, or deletes the quartz job(s) for the state timer trigger when a Vorgang was deleted.
        Parameters:
        ec - Current entity context for accessing the database.
        formRecord - Form record that was deleted.
        handler - Handler for the state timer trigger.
      • handlePostDeleteTrigger

        public final void handlePostDeleteTrigger​(IEntityContext ec,
                                                  WorkflowTrigger trigger,
                                                  ITriggerHandler<TData> handler)
        Create, updates, or deletes the quartz job(s) for the state timer trigger when a WorkflowTrigger was deleted.
        Parameters:
        handler - Handler for the state timer trigger.
        trigger - Trigger that was deleted.
        ec - Current entity context for accessing the database.
      • handlePostUpdateFormRecord

        public final void handlePostUpdateFormRecord​(IEntityContext ec,
                                                     Vorgang formRecord,
                                                     ITriggerHandler<TData> handler)
        Create, updates, or deletes the quartz job(s) for the state timer trigger when a Vorgang was updated.
        Parameters:
        ec - Current entity context for accessing the database.
        formRecord - Form record that was updated.
        handler - Handler for the state timer trigger.
      • formatNextFireTime

        protected final String formatNextFireTime​(Locale locale,
                                                  org.quartz.Trigger quartzTrigger)