//
// Start with the default query
String selectStatement =
- "SELECT DISTINCT hierarchy_termgroup.parentid as id"
- + " FROM " + handler.getJDBCQueryParams().get(TERM_GROUP_TABLE_NAME_PARAM) + " termgroup";
+ "SELECT DISTINCT commonschema.id"
+ + " FROM " + handler.getServiceContext().getCommonPartLabel() + " commonschema";
String joinClauses =
- " INNER JOIN hierarchy hierarchy_termgroup"
- + " ON hierarchy_termgroup.id = termgroup.id";
+ " INNER JOIN misc"
+ + " ON misc.id = commonschema.id"
+ + " INNER JOIN hierarchy hierarchy_termgroup"
+ + " ON hierarchy_termgroup.parentid = misc.id"
+ + " INNER JOIN " + handler.getJDBCQueryParams().get(TERM_GROUP_TABLE_NAME_PARAM) + " termgroup"
+ + " ON termgroup.id = hierarchy_termgroup.id ";
String whereClause;
MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
" LIMIT " + getMaxItemsLimitOnJdbcQueries(maxListItemsLimit); // implicit int-to-String conversion
List<String> params = new ArrayList<>();
-
+
// Read tenant bindings configuration to determine whether
// to automatically insert leading, as well as trailing, wildcards
// into the term matching string.
// Automatically insert a trailing wildcard
params.add(partialTerm + JDBCTools.SQL_WILDCARD); // Value for replaceable parameter 1 in the query
+ // Optionally add restrictions to the default query, based on variables
+ // in the current request
+
// Restrict the query to filter out deleted records, if requested
String includeDeleted = queryParams.getFirst(WorkflowClient.WORKFLOW_QUERY_NONDELETED);
if (includeDeleted != null && includeDeleted.equalsIgnoreCase(Boolean.FALSE.toString())) {
- joinClauses = joinClauses
- + " INNER JOIN misc"
- + " ON misc.id = hierarchy_termgroup.parentid";
whereClause = whereClause
+ " AND (misc.lifecyclestate <> '" + WorkflowClient.WORKFLOWSTATE_DELETED + "')";
}