Skip to content

Commit

Permalink
feat(engine): Add variableNameLike filter to historic detail REST API (
Browse files Browse the repository at this point in the history
  • Loading branch information
mboskamp authored Aug 27, 2024
1 parent 3ed0a47 commit fbdd474
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
[here](${docsUrl}/user-guide/process-engine/variables/#supported-variable-values).
**Note:** All non-primitive variables are associated with the type `serializable`."
},
"variableNameLike": {
"type": "string",
"desc": "Filter by variable name like. Example usage: `variableNameLike(%camunda%)`. The query will match the names of variables in a case-insensitive way."
},
"tenantIdIn": {
"type": "array",
"itemType": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@
*/
package org.camunda.bpm.engine.rest.dto.history;

import static java.lang.Boolean.TRUE;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.history.HistoricDetailQuery;
import org.camunda.bpm.engine.rest.dto.AbstractQueryDto;
Expand All @@ -35,10 +26,17 @@
import org.camunda.bpm.engine.rest.dto.converter.DateConverter;
import org.camunda.bpm.engine.rest.dto.converter.StringArrayConverter;
import org.camunda.bpm.engine.rest.dto.converter.StringListConverter;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.camunda.bpm.engine.rest.exception.InvalidRequestException;

import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import static java.lang.Boolean.TRUE;

/**
* @author Roman Smirnov
*
Expand All @@ -56,7 +54,7 @@ public class HistoricDetailQueryDto extends AbstractQueryDto<HistoricDetailQuery

private static final List<String> VALID_SORT_BY_VALUES;
static {
VALID_SORT_BY_VALUES = new ArrayList<String>();
VALID_SORT_BY_VALUES = new ArrayList<>();
VALID_SORT_BY_VALUES.add(SORT_BY_PROCESS_INSTANCE_ID);
VALID_SORT_BY_VALUES.add(SORT_BY_VARIABLE_NAME);
VALID_SORT_BY_VALUES.add(SORT_BY_VARIABLE_TYPE);
Expand All @@ -74,6 +72,7 @@ public class HistoricDetailQueryDto extends AbstractQueryDto<HistoricDetailQuery
protected String caseExecutionId;
protected String variableInstanceId;
protected String[] variableTypeIn;
protected String variableNameLike;
protected String taskId;
protected Boolean formFields;
protected Boolean variableUpdates;
Expand Down Expand Up @@ -123,11 +122,16 @@ public void setVariableInstanceId(String variableInstanceId) {
this.variableInstanceId = variableInstanceId;
}

@CamundaQueryParam(value="variableTypeIn", converter = StringArrayConverter.class)
@CamundaQueryParam(value="variableTypeIn", converter = StringArrayConverter.class)
public void setVariableTypeIn(String[] variableTypeIn) {
this.variableTypeIn = variableTypeIn;
}

@CamundaQueryParam(value="variableNameLike")
public void setVariableNameLike(String variableNameLike) {
this.variableNameLike = variableNameLike;
}

@CamundaQueryParam(value = "taskId")
public void setTaskId(String taskId) {
this.taskId = taskId;
Expand Down Expand Up @@ -236,6 +240,9 @@ protected void applyFilters(HistoricDetailQuery query) {
if (variableTypeIn != null && variableTypeIn.length > 0) {
query.variableTypeIn(variableTypeIn);
}
if(variableNameLike != null) {
query.variableNameLike(variableNameLike);
}
if (taskId != null) {
query.taskId(taskId);
}
Expand Down
Loading

0 comments on commit fbdd474

Please sign in to comment.