Skip to content

Commit

Permalink
feat(engine): introduce case-insensitive variable queries
Browse files Browse the repository at this point in the history
* ProcessInstanceQuery
* CaseExecutionQuery
* CaseInstanceQuery
* ExecutionQuery
* HistoricCaseInstanceQuery
* HistoricProcessInstanceQuery
* VariableInstanceQuery

Related to CAM-10647, CAM-10395, Closes #416
  • Loading branch information
mboskamp committed Jul 26, 2019
1 parent de6bd01 commit 6229264
Show file tree
Hide file tree
Showing 38 changed files with 4,345 additions and 222 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public class HistoricCaseInstanceQueryDto extends AbstractQueryDto<HistoricCaseI

protected List<VariableQueryParameterDto> variables;

protected Boolean variableValuesIgnoreCase;
protected Boolean variableNamesIgnoreCase;

public HistoricCaseInstanceQueryDto() {}

public HistoricCaseInstanceQueryDto(ObjectMapper objectMapper, MultivaluedMap<String, String> queryParameters) {
Expand Down Expand Up @@ -230,6 +233,16 @@ public void setVariables(List<VariableQueryParameterDto> variables) {
this.variables = variables;
}

@CamundaQueryParam(value = "variableValuesIgnoreCase", converter = BooleanConverter.class)
public void setVariableValuesIgnoreCase(Boolean variableValuesIgnoreCase) {
this.variableValuesIgnoreCase = variableValuesIgnoreCase;
}

@CamundaQueryParam(value = "variableNamesIgnoreCase", converter = BooleanConverter.class)
public void setVariableNamesIgnoreCase(Boolean variableNamesIgnoreCase) {
this.variableNamesIgnoreCase = variableNamesIgnoreCase;
}

@CamundaQueryParam(value = "caseActivityIdIn", converter = StringListConverter.class)
public void setCaseActivityIdIn(List<String> caseActivityIdIn) {
this.caseActivityIdIn = caseActivityIdIn;
Expand Down Expand Up @@ -326,6 +339,12 @@ protected void applyFilters(HistoricCaseInstanceQuery query) {
if (caseActivityIdIn != null && !caseActivityIdIn.isEmpty()) {
query.caseActivityIdIn(caseActivityIdIn.toArray(new String[caseActivityIdIn.size()]));
}
if(Boolean.TRUE.equals(variableNamesIgnoreCase)) {
query.matchVariableNamesIgnoreCase();
}
if(Boolean.TRUE.equals(variableValuesIgnoreCase)) {
query.matchVariableValuesIgnoreCase();
}
if (variables != null) {
for (VariableQueryParameterDto variableQueryParam : variables) {
String variableName = variableQueryParam.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public class HistoricProcessInstanceQueryDto extends AbstractQueryDto<HistoricPr

private List<VariableQueryParameterDto> variables;

protected Boolean variableNamesIgnoreCase;
protected Boolean variableValuesIgnoreCase;

private List<HistoricProcessInstanceQueryDto> orQueries;

public HistoricProcessInstanceQueryDto() {}
Expand Down Expand Up @@ -278,6 +281,16 @@ public void setVariables(List<VariableQueryParameterDto> variables) {
this.variables = variables;
}

@CamundaQueryParam(value = "variableNamesIgnoreCase", converter = BooleanConverter.class)
public void setVariableNamesIgnoreCase(Boolean variableNamesIgnoreCase) {
this.variableNamesIgnoreCase = variableNamesIgnoreCase;
}

@CamundaQueryParam(value = "variableValuesIgnoreCase", converter = BooleanConverter.class)
public void setVariableValuesIgnoreCase(Boolean variableValuesIgnoreCase) {
this.variableValuesIgnoreCase = variableValuesIgnoreCase;
}

public String getIncidentType() {
return incidentType;
}
Expand Down Expand Up @@ -469,7 +482,12 @@ protected void applyFilters(HistoricProcessInstanceQuery query) {
if (TRUE.equals(withoutTenantId)) {
query.withoutTenantId();
}

if(TRUE.equals(variableNamesIgnoreCase)) {
query.matchVariableNamesIgnoreCase();
}
if(TRUE.equals(variableValuesIgnoreCase)) {
query.matchVariableValuesIgnoreCase();
}
if (variables != null) {
for (VariableQueryParameterDto variableQueryParam : variables) {
String variableName = variableQueryParam.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public class CaseExecutionQueryDto extends AbstractQueryDto<CaseExecutionQuery>
protected List<VariableQueryParameterDto> variables;
protected List<VariableQueryParameterDto> caseInstanceVariables;

protected Boolean variableNamesIgnoreCase;
protected Boolean variableValuesIgnoreCase;

public CaseExecutionQueryDto() {
}

Expand Down Expand Up @@ -137,6 +140,16 @@ public void setVariables(List<VariableQueryParameterDto> variables) {
this.variables = variables;
}

@CamundaQueryParam(value = "variableNamesIgnoreCase", converter = BooleanConverter.class)
public void setVariableNamesIgnoreCase(Boolean variableNamesIgnoreCase) {
this.variableNamesIgnoreCase = variableNamesIgnoreCase;
}

@CamundaQueryParam(value = "variableValuesIgnoreCase", converter = BooleanConverter.class)
public void setVariableValuesIgnoreCase(Boolean variableValuesIgnoreCase) {
this.variableValuesIgnoreCase = variableValuesIgnoreCase;
}

@CamundaQueryParam(value = "caseInstanceVariables", converter = VariableListConverter.class)
public void setCaseInstanceVariables(List<VariableQueryParameterDto> caseInstanceVariables) {
this.caseInstanceVariables = caseInstanceVariables;
Expand Down Expand Up @@ -198,6 +211,14 @@ protected void applyFilters(CaseExecutionQuery query) {
query.disabled();
}

if(Boolean.TRUE.equals(variableNamesIgnoreCase)) {
query.matchVariableNamesIgnoreCase();
}

if(Boolean.TRUE.equals(variableValuesIgnoreCase)) {
query.matchVariableValuesIgnoreCase();
}

if (variables != null) {

for (VariableQueryParameterDto variableQueryParam : variables) {
Expand Down Expand Up @@ -266,5 +287,4 @@ protected void applySortBy(CaseExecutionQuery query, String sortBy, Map<String,
query.orderByTenantId();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public class CaseInstanceQueryDto extends AbstractQueryDto<CaseInstanceQuery> {

protected List<VariableQueryParameterDto> variables;

protected Boolean variableNamesIgnoreCase;
protected Boolean variableValuesIgnoreCase;

public CaseInstanceQueryDto() {
}

Expand Down Expand Up @@ -156,6 +159,16 @@ public void setVariables(List<VariableQueryParameterDto> variables) {
this.variables = variables;
}

@CamundaQueryParam(value = "variableNamesIgnoreCase", converter = BooleanConverter.class)
public void setVariableNamesIgnoreCase(Boolean variableNamesIgnoreCase) {
this.variableNamesIgnoreCase = variableNamesIgnoreCase;
}

@CamundaQueryParam(value = "variableValuesIgnoreCase", converter = BooleanConverter.class)
public void setVariableValuesIgnoreCase(Boolean variableValuesIgnoreCase) {
this.variableValuesIgnoreCase = variableValuesIgnoreCase;
}

@Override
protected boolean isValidSortByValue(String value) {
return VALID_SORT_BY_VALUES.contains(value);
Expand Down Expand Up @@ -210,6 +223,12 @@ protected void applyFilters(CaseInstanceQuery query) {
if (terminated != null && terminated == true) {
query.terminated();
}
if(Boolean.TRUE.equals(variableNamesIgnoreCase)) {
query.matchVariableNamesIgnoreCase();
}
if(Boolean.TRUE.equals(variableValuesIgnoreCase)) {
query.matchVariableValuesIgnoreCase();
}
if (variables != null) {

for (VariableQueryParameterDto variableQueryParam : variables) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public class ExecutionQueryDto extends AbstractQueryDto<ExecutionQuery> {
private List<VariableQueryParameterDto> variables;
private List<VariableQueryParameterDto> processVariables;

Boolean variableValuesIgnoreCase;
Boolean variableNamesIgnoreCase;

public ExecutionQueryDto() {

}
Expand Down Expand Up @@ -122,6 +125,16 @@ public void setProcessVariables(List<VariableQueryParameterDto> processVariables
this.processVariables = processVariables;
}

@CamundaQueryParam(value = "variableValuesIgnoreCase", converter = BooleanConverter.class)
public void setVariableValuesIgnoreCase(Boolean variableValuesIgnoreCase) {
this.variableValuesIgnoreCase = variableValuesIgnoreCase;
}

@CamundaQueryParam(value = "variableNamesIgnoreCase", converter = BooleanConverter.class)
public void setVariableNamesIgnoreCase(Boolean variableNamesIgnoreCase) {
this.variableNamesIgnoreCase = variableNamesIgnoreCase;
}

@CamundaQueryParam(value = "active", converter = BooleanConverter.class)
public void setActive(Boolean active) {
this.active = active;
Expand Down Expand Up @@ -211,7 +224,12 @@ protected void applyFilters(ExecutionQuery query) {
if (tenantIdIn != null && !tenantIdIn.isEmpty()) {
query.tenantIdIn(tenantIdIn.toArray(new String[tenantIdIn.size()]));
}

if(Boolean.TRUE.equals(variableNamesIgnoreCase)) {
query.matchVariableNamesIgnoreCase();
}
if(Boolean.TRUE.equals(variableValuesIgnoreCase)) {
query.matchVariableValuesIgnoreCase();
}
if (variables != null) {
for (VariableQueryParameterDto variableQueryParam : variables) {
String variableName = variableQueryParam.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public class ProcessInstanceQueryDto extends AbstractQueryDto<ProcessInstanceQue
private Boolean leafProcessInstances;
private Boolean isProcessDefinitionWithoutTenantId;

protected Boolean variableNamesIgnoreCase;
protected Boolean variableValuesIgnoreCase;

private List<VariableQueryParameterDto> variables;

private List<ProcessInstanceQueryDto> orQueries;
Expand Down Expand Up @@ -246,6 +249,24 @@ public void setVariables(List<VariableQueryParameterDto> variables) {
this.variables = variables;
}

public Boolean isVariableNamesIgnoreCase() {
return variableNamesIgnoreCase;
}

@CamundaQueryParam(value = "variableNamesIgnoreCase", converter = BooleanConverter.class)
public void setVariableNamesIgnoreCase(Boolean variableNamesCaseInsensitive) {
this.variableNamesIgnoreCase = variableNamesCaseInsensitive;
}

public Boolean isVariableValuesIgnoreCase() {
return variableValuesIgnoreCase;
}

@CamundaQueryParam(value ="variableValuesIgnoreCase", converter = BooleanConverter.class)
public void setVariableValuesIgnoreCase(Boolean variableValuesCaseInsensitive) {
this.variableValuesIgnoreCase = variableValuesCaseInsensitive;
}

public Boolean isWithIncident() {
return withIncident;
}
Expand Down Expand Up @@ -448,6 +469,12 @@ protected void applyFilters(ProcessInstanceQuery query) {
if (TRUE.equals(isProcessDefinitionWithoutTenantId)) {
query.processDefinitionWithoutTenantId();
}
if(TRUE.equals(variableNamesIgnoreCase)) {
query.matchVariableNamesIgnoreCase();
}
if(TRUE.equals(variableValuesIgnoreCase)) {
query.matchVariableValuesIgnoreCase();
}
if (variables != null) {
for (VariableQueryParameterDto variableQueryParam : variables) {
String variableName = variableQueryParam.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.camunda.bpm.engine.rest.dto.AbstractQueryDto;
import org.camunda.bpm.engine.rest.dto.CamundaQueryParam;
import org.camunda.bpm.engine.rest.dto.VariableQueryParameterDto;
import org.camunda.bpm.engine.rest.dto.converter.BooleanConverter;
import org.camunda.bpm.engine.rest.dto.converter.StringArrayConverter;
import org.camunda.bpm.engine.rest.dto.converter.StringListConverter;
import org.camunda.bpm.engine.rest.dto.converter.VariableListConverter;
Expand Down Expand Up @@ -57,6 +58,8 @@ public class VariableInstanceQueryDto extends AbstractQueryDto<VariableInstanceQ
protected String variableName;
protected String variableNameLike;
protected List<VariableQueryParameterDto> variableValues;
protected Boolean variableNamesIgnoreCase;
protected Boolean variableValuesIgnoreCase;
protected String[] executionIdIn;
protected String[] processInstanceIdIn;
protected String[] caseExecutionIdIn;
Expand Down Expand Up @@ -87,6 +90,16 @@ public void setVariableValues(List<VariableQueryParameterDto> variableValues) {
this.variableValues = variableValues;
}

@CamundaQueryParam(value = "variableNamesIgnoreCase", converter = BooleanConverter.class)
public void setVariableNamesIgnoreCase(Boolean variableNamesIgnoreCase) {
this.variableNamesIgnoreCase = variableNamesIgnoreCase;
}

@CamundaQueryParam(value = "variableValuesIgnoreCase", converter = BooleanConverter.class)
public void setVariableValuesIgnoreCase(Boolean variableValuesIgnoreCase) {
this.variableValuesIgnoreCase = variableValuesIgnoreCase;
}

@CamundaQueryParam(value="executionIdIn", converter = StringArrayConverter.class)
public void setExecutionIdIn(String[] executionIdIn) {
this.executionIdIn = executionIdIn;
Expand Down Expand Up @@ -147,6 +160,14 @@ protected void applyFilters(VariableInstanceQuery query) {
query.variableNameLike(variableNameLike);
}

if(Boolean.TRUE.equals(variableNamesIgnoreCase)) {
query.matchVariableNamesIgnoreCase();
}

if(Boolean.TRUE.equals(variableValuesIgnoreCase)) {
query.matchVariableValuesIgnoreCase();
}

if (variableValues != null) {
for (VariableQueryParameterDto variableQueryParam : variableValues) {
String variableName = variableQueryParam.getName();
Expand Down
Loading

0 comments on commit 6229264

Please sign in to comment.