use of com.hortonworks.registries.tag.TagStorableMapping in project registry by hortonworks.
the class CatalogTagService method getTaggedEntities.
private List<TaggedEntity> getTaggedEntities(Long tagId) {
List<TaggedEntity> taggedEntities = new ArrayList<>();
QueryParam qp1 = new QueryParam(TagStorableMapping.FIELD_TAG_ID, String.valueOf(tagId));
for (TagStorableMapping mapping : listTagStorableMapping(ImmutableList.of(qp1))) {
taggedEntities.add(new TaggedEntity(mapping.getStorableNamespace(), mapping.getStorableId()));
}
return taggedEntities;
}
use of com.hortonworks.registries.tag.TagStorableMapping in project registry by hortonworks.
the class CatalogTagService method removeTagsFromStorable.
@Override
public void removeTagsFromStorable(TaggedEntity taggedEntity, List<Tag> tags) {
if (tags != null) {
for (Tag tag : tags) {
TagStorableMapping tagStorable = new TagStorableMapping();
tagStorable.setTagId(tag.getId());
tagStorable.setStorableId(taggedEntity.getId());
tagStorable.setStorableNamespace(taggedEntity.getNamespace());
this.dao.remove(tagStorable.getStorableKey());
}
}
}
use of com.hortonworks.registries.tag.TagStorableMapping in project registry by hortonworks.
the class CatalogTagService method addTagsForStorable.
@Override
public void addTagsForStorable(TaggedEntity taggedEntity, List<Tag> tags) {
if (tags != null) {
for (Tag tag : tags) {
TagStorableMapping tagStorable = new TagStorableMapping();
tagStorable.setTagId(tag.getId());
tagStorable.setStorableNamespace(taggedEntity.getNamespace());
tagStorable.setStorableId(taggedEntity.getId());
this.dao.add(tagStorable);
}
}
}
use of com.hortonworks.registries.tag.TagStorableMapping in project registry by hortonworks.
the class CatalogTagService method getTags.
@Override
public List<Tag> getTags(TaggedEntity taggedEntity) {
List<Tag> tags = new ArrayList<>();
QueryParam qp1 = new QueryParam(TagStorableMapping.FIELD_STORABLE_ID, String.valueOf(taggedEntity.getId()));
QueryParam qp2 = new QueryParam(TagStorableMapping.FIELD_STORABLE_NAMESPACE, String.valueOf(taggedEntity.getNamespace()));
for (TagStorableMapping mapping : listTagStorableMapping(ImmutableList.of(qp1, qp2))) {
tags.add(getTag(mapping.getTagId()));
}
return tags;
}
Aggregations