@Test public void testCopyTags() { DocumentModel srcFile = session.createDocumentModel("/", "srcFile", "File"); srcFile.setPropertyValue("dc:title", "File1"); srcFile = session.createDocument(srcFile); session.save(); String srcDocId = srcFile.getId(); DocumentModel dstFile = session.createDocumentModel("/", "dstFile", "File"); dstFile.setPropertyValue("dc:title", "File1"); dstFile = session.createDocument(dstFile); session.save(); String dstDocId = dstFile.getId(); tagService.tag(session, srcDocId, "foo"); tagService.tag(session, srcDocId, "bar"); tagService.tag(session, srcDocId, "baz"); assertEquals(3, tagService.getTags(session, srcDocId).size()); assertEquals(0, tagService.getTags(session, dstDocId).size()); tagService.copyTags(session, srcDocId, dstDocId); session.save(); assertEquals(3, tagService.getTags(session, srcDocId).size()); Set<String> tags = tagService.getTags(session, dstDocId); assertEquals(3, tags.size()); assertTrue(tags.contains("foo")); assertTrue(tags.contains("bar")); assertTrue(tags.contains("baz")); }
@Override public void copyTags(CoreSession session, String srcDocId, String dstDocId) { copyTags(session, srcDocId, dstDocId, false); }
AbstractTagService implements TagService { @Override public void copyTags(CoreSession session, String srcDocId, String dstDocId) { copyTags(session, srcDocId, dstDocId, false); } }
AbstractTagService implements TagService { @Override public void copyTags(CoreSession session, String srcDocId, String dstDocId) { copyTags(session, srcDocId, dstDocId, false); }  }
AbstractTagService implements TagService { @Override public void copyTags(CoreSession session, String srcDocId, String dstDocId) { copyTags(session, srcDocId, dstDocId, false); }  @Override boolean isEnabled(); @Override void tag(CoreSession session, String docId, String label); @Override void tag(CoreSession session, String docId, String label, String username); @Override void untag(CoreSession session, String docId, String label); @Override void untag(CoreSession session, String docId, String label, String username); @Override boolean canUntag(CoreSession session, String docId, String label); @Override Set<String> getTags(CoreSession session, String docId); @Override List<Tag> getDocumentTags(CoreSession session, String docId, String username); @Override List<Tag> getDocumentTags(CoreSession session, String docId, String username, boolean useCore); @Override void removeTags(CoreSession session, String docId); @Override void copyTags(CoreSession session, String srcDocId, String dstDocId); @Override void replaceTags(CoreSession session, String srcDocId, String dstDocId); @Override List<String> getTagDocumentIds(CoreSession session, String label); @Override List<String> getTagDocumentIds(CoreSession session, String label, String username); @Override Set<String> getSuggestions(CoreSession session, String label); @Override List<Tag> getSuggestions(CoreSession session, String label, String username); abstract void doTag(CoreSession session, String docId, String label, String username); abstract void doUntag(CoreSession session, String docId, String label); abstract Set<String> doGetTags(CoreSession session, String docId); abstract void doCopyTags(CoreSession session, String srcDocId, String dstDocId, boolean removeExistingTags); abstract List<String> doGetTagDocumentIds(CoreSession session, String label); abstract Set<String> doGetTagSuggestions(CoreSession session, String label); }
AbstractTagService implements TagService { @Override public void copyTags(CoreSession session, String srcDocId, String dstDocId) { copyTags(session, srcDocId, dstDocId, false); }  @Override boolean isEnabled(); @Override void tag(CoreSession session, String docId, String label); @Override void tag(CoreSession session, String docId, String label, String username); @Override void untag(CoreSession session, String docId, String label); @Override void untag(CoreSession session, String docId, String label, String username); @Override boolean canUntag(CoreSession session, String docId, String label); @Override Set<String> getTags(CoreSession session, String docId); @Override List<Tag> getDocumentTags(CoreSession session, String docId, String username); @Override List<Tag> getDocumentTags(CoreSession session, String docId, String username, boolean useCore); @Override void removeTags(CoreSession session, String docId); @Override void copyTags(CoreSession session, String srcDocId, String dstDocId); @Override void replaceTags(CoreSession session, String srcDocId, String dstDocId); @Override List<String> getTagDocumentIds(CoreSession session, String label); @Override List<String> getTagDocumentIds(CoreSession session, String label, String username); @Override Set<String> getSuggestions(CoreSession session, String label); @Override List<Tag> getSuggestions(CoreSession session, String label, String username); abstract void doTag(CoreSession session, String docId, String label, String username); abstract void doUntag(CoreSession session, String docId, String label); abstract Set<String> doGetTags(CoreSession session, String docId); abstract void doCopyTags(CoreSession session, String srcDocId, String dstDocId, boolean removeExistingTags); abstract List<String> doGetTagDocumentIds(CoreSession session, String label); abstract Set<String> doGetTagSuggestions(CoreSession session, String label); static final String TAG_SANITIZATION_PROP; }