mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-22 15:12:38 +00:00
Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)
107747: Fix for ACE-2125 Boolean properties should be supported in the predicate for transactional metadata queries.
- also includes float and double
Fix for ACE-2685 Error when using content length and mimetype in the same query
- SQL refactor removes this issue
Fix for ACE-3889 Support the OR operator with transactional AFTS queries
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@107764 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -408,6 +408,18 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="metadataQueryIndexesCheck2" class="org.alfresco.repo.admin.patch.OptionalPatchApplicationCheckBootstrapBean">
|
||||
<property name="patchService">
|
||||
<ref bean="PatchService" />
|
||||
</property>
|
||||
<property name="descriptorService">
|
||||
<ref bean="descriptorComponent" />
|
||||
</property>
|
||||
<property name="patch">
|
||||
<ref bean="patch.db-V5.1-metadata-query-indexes" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Import other Alfresco bootstrap components -->
|
||||
<import resource="classpath*:alfresco/alfresco-*-bootstrap-context.xml" />
|
||||
|
||||
|
||||
@@ -308,6 +308,9 @@ CREATE TABLE alf_node_properties
|
||||
KEY fk_alf_nprop_loc (locale_id),
|
||||
KEY idx_alf_nprop_s (qname_id, string_value(42)),
|
||||
KEY idx_alf_nprop_l (qname_id, long_value),
|
||||
KEY idx_alf_nprop_b (qname_id, boolean_value),
|
||||
KEY idx_alf_nprop_f (qname_id, float_value),
|
||||
KEY idx_alf_nprop_d (qname_id, double_value),
|
||||
CONSTRAINT fk_alf_nprop_loc FOREIGN KEY (locale_id) REFERENCES alf_locale (id),
|
||||
CONSTRAINT fk_alf_nprop_n FOREIGN KEY (node_id) REFERENCES alf_node (id),
|
||||
CONSTRAINT fk_alf_nprop_qn FOREIGN KEY (qname_id) REFERENCES alf_qname (id)
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<ref bean="patch.db-V4.2-restructure-idx_alf_nprop_s-MSSQL" />
|
||||
<ref bean="patch.db-V4.2-migrate-locale-multilingual" />
|
||||
<ref bean="patch.db-V5.0-ContentUrlEncryptionTables" />
|
||||
<ref bean="patch.db-V5.1-metadata-query-indexes" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
--
|
||||
-- Title: Update alf_node_properties to support in-transaction metadata queries on remaining property types
|
||||
-- Database: Generic
|
||||
-- Since: V5.1 Schema 9004
|
||||
-- Author: Andy Hind
|
||||
--
|
||||
-- Please contact support@alfresco.com if you need assistance with the upgrade.
|
||||
--
|
||||
|
||||
CREATE INDEX idx_alf_nprop_b ON alf_node_properties (qname_id, boolean_value, node_id); --(optional)
|
||||
CREATE INDEX idx_alf_nprop_f ON alf_node_properties (qname_id, float_value, node_id); --(optional)
|
||||
CREATE INDEX idx_alf_nprop_d ON alf_node_properties (qname_id, double_value, node_id); --(optional)
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V5.1-metadata-query-indexes';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V5.1-metadata-query-indexes', 'Manually executed script upgrade V5.1: Updates for metadata query',
|
||||
0, 9003, -1, 9004, null, 'UNKNOWN', ${TRUE}, ${TRUE}, 'Script completed'
|
||||
);
|
||||
@@ -33,8 +33,10 @@
|
||||
node.type_qname_id <> #{sysDeletedType}
|
||||
AND node.store_id = #{storeId}
|
||||
<if test="sinceTxId != null">
|
||||
<if test="sinceTxId > -1">
|
||||
AND node.transaction_id > #{sinceTxId}
|
||||
</if>
|
||||
</if>
|
||||
<if test="hasPredicate">
|
||||
AND
|
||||
<foreach item="item" index="index" collection="predicateParts">
|
||||
@@ -60,6 +62,45 @@
|
||||
<when test="item.type == 'NP_FAILS'">
|
||||
1 = 0
|
||||
</when>
|
||||
<when test="item.type == 'ASPECT'">
|
||||
node.id IN (select aspect.node_id from alf_node_aspects aspect
|
||||
where aspect.qname_id IN <foreach item="val" index="iVal" collection="item.values" open="(" separator="," close=")">#{val}</foreach>)
|
||||
</when>
|
||||
<otherwise>
|
||||
<!-- skip ORDER and NO_ORDER -->
|
||||
<if test="item.type != 'ORDER' and item.type != 'NO_ORDER'">
|
||||
<choose>
|
||||
<when test="item.joinCommandType == 'NODE'">
|
||||
(
|
||||
</when>
|
||||
<otherwise>
|
||||
node.id IN (
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
<choose>
|
||||
<when test="item.joinCommandType == 'PARENT'">
|
||||
select ${item.alias}.child_node_id from alf_child_assoc ${item.alias} where
|
||||
</when>
|
||||
<when test="item.joinCommandType == 'PROPERTY'">
|
||||
select ${item.alias}.node_id from alf_node_properties ${item.alias} where (#{item.qnameId} = ${item.alias}.qname_id) AND
|
||||
</when>
|
||||
<when test="item.joinCommandType == 'CONTENT_MIMETYPE'">
|
||||
select ${item.alias}_p.node_id from alf_node_properties ${item.alias}_p
|
||||
join alf_content_data ${item.alias}_cd on (${item.alias}_cd.id = ${item.alias}_p.long_value)
|
||||
join alf_mimetype ${item.alias} on (${item.alias}_cd.content_mimetype_id = ${item.alias}.id)
|
||||
where (#{item.qnameId} = ${item.alias}_p.qname_id)
|
||||
AND
|
||||
</when>
|
||||
<when test="item.joinCommandType == 'CONTENT_URL'">
|
||||
select ${item.alias}_p.node_id from alf_node_properties ${item.alias}_p
|
||||
join alf_content_data ${item.alias}_cd on (${item.alias}_cd.id = ${item.alias}_p.long_value)
|
||||
join alf_content_url ${item.alias} on (${item.alias}.id = ${item.alias}_cd.content_url_id)
|
||||
where (#{item.qnameId} = ${item.alias}_p.qname_id)
|
||||
AND
|
||||
</when>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="item.type == 'EQUALS'">
|
||||
${item.fieldAndFunction} = #{item.value}
|
||||
</when>
|
||||
@@ -96,11 +137,10 @@
|
||||
<when test="item.type == 'NOTEQUALS'">
|
||||
${item.fieldAndFunction} <> #{item.value}
|
||||
</when>
|
||||
<when test="item.type == 'ASPECT'">
|
||||
EXISTS (select 1 from alf_node_aspects aspect where aspect.node_id = node.id AND
|
||||
aspect.qname_id IN <foreach item="val" index="iVal" collection="item.values" open="(" separator="," close=")">#{val}</foreach>)
|
||||
</when>
|
||||
<!-- skip ORDER and NO_ORDER -->
|
||||
</choose>
|
||||
)
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
@@ -365,3 +365,5 @@ patch.downloadsFolder=Adds the System Downloads folder
|
||||
patch.downloadsFolder.description=Ensures the Syste Downloads folder exists.
|
||||
patch.downloadsFolder.result.exists=The System Downloads folder already exists.
|
||||
patch.downloadsFolder.result.created=The System Downloads folder was created.
|
||||
|
||||
patch.db-V5.1-metadata-query-indexes.description=Add additional indexes to support transactional metadata query direct to the database.>>>>>>> .merge-right.r99951
|
||||
|
||||
@@ -1171,4 +1171,17 @@
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.db-V5.1-metadata-query-indexes" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
|
||||
<property name="id"><value>patch.db-V5.1-metadata-query-indexes</value></property>
|
||||
<property name="description"><value>patch.db-V5.1-metadata-query-indexes.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>9003</value></property>
|
||||
<property name="targetSchema"><value>9004</value></property>
|
||||
<property name="ignored"><value>${system.metadata-query-indexes-more.ignored}</value></property>
|
||||
<property name="scriptUrl">
|
||||
<value>classpath:alfresco/dbscripts/upgrade/5.1/${db.script.dialect}/metadata-query-indexes-2.sql</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1039,7 +1039,9 @@ webscripts.setMaxContentSize=4294967296
|
||||
# Adding each the supporting indexes may take several hours depending on the size of the database.
|
||||
# The required indexes may be added in stages.
|
||||
# See: classpath:alfresco/dbscripts/upgrade/4.2/${db.script.dialect}/metadata-query-indexes.sql
|
||||
# See: classpath:alfresco/dbscripts/upgrade/5.1/${db.script.dialect}/metadata-query-indexes-2.sql
|
||||
system.metadata-query-indexes.ignored=true
|
||||
system.metadata-query-indexes-more.ignored=true
|
||||
|
||||
#
|
||||
# Do we defer running the shared folder patch?
|
||||
|
||||
@@ -82,9 +82,12 @@
|
||||
<property name="cmisDictionaryService">
|
||||
<ref bean="OpenCMISDictionaryService" />
|
||||
</property>
|
||||
<property name="optionalPatchApplicationCheckBootstrapBean">
|
||||
<property name="metadataIndexCheck1">
|
||||
<ref bean="metadataQueryIndexesCheck" />
|
||||
</property>
|
||||
<property name="metadataIndexCheck2">
|
||||
<ref bean="metadataQueryIndexesCheck2" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="search.cmis.alfresco.db1.1" class="org.alfresco.repo.search.impl.solr.DbCmisQueryLanguage" >
|
||||
@@ -96,12 +99,12 @@
|
||||
<property name="queryEngine">
|
||||
<ref bean="search.dbQueryEngine" />
|
||||
</property>
|
||||
<property name="cmisDictionaryService">
|
||||
<ref bean="OpenCMISDictionaryService1.1" />
|
||||
</property>
|
||||
<property name="optionalPatchApplicationCheckBootstrapBean">
|
||||
<property name="metadataIndexCheck1">
|
||||
<ref bean="metadataQueryIndexesCheck" />
|
||||
</property>
|
||||
<property name="metadataIndexCheck2">
|
||||
<ref bean="metadataQueryIndexesCheck2" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -101,9 +101,12 @@
|
||||
<property name="namespaceService">
|
||||
<ref bean="namespaceService" />
|
||||
</property>
|
||||
<property name="optionalPatchApplicationCheckBootstrapBean">
|
||||
<property name="metadataIndexCheck1">
|
||||
<ref bean="metadataQueryIndexesCheck" />
|
||||
</property>
|
||||
<property name="metadataIndexCheck2">
|
||||
<ref bean="metadataQueryIndexesCheck2" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="search.dbQueryEngineImpl" class="org.alfresco.repo.search.impl.querymodel.impl.db.DBQueryEngine" >
|
||||
@@ -118,6 +121,9 @@
|
||||
<property name="nodeService" ref="nodeService"/>
|
||||
<property name="nodeDAO" ref="nodeDAO"/>
|
||||
<property name="tenantService" ref="tenantService"/>
|
||||
<property name="metadataIndexCheck2">
|
||||
<ref bean="metadataQueryIndexesCheck2" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="search.dbQueryEngine" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
|
||||
@@ -23,4 +23,4 @@ version.build=r@scm-revision@-b@build-number@
|
||||
|
||||
# Schema number
|
||||
|
||||
version.schema=9006
|
||||
version.schema=9007
|
||||
|
||||
@@ -68,7 +68,7 @@ public class AspectSupport implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -81,12 +81,7 @@ public class AspectSupport implements DBQueryBuilderComponent
|
||||
@Override
|
||||
public void buildJoins(Map<QName, DBQueryBuilderJoinCommand> singleJoins, List<DBQueryBuilderJoinCommand> multiJoins)
|
||||
{
|
||||
DBQueryBuilderJoinCommand join = new DBQueryBuilderJoinCommand();
|
||||
alias = "ASPECT_" + multiJoins.size();
|
||||
join.setAlias(alias);
|
||||
join.setOuter(false);
|
||||
join.setType(DBQueryBuilderJoinCommandType.ASPECT);
|
||||
multiJoins.add(join);
|
||||
// Nothing to do (uses semi-join)
|
||||
|
||||
}
|
||||
|
||||
@@ -100,6 +95,7 @@ public class AspectSupport implements DBQueryBuilderComponent
|
||||
public void buildPredicateCommands(List<DBQueryBuilderPredicatePartCommand> predicatePartCommands)
|
||||
{
|
||||
DBQueryBuilderPredicatePartCommand command = new DBQueryBuilderPredicatePartCommand();
|
||||
command.setJoinCommandType(DBQueryBuilderJoinCommandType.ASPECT);
|
||||
command.setAlias(alias);
|
||||
command.setType(DBQueryBuilderPredicatePartCommandType.ASPECT);
|
||||
if(qnameIds.size() > 0)
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DBConjunction extends BaseConjunction implements DBQueryBuilderComp
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
for (Constraint constraint : getConstraints())
|
||||
{
|
||||
@@ -74,7 +74,7 @@ public class DBConjunction extends BaseConjunction implements DBQueryBuilderComp
|
||||
throw new QueryModelException("Disjunctions are not suported");
|
||||
}
|
||||
DBQueryBuilderComponent dbQueryBuilderComponent = (DBQueryBuilderComponent) constraint;
|
||||
dbQueryBuilderComponent.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectors, functionArgs, functionContext);
|
||||
dbQueryBuilderComponent.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectors, functionArgs, functionContext, supportBooleanFloatAndDouble);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -63,22 +63,22 @@ public class DBDisjunction extends BaseDisjunction implements DBQueryBuilderComp
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
throw new QueryModelException("Disjunctions are not suported");
|
||||
//throw new QueryModelException("Disjunctions are not suported");
|
||||
|
||||
// for (Constraint constraint : getConstraints())
|
||||
// {
|
||||
// if (constraint instanceof DBQueryBuilderComponent)
|
||||
// {
|
||||
// DBQueryBuilderComponent dbQueryBuilderComponent = (DBQueryBuilderComponent) constraint;
|
||||
// dbQueryBuilderComponent.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, selectors, functionArgs, functionContext);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// throw new UnsupportedOperationException();
|
||||
// }
|
||||
// }
|
||||
for (Constraint constraint : getConstraints())
|
||||
{
|
||||
if (constraint instanceof DBQueryBuilderComponent)
|
||||
{
|
||||
DBQueryBuilderComponent dbQueryBuilderComponent = (DBQueryBuilderComponent) constraint;
|
||||
dbQueryBuilderComponent.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectors, functionArgs, functionContext, supportBooleanFloatAndDouble);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DBFunctionalConstraint extends BaseFunctionalConstraint implements
|
||||
* @see org.alfresco.repo.search.impl.querymodel.impl.db.DBQueryBuilderComponent#prepare(org.alfresco.service.namespace.NamespaceService, org.alfresco.service.cmr.dictionary.DictionaryService, org.alfresco.repo.domain.qname.QNameDAO, org.alfresco.repo.domain.node.NodeDAO)
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors, Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors, Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
Function function = getFunction();
|
||||
if(function != null)
|
||||
@@ -71,7 +71,7 @@ public class DBFunctionalConstraint extends BaseFunctionalConstraint implements
|
||||
if(function instanceof DBQueryBuilderComponent)
|
||||
{
|
||||
DBQueryBuilderComponent dbQueryBuilderComponent = (DBQueryBuilderComponent)function;
|
||||
dbQueryBuilderComponent.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectors, getFunctionArguments(), functionContext);
|
||||
dbQueryBuilderComponent.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectors, getFunctionArguments(), functionContext, supportBooleanFloatAndDouble);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@ public class DBOrdering extends BaseOrdering implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
if (getColumn().getFunction().getName().equals(PropertyAccessor.NAME))
|
||||
{
|
||||
@@ -154,7 +154,7 @@ public class DBOrdering extends BaseOrdering implements DBQueryBuilderComponent
|
||||
propertySupport.setPropertyQName(propertyQName);
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
||||
propertySupport.setLeftOuter(true);
|
||||
builderSupport = propertySupport;
|
||||
|
||||
@@ -194,7 +194,7 @@ public class DBQuery extends BaseQuery implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
selectorGroup = selectors;
|
||||
if (selectorGroup != null)
|
||||
@@ -204,7 +204,7 @@ public class DBQuery extends BaseQuery implements DBQueryBuilderComponent
|
||||
Selector current = getSource().getSelector(selector);
|
||||
if (current instanceof DBQueryBuilderComponent)
|
||||
{
|
||||
((DBQueryBuilderComponent) current).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext);
|
||||
((DBQueryBuilderComponent) current).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext, supportBooleanFloatAndDouble);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -217,7 +217,7 @@ public class DBQuery extends BaseQuery implements DBQueryBuilderComponent
|
||||
{
|
||||
if (getConstraint() instanceof DBQueryBuilderComponent)
|
||||
{
|
||||
((DBQueryBuilderComponent) getConstraint()).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext);
|
||||
((DBQueryBuilderComponent) getConstraint()).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext, supportBooleanFloatAndDouble);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -231,7 +231,7 @@ public class DBQuery extends BaseQuery implements DBQueryBuilderComponent
|
||||
{
|
||||
if(ordering instanceof DBQueryBuilderComponent)
|
||||
{
|
||||
((DBQueryBuilderComponent) ordering).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext);
|
||||
((DBQueryBuilderComponent) ordering).prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, functionArgs, functionContext, supportBooleanFloatAndDouble);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -744,7 +744,7 @@ public class DBQuery extends BaseQuery implements DBQueryBuilderComponent
|
||||
* @param propertyQName QName
|
||||
* @return String
|
||||
*/
|
||||
public static String getFieldName(DictionaryService dictionaryService, QName propertyQName)
|
||||
public static String getFieldName(DictionaryService dictionaryService, QName propertyQName, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
if (propertyQName.equals(ContentModel.PROP_CREATED))
|
||||
{
|
||||
@@ -818,6 +818,18 @@ public class DBQuery extends BaseQuery implements DBQueryBuilderComponent
|
||||
{
|
||||
return "string_value";
|
||||
}
|
||||
else if (dataType.getName().equals(DataTypeDefinition.BOOLEAN) && supportBooleanFloatAndDouble)
|
||||
{
|
||||
return "boolean_value";
|
||||
}
|
||||
else if (dataType.getName().equals(DataTypeDefinition.FLOAT) && supportBooleanFloatAndDouble)
|
||||
{
|
||||
return "float_value";
|
||||
}
|
||||
else if (dataType.getName().equals(DataTypeDefinition.DOUBLE) && supportBooleanFloatAndDouble)
|
||||
{
|
||||
return "double_value";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new QueryModelException("Unsupported property type " + dataType.getName());
|
||||
|
||||
@@ -58,7 +58,7 @@ public interface DBQueryBuilderComponent
|
||||
* @param functionArgs Map<String, Argument>
|
||||
* @param functionContext FunctionEvaluationContext
|
||||
*/
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors, Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext);
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors, Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble);
|
||||
|
||||
/**
|
||||
* Build the Set of required joins
|
||||
|
||||
@@ -35,8 +35,44 @@ public class DBQueryBuilderPredicatePartCommand
|
||||
|
||||
String alias;
|
||||
|
||||
private DBQueryBuilderJoinCommandType joinCommandType;
|
||||
|
||||
private LuceneFunction function;
|
||||
|
||||
private Long qnameId;
|
||||
|
||||
/**
|
||||
* @return the qnameId
|
||||
*/
|
||||
public Long getQnameId()
|
||||
{
|
||||
return qnameId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param qnameId the qnameId to set
|
||||
*/
|
||||
public void setQnameId(Long qnameId)
|
||||
{
|
||||
this.qnameId = qnameId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the joinCommandType
|
||||
*/
|
||||
public String getJoinCommandType()
|
||||
{
|
||||
return joinCommandType.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param joinCommandType the joinCommandType to set
|
||||
*/
|
||||
public void setJoinCommandType(DBQueryBuilderJoinCommandType joinCommandType)
|
||||
{
|
||||
this.joinCommandType = joinCommandType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.admin.patch.OptionalPatchApplicationCheckBootstrapBean;
|
||||
import org.alfresco.repo.domain.node.Node;
|
||||
import org.alfresco.repo.domain.node.NodeDAO;
|
||||
import org.alfresco.repo.domain.qname.QNameDAO;
|
||||
@@ -69,6 +70,13 @@ public class DBQueryEngine implements QueryEngine
|
||||
|
||||
private TenantService tenantService;
|
||||
|
||||
private OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck2;
|
||||
|
||||
public void setMetadataIndexCheck2(OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck2)
|
||||
{
|
||||
this.metadataIndexCheck2 = metadataIndexCheck2;
|
||||
}
|
||||
|
||||
public void setTenantService(TenantService tenantService)
|
||||
{
|
||||
this.tenantService = tenantService;
|
||||
@@ -184,7 +192,7 @@ public class DBQueryEngine implements QueryEngine
|
||||
}
|
||||
dbQuery.setSinceTxId(sinceTxId);
|
||||
|
||||
dbQuery.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, null, functionContext);
|
||||
dbQuery.prepare(namespaceService, dictionaryService, qnameDAO, nodeDAO, tenantService, selectorGroup, null, functionContext, metadataIndexCheck2.getPatchApplied());
|
||||
List<Node> nodes = template.selectList(SELECT_BY_DYNAMIC_QUERY, dbQuery);
|
||||
LinkedHashSet<Long> set = new LinkedHashSet<Long>(nodes.size());
|
||||
for(Node node : nodes)
|
||||
|
||||
@@ -75,7 +75,7 @@ public class DBSelector extends BaseSelector implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
ClassDefinition classDef = dictionaryService.getClass(getType());
|
||||
List<Long> qnameIds = new ArrayList<Long>();
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ParentSupport implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -102,6 +102,9 @@ public class ParentSupport implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void buildJoins(Map<QName, DBQueryBuilderJoinCommand> singleJoins, List<DBQueryBuilderJoinCommand> multiJoins)
|
||||
{
|
||||
alias = "PARENT";
|
||||
if(commandType == DBQueryBuilderPredicatePartCommandType.ORDER)
|
||||
{
|
||||
DBQueryBuilderJoinCommand join = new DBQueryBuilderJoinCommand();
|
||||
alias = "PARENT_" + multiJoins.size();
|
||||
@@ -109,6 +112,7 @@ public class ParentSupport implements DBQueryBuilderComponent
|
||||
join.setOuter(leftOuter);
|
||||
join.setType(DBQueryBuilderJoinCommandType.PARENT);
|
||||
multiJoins.add(join);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -122,6 +126,7 @@ public class ParentSupport implements DBQueryBuilderComponent
|
||||
public void buildPredicateCommands(List<DBQueryBuilderPredicatePartCommand> predicatePartCommands)
|
||||
{
|
||||
DBQueryBuilderPredicatePartCommand command = new DBQueryBuilderPredicatePartCommand();
|
||||
command.setJoinCommandType(DBQueryBuilderJoinCommandType.PARENT);
|
||||
command.setAlias(alias);
|
||||
command.setType(commandType);
|
||||
command.setValue(dbid);
|
||||
|
||||
@@ -153,7 +153,7 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -165,6 +165,10 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void buildJoins(Map<QName, DBQueryBuilderJoinCommand> singleJoins, List<DBQueryBuilderJoinCommand> multiJoins)
|
||||
{
|
||||
// JOIN is only required for ordering - predicts are done via semi-join
|
||||
alias = "PROP";
|
||||
if(commandType == DBQueryBuilderPredicatePartCommandType.ORDER)
|
||||
{
|
||||
DBQueryBuilderJoinCommand join = singleJoins.get(propertyQName);
|
||||
if (join == null)
|
||||
@@ -194,6 +198,7 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
@@ -206,6 +211,7 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
if (pair == null)
|
||||
{
|
||||
DBQueryBuilderPredicatePartCommand command = new DBQueryBuilderPredicatePartCommand();
|
||||
command.setJoinCommandType(DBQueryBuilderJoinCommandType.NODE);
|
||||
switch(joinCommandType)
|
||||
{
|
||||
case NODE:
|
||||
@@ -232,8 +238,9 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
DBQueryBuilderPredicatePartCommand command = new DBQueryBuilderPredicatePartCommand();
|
||||
command.setJoinCommandType(joinCommandType);
|
||||
command.setQnameId(pair.getFirst());
|
||||
switch(joinCommandType)
|
||||
{
|
||||
case NODE:
|
||||
|
||||
@@ -78,7 +78,7 @@ public class TypeSupport implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -105,6 +105,7 @@ public class TypeSupport implements DBQueryBuilderComponent
|
||||
public void buildPredicateCommands(List<DBQueryBuilderPredicatePartCommand> predicatePartCommands)
|
||||
{
|
||||
DBQueryBuilderPredicatePartCommand command = new DBQueryBuilderPredicatePartCommand();
|
||||
command.setJoinCommandType(DBQueryBuilderJoinCommandType.NODE);
|
||||
command.setAlias("node");
|
||||
command.setFieldName("type_qname_id");
|
||||
command.setType(commandType);
|
||||
|
||||
@@ -104,7 +104,7 @@ public class UUIDSupport implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -125,6 +125,7 @@ public class UUIDSupport implements DBQueryBuilderComponent
|
||||
public void buildPredicateCommands(List<DBQueryBuilderPredicatePartCommand> predicatePartCommands)
|
||||
{
|
||||
DBQueryBuilderPredicatePartCommand command = new DBQueryBuilderPredicatePartCommand();
|
||||
command.setJoinCommandType(DBQueryBuilderJoinCommandType.NODE);
|
||||
command.setAlias("node");
|
||||
command.setType(commandType);
|
||||
command.setFieldName("uuid");
|
||||
|
||||
@@ -61,7 +61,7 @@ public class DBChild extends Child implements DBQueryBuilderComponent
|
||||
* @see org.alfresco.repo.search.impl.querymodel.impl.db.DBQueryBuilderComponent#prepare(org.alfresco.service.namespace.NamespaceService, org.alfresco.service.cmr.dictionary.DictionaryService, org.alfresco.repo.domain.qname.QNameDAO, org.alfresco.repo.domain.node.NodeDAO)
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors, Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors, Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
|
||||
Argument argument = functionArgs.get(ARG_PARENT);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DBDescendant extends Descendant implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
throw new QueryModelException("Descendant/IN_TREE() is unsupported");
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DBEquals extends Equals implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
setPropertyAndStaticArguments(functionArgs);
|
||||
Serializable staticValue = getStaticArgument().getValue(functionContext);
|
||||
@@ -150,7 +150,7 @@ public class DBEquals extends Equals implements DBQueryBuilderComponent
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.EQUALS);
|
||||
propertySupport.setLuceneFunction(functionContext.getLuceneFunction(getFunctionArgument()));
|
||||
builderSupport = propertySupport;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
PropertyArgument propertyArgument = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
|
||||
Argument inverseArgument = functionArgs.get(ARG_NOT);
|
||||
@@ -186,7 +186,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DBFTSFuzzyTerm extends FTSFuzzyTerm implements DBQueryBuilderCompo
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
throw new QueryModelException("Fuzzy term is unsupported");
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DBFTSPhrase extends FTSPhrase implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
|
||||
Argument argument = functionArgs.get(ARG_PHRASE);
|
||||
@@ -135,7 +135,7 @@ public class DBFTSPhrase extends FTSPhrase implements DBQueryBuilderComponent
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.EQUALS);
|
||||
builderSupport = propertySupport;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class DBFTSPrefixTerm extends FTSPrefixTerm implements DBQueryBuilderComp
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
Argument argument = functionArgs.get(ARG_TERM);
|
||||
String term = (String) argument.getValue(functionContext);
|
||||
@@ -91,7 +91,7 @@ public class DBFTSPrefixTerm extends FTSPrefixTerm implements DBQueryBuilderComp
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.LIKE);
|
||||
builderSupport = propertySupport;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DBFTSProximity extends FTSProximity implements DBQueryBuilderCompon
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
throw new QueryModelException("Proximity term is unsupported");
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DBFTSRange extends FTSRange implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
throw new QueryModelException("Range term is unsupported");
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DBFTSTerm extends FTSTerm implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
Argument argument = functionArgs.get(ARG_TERM);
|
||||
String term = (String) argument.getValue(functionContext);
|
||||
@@ -133,7 +133,7 @@ public class DBFTSTerm extends FTSTerm implements DBQueryBuilderComponent
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.EQUALS);
|
||||
builderSupport = propertySupport;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DBFTSWildTerm extends FTSWildTerm implements DBQueryBuilderCompone
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
throw new QueryModelException("Wild term is unsupported");
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DBGreaterThan extends GreaterThan implements DBQueryBuilderComponen
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
setPropertyAndStaticArguments(functionArgs);
|
||||
Serializable staticValue = getStaticArgument().getValue(functionContext);
|
||||
@@ -109,7 +109,7 @@ public class DBGreaterThan extends GreaterThan implements DBQueryBuilderComponen
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(getStaticPosition().equals(ARG_RHS) ? DBQueryBuilderPredicatePartCommandType.GT : DBQueryBuilderPredicatePartCommandType.GT.propertyAndValueReversed());
|
||||
propertySupport.setLuceneFunction(functionContext.getLuceneFunction(getFunctionArgument()));
|
||||
builderSupport = propertySupport;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class DBGreaterThanOrEquals extends GreaterThanOrEquals implements DBQuer
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
setPropertyAndStaticArguments(functionArgs);
|
||||
Serializable staticValue = getStaticArgument().getValue(functionContext);
|
||||
@@ -114,7 +114,7 @@ public class DBGreaterThanOrEquals extends GreaterThanOrEquals implements DBQuer
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(getStaticPosition().equals(ARG_RHS) ? DBQueryBuilderPredicatePartCommandType.GTE : DBQueryBuilderPredicatePartCommandType.GTE.propertyAndValueReversed());
|
||||
propertySupport.setLuceneFunction(functionContext.getLuceneFunction(getFunctionArgument()));
|
||||
builderSupport = propertySupport;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DBIn extends In implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
PropertyArgument propertyArgument = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
|
||||
|
||||
@@ -209,7 +209,7 @@ public class DBIn extends In implements DBQueryBuilderComponent
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
if((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTIN);
|
||||
|
||||
@@ -69,7 +69,7 @@ public class DBLessThan extends LessThan implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
setPropertyAndStaticArguments(functionArgs);
|
||||
Serializable staticValue = getStaticArgument().getValue(functionContext);
|
||||
@@ -114,7 +114,7 @@ public class DBLessThan extends LessThan implements DBQueryBuilderComponent
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(getStaticPosition().equals(ARG_RHS) ? DBQueryBuilderPredicatePartCommandType.LT : DBQueryBuilderPredicatePartCommandType.LT.propertyAndValueReversed());
|
||||
propertySupport.setLuceneFunction(functionContext.getLuceneFunction(getFunctionArgument()));
|
||||
builderSupport = propertySupport;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DBLessThanOrEquals extends LessThanOrEquals implements DBQueryBuild
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
setPropertyAndStaticArguments(functionArgs);
|
||||
Serializable staticValue = getStaticArgument().getValue(functionContext);
|
||||
@@ -109,7 +109,7 @@ public class DBLessThanOrEquals extends LessThanOrEquals implements DBQueryBuild
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(getStaticPosition().equals(ARG_RHS) ? DBQueryBuilderPredicatePartCommandType.LTE : DBQueryBuilderPredicatePartCommandType.LTE.propertyAndValueReversed());
|
||||
propertySupport.setLuceneFunction(functionContext.getLuceneFunction(getFunctionArgument()));
|
||||
builderSupport = propertySupport;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DBLike extends Like implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
PropertyArgument propertyArgument = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
|
||||
Argument inverseArgument = functionArgs.get(ARG_NOT);
|
||||
@@ -103,7 +103,7 @@ public class DBLike extends Like implements DBQueryBuilderComponent
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
if((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTLIKE);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class DBLower extends Lower implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class DBNotEquals extends NotEquals implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
setPropertyAndStaticArguments(functionArgs);
|
||||
Serializable staticValue = getStaticArgument().getValue(functionContext);
|
||||
@@ -143,7 +143,7 @@ public class DBNotEquals extends NotEquals implements DBQueryBuilderComponent
|
||||
propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName));
|
||||
propertySupport.setPair(qnameDAO.getQName(propertyQName));
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble));
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEQUALS);
|
||||
propertySupport.setLuceneFunction(functionContext.getLuceneFunction(getFunctionArgument()));
|
||||
builderSupport = propertySupport;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DBPropertyAccessor extends PropertyAccessor implements DBQueryBuild
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DBScore extends Score implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DBUpper extends Upper implements DBQueryBuilderComponent
|
||||
*/
|
||||
@Override
|
||||
public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors,
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext)
|
||||
Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.search.impl.solr;
|
||||
|
||||
import org.alfresco.repo.admin.patch.AppliedPatch;
|
||||
import org.alfresco.repo.admin.patch.OptionalPatchApplicationCheckBootstrapBean;
|
||||
import org.alfresco.repo.admin.patch.PatchService;
|
||||
import org.alfresco.repo.search.IndexerAndSearcher;
|
||||
import org.alfresco.repo.search.impl.lucene.ADMLuceneSearcherImpl;
|
||||
import org.alfresco.repo.search.impl.lucene.AbstractAlfrescoFtsQueryLanguage;
|
||||
import org.alfresco.repo.search.impl.querymodel.QueryModelException;
|
||||
@@ -30,7 +27,6 @@ import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.SearchParameters;
|
||||
import org.alfresco.service.namespace.NamespacePrefixResolver;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
/**
|
||||
* @author Andy
|
||||
@@ -42,18 +38,28 @@ public class DbAftsQueryLanguage extends AbstractAlfrescoFtsQueryLanguage
|
||||
|
||||
DictionaryService dictionaryService;
|
||||
|
||||
OptionalPatchApplicationCheckBootstrapBean optionalPatchApplicationCheckBootstrapBean;
|
||||
OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck1;
|
||||
|
||||
OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck2;
|
||||
|
||||
/**
|
||||
* @param optionalPatchApplicationCheckBootstrapBean the optionalPatchApplicationCheckBootstrapBean to set
|
||||
* @param metadataIndexCheck1 the metadataIndexCheck1 to set
|
||||
*/
|
||||
public void setOptionalPatchApplicationCheckBootstrapBean(OptionalPatchApplicationCheckBootstrapBean optionalPatchApplicationCheckBootstrapBean)
|
||||
public void setMetadataIndexCheck1(OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck1)
|
||||
{
|
||||
this.optionalPatchApplicationCheckBootstrapBean = optionalPatchApplicationCheckBootstrapBean;
|
||||
this.metadataIndexCheck1 = metadataIndexCheck1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param namespaceService the namespaceService to set
|
||||
* @param metadataIndexCheck2 the metadataIndexCheck2 to set
|
||||
*/
|
||||
public void setMetadataIndexCheck2(OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck2)
|
||||
{
|
||||
this.metadataIndexCheck2 = metadataIndexCheck2;
|
||||
}
|
||||
|
||||
/**
|
||||
** @param namespaceService the namespaceService to set
|
||||
*/
|
||||
public void setNamespaceService(NamespaceService namespaceService)
|
||||
{
|
||||
@@ -94,7 +100,7 @@ public class DbAftsQueryLanguage extends AbstractAlfrescoFtsQueryLanguage
|
||||
@Override
|
||||
public ResultSet executeQuery(SearchParameters searchParameters, ADMLuceneSearcherImpl admLuceneSearcher)
|
||||
{
|
||||
if(optionalPatchApplicationCheckBootstrapBean.getPatchApplied())
|
||||
if(metadataIndexCheck1.getPatchApplied())
|
||||
{
|
||||
return super.executeQuery(searchParameters, admLuceneSearcher);
|
||||
}
|
||||
|
||||
@@ -50,14 +50,27 @@ public class DbCmisQueryLanguage extends AbstractLuceneQueryLanguage
|
||||
|
||||
private CMISDictionaryService cmisDictionaryService;
|
||||
|
||||
OptionalPatchApplicationCheckBootstrapBean optionalPatchApplicationCheckBootstrapBean;
|
||||
OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck1;
|
||||
|
||||
OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck2;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param optionalPatchApplicationCheckBootstrapBean the optionalPatchApplicationCheckBootstrapBean to set
|
||||
* @param metadataIndexCheck1 the metadataIndexCheck1 to set
|
||||
*/
|
||||
public void setOptionalPatchApplicationCheckBootstrapBean(OptionalPatchApplicationCheckBootstrapBean optionalPatchApplicationCheckBootstrapBean)
|
||||
public void setMetadataIndexCheck1(OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck1)
|
||||
{
|
||||
this.optionalPatchApplicationCheckBootstrapBean = optionalPatchApplicationCheckBootstrapBean;
|
||||
this.metadataIndexCheck1 = metadataIndexCheck1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param metadataIndexCheck2 the metadataIndexCheck2 to set
|
||||
*/
|
||||
public void setMetadataIndexCheck2(OptionalPatchApplicationCheckBootstrapBean metadataIndexCheck2)
|
||||
{
|
||||
this.metadataIndexCheck2 = metadataIndexCheck2;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +103,7 @@ public class DbCmisQueryLanguage extends AbstractLuceneQueryLanguage
|
||||
@Override
|
||||
public ResultSet executeQuery(SearchParameters searchParameters, ADMLuceneSearcherImpl admLuceneSearcher)
|
||||
{
|
||||
if(optionalPatchApplicationCheckBootstrapBean.getPatchApplied())
|
||||
if(metadataIndexCheck1.getPatchApplied())
|
||||
{
|
||||
return executeQueryImpl(searchParameters, admLuceneSearcher);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user