Class WorkflowServiceImpl
- All Implemented Interfaces:
WorkflowService
WorkflowService implementation.
advance(Investigation, WorkflowState, String, Long) is the
sole audit-event emitter; it carries
@AuditedConditional so the surrounding aspect
handles the audit-row insert ONLY on real transitions. The SpEL
predicate inspects #result.previousState != #result.currentState
to skip emission on idempotent no-ops -- the handoff is explicit that
idempotent PUTs emit NO audit event.
-
Constructor Summary
ConstructorsConstructorDescriptionWorkflowServiceImpl(AuditEventService auditEventService, SessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionadvance(Investigation dataset, WorkflowState targetState, String reason, Long ticketId) Advance the given dataset totargetState.getCurrentState(Investigation investigation) getHistory(Investigation investigation) Retrieve the full chronological history of workflow transitions for a dataset, derived from the AUDIT_EVENT stream filtered toWorkflowStateChangedEventrows.queue(WorkflowState state, String datasetType, String assignee, Date since, int offset, int limit) Return datasets currently instate, oldest entry first (so the curator's "what's been waiting longest" view is the natural read).
-
Constructor Details
-
WorkflowServiceImpl
@Autowired public WorkflowServiceImpl(AuditEventService auditEventService, SessionFactory sessionFactory)
-
-
Method Details
-
getCurrentState
- Specified by:
getCurrentStatein interfaceWorkflowService- Returns:
- the current workflow state of
investigation. Never null (legacy rows default toWorkflowState.Loaded).
-
getHistory
Description copied from interface:WorkflowServiceRetrieve the full chronological history of workflow transitions for a dataset, derived from the AUDIT_EVENT stream filtered toWorkflowStateChangedEventrows.- Specified by:
getHistoryin interfaceWorkflowService- Parameters:
investigation- the dataset whose workflow history to fetch.- Returns:
- zero-or-more events, oldest first. Empty list for a dataset that has never been transitioned via the workflow service (the backfilled 'Loaded' default is NOT a transition and does not appear in history).
-
advance
@Transactional @AuditedConditional(value=WorkflowStateChangedEvent.class, when="#result != null and #result.previousState != #result.currentState", messageSpel="'Workflow ' + #result.previousState + ' -> ' + #result.currentState + (#reason != null and #reason.length() > 0 ? ': ' + #reason : '') + (#ticketId != null ? ' (ticket=' + #ticketId + ')' : '')") public WorkflowTransition advance(Investigation dataset, WorkflowState targetState, @Nullable String reason, @Nullable Long ticketId) Description copied from interface:WorkflowServiceAdvance the given dataset totargetState.Idempotent on
targetState == current: returns aWorkflowTransitionwithpreviousState == currentStateand anullaudit-event id; no row mutation, no audit event.The first argument is the
Investigation(Auditable) target because@AuditedConditionalrequires the auditable to be on the argument list (the aspect locates it positionally). REST callers resolve the dataset id to anInvestigationbefore invoking.- Specified by:
advancein interfaceWorkflowService- Parameters:
dataset- the dataset to advance.targetState- the desired next state. Must satisfycurrent.canTransitionTo(targetState)OR equalcurrent(idempotent no-op).reason- optional human-readable rationale; recorded on the audit event note.ticketId- optional ticket id (forward-compatible with the Ticket integration); the service currently records the value on the audit note but does not interpret it.- Returns:
- the transition record; never null.
-
queue
@Transactional(readOnly=true) public Slice<WorkflowQueueEntry> queue(WorkflowState state, @Nullable String datasetType, @Nullable String assignee, @Nullable Date since, int offset, int limit) Description copied from interface:WorkflowServiceReturn datasets currently instate, oldest entry first (so the curator's "what's been waiting longest" view is the natural read).- Specified by:
queuein interfaceWorkflowService- Parameters:
state- required; restrict to this workflow state.datasetType- optional; "expression_experiment" or "preboarded_experiment". Currently only the former is implemented.assignee- optional; restrict to datasets that have an OPEN ticket assigned to this user login.since- optional; restrict to datasets whoseworkflowStateEnteredAtis on or after this instant.offset- pagination offset.limit- pagination page size.
-