diff --git a/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java b/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java index b3b9200c57..59c13d013f 100644 --- a/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java +++ b/source/java/org/alfresco/repo/calendar/CalendarServiceImpl.java @@ -124,53 +124,6 @@ public class CalendarServiceImpl implements CalendarService siteShortName, CALENDAR_COMPONENT, create, siteService, transactionService, taggingService); } - - private void handleTags(CalendarEntry entry) - { - NodeRef nodeRef = entry.getNodeRef(); - - List currentTags = taggingService.getTags(nodeRef); - List newTags = entry.getTags(); - - if(currentTags.size() == 0 && newTags.size() == 0) - { - // No tags, easy - return; - } - - // Figure out what (if anything) changed - Set toAdd = new HashSet(newTags); - Set toDel = new HashSet(currentTags); - for(String tag : currentTags) - { - if(toAdd.contains(tag)) - { - toAdd.remove(tag); - } - } - for(String tag : newTags) - { - if(toDel.contains(tag)) - { - toDel.remove(tag); - } - } - - if(toDel.size() == 0 && toAdd.size() == 0) - { - // No changes - } - - // Make the changes - for(String tag : toDel) - { - taggingService.removeTag(nodeRef, tag); - } - for(String tag : toAdd) - { - taggingService.addTag(nodeRef, tag); - } - } @Override public CalendarEntry getCalendarEntry(String siteShortName, String entryName) @@ -237,7 +190,7 @@ public class CalendarServiceImpl implements CalendarService } // Tag it - handleTags(entryImpl); + taggingService.setTags(nodeRef, entry.getTags()); // All done return entryImpl; @@ -267,7 +220,7 @@ public class CalendarServiceImpl implements CalendarService nodeService.setProperties(entry.getNodeRef(), properties); // Update the tags - handleTags(entry); + taggingService.setTags(entry.getNodeRef(), entry.getTags()); // Nothing was changed on the entry itself return entry; diff --git a/source/java/org/alfresco/repo/links/LinksServiceImpl.java b/source/java/org/alfresco/repo/links/LinksServiceImpl.java index 5119a691e7..4bcc6b2823 100644 --- a/source/java/org/alfresco/repo/links/LinksServiceImpl.java +++ b/source/java/org/alfresco/repo/links/LinksServiceImpl.java @@ -22,10 +22,8 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.alfresco.model.ContentModel; import org.alfresco.query.CannedQueryFactory; @@ -138,53 +136,6 @@ public class LinksServiceImpl implements LinksService siteService, transactionService, taggingService); } - private void handleTags(LinkInfo link) - { - NodeRef nodeRef = link.getNodeRef(); - - List currentTags = taggingService.getTags(nodeRef); - List newTags = link.getTags(); - - if(currentTags.size() == 0 && newTags.size() == 0) - { - // No tags, easy - return; - } - - // Figure out what (if anything) changed - Set toAdd = new HashSet(newTags); - Set toDel = new HashSet(currentTags); - for(String tag : currentTags) - { - if(toAdd.contains(tag)) - { - toAdd.remove(tag); - } - } - for(String tag : newTags) - { - if(toDel.contains(tag)) - { - toDel.remove(tag); - } - } - - if(toDel.size() == 0 && toAdd.size() == 0) - { - // No changes - } - - // Make the changes - for(String tag : toDel) - { - taggingService.removeTag(nodeRef, tag); - } - for(String tag : toAdd) - { - taggingService.addTag(nodeRef, tag); - } - } - private LinkInfo buildLink(NodeRef nodeRef, NodeRef container, String name) { LinkInfoImpl link = new LinkInfoImpl(nodeRef, container, name); @@ -313,7 +264,7 @@ public class LinksServiceImpl implements LinksService } // Now do the tags - handleTags(link); + taggingService.setTags(nodeRef, link.getTags()); // All done return link;