Package de.xima.fc.workflow.setup
Class TimePointTriggerSetup
- java.lang.Object
-
- de.xima.fc.workflow.setup.TimePointTriggerSetup
-
public final class TimePointTriggerSetup extends Object
Utility methods forEWorkflowTriggerType.FC_TIME_POINT
. Sets up the quartz listeners for triggering a task at a certain point in time.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addProtocolEntry(IEntityContext ec, Vorgang formRecord, EProtocolEntryProcessType type, String name, String comment)
protected void
addProtocolEntryForDeletedJob(IEntityContext ec, Locale locale, Vorgang formRecord, org.quartz.JobDetail jobDetail)
protected void
addProtocolEntryForNewJob(IEntityContext ec, Locale locale, Vorgang formRecord, WorkflowTrigger trigger, IJobWrapper job, org.quartz.Trigger quartzTrigger, Instant triggerFireInstant)
protected void
addProtocolEntryForUpdatedJob(IEntityContext ec, Locale locale, Vorgang formRecord, WorkflowTrigger trigger, IJobWrapper job, org.quartz.Trigger quartzTrigger, Instant triggerFireInstant)
protected boolean
allowsState(List<UuidEntityRef> states, UUID currentStateUuid)
protected 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).protected de.xima.cmn.criteria.FilterCriterion
createStateFilter(List<UuidEntityRef> states)
protected de.xima.cmn.criteria.FilterCriterion
findApplicableFormRecords(IEntityContext ec, WorkflowTrigger trigger, FcTimePointProps props)
protected List<WorkflowTrigger>
findApplicableTriggers(IEntityContext ec, Vorgang formRecord)
protected String
findProcessDbId(org.quartz.JobDetail jobDetails)
protected String
findProcessId(org.quartz.JobDetail jobDetails)
Deprecated.protected String
formatInstant(Locale locale, Instant instant)
protected String
formatNextFireTime(Locale locale, org.quartz.Trigger quartzTrigger)
static TimePointTriggerSetup
getInstance()
protected Instant
getPreviousFireInstant(org.quartz.JobDetail job, org.quartz.Trigger trigger)
protected Instant
getTriggerFireInstant(IEntityContext ec, Vorgang formRecord, FcTimePointProps props)
List<ApplyToExistingFormRecordResult>
handleApplyToExistingFormRecords(IEntityContext ec, WorkflowTrigger trigger, ITriggerHandler<TData> handler)
<C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding>
voidhandlePostBulkDeleteFormRecord(IEntityContext ec, C cm, ITriggerHandler<TData> handler)
Create, updates, or deletes the quartz job(s) for the trigger when aVorgang
was deleted.void
handlePostCreateFormRecord(IEntityContext ec, Vorgang formRecord, ITriggerHandler<TData> handler)
Create, updates, or deletes the quartz job(s) for the trigger when aVorgang
was created.void
handlePostDeleteClient(IEntityContext ec, Mandant client, ITriggerHandler<TData> handler)
Deletes the quartz job(s) for the trigger when aMandant
was deleted.void
handlePostDeleteFormRecord(IEntityContext ec, Vorgang formRecord, ITriggerHandler<TData> handler)
Create, updates, or deletes the quartz job(s) for the trigger when aVorgang
was deleted.void
handlePostDeleteProject(IEntityContext ec, Projekt project, ITriggerHandler<TData> handler)
Deletes the quartz job(s) for the trigger when aProjekt
was deleted.void
handlePostDeleteTrigger(IEntityContext ec, WorkflowTrigger trigger, ITriggerHandler<TData> handler)
Create, updates, or deletes the quartz job(s) for the trigger when aWorkflowTrigger
was deleted.void
handlePostUpdateFormRecord(IEntityContext ec, Vorgang formRecord, ITriggerHandler<TData> handler)
Create, updates, or deletes the quartz job(s) for the trigger when aVorgang
was updated.protected boolean
isAppliesToFormRecordUpdate(IEntityContext ec, Vorgang formRecord, ITriggerHandler<FcTimePointProps> handler)
protected boolean
isNeedToRescheduleJob(de.xima.fc.workflow.setup.CheckRescheduleParams<FcTimePointProps> params)
protected boolean
isRemoveJobWhenStateIsDeleted(WorkflowState state, org.quartz.JobDetail jobDetail)
protected IJobWrapper
newJob(IEntityContext ec, Vorgang formRecord, WorkflowTrigger trigger, FcTimePointProps props, Instant triggerFireInstant)
-
-
-
Field Detail
-
LOG
protected static final org.slf4j.Logger LOG
-
type
protected final String type
-
-
Method Detail
-
addProtocolEntryForDeletedJob
protected void addProtocolEntryForDeletedJob(IEntityContext ec, Locale locale, Vorgang formRecord, org.quartz.JobDetail jobDetail)
-
addProtocolEntryForNewJob
protected void addProtocolEntryForNewJob(IEntityContext ec, Locale locale, Vorgang formRecord, WorkflowTrigger trigger, IJobWrapper job, org.quartz.Trigger quartzTrigger, Instant triggerFireInstant)
-
addProtocolEntryForUpdatedJob
protected void addProtocolEntryForUpdatedJob(IEntityContext ec, Locale locale, Vorgang formRecord, WorkflowTrigger trigger, IJobWrapper job, org.quartz.Trigger quartzTrigger, Instant triggerFireInstant)
-
findApplicableFormRecords
protected de.xima.cmn.criteria.FilterCriterion findApplicableFormRecords(IEntityContext ec, WorkflowTrigger trigger, FcTimePointProps props)
-
findApplicableTriggers
protected List<WorkflowTrigger> findApplicableTriggers(IEntityContext ec, Vorgang formRecord)
-
findProcessId
@Deprecated protected String findProcessId(org.quartz.JobDetail jobDetails)
Deprecated.- Parameters:
jobDetails
- Custom parameters of the job.- Returns:
- The
process ID
of the form record to which the job applies.
-
findProcessDbId
protected String findProcessDbId(org.quartz.JobDetail jobDetails)
- Parameters:
jobDetails
- Custom parameters of the job.- Returns:
- The
database ID
of the form record to which the job applies.
-
getPreviousFireInstant
protected Instant getPreviousFireInstant(org.quartz.JobDetail job, org.quartz.Trigger trigger)
-
getTriggerFireInstant
protected Instant getTriggerFireInstant(IEntityContext ec, Vorgang formRecord, FcTimePointProps props)
-
isAppliesToFormRecordUpdate
protected boolean isAppliesToFormRecordUpdate(IEntityContext ec, Vorgang formRecord, ITriggerHandler<FcTimePointProps> handler)
-
isNeedToRescheduleJob
protected boolean isNeedToRescheduleJob(de.xima.fc.workflow.setup.CheckRescheduleParams<FcTimePointProps> 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.
-
newJob
protected IJobWrapper newJob(IEntityContext ec, Vorgang formRecord, WorkflowTrigger trigger, FcTimePointProps props, Instant triggerFireInstant)
-
getInstance
public static TimePointTriggerSetup getInstance()
- Returns:
- The singleton instance of this setup utility.
-
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 termstateUuid
- 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)
-
handleApplyToExistingFormRecords
public final List<ApplyToExistingFormRecordResult> handleApplyToExistingFormRecords(IEntityContext ec, WorkflowTrigger trigger, ITriggerHandler<TData> handler)
-
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 trigger when aVorgang
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 trigger when aVorgang
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 trigger when aVorgang
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 trigger when aWorkflowTrigger
was deleted.- Parameters:
handler
- Handler for the state timer trigger.trigger
- Trigger that was deleted.ec
- Current entity context for accessing the database.
-
handlePostDeleteProject
public final void handlePostDeleteProject(IEntityContext ec, Projekt project, ITriggerHandler<TData> handler)
Deletes the quartz job(s) for the trigger when aProjekt
was deleted.- Parameters:
handler
- Handler for the state timer trigger.project
- Project that was deleted.ec
- Current entity context for accessing the database.
-
handlePostDeleteClient
public final void handlePostDeleteClient(IEntityContext ec, Mandant client, ITriggerHandler<TData> handler)
Deletes the quartz job(s) for the trigger when aMandant
was deleted.- Parameters:
handler
- Handler for the state timer trigger.client
- Client 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 trigger when aVorgang
was updated.- Parameters:
ec
- Current entity context for accessing the database.formRecord
- Form record that was updated.handler
- Handler for the state timer trigger.
-
addProtocolEntry
protected final void addProtocolEntry(IEntityContext ec, Vorgang formRecord, EProtocolEntryProcessType type, String name, String comment)
-
-