Class MetaWorkflowRepository

All Implemented Interfaces:
Repository<MetaWorkflow>

public class MetaWorkflowRepository extends AbstractMetaWorkflowRepository
  • Constructor Details

    • MetaWorkflowRepository

      public MetaWorkflowRepository()
  • Method Details

    • save

      public MetaWorkflow save(MetaWorkflow entity)
      Description copied from interface: Repository
      Save the given entity.

      Depending on the implementation, it may return same entity or a copy of it. For example JPA implementation may return a copy if the given entity can't be managed.

      Specified by:
      save in interface Repository<MetaWorkflow>
      Overrides:
      save in class JpaRepository<MetaWorkflow>
      Parameters:
      entity - the entity object to save
      Returns:
      an instance of the entity with saved state
    • remove

      public void remove(MetaWorkflow entity)
      Description copied from interface: Repository
      Remove the given entity.
      Specified by:
      remove in interface Repository<MetaWorkflow>
      Overrides:
      remove in class JpaRepository<MetaWorkflow>
      Parameters:
      entity - the entity object
    • resolveGraphsForRuns

      public Map<Long,String> resolveGraphsForRuns(List<MetaWorkflowRun> runs)
      The same resolution for many runs, in one query instead of one per run.

      Worth having because the cost is the query, not the payload: a 359-character definition and an 11 000-character one measure the same per call, so what a record with several parked runs pays on every save is one round trip each. Runs on the same record usually share very few distinct definitions, so the pairs asked for here collapse to a handful.

      Returns run id to definition XML, with no entry for a run whose definition is gone. A run with no pinned revision falls back to the definition as it stands, one query each -- in practice only hand-built runs, i.e. tests.

    • resolveGraphForRun

      public String resolveGraphForRun(MetaWorkflowRun run)
    • findByModelNameJson

      public MetaWorkflow findByModelNameJson(String model, String name, String jsonModel)
      The lone definition for a (model, name) with the given jsonModel (blank when none).
    • hasInflight

      public boolean hasInflight(MetaWorkflow entity)
      True when any run is parked (waiting) or any task pending on this definition.
    • assertNoInflight

      public void assertNoInflight(MetaWorkflow entity)
      Reject an operation (edit, remove, or app undeploy) that would strand in-flight instances — a run parked at a task/wait, or a pending approval task. The caller must complete or cancel them first. Shared by the save-time edit guard and the remove/undeploy path.