@Override public int hashCode() { HashCodeBuilder b = new HashCodeBuilder(); b.append(getResourceId()); b.append(getTag()); return b.toHashCode(); }
@Override public ResourceTag addTag(TagDefinition theTag) { for (ResourceTag next : getTags()) { if (next.getTag().equals(theTag)) { return next; } } ResourceTag tag = new ResourceTag(this, theTag); getTags().add(tag); return tag; }
public void addTag(ResourceTag theTag) { ResourceHistoryTag tag = new ResourceHistoryTag(this, theTag.getTag()); tag.setResourceType(theTag.getResourceType()); getTags().add(tag); }
public ResourceTag(ResourceTable theResourceTable, TagDefinition theTag) { setTag(theTag); setResource(theResourceTable); setResourceId(theResourceTable.getId()); setResourceType(theResourceTable.getResourceType()); }
if (metaSnapshotModeTokens.contains(theTag.getTag().getTagType())) { return true;
private Map<Long, Collection<ResourceTag>> getResourceTagMap(Collection<ResourceSearchView> theResourceSearchViewList) { List<Long> idList = new ArrayList<>(theResourceSearchViewList.size()); //-- find all resource has tags for (ResourceSearchView resource : theResourceSearchViewList) { if (resource.isHasTags()) idList.add(resource.getId()); } Map<Long, Collection<ResourceTag>> tagMap = new HashMap<>(); //-- no tags if (idList.size() == 0) return tagMap; //-- get all tags for the idList Collection<ResourceTag> tagList = myResourceTagDao.findByResourceIds(idList); //-- build the map, key = resourceId, value = list of ResourceTag Long resourceId; Collection<ResourceTag> tagCol; for (ResourceTag tag : tagList) { resourceId = tag.getResourceId(); tagCol = tagMap.get(resourceId); if (tagCol == null) { tagCol = new ArrayList<>(); tagCol.add(tag); tagMap.put(resourceId, tagCol); } else { tagCol.add(tag); } } return tagMap; }
if (!allDefsPresent.add(tag.getTag())) { theEntity.getTags().remove(tag);
private Map<Long, Collection<ResourceTag>> getResourceTagMap(Collection<ResourceSearchView> theResourceSearchViewList) { List<Long> idList = new ArrayList<>(theResourceSearchViewList.size()); //-- find all resource has tags for (ResourceSearchView resource : theResourceSearchViewList) { if (resource.isHasTags()) idList.add(resource.getId()); } Map<Long, Collection<ResourceTag>> tagMap = new HashMap<>(); //-- no tags if (idList.size() == 0) return tagMap; //-- get all tags for the idList Collection<ResourceTag> tagList = myResourceTagDao.findByResourceIds(idList); //-- build the map, key = resourceId, value = list of ResourceTag Long resourceId; Collection<ResourceTag> tagCol; for (ResourceTag tag : tagList) { resourceId = tag.getResourceId(); tagCol = tagMap.get(resourceId); if (tagCol == null) { tagCol = new ArrayList<>(); tagCol.add(tag); tagMap.put(resourceId, tagCol); } else { tagCol.add(tag); } } return tagMap; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ResourceTag)) { return false; } ResourceTag other = (ResourceTag) obj; EqualsBuilder b = new EqualsBuilder(); b.append(getResourceId(), other.getResourceId()); b.append(getTag(), other.getTag()); return b.isEquals(); }
if (metaSnapshotModeTokens.contains(theTag.getTag().getTagType())) { return true;
@Override public String toString() { ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); b.append("resId", getResourceId()); b.append("tag", getTag().getId()); return b.build(); }
if (!allDefsPresent.add(tag.getTag())) { theEntity.getTags().remove(tag);