mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Tagging Service: tags are case insensitive
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9632 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -132,6 +132,9 @@ public class TaggingServiceImpl implements TaggingService
|
||||
*/
|
||||
public boolean isTag(StoreRef storeRef, String tag)
|
||||
{
|
||||
// Lower the case of the tag
|
||||
tag = tag.toLowerCase();
|
||||
|
||||
return (getTagNodeRef(storeRef, tag) != null);
|
||||
}
|
||||
|
||||
@@ -140,6 +143,9 @@ public class TaggingServiceImpl implements TaggingService
|
||||
*/
|
||||
public void createTag(StoreRef storeRef, String tag)
|
||||
{
|
||||
// Lower the case of the tag
|
||||
tag = tag.toLowerCase();
|
||||
|
||||
if (isTag(storeRef, tag) == false)
|
||||
{
|
||||
this.categoryService.createRootCategory(storeRef, ContentModel.ASPECT_TAGGABLE, tag);
|
||||
@@ -166,6 +172,9 @@ public class TaggingServiceImpl implements TaggingService
|
||||
*/
|
||||
public void addTag(NodeRef nodeRef, String tag)
|
||||
{
|
||||
// Lower the case of the tag
|
||||
tag = tag.toLowerCase();
|
||||
|
||||
// Get the tag node reference
|
||||
NodeRef newTagNodeRef = getTagNodeRef(nodeRef.getStoreRef(), tag);
|
||||
if (newTagNodeRef == null)
|
||||
@@ -241,6 +250,9 @@ public class TaggingServiceImpl implements TaggingService
|
||||
*/
|
||||
public void removeTag(NodeRef nodeRef, String tag)
|
||||
{
|
||||
// Lower the case of the tag
|
||||
tag = tag.toLowerCase();
|
||||
|
||||
// Check for the taggable aspect
|
||||
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_TAGGABLE) == true)
|
||||
{
|
||||
@@ -406,6 +418,9 @@ public class TaggingServiceImpl implements TaggingService
|
||||
*/
|
||||
public List<NodeRef> findTaggedNodes(String tag)
|
||||
{
|
||||
// Lower the case of the tag
|
||||
tag = tag.toLowerCase();
|
||||
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
@@ -415,6 +430,9 @@ public class TaggingServiceImpl implements TaggingService
|
||||
*/
|
||||
public List<NodeRef> findTaggedNodes(String tag, TagScope tagScope)
|
||||
{
|
||||
// Lower the case of the tag
|
||||
tag = tag.toLowerCase();
|
||||
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
@@ -64,9 +64,12 @@ public class TaggingServiceImplTest extends BaseAlfrescoSpringTest
|
||||
private NodeRef document;
|
||||
private NodeRef subDocument;
|
||||
|
||||
private static final String TAG_1 = "tagOne";
|
||||
private static final String TAG_2 = "tagTwo";
|
||||
private static final String TAG_3 = "tagThree";
|
||||
private static final String TAG_1 = "tag one";
|
||||
private static final String TAG_2 = "tag two";
|
||||
private static final String TAG_3 = "Tag Three";
|
||||
|
||||
private static final String UPPER_TAG = "House";
|
||||
private static final String LOWER_TAG = "house";
|
||||
|
||||
private static boolean init = false;
|
||||
|
||||
@@ -173,6 +176,7 @@ public class TaggingServiceImplTest extends BaseAlfrescoSpringTest
|
||||
|
||||
// Create a tag
|
||||
this.taggingService.createTag(TaggingServiceImplTest.storeRef, TAG_1);
|
||||
this.taggingService.createTag(TaggingServiceImplTest.storeRef, UPPER_TAG);
|
||||
|
||||
setComplete();
|
||||
endTransaction();
|
||||
@@ -183,13 +187,15 @@ public class TaggingServiceImplTest extends BaseAlfrescoSpringTest
|
||||
// Get all the tags
|
||||
tags = this.taggingService.getTags(TaggingServiceImplTest.storeRef);
|
||||
assertNotNull(tags);
|
||||
assertEquals(1, tags.size());
|
||||
assertEquals(2, tags.size());
|
||||
assertTrue(tags.contains(TAG_1));
|
||||
assertTrue(tags.contains(LOWER_TAG));
|
||||
|
||||
// Check isTag method
|
||||
assertFalse(this.taggingService.isTag(TaggingServiceImplTest.storeRef, TAG_2));
|
||||
assertTrue(this.taggingService.isTag(TaggingServiceImplTest.storeRef, TAG_1));
|
||||
|
||||
assertTrue(this.taggingService.isTag(TaggingServiceImplTest.storeRef, UPPER_TAG));
|
||||
assertTrue(this.taggingService.isTag(TaggingServiceImplTest.storeRef, LOWER_TAG));
|
||||
tx.commit();
|
||||
}
|
||||
|
||||
@@ -315,7 +321,7 @@ public class TaggingServiceImplTest extends BaseAlfrescoSpringTest
|
||||
assertEquals(2, ts2.getTags().get(1).getTagCount());
|
||||
assertEquals(TAG_1, ts2.getTags().get(1).getTagName());
|
||||
assertEquals(1, ts2.getTags().get(2).getTagCount());
|
||||
assertEquals(TAG_3, ts2.getTags().get(2).getTagName());
|
||||
assertEquals(TAG_3.toLowerCase(), ts2.getTags().get(2).getTagName());
|
||||
|
||||
tx.commit();
|
||||
|
||||
@@ -341,6 +347,8 @@ public class TaggingServiceImplTest extends BaseAlfrescoSpringTest
|
||||
private void addTag(NodeRef nodeRef, String tag, int tagCount, NodeRef tagScopeNodeRef)
|
||||
throws Exception
|
||||
{
|
||||
tag = tag.toLowerCase();
|
||||
|
||||
UserTransaction tx = this.transactionService.getUserTransaction();
|
||||
tx.begin();
|
||||
|
||||
|
@@ -24,12 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.thumbnail.script;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.jscript.BaseScopableProcessorExtension;
|
||||
import org.alfresco.repo.site.SiteInfo;
|
||||
import org.alfresco.repo.site.SiteService;
|
||||
import org.alfresco.repo.thumbnail.ThumbnailDetails;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
|
||||
|
Reference in New Issue
Block a user