mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix for ALF-19901 Metadata query CMIS QL queries need to do outer joins for "is null" and "order by"
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@55121 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -114,6 +114,7 @@ public class DBOrdering extends BaseOrdering implements DBQueryBuilderComponent
|
||||
propertySupport.setJoinCommandType(DBQueryBuilderJoinCommandType.CONTENT_MIMETYPE);
|
||||
propertySupport.setFieldName("mimetype_str");
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
||||
propertySupport.setLeftOuter(true);
|
||||
builderSupport = propertySupport;
|
||||
}
|
||||
else if (property.getPropertyName().equals(PropertyIds.CONTENT_STREAM_LENGTH))
|
||||
@@ -134,6 +135,7 @@ public class DBOrdering extends BaseOrdering implements DBQueryBuilderComponent
|
||||
propertySupport.setJoinCommandType(DBQueryBuilderJoinCommandType.CONTENT_URL);
|
||||
propertySupport.setFieldName("content_size");
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
||||
propertySupport.setLeftOuter(true);
|
||||
builderSupport = propertySupport;
|
||||
}
|
||||
else
|
||||
@@ -153,6 +155,7 @@ public class DBOrdering extends BaseOrdering implements DBQueryBuilderComponent
|
||||
propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName));
|
||||
propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName));
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.ORDER);
|
||||
propertySupport.setLeftOuter(true);
|
||||
builderSupport = propertySupport;
|
||||
}
|
||||
}
|
||||
|
@@ -40,6 +40,8 @@ public class ParentSupport implements DBQueryBuilderComponent
|
||||
|
||||
DBQueryBuilderPredicatePartCommandType commandType;
|
||||
|
||||
private boolean leftOuter;
|
||||
|
||||
/**
|
||||
* @param dbid
|
||||
* the dbid to set
|
||||
@@ -103,7 +105,7 @@ public class ParentSupport implements DBQueryBuilderComponent
|
||||
DBQueryBuilderJoinCommand join = new DBQueryBuilderJoinCommand();
|
||||
alias = "PARENT_" + multiJoins.size();
|
||||
join.setAlias(alias);
|
||||
join.setOuter(false);
|
||||
join.setOuter(leftOuter);
|
||||
join.setType(DBQueryBuilderJoinCommandType.PARENT);
|
||||
multiJoins.add(join);
|
||||
|
||||
@@ -128,4 +130,12 @@ public class ParentSupport implements DBQueryBuilderComponent
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param leftOuter
|
||||
*/
|
||||
public void setLeftOuter(boolean leftOuter)
|
||||
{
|
||||
this.leftOuter = leftOuter;
|
||||
}
|
||||
|
||||
}
|
@@ -58,6 +58,8 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
DBQueryBuilderPredicatePartCommandType commandType;
|
||||
|
||||
LuceneFunction luceneFunction;
|
||||
|
||||
private boolean leftOuter;
|
||||
|
||||
/**
|
||||
* @param pair
|
||||
@@ -171,7 +173,7 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
join = new DBQueryBuilderJoinCommand();
|
||||
alias = "PROP_" + singleJoins.size();
|
||||
join.setAlias(alias);
|
||||
join.setOuter(false);
|
||||
join.setOuter(leftOuter);
|
||||
join.setType(joinCommandType);
|
||||
join.setQnameId(pair.getFirst());
|
||||
singleJoins.put(propertyQName, join);
|
||||
@@ -185,6 +187,10 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
if(join != null)
|
||||
{
|
||||
alias = join.getAlias();
|
||||
if(leftOuter)
|
||||
{
|
||||
join.setOuter(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,14 +307,25 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
case CONTENT_MIMETYPE:
|
||||
command.setAlias(alias);
|
||||
command.setType(commandType);
|
||||
|
||||
// Good for order and predicates
|
||||
command.setValue(value);
|
||||
command.setValues(values);
|
||||
|
||||
break;
|
||||
case CONTENT_URL:
|
||||
command.setAlias(alias);
|
||||
command.setType(commandType);
|
||||
command.setValue(DefaultTypeConverter.INSTANCE.convert(Integer.class, value));
|
||||
command.setValues(values == null ? null : DefaultTypeConverter.INSTANCE.convert(Integer.class, Arrays.asList(values)).toArray(new Integer[]{}));
|
||||
if(commandType == DBQueryBuilderPredicatePartCommandType.ORDER)
|
||||
{
|
||||
command.setValue(value);
|
||||
command.setValues(values);
|
||||
}
|
||||
else
|
||||
{
|
||||
command.setValue(DefaultTypeConverter.INSTANCE.convert(Long.class, value));
|
||||
command.setValues(values == null ? null : DefaultTypeConverter.INSTANCE.convert(Integer.class, Arrays.asList(values)).toArray(new Integer[]{}));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
command.setType(commandType.propertyNotFound());
|
||||
@@ -332,5 +349,13 @@ public class PropertySupport implements DBQueryBuilderComponent
|
||||
{
|
||||
this.luceneFunction = luceneFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param leftOuter
|
||||
*/
|
||||
public void setLeftOuter(boolean leftOuter)
|
||||
{
|
||||
this.leftOuter = leftOuter;
|
||||
}
|
||||
|
||||
}
|
@@ -37,6 +37,8 @@ public class TypeSupport implements DBQueryBuilderComponent
|
||||
|
||||
DBQueryBuilderPredicatePartCommandType commandType;
|
||||
|
||||
private boolean leftOuter;
|
||||
|
||||
/**
|
||||
* @param qnameIds
|
||||
* the qnameIds to set
|
||||
@@ -117,4 +119,12 @@ public class TypeSupport implements DBQueryBuilderComponent
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param leftOuter
|
||||
*/
|
||||
public void setLeftOuter(boolean leftOuter)
|
||||
{
|
||||
this.leftOuter = leftOuter;
|
||||
}
|
||||
|
||||
}
|
@@ -43,6 +43,8 @@ public class UUIDSupport implements DBQueryBuilderComponent
|
||||
|
||||
DBQueryBuilderPredicatePartCommandType commandType;
|
||||
|
||||
private boolean leftOuter;
|
||||
|
||||
/**
|
||||
* @param uud the uud to set
|
||||
*/
|
||||
@@ -129,5 +131,13 @@ public class UUIDSupport implements DBQueryBuilderComponent
|
||||
command.setValues(uuids);
|
||||
predicatePartCommands.add(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param leftOuter
|
||||
*/
|
||||
public void setLeftOuter(boolean leftOuter)
|
||||
{
|
||||
this.leftOuter = leftOuter;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -84,6 +84,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
parentSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||
parentSupport.setLeftOuter(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -97,6 +98,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
uuidSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||
uuidSupport.setLeftOuter(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -110,6 +112,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
typeSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||
typeSupport.setLeftOuter(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -123,6 +126,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
typeSupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||
typeSupport.setLeftOuter(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -143,6 +147,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||
propertySupport.setLeftOuter(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -163,6 +168,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||
propertySupport.setLeftOuter(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -183,6 +189,7 @@ public class DBExists extends Exists implements DBQueryBuilderComponent
|
||||
if ((not != null) && (not.equals(Boolean.TRUE)))
|
||||
{
|
||||
propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.NOTEXISTS);
|
||||
propertySupport.setLeftOuter(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user