ALF-9542 - SVC 65: Contribution: Share Tag Management Console

* based on contribution from iptech
  * replaced origional web scripts with versions that compliement and extend exitsing tagging REST API
  * updated UI to use changed webScripts
  * fixed rename action caps sensitivity (rename with different capitalisation, but same name deleted tag!)
  * tested 

Also fixes:

  * ALF-8688 - Can't remove a tag from the tag list
  * ALF-4710 - Share Impossible to Permanently Remove Content Tags



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29327 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2011-07-26 05:03:44 +00:00
parent b3ce73691e
commit f1fe03239e
2 changed files with 33 additions and 7 deletions

View File

@@ -66,6 +66,7 @@ import org.alfresco.service.cmr.tagging.TaggingService;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.util.ISO9075; import org.alfresco.util.ISO9075;
import org.alfresco.util.ParameterCheck;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@@ -476,6 +477,8 @@ public class TaggingServiceImpl implements TaggingService,
*/ */
public List<String> getTags(StoreRef storeRef) public List<String> getTags(StoreRef storeRef)
{ {
ParameterCheck.mandatory("storeRef", storeRef);
Collection<ChildAssociationRef> rootCategories = this.categoryService.getRootCategories(storeRef, ContentModel.ASPECT_TAGGABLE); Collection<ChildAssociationRef> rootCategories = this.categoryService.getRootCategories(storeRef, ContentModel.ASPECT_TAGGABLE);
List<String> result = new ArrayList<String>(rootCategories.size()); List<String> result = new ArrayList<String>(rootCategories.size());
for (ChildAssociationRef rootCategory : rootCategories) for (ChildAssociationRef rootCategory : rootCategories)
@@ -491,16 +494,27 @@ public class TaggingServiceImpl implements TaggingService,
*/ */
public List<String> getTags(StoreRef storeRef, String filter) public List<String> getTags(StoreRef storeRef, String filter)
{ {
Collection<ChildAssociationRef> rootCategories = this.categoryService.getRootCategories(storeRef, ContentModel.ASPECT_TAGGABLE); ParameterCheck.mandatory("storeRef", storeRef);
List<String> result = new ArrayList<String>(rootCategories.size());
for (ChildAssociationRef rootCategory : rootCategories) List<String> result = null;
if (filter == null || filter.length() == 0)
{ {
String name = (String)this.nodeService.getProperty(rootCategory.getChildRef(), ContentModel.PROP_NAME); result = getTags(storeRef);
if (name.contains(filter.toLowerCase()) == true) }
else
{
Collection<ChildAssociationRef> rootCategories = this.categoryService.getRootCategories(storeRef, ContentModel.ASPECT_TAGGABLE);
result = new ArrayList<String>(rootCategories.size());
for (ChildAssociationRef rootCategory : rootCategories)
{ {
result.add(name); String name = (String)this.nodeService.getProperty(rootCategory.getChildRef(), ContentModel.PROP_NAME);
if (name.contains(filter.toLowerCase()) == true)
{
result.add(name);
}
} }
} }
return result; return result;
} }

View File

@@ -87,7 +87,7 @@ public class ScriptTaggingService extends BaseScopableProcessorExtension
NodeRef result = this.serviceRegistry.getTaggingService().getTagNodeRef(storeRef, tag); NodeRef result = this.serviceRegistry.getTaggingService().getTagNodeRef(storeRef, tag);
if (result != null) if (result != null)
{ {
return new ScriptNode(result, this.serviceRegistry); return new ScriptNode(result, this.serviceRegistry, this.getScope());
} }
return null; return null;
} }
@@ -109,4 +109,16 @@ public class ScriptTaggingService extends BaseScopableProcessorExtension
} }
return null; return null;
} }
/**
* delete tag at the given store
*
* @param store store reference
* @param tag tag name
*/
public void deleteTag(String store, String tag)
{
StoreRef storeRef = new StoreRef(store);
this.serviceRegistry.getTaggingService().deleteTag(storeRef, tag);
}
} }