Search in sources :

Example 1 with UserTimestamp

use of org.finos.waltz.model.UserTimestamp in project waltz by khartec.

the class AssessmentRatingEndpoint method mkCommand.

private SaveAssessmentRatingCommand mkCommand(Request request) throws IOException {
    String username = getUsername(request);
    Map<String, Object> body = readBody(request, Map.class);
    UserTimestamp lastUpdate = UserTimestamp.mkForUser(username);
    return ImmutableSaveAssessmentRatingCommand.builder().entityReference(getEntityReference(request)).assessmentDefinitionId(getLong(request, "assessmentDefinitionId")).ratingId(Long.valueOf(body.getOrDefault("ratingId", "").toString())).comment(StringUtilities.mkSafe((String) body.get("comment"))).lastUpdatedAt(lastUpdate.at()).lastUpdatedBy(lastUpdate.by()).provenance("waltz").build();
}
Also used : UserTimestamp(org.finos.waltz.model.UserTimestamp)

Example 2 with UserTimestamp

use of org.finos.waltz.model.UserTimestamp in project waltz by khartec.

the class AssessmentRatingEndpoint method removeRoute.

private boolean removeRoute(Request request, Response z) throws IOException {
    String username = getUsername(request);
    UserTimestamp lastUpdate = UserTimestamp.mkForUser(username);
    RemoveAssessmentRatingCommand command = ImmutableRemoveAssessmentRatingCommand.builder().entityReference(getEntityReference(request)).assessmentDefinitionId(getLong(request, "assessmentDefinitionId")).lastUpdatedAt(lastUpdate.at()).lastUpdatedBy(lastUpdate.by()).build();
    verifyCanWrite(request, command.assessmentDefinitionId());
    return assessmentRatingService.remove(command, getUsername(request));
}
Also used : UserTimestamp(org.finos.waltz.model.UserTimestamp)

Example 3 with UserTimestamp

use of org.finos.waltz.model.UserTimestamp in project waltz by khartec.

the class InvolvementKindDao method update.

public boolean update(InvolvementKindChangeCommand command) {
    checkNotNull(command, "command cannot be null");
    checkOptionalIsPresent(command.lastUpdate(), "lastUpdate must be present");
    InvolvementKindRecord record = new InvolvementKindRecord();
    record.setId(command.id());
    record.changed(INVOLVEMENT_KIND.ID, false);
    command.name().ifPresent(change -> record.setName(change.newVal()));
    command.description().ifPresent(change -> record.setDescription(change.newVal()));
    UserTimestamp lastUpdate = command.lastUpdate().get();
    record.setLastUpdatedAt(Timestamp.valueOf(lastUpdate.at()));
    record.setLastUpdatedBy(lastUpdate.by());
    return dsl.executeUpdate(record) == 1;
}
Also used : InvolvementKindRecord(org.finos.waltz.schema.tables.records.InvolvementKindRecord) UserTimestamp(org.finos.waltz.model.UserTimestamp)

Example 4 with UserTimestamp

use of org.finos.waltz.model.UserTimestamp in project waltz by khartec.

the class ChangeUnitDao method updateExecutionStatus.

public boolean updateExecutionStatus(UpdateExecutionStatusCommand command) {
    checkNotNull(command, "command cannot be null");
    checkOptionalIsPresent(command.lastUpdate(), "lastUpdate must be present");
    checkTrue(command.executionStatus().oldVal().equals(ExecutionStatus.PENDING), "Current status should be PENDING");
    UserTimestamp lastUpdate = command.lastUpdate().get();
    int count = dsl.update(CHANGE_UNIT).set(CHANGE_UNIT.EXECUTION_STATUS, command.executionStatus().newVal().name()).set(CHANGE_UNIT.LAST_UPDATED_AT, Timestamp.valueOf(lastUpdate.at())).set(CHANGE_UNIT.LAST_UPDATED_BY, lastUpdate.by()).where(CHANGE_UNIT.EXECUTION_STATUS.eq(command.executionStatus().oldVal().name())).and(CHANGE_UNIT.ID.eq(command.id())).execute();
    return count == 1;
}
Also used : UserTimestamp(org.finos.waltz.model.UserTimestamp)

Aggregations

UserTimestamp (org.finos.waltz.model.UserTimestamp)4 InvolvementKindRecord (org.finos.waltz.schema.tables.records.InvolvementKindRecord)1