Search in sources :

Example 1 with ReportGridRecord

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

the class ReportGridDao method create.

public long create(ReportGridCreateCommand createCommand, String username) {
    ReportGridRecord record = dsl.newRecord(rg);
    record.setName(createCommand.name());
    record.setExternalId(createCommand.toExtId(username));
    record.setDescription(createCommand.description());
    record.setLastUpdatedAt(DateTimeUtilities.nowUtcTimestamp());
    record.setLastUpdatedBy(username);
    record.setProvenance("waltz");
    record.setKind(createCommand.kind().name());
    try {
        int insert = record.insert();
        return record.getId();
    } catch (DataIntegrityViolationException exception) {
        throw new DataIntegrityViolationException(format("Grid already exists with the name: %s for user.", createCommand.name()));
    }
}
Also used : ReportGridRecord(org.finos.waltz.schema.tables.records.ReportGridRecord) DataIntegrityViolationException(org.springframework.dao.DataIntegrityViolationException)

Aggregations

ReportGridRecord (org.finos.waltz.schema.tables.records.ReportGridRecord)1 DataIntegrityViolationException (org.springframework.dao.DataIntegrityViolationException)1