use of com.khartec.waltz.schema.tables.records.EntityTagRecord in project waltz by khartec.
the class EntityTagDao method updateTags.
public int[] updateTags(EntityReference ref, Collection<String> tags, String username) {
LOG.info("Updating tags for entity ref: {}, tags: {} ", ref, tags);
dsl.delete(ENTITY_TAG).where(ENTITY_TAG.ENTITY_ID.eq(ref.id())).and(ENTITY_TAG.ENTITY_KIND.eq(ref.kind().name())).execute();
List<EntityTagRecord> records = tags.stream().map(t -> {
EntityTagRecord record = new EntityTagRecord();
record.setEntityId(ref.id());
record.setEntityKind(ref.kind().name());
record.setTag(t);
record.setLastUpdatedAt(Timestamp.valueOf(DateTimeUtilities.nowUtc()));
record.setLastUpdatedBy(username);
record.setProvenance("waltz");
return record;
}).collect(Collectors.toList());
return dsl.batchInsert(records).execute();
}
Aggregations