use of pipelite.entity.StageEntityId in project pipelite by enasequence.
the class StageService method createExecution.
/**
* Assigns a stage entity to the stage. Uses a saved stage entity if it exists or creates a new
* one. Saves the stage.
*
* @param pipelineName the pipeline name
* @param processId the process id
* @param stage the stage
*/
@Timed("pipelite.transactional")
public void createExecution(String pipelineName, String processId, Stage stage) {
// Uses saved stage if it exists.
Optional<StageEntity> savedStageEntity = repository.findById(new StageEntityId(processId, pipelineName, stage.getStageName()));
if (savedStageEntity.isPresent()) {
stage.setStageEntity(savedStageEntity.get());
}
StageEntity.createExecution(pipelineName, processId, stage);
if (stage.getStageEntity() == null) {
throw new PipeliteException("Failed to create new stage entity");
}
saveStage(stage);
}
Aggregations