Search in sources :

Example 1 with InvolvementKindRecord

use of org.finos.waltz.schema.tables.records.InvolvementKindRecord 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 2 with InvolvementKindRecord

use of org.finos.waltz.schema.tables.records.InvolvementKindRecord in project waltz by khartec.

the class InvolvementKindDao method create.

public Long create(InvolvementKindCreateCommand command, String username) {
    checkNotNull(command, "command cannot be null");
    InvolvementKindRecord record = dsl.newRecord(INVOLVEMENT_KIND);
    record.setName(command.name());
    record.setDescription(command.description());
    record.setLastUpdatedBy(username);
    record.setLastUpdatedAt(Timestamp.valueOf(DateTimeUtilities.nowUtc()));
    command.externalId().ifPresent(record::setExternalId);
    record.store();
    return record.getId();
}
Also used : InvolvementKindRecord(org.finos.waltz.schema.tables.records.InvolvementKindRecord)

Aggregations

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