use of org.finos.waltz.schema.tables.RatingSchemeItem.RATING_SCHEME_ITEM in project waltz by khartec.
the class RatingSchemeDAO method saveRatingItem.
public Long saveRatingItem(long schemeId, RatingSchemeItem item) {
RatingSchemeItemRecord r = dsl.newRecord(RATING_SCHEME_ITEM);
r.setSchemeId(schemeId);
r.setName(item.name());
r.setDescription(item.description());
r.setCode(Character.toString(item.rating()));
r.setColor(item.color());
r.setPosition(item.position());
r.setUserSelectable(item.userSelectable());
return item.id().map(id -> {
r.setId(id);
r.changed(RATING_SCHEME_ITEM.ID, false);
r.store();
return id;
}).orElseGet(() -> {
r.insert();
return r.getId();
});
}
Aggregations