Class WorkflowServiceImpl

java.lang.Object
ubic.gemma.persistence.service.expression.experiment.WorkflowServiceImpl
All Implemented Interfaces:
WorkflowService

@Service public class WorkflowServiceImpl extends Object implements WorkflowService
Default 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 Details

  • Method Details

    • getCurrentState

      @Transactional(readOnly=true) public WorkflowState getCurrentState(Investigation investigation)
      Specified by:
      getCurrentState in interface WorkflowService
      Returns:
      the current workflow state of investigation. Never null (legacy rows default to WorkflowState.Loaded).
    • getHistory

      @Transactional(readOnly=true) public List<AuditEvent> getHistory(Investigation investigation)
      Description copied from interface: WorkflowService
      Retrieve the full chronological history of workflow transitions for a dataset, derived from the AUDIT_EVENT stream filtered to WorkflowStateChangedEvent rows.
      Specified by:
      getHistory in interface WorkflowService
      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: WorkflowService
      Advance the given dataset to targetState.

      Idempotent on targetState == current: returns a WorkflowTransition with previousState == currentState and a null audit-event id; no row mutation, no audit event.

      The first argument is the Investigation (Auditable) target because @AuditedConditional requires the auditable to be on the argument list (the aspect locates it positionally). REST callers resolve the dataset id to an Investigation before invoking.

      Specified by:
      advance in interface WorkflowService
      Parameters:
      dataset - the dataset to advance.
      targetState - the desired next state. Must satisfy current.canTransitionTo(targetState) OR equal current (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: WorkflowService
      Return datasets currently in state, oldest entry first (so the curator's "what's been waiting longest" view is the natural read).
      Specified by:
      queue in interface WorkflowService
      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 whose workflowStateEnteredAt is on or after this instant.
      offset - pagination offset.
      limit - pagination page size.