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