11-03-2010 04:13 PM
package com.alfresco.tutorial;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.namespace.QName;
import org.springframework.extensions.webscripts.Cache;
import org.springframework.extensions.webscripts.DeclarativeWebScript;
import org.springframework.extensions.webscripts.Status;
import org.springframework.extensions.webscripts.WebScriptRequest;
public class ClassList extends DeclarativeWebScript {
private DictionaryService dictionaryService;
private static final String CM_CONTENT_NAMESPACE = "cm";
private static final String CM_CONTENT = "content";
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
Map<String, Object> model = new HashMap<String, Object>();
QName rootNode = QName.createQName(CM_CONTENT_NAMESPACE, CM_CONTENT);
Collection<QName> contentTypes = this.dictionaryService.getSubTypes(rootNode, true);
model.put("contentTypes", contentTypes);
return model;
}
public void setDictionaryService(DictionaryService dictionaryService) {
this.dictionaryService = dictionaryService;
}
}
<bean id="webscript.butterfly.metadata.classlist.get"
class="com.alfresco.tutorial.ClassList" parent="webscript">
<property name="dictionaryService" ref="DictionaryService"/>
</bean>
<webscript>
<shortname>Class list</shortname>
<description>Get all sub contents of cm:content</description>
<url>/metadata/classlist</url>
<format default="json">argument</format>
<authentication>user</authentication>
<transaction>required</transaction>
</webscript>
06-20-2014 08:54 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.