Search in sources :

Example 1 with RATING_SCHEME

use of org.finos.waltz.schema.tables.RatingScheme.RATING_SCHEME in project waltz by khartec.

the class RatingSchemeDAO method save.

public Boolean save(RatingScheme scheme) {
    RatingSchemeRecord r = dsl.newRecord(RATING_SCHEME);
    r.setName(scheme.name());
    r.setDescription(scheme.description());
    return scheme.id().map(id -> {
        r.setId(id);
        r.changed(RATING_SCHEME.ID, false);
        return r.update() == 1;
    }).orElseGet(() -> r.insert() == 1);
}
Also used : RatingSchemeRecord(org.finos.waltz.schema.tables.records.RatingSchemeRecord) java.util(java.util) RATING_SCHEME_ITEM(org.finos.waltz.schema.tables.RatingSchemeItem.RATING_SCHEME_ITEM) DSL(org.jooq.impl.DSL) Tables(org.finos.waltz.schema.Tables) Collections.emptyList(java.util.Collections.emptyList) Optional.ofNullable(java.util.Optional.ofNullable) EntityKind(org.finos.waltz.model.EntityKind) RatingSchemeItemRecord(org.finos.waltz.schema.tables.records.RatingSchemeItemRecord) Autowired(org.springframework.beans.factory.annotation.Autowired) org.finos.waltz.model.rating(org.finos.waltz.model.rating) MEASURABLE_CATEGORY(org.finos.waltz.schema.tables.MeasurableCategory.MEASURABLE_CATEGORY) StringUtilities.firstChar(org.finos.waltz.common.StringUtilities.firstChar) RATING_SCHEME(org.finos.waltz.schema.tables.RatingScheme.RATING_SCHEME) Collectors.toList(java.util.stream.Collectors.toList) Checks.checkNotNull(org.finos.waltz.common.Checks.checkNotNull) MapUtilities.groupBy(org.finos.waltz.common.MapUtilities.groupBy) org.jooq(org.jooq) EntityReference(org.finos.waltz.model.EntityReference) RatingSchemeRecord(org.finos.waltz.schema.tables.records.RatingSchemeRecord) Repository(org.springframework.stereotype.Repository)

Aggregations

java.util (java.util)1 Collections.emptyList (java.util.Collections.emptyList)1 Optional.ofNullable (java.util.Optional.ofNullable)1 Collectors.toList (java.util.stream.Collectors.toList)1 Checks.checkNotNull (org.finos.waltz.common.Checks.checkNotNull)1 MapUtilities.groupBy (org.finos.waltz.common.MapUtilities.groupBy)1 StringUtilities.firstChar (org.finos.waltz.common.StringUtilities.firstChar)1 EntityKind (org.finos.waltz.model.EntityKind)1 EntityReference (org.finos.waltz.model.EntityReference)1 org.finos.waltz.model.rating (org.finos.waltz.model.rating)1 Tables (org.finos.waltz.schema.Tables)1 MEASURABLE_CATEGORY (org.finos.waltz.schema.tables.MeasurableCategory.MEASURABLE_CATEGORY)1 RATING_SCHEME (org.finos.waltz.schema.tables.RatingScheme.RATING_SCHEME)1 RATING_SCHEME_ITEM (org.finos.waltz.schema.tables.RatingSchemeItem.RATING_SCHEME_ITEM)1 RatingSchemeItemRecord (org.finos.waltz.schema.tables.records.RatingSchemeItemRecord)1 RatingSchemeRecord (org.finos.waltz.schema.tables.records.RatingSchemeRecord)1 org.jooq (org.jooq)1 DSL (org.jooq.impl.DSL)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Repository (org.springframework.stereotype.Repository)1