mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
CMIS Dictionary Refactor
- follows pattern of Alfresco Dictionary - simplified and much reduced DictionaryService interface - model now compiled and cached (no more lots of small continuous object creations) - walk model via simple getters - validated (no dangling references) - fix up property inheritance - fix up sub-types for all types - implements strict mode only for now (i.e. doesn't go outside of CMIS doc, folder, rel and policy) - abstract helper for building other CMIS dictionaries (e.g. mapping all types in Alfresco) Alfresco Dictionary: - add event for initialized or re-initialized Fix up usage in CMIS REST, Web Services and query. Tests pass. REST support for custom sub-types and properties now reliable as constrained by validated CMIS model. TODO: - hook property value accessors into CMIS Dictionary git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13768 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -29,6 +29,7 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyId;
|
||||
import org.alfresco.cmis.property.CMISPropertyService;
|
||||
import org.alfresco.cmis.property.CMISPropertyServiceImpl;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
@@ -130,8 +131,8 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
*/
|
||||
public Serializable getProperty(NodeRef nodeRef, QName propertyQName)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
return cmisPropertyService.getProperty(nodeRef, propertyName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
return cmisPropertyService.getProperty(nodeRef, propertyId.getName());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -165,9 +166,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneEquality(lqp, propertyName, value, mode);
|
||||
return impl.buildLuceneEquality(lqp, propertyId.getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -185,9 +186,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneExists(lqp, propertyName, not);
|
||||
return impl.buildLuceneExists(lqp, propertyId.getName(), not);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -206,9 +207,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneGreaterThan(lqp, propertyName, value, mode);
|
||||
return impl.buildLuceneGreaterThan(lqp, propertyId.getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -227,9 +228,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneGreaterThanOrEquals(lqp, propertyName, value, mode);
|
||||
return impl.buildLuceneGreaterThanOrEquals(lqp, propertyId.getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -248,9 +249,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneIn(lqp, propertyName, values, not, mode);
|
||||
return impl.buildLuceneIn(lqp, propertyId.getName(), values, not, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -269,9 +270,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneInequality(lqp, propertyName, value, mode);
|
||||
return impl.buildLuceneInequality(lqp, propertyId.getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -290,9 +291,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneLessThan(lqp, propertyName, value, mode);
|
||||
return impl.buildLuceneLessThan(lqp, propertyId.getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -311,9 +312,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneLessThanOrEquals(lqp, propertyName, value, mode);
|
||||
return impl.buildLuceneLessThanOrEquals(lqp, propertyId.getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -331,9 +332,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneLike(lqp, propertyName, value, not);
|
||||
return impl.buildLuceneLike(lqp, propertyId.getName(), value, not);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -348,9 +349,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.getLuceneSortField(propertyName);
|
||||
return impl.getLuceneSortField(propertyId.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user