mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
102715: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud) (PARTIAL MERGE) 102515: SHA-647 Dictionary GET support methods git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@103545 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<webscript>
|
<webscript>
|
||||||
<shortname>Get remote dictionary definitions</shortname>
|
<shortname>Get remote dictionary definitions</shortname>
|
||||||
<description>Gets all apspect and class definitions that form the dictionary - to enable a lightweight remote dictionary.</description>
|
<description>Gets all aspect and class definitions that form the dictionary - to enable a lightweight remote dictionary.</description>
|
||||||
<url>/api/dictionary</url>
|
<url>/api/dictionary</url>
|
||||||
<format default="json">argument</format>
|
<format default="json">argument</format>
|
||||||
<authentication>user</authentication>
|
<authentication>user</authentication>
|
||||||
|
@@ -29,6 +29,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||||
|
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
@@ -74,7 +75,7 @@ public class DictionaryGet extends DictionaryWebServiceBase
|
|||||||
Map<QName, Collection<PropertyDefinition>> propdef = new HashMap<QName, Collection<PropertyDefinition>>();
|
Map<QName, Collection<PropertyDefinition>> propdef = new HashMap<QName, Collection<PropertyDefinition>>();
|
||||||
Map<QName, Collection<AssociationDefinition>> assocdef = new HashMap<QName, Collection<AssociationDefinition>>();
|
Map<QName, Collection<AssociationDefinition>> assocdef = new HashMap<QName, Collection<AssociationDefinition>>();
|
||||||
|
|
||||||
// check configured list of model namespaces to ignore
|
// check configured list of model namespaces to ignore when retrieving all models
|
||||||
for (String ns : this.namespaceService.getURIs())
|
for (String ns : this.namespaceService.getURIs())
|
||||||
{
|
{
|
||||||
if (!ignoreNamespaces.contains(ns))
|
if (!ignoreNamespaces.contains(ns))
|
||||||
@@ -82,21 +83,38 @@ public class DictionaryGet extends DictionaryWebServiceBase
|
|||||||
namespaces.add(ns);
|
namespaces.add(ns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// walk the models and extract the aspects and types
|
// specific model qname provided or will process all available models
|
||||||
for (QName qname : this.dictionaryservice.getAllModels())
|
String strModel = req.getParameter("model");
|
||||||
|
if (strModel != null && strModel.length() != 0)
|
||||||
{
|
{
|
||||||
if (namespaces.contains(qname.getNamespaceURI()))
|
// handle full QName and prefixed shortname of a model
|
||||||
|
QName modelQName = (strModel.charAt(0) == QName.NAMESPACE_BEGIN ? QName.createQName(strModel) : QName.createQName(strModel, this.namespaceService));
|
||||||
|
ModelDefinition modelDef = this.dictionaryservice.getModel(modelQName);
|
||||||
|
if (modelDef != null)
|
||||||
{
|
{
|
||||||
qnames.addAll(this.dictionaryservice.getAspects(qname));
|
qnames.addAll(this.dictionaryservice.getAspects(modelQName));
|
||||||
qnames.addAll(this.dictionaryservice.getTypes(qname));
|
qnames.addAll(this.dictionaryservice.getTypes(modelQName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// walk all models and extract the aspects and types
|
||||||
|
for (QName qname : this.dictionaryservice.getAllModels())
|
||||||
|
{
|
||||||
|
if (namespaces.contains(qname.getNamespaceURI()))
|
||||||
|
{
|
||||||
|
qnames.addAll(this.dictionaryservice.getAspects(qname));
|
||||||
|
qnames.addAll(this.dictionaryservice.getTypes(qname));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get the class definitions and the properties and associations
|
// get the class definitions and the properties and associations
|
||||||
for (QName qname : qnames)
|
for (QName qname : qnames)
|
||||||
{
|
{
|
||||||
classdef.put(qname, this.dictionaryservice.getClass(qname));
|
ClassDefinition classDef = this.dictionaryservice.getClass(qname);
|
||||||
propdef.put(qname, this.dictionaryservice.getClass(qname).getProperties().values());
|
classdef.put(qname, classDef);
|
||||||
assocdef.put(qname, this.dictionaryservice.getClass(qname).getAssociations().values());
|
propdef.put(qname, classDef.getProperties().values());
|
||||||
|
assocdef.put(qname, classDef.getAssociations().values());
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> model = new HashMap<String, Object>();
|
Map<String, Object> model = new HashMap<String, Object>();
|
||||||
|
Reference in New Issue
Block a user