ALF-9252 - SVC 58: Apply contribution for category management services

* Contribution from Jan Pfitzner
  * Merged Util methods into core category JS API
  * Light refactor of category web scripts to align them better with other Alfresco web scripts and add them to the repository API
  * Minor bug fixes/tweaks to UI (added title, I18N, adjust to use modified webscripts, etc)

TODO: modify results from webscripts to bring inline with other webscripts in API (will take into consideration tag manager first)



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29264 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2011-07-22 00:49:32 +00:00
parent 240f77d3ba
commit 92eefc9b78
2 changed files with 81 additions and 7 deletions

View File

@@ -21,6 +21,7 @@ package org.alfresco.repo.jscript;
import java.util.Collection;
import java.util.List;
import org.alfresco.model.ContentModel;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -105,6 +106,24 @@ public final class Classification extends BaseScopableProcessorExtension
return categoryNode;
}
/**
* Get the category node from the category node reference.
*
* @param categoryRef category node reference
* @return {@link CategoryNode} category node
*/
public CategoryNode getCategory(String categoryRef)
{
CategoryNode result = null;
NodeRef categoryNodeRef = new NodeRef(categoryRef);
if (services.getNodeService().exists(categoryNodeRef) == true &&
services.getDictionaryService().isSubClass(ContentModel.TYPE_CATEGORY, services.getNodeService().getType(categoryNodeRef)) == true)
{
result = new CategoryNode(categoryNodeRef, this.services, getScope());
}
return result;
}
/**
* Get the root categories in a classification.
@@ -139,6 +158,12 @@ public final class Classification extends BaseScopableProcessorExtension
return Context.getCurrentContext().newArray(getScope(), tags);
}
/**
* Build category nodes.
*
* @param cars list of associations to category nodes
* @return {@link Object}[] array of category nodes
*/
private Object[] buildCategoryNodes(Collection<ChildAssociationRef> cars)
{
Object[] categoryNodes = new Object[cars.size()];
@@ -150,6 +175,12 @@ public final class Classification extends BaseScopableProcessorExtension
return categoryNodes;
}
/**
* Create QName from string
*
* @param s QName string value
* @return {@link QName} qualified name object
*/
private QName createQName(String s)
{
QName qname;