use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.
the class ExternalTaskManager method selectExternalTasksForTopics.
public List<ExternalTaskEntity> selectExternalTasksForTopics(Collection<TopicFetchInstruction> queryFilters, boolean filterByBusinessKey, int maxResults, boolean usePriority) {
if (queryFilters.isEmpty()) {
return new ArrayList<ExternalTaskEntity>();
}
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("topics", queryFilters);
parameters.put("businessKeyFilter", filterByBusinessKey);
parameters.put("now", ClockUtil.getCurrentTime());
parameters.put("applyOrdering", usePriority);
List<QueryOrderingProperty> orderingProperties = new ArrayList<QueryOrderingProperty>();
orderingProperties.add(EXT_TASK_PRIORITY_ORDERING_PROPERTY);
parameters.put("orderingProperties", orderingProperties);
ListQueryParameterObject parameter = new ListQueryParameterObject(parameters, 0, maxResults);
configureQuery(parameter);
DbEntityManager manager = getDbEntityManager();
return manager.selectList("selectExternalTasksForTopics", parameter);
}
use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.
the class BatchManager method updateBatchSuspensionStateById.
public void updateBatchSuspensionStateById(String batchId, SuspensionState suspensionState) {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("batchId", batchId);
parameters.put("suspensionState", suspensionState.getStateCode());
ListQueryParameterObject queryParameter = new ListQueryParameterObject();
queryParameter.setParameter(parameters);
getDbEntityManager().update(BatchEntity.class, "updateBatchSuspensionStateByParameters", queryParameter);
}
use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.
the class CommentManager method findEventsByTaskId.
@SuppressWarnings("unchecked")
public List<Event> findEventsByTaskId(String taskId) {
checkHistoryEnabled();
ListQueryParameterObject query = new ListQueryParameterObject();
query.setParameter(taskId);
query.getOrderingProperties().add(new QueryOrderingProperty(new QueryPropertyImpl("TIME_"), Direction.DESCENDING));
return getDbEntityManager().selectList("selectEventsByTaskId", query);
}
use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.
the class AuthorizationCheckRevokesCfgTest method shouldCheckDbForCfgValueWithNoRevokes_auto.
@Test
public void shouldCheckDbForCfgValueWithNoRevokes_auto() {
final ListQueryParameterObject query = new ListQueryParameterObject();
final AuthorizationCheck authCheck = query.getAuthCheck();
final HashMap<String, Object> expectedQueryParams = new HashMap<String, Object>();
expectedQueryParams.put("userId", AUTHENTICATED_USER_ID);
expectedQueryParams.put("authGroupIds", AUTHENTICATED_GROUPS);
// given
when(mockedConfiguration.getAuthorizationCheckRevokes()).thenReturn(ProcessEngineConfiguration.AUTHORIZATION_CHECK_REVOKE_AUTO);
when(mockedEntityManager.selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams))).thenReturn(false);
// if
authorizationManager.configureQuery(query);
// then
assertEquals(false, authCheck.isRevokeAuthorizationCheckEnabled());
verify(mockedEntityManager, times(1)).selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams));
}
use of org.camunda.bpm.engine.impl.db.ListQueryParameterObject in project camunda-bpm-platform by camunda.
the class AuthorizationCheckRevokesCfgTest method shouldCheckDbForCfgValue_auto.
@Test
public void shouldCheckDbForCfgValue_auto() {
final ListQueryParameterObject query = new ListQueryParameterObject();
final AuthorizationCheck authCheck = query.getAuthCheck();
final HashMap<String, Object> expectedQueryParams = new HashMap<String, Object>();
expectedQueryParams.put("userId", AUTHENTICATED_USER_ID);
expectedQueryParams.put("authGroupIds", AUTHENTICATED_GROUPS);
// given
when(mockedConfiguration.getAuthorizationCheckRevokes()).thenReturn(ProcessEngineConfiguration.AUTHORIZATION_CHECK_REVOKE_AUTO);
when(mockedEntityManager.selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams))).thenReturn(true);
// if
authorizationManager.configureQuery(query);
// then
assertEquals(true, authCheck.isRevokeAuthorizationCheckEnabled());
verify(mockedEntityManager, times(1)).selectBoolean(eq("selectRevokeAuthorization"), eq(expectedQueryParams));
}
Aggregations