@Test public void testBuildNegativeStateQuery() throws Exception { WorkflowQuery q = new WorkflowQuery().withSeriesId("series1").withoutState(WorkflowState.RUNNING); String solrQuery = dao.createQuery(q, Permissions.Action.READ.toString(), true); String expected = "oc_org:mh_default_org AND seriesid:series1 AND (-state:running AND *:*)"; assertEquals(expected, solrQuery); }
protected String createQuery(WorkflowQuery query, String action, boolean applyPermissions) throws WorkflowDatabaseException { String orgId = securityService.getOrganization().getId(); StringBuilder sb = new StringBuilder().append(ORG_KEY).append(":").append(escapeQueryChars(orgId)); append(sb, ID_KEY, query.getId(), false); append(sb, MEDIAPACKAGE_KEY, query.getMediaPackageId(), false); append(sb, SERIES_ID_KEY, query.getSeriesId(), false); appendFuzzy(sb, SERIES_TITLE_KEY, query.getSeriesTitle()); appendFuzzy(sb, FULLTEXT_KEY, query.getText()); append(sb, WORKFLOW_DEFINITION_KEY, query.getWorkflowDefinitionId(), false); append(sb, CREATED_KEY, query.getFromDate(), query.getToDate()); appendFuzzy(sb, CREATOR_KEY, query.getCreator()); appendFuzzy(sb, CONTRIBUTOR_KEY, query.getContributor()); appendFuzzy(sb, LANGUAGE_KEY, query.getLanguage()); appendFuzzy(sb, LICENSE_KEY, query.getLicense()); appendFuzzy(sb, TITLE_KEY, query.getTitle()); appendFuzzy(sb, SUBJECT_KEY, query.getSubject()); appendMap(sb, OPERATION_KEY, query.getCurrentOperations()); appendMap(sb, STATE_KEY, query.getStates()); if (applyPermissions) { appendSolrAuthFragment(sb, action); } logger.debug(sb.toString()); return sb.toString(); }
WorkflowServiceSolrIndex implements WorkflowServiceIndex { protected String createQuery(WorkflowQuery query, String action, boolean applyPermissions) throws WorkflowDatabaseException { String orgId = securityService.getOrganization().getId(); StringBuilder sb = new StringBuilder().append(ORG_KEY).append(":").append(escapeQueryChars(orgId)); append(sb, ID_KEY, query.getId(), false); append(sb, MEDIAPACKAGE_KEY, query.getMediaPackageId(), false); append(sb, SERIES_ID_KEY, query.getSeriesId(), false); appendFuzzy(sb, SERIES_TITLE_KEY, query.getSeriesTitle()); appendFuzzy(sb, FULLTEXT_KEY, query.getText()); append(sb, WORKFLOW_DEFINITION_KEY, query.getWorkflowDefinitionId(), false); append(sb, CREATED_KEY, query.getFromDate(), query.getToDate()); appendFuzzy(sb, CREATOR_KEY, query.getCreator()); appendFuzzy(sb, CONTRIBUTOR_KEY, query.getContributor()); appendFuzzy(sb, LANGUAGE_KEY, query.getLanguage()); appendFuzzy(sb, LICENSE_KEY, query.getLicense()); appendFuzzy(sb, TITLE_KEY, query.getTitle()); appendFuzzy(sb, SUBJECT_KEY, query.getSubject()); appendMap(sb, OPERATION_KEY, query.getCurrentOperations()); appendMap(sb, STATE_KEY, query.getStates()); if (applyPermissions) { appendSolrAuthFragment(sb, action); } logger.debug(sb.toString()); return sb.toString(); } }
WorkflowServiceSolrIndex implements WorkflowServiceIndex { protected String createQuery(WorkflowQuery query, String action, boolean applyPermissions) throws WorkflowDatabaseException { String orgId = securityService.getOrganization().getId(); StringBuilder sb = new StringBuilder().append(ORG_KEY).append(":").append(escapeQueryChars(orgId)); append(sb, ID_KEY, query.getId(), false); append(sb, MEDIAPACKAGE_KEY, query.getMediaPackageId(), false); append(sb, SERIES_ID_KEY, query.getSeriesId(), false); appendFuzzy(sb, SERIES_TITLE_KEY, query.getSeriesTitle()); appendFuzzy(sb, FULLTEXT_KEY, query.getText()); append(sb, WORKFLOW_DEFINITION_KEY, query.getWorkflowDefinitionId(), false); append(sb, CREATED_KEY, query.getFromDate(), query.getToDate()); appendFuzzy(sb, CREATOR_KEY, query.getCreator()); appendFuzzy(sb, CONTRIBUTOR_KEY, query.getContributor()); appendFuzzy(sb, LANGUAGE_KEY, query.getLanguage()); appendFuzzy(sb, LICENSE_KEY, query.getLicense()); appendFuzzy(sb, TITLE_KEY, query.getTitle()); appendFuzzy(sb, SUBJECT_KEY, query.getSubject()); appendMap(sb, OPERATION_KEY, query.getCurrentOperations()); appendMap(sb, STATE_KEY, query.getStates()); if (applyPermissions) { appendSolrAuthFragment(sb, action); } logger.debug(sb.toString()); return sb.toString(); }  }
WorkflowServiceSolrIndex implements WorkflowServiceIndex { protected String createQuery(WorkflowQuery query, String action, boolean applyPermissions) throws WorkflowDatabaseException { String orgId = securityService.getOrganization().getId(); StringBuilder sb = new StringBuilder().append(ORG_KEY).append(":").append(escapeQueryChars(orgId)); append(sb, ID_KEY, query.getId(), false); append(sb, MEDIAPACKAGE_KEY, query.getMediaPackageId(), false); append(sb, SERIES_ID_KEY, query.getSeriesId(), false); appendFuzzy(sb, SERIES_TITLE_KEY, query.getSeriesTitle()); appendFuzzy(sb, FULLTEXT_KEY, query.getText()); append(sb, WORKFLOW_DEFINITION_KEY, query.getWorkflowDefinitionId(), false); append(sb, CREATED_KEY, query.getFromDate(), query.getToDate()); appendFuzzy(sb, CREATOR_KEY, query.getCreator()); appendFuzzy(sb, CONTRIBUTOR_KEY, query.getContributor()); appendFuzzy(sb, LANGUAGE_KEY, query.getLanguage()); appendFuzzy(sb, LICENSE_KEY, query.getLicense()); appendFuzzy(sb, TITLE_KEY, query.getTitle()); appendFuzzy(sb, SUBJECT_KEY, query.getSubject()); appendMap(sb, OPERATION_KEY, query.getCurrentOperations()); appendMap(sb, STATE_KEY, query.getStates()); if (applyPermissions) { appendSolrAuthFragment(sb, action); } logger.debug(sb.toString()); return sb.toString(); }  @Activate void activate(ComponentContext cc); void activate(String systemUserName); @Deactivate void deactivate(); void index(final WorkflowInstance instance); @Override long countWorkflowInstances(WorkflowState state, String operation); @Override WorkflowStatistics getStatistics(); @Override WorkflowSet getWorkflowInstances(WorkflowQuery query, String action, boolean applyPermissions); @Override void remove(long id); @Override void update(WorkflowInstance instance); void clear(); }
WorkflowServiceSolrIndex implements WorkflowServiceIndex { protected String createQuery(WorkflowQuery query, String action, boolean applyPermissions) throws WorkflowDatabaseException { String orgId = securityService.getOrganization().getId(); StringBuilder sb = new StringBuilder().append(ORG_KEY).append(":").append(escapeQueryChars(orgId)); append(sb, ID_KEY, query.getId(), false); append(sb, MEDIAPACKAGE_KEY, query.getMediaPackageId(), false); append(sb, SERIES_ID_KEY, query.getSeriesId(), false); appendFuzzy(sb, SERIES_TITLE_KEY, query.getSeriesTitle()); appendFuzzy(sb, FULLTEXT_KEY, query.getText()); append(sb, WORKFLOW_DEFINITION_KEY, query.getWorkflowDefinitionId(), false); append(sb, CREATED_KEY, query.getFromDate(), query.getToDate()); appendFuzzy(sb, CREATOR_KEY, query.getCreator()); appendFuzzy(sb, CONTRIBUTOR_KEY, query.getContributor()); appendFuzzy(sb, LANGUAGE_KEY, query.getLanguage()); appendFuzzy(sb, LICENSE_KEY, query.getLicense()); appendFuzzy(sb, TITLE_KEY, query.getTitle()); appendFuzzy(sb, SUBJECT_KEY, query.getSubject()); appendMap(sb, OPERATION_KEY, query.getCurrentOperations()); appendMap(sb, STATE_KEY, query.getStates()); if (applyPermissions) { appendSolrAuthFragment(sb, action); } logger.debug(sb.toString()); return sb.toString(); }  @Activate void activate(ComponentContext cc); void activate(String systemUserName); @Deactivate void deactivate(); void index(final WorkflowInstance instance); @Override long countWorkflowInstances(WorkflowState state, String operation); @Override WorkflowStatistics getStatistics(); @Override WorkflowSet getWorkflowInstances(WorkflowQuery query, String action, boolean applyPermissions); @Override void remove(long id); @Override void update(WorkflowInstance instance); void clear(); static final String CONFIG_SOLR_URL; static final String CONFIG_SOLR_ROOT; static final Fn<Job, Boolean> operationIsStartWorkflow; }