use of com.khartec.waltz.model.EntityKind in project waltz by khartec.
the class EntityNamedNoteTypeDao method create.
/**
* Creates a new record and returns the generated id. All fields in the command must be
* provided.
* @param command
* @return
*/
public long create(EntityNamedNoteTypeChangeCommand command) {
String name = Checks.checkOptionalIsPresent(command.name(), "Name must be provided");
Set<EntityKind> applicableEntityKinds = Checks.checkOptionalIsPresent(command.applicableEntityKinds(), "Applicable Entity Kinds must be provided");
String kinds = join(applicableEntityKinds, SEPARATOR);
EntityNamedNoteTypeRecord record = dsl.newRecord(ENTITY_NAMED_NOTE_TYPE);
record.setName(name);
record.setDescription(command.description().orElse(""));
record.setApplicableEntityKinds(kinds);
record.setIsReadonly(command.isReadOnly().orElse(false));
record.store();
return record.getId();
}
Aggregations