Search in sources :

Example 6 with EntityKind

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();
}
Also used : EntityNamedNoteTypeRecord(com.khartec.waltz.schema.tables.records.EntityNamedNoteTypeRecord) EntityKind(com.khartec.waltz.model.EntityKind)

Aggregations

EntityKind (com.khartec.waltz.model.EntityKind)6 EntityReference (com.khartec.waltz.model.EntityReference)3 CollectionUtilities.map (com.khartec.waltz.common.CollectionUtilities.map)1 ListUtilities.newArrayList (com.khartec.waltz.common.ListUtilities.newArrayList)1 MapUtilities.groupBy (com.khartec.waltz.common.MapUtilities.groupBy)1 SetUtilities (com.khartec.waltz.common.SetUtilities)1 EntityNameUtilities (com.khartec.waltz.data.EntityNameUtilities)1 LogicalFlowDao (com.khartec.waltz.data.logical_flow.LogicalFlowDao)1 ACTOR (com.khartec.waltz.model.EntityKind.ACTOR)1 APPLICATION (com.khartec.waltz.model.EntityKind.APPLICATION)1 EntityReference.mkRef (com.khartec.waltz.model.EntityReference.mkRef)1 ImmutableEntityReference (com.khartec.waltz.model.ImmutableEntityReference)1 AuthoritativenessRating (com.khartec.waltz.model.rating.AuthoritativenessRating)1 LOGICAL_FLOW (com.khartec.waltz.schema.tables.LogicalFlow.LOGICAL_FLOW)1 LOGICAL_FLOW_DECORATOR (com.khartec.waltz.schema.tables.LogicalFlowDecorator.LOGICAL_FLOW_DECORATOR)1 EntityNamedNoteTypeRecord (com.khartec.waltz.schema.tables.records.EntityNamedNoteTypeRecord)1 DIConfiguration (com.khartec.waltz.service.DIConfiguration)1 Collection (java.util.Collection)1 Map (java.util.Map)1 Set (java.util.Set)1