Merge from SEAMIST3

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10733 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
David Caruana
2008-09-04 11:22:17 +00:00
parent 41b5618d1d
commit a6625b1c61
63 changed files with 5450 additions and 962 deletions

View File

@@ -25,6 +25,7 @@
package org.alfresco.cmis.search;
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import org.alfresco.cmis.dictionary.CMISDictionaryService;
@@ -33,6 +34,7 @@ import org.alfresco.cmis.property.CMISPropertyServiceImpl;
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
import org.alfresco.repo.search.impl.lucene.ParseException;
import org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext;
import org.alfresco.repo.search.impl.querymodel.PredicateMode;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
@@ -159,13 +161,13 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
this.score = score;
}
public Query buildLuceneEquality(LuceneQueryParser lqp, QName propertyQName, Serializable value) throws ParseException
public Query buildLuceneEquality(LuceneQueryParser lqp, QName propertyQName, Serializable value, PredicateMode mode) throws ParseException
{
if(cmisPropertyService instanceof CMISPropertyServiceImpl)
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl)cmisPropertyService;
return impl.buildLuceneEquality(lqp, propertyName, value);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.buildLuceneEquality(lqp, propertyName, value, mode);
}
else
{
@@ -173,15 +175,18 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
}
}
/* (non-Javadoc)
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#buildLuceneExists(org.alfresco.repo.search.impl.lucene.LuceneQueryParser, org.alfresco.service.namespace.QName, java.lang.Boolean)
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#buildLuceneExists(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
* org.alfresco.service.namespace.QName, java.lang.Boolean)
*/
public Query buildLuceneExists(LuceneQueryParser lqp, QName propertyQName, Boolean not) throws ParseException
{
if(cmisPropertyService instanceof CMISPropertyServiceImpl)
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl)cmisPropertyService;
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.buildLuceneExists(lqp, propertyName, not);
}
else
@@ -190,4 +195,167 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
}
}
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#buildLuceneGreaterThan(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
* org.alfresco.service.namespace.QName, java.io.Serializable,
* org.alfresco.repo.search.impl.querymodel.PredicateMode)
*/
public Query buildLuceneGreaterThan(LuceneQueryParser lqp, QName propertyQName, Serializable value, PredicateMode mode) throws ParseException
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.buildLuceneGreaterThan(lqp, propertyName, value, mode);
}
else
{
return null;
}
}
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#buildLuceneGreaterThanOrEquals(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
* org.alfresco.service.namespace.QName, java.io.Serializable,
* org.alfresco.repo.search.impl.querymodel.PredicateMode)
*/
public Query buildLuceneGreaterThanOrEquals(LuceneQueryParser lqp, QName propertyQName, Serializable value, PredicateMode mode) throws ParseException
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.buildLuceneGreaterThanOrEquals(lqp, propertyName, value, mode);
}
else
{
return null;
}
}
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#buildLuceneIn(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
* org.alfresco.service.namespace.QName, java.util.Collection, java.lang.Boolean,
* org.alfresco.repo.search.impl.querymodel.PredicateMode)
*/
public Query buildLuceneIn(LuceneQueryParser lqp, QName propertyQName, Collection<Serializable> values, Boolean not, PredicateMode mode) throws ParseException
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.buildLuceneIn(lqp, propertyName, values, not, mode);
}
else
{
return null;
}
}
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#buildLuceneInequality(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
* org.alfresco.service.namespace.QName, java.io.Serializable,
* org.alfresco.repo.search.impl.querymodel.PredicateMode)
*/
public Query buildLuceneInequality(LuceneQueryParser lqp, QName propertyQName, Serializable value, PredicateMode mode) throws ParseException
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.buildLuceneInequality(lqp, propertyName, value, mode);
}
else
{
return null;
}
}
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#buildLuceneLessThan(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
* org.alfresco.service.namespace.QName, java.io.Serializable,
* org.alfresco.repo.search.impl.querymodel.PredicateMode)
*/
public Query buildLuceneLessThan(LuceneQueryParser lqp, QName propertyQName, Serializable value, PredicateMode mode) throws ParseException
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.buildLuceneLessThan(lqp, propertyName, value, mode);
}
else
{
return null;
}
}
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#buildLuceneLessThanOrEquals(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
* org.alfresco.service.namespace.QName, java.io.Serializable,
* org.alfresco.repo.search.impl.querymodel.PredicateMode)
*/
public Query buildLuceneLessThanOrEquals(LuceneQueryParser lqp, QName propertyQName, Serializable value, PredicateMode mode) throws ParseException
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.buildLuceneLessThanOrEquals(lqp, propertyName, value, mode);
}
else
{
return null;
}
}
/*
* (non-Javadoc)
*
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#buildLuceneLike(org.alfresco.repo.search.impl.lucene.LuceneQueryParser,
* org.alfresco.service.namespace.QName, java.io.Serializable, java.lang.Boolean)
*/
public Query buildLuceneLike(LuceneQueryParser lqp, QName propertyQName, Serializable value, Boolean not) throws ParseException
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.buildLuceneLike(lqp, propertyName, value, not);
}
else
{
return null;
}
}
/* (non-Javadoc)
* @see org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext#getLuceneSortField(org.alfresco.service.namespace.QName)
*/
public String getLuceneSortField(QName propertyQName)
{
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
{
String propertyName = cmisDictionaryService.getCMISMapping().getCmisPropertyName(propertyQName);
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
return impl.getLuceneSortField(propertyName);
}
else
{
return null;
}
}
}