SEARCH-433 CMIS QL - Support inner and left outer joins from/to a single type and any number of aspects

- fix switch style issues
This commit is contained in:
ahind
2017-10-20 12:29:04 +01:00
parent 82854e2d68
commit 8a6ec6604b
2 changed files with 53 additions and 53 deletions

View File

@@ -107,6 +107,13 @@ public class AspectSupport implements DBQueryBuilderComponent
DBQueryBuilderPredicatePartCommand command; DBQueryBuilderPredicatePartCommand command;
switch(joinType) switch(joinType)
{ {
case LEFT:
case RIGHT:
command = new DBQueryBuilderPredicatePartCommand();
command.setJoinCommandType(DBQueryBuilderJoinCommandType.ASPECT);
command.setType(DBQueryBuilderPredicatePartCommandType.NP_MATCHES);
predicatePartCommands.add(command);
break;
case NONE: case NONE:
case INNER: case INNER:
default: default:
@@ -124,13 +131,6 @@ public class AspectSupport implements DBQueryBuilderComponent
} }
predicatePartCommands.add(command); predicatePartCommands.add(command);
break; break;
case LEFT:
case RIGHT:
command = new DBQueryBuilderPredicatePartCommand();
command.setJoinCommandType(DBQueryBuilderJoinCommandType.ASPECT);
command.setType(DBQueryBuilderPredicatePartCommandType.NP_MATCHES);
predicatePartCommands.add(command);
break;
} }
} }

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.search.impl.querymodel.impl.db; package org.alfresco.repo.search.impl.querymodel.impl.db;
import java.util.ArrayList; import java.util.ArrayList;
@@ -33,8 +33,8 @@ import java.util.Set;
import org.alfresco.repo.domain.node.NodeDAO; import org.alfresco.repo.domain.node.NodeDAO;
import org.alfresco.repo.domain.qname.QNameDAO; import org.alfresco.repo.domain.qname.QNameDAO;
import org.alfresco.repo.search.impl.querymodel.Argument; import org.alfresco.repo.search.impl.querymodel.Argument;
import org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext; import org.alfresco.repo.search.impl.querymodel.FunctionEvaluationContext;
import org.alfresco.repo.search.impl.querymodel.JoinType; import org.alfresco.repo.search.impl.querymodel.JoinType;
import org.alfresco.repo.tenant.TenantService; import org.alfresco.repo.tenant.TenantService;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
@@ -111,12 +111,19 @@ public class TypeSupport implements DBQueryBuilderComponent
*/ */
@Override @Override
public void buildPredicateCommands(List<DBQueryBuilderPredicatePartCommand> predicatePartCommands) public void buildPredicateCommands(List<DBQueryBuilderPredicatePartCommand> predicatePartCommands)
{ {
DBQueryBuilderPredicatePartCommand command; DBQueryBuilderPredicatePartCommand command;
switch(joinType) switch(joinType)
{ {
case NONE: case LEFT:
case INNER: case RIGHT:
command = new DBQueryBuilderPredicatePartCommand();
command.setJoinCommandType(DBQueryBuilderJoinCommandType.NODE);
command.setType(DBQueryBuilderPredicatePartCommandType.NP_MATCHES);
predicatePartCommands.add(command);
break;
case NONE:
case INNER:
default: default:
command = new DBQueryBuilderPredicatePartCommand(); command = new DBQueryBuilderPredicatePartCommand();
command.setJoinCommandType(DBQueryBuilderJoinCommandType.NODE); command.setJoinCommandType(DBQueryBuilderJoinCommandType.NODE);
@@ -131,22 +138,15 @@ public class TypeSupport implements DBQueryBuilderComponent
{ {
command.setValues(new Long[]{-1l}); command.setValues(new Long[]{-1l});
} }
predicatePartCommands.add(command); predicatePartCommands.add(command);
break; break;
case LEFT:
case RIGHT:
command = new DBQueryBuilderPredicatePartCommand();
command.setJoinCommandType(DBQueryBuilderJoinCommandType.NODE);
command.setType(DBQueryBuilderPredicatePartCommandType.NP_MATCHES);
predicatePartCommands.add(command);
break;
} }
} }
public void setJoinType(JoinType joinType) public void setJoinType(JoinType joinType)
{ {
this.joinType = joinType; this.joinType = joinType;
} }
} }