use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.
the class HibernateTagDao method addTag.
@Override
public void addTag(String tagValue) {
Tag tag = new Tag(tagValue);
hibernateHelper.executeWithExceptionHandling(tag, (session) -> {
session.saveOrUpdate(tag);
return null;
});
}
use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.
the class HibernateTagDao method deleteTag.
@Override
public void deleteTag(String tagValue) {
Tag tag = new Tag(tagValue);
hibernateHelper.executeWithExceptionHandling(tag, (session) -> {
session.remove(tag);
return null;
});
}
use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.
the class HibernateTagDao method getTags.
@Override
public Map<String, List<String>> getTags() {
ListMultimap<String, String> multimap = MultimapBuilder.hashKeys().arrayListValues().build();
List<Tag> tags = hibernateHelper.queryGet("from Tag", null, null, null, Tag.class);
for (Tag tag : tags) {
String[] elements = tag.getValue().split(":", 2);
if (elements.length == 1) {
multimap.put("default", elements[0]);
} else {
multimap.put(elements[0], elements[1]);
}
}
return Multimaps.asMap(multimap);
}
Aggregations