use of org.finos.waltz.schema.tables.records.ScenarioRecord in project waltz by khartec.
the class ScenarioDao method add.
public Scenario add(long roadmapId, String name, String userId) {
Scenario scenario = ImmutableScenario.builder().roadmapId(roadmapId).name(name).description("").entityLifecycleStatus(EntityLifecycleStatus.PENDING).scenarioType(ScenarioType.INTERIM).releaseStatus(ReleaseLifecycleStatus.DRAFT).effectiveDate(today()).lastUpdatedAt(nowUtc()).lastUpdatedBy(userId).position(0).build();
ScenarioRecord record = TO_RECORD_MAPPER.apply(scenario, dsl);
record.store();
return ImmutableScenario.copyOf(scenario).withId(record.getId());
}
use of org.finos.waltz.schema.tables.records.ScenarioRecord in project waltz by khartec.
the class ScenarioDao method updateReleaseStatus.
public Boolean updateReleaseStatus(long scenarioId, ReleaseLifecycleStatus newValue, String userId) {
ScenarioRecord record = dsl.fetchOne(SCENARIO, SCENARIO.ID.eq(scenarioId));
if (record.getReleaseStatus().equals(newValue.name())) {
return false;
} else {
record.setReleaseStatus(newValue.name());
record.setLifecycleStatus(newValue == ReleaseLifecycleStatus.DRAFT ? EntityLifecycleStatus.PENDING.name() : EntityLifecycleStatus.ACTIVE.name());
record.setLastUpdatedAt(nowUtcTimestamp());
record.setLastUpdatedBy(userId);
return record.store() == 1;
}
}
use of org.finos.waltz.schema.tables.records.ScenarioRecord in project waltz by khartec.
the class ScenarioDao method cloneScenario.
public Scenario cloneScenario(CloneScenarioCommand command) {
Scenario orig = getById(command.scenarioId());
Scenario clone = ImmutableScenario.copyOf(orig).withName(command.newName()).withEntityLifecycleStatus(EntityLifecycleStatus.PENDING).withReleaseStatus(ReleaseLifecycleStatus.DRAFT).withLastUpdatedAt(nowUtc()).withLastUpdatedBy(command.userId());
ScenarioRecord clonedRecord = TO_RECORD_MAPPER.apply(clone, dsl);
clonedRecord.store();
return ImmutableScenario.copyOf(clone).withId(clonedRecord.getId());
}
Aggregations