Search in sources :

Example 1 with ListQueryParameterObject

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);
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) QueryOrderingProperty(org.camunda.bpm.engine.impl.QueryOrderingProperty) DbEntityManager(org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)

Example 2 with ListQueryParameterObject

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);
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) HashMap(java.util.HashMap) ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject)

Example 3 with ListQueryParameterObject

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);
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) QueryPropertyImpl(org.camunda.bpm.engine.impl.QueryPropertyImpl) QueryOrderingProperty(org.camunda.bpm.engine.impl.QueryOrderingProperty)

Example 4 with ListQueryParameterObject

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));
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) HashMap(java.util.HashMap) ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) AuthorizationCheck(org.camunda.bpm.engine.impl.db.AuthorizationCheck) Test(org.junit.Test)

Example 5 with ListQueryParameterObject

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));
}
Also used : ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) HashMap(java.util.HashMap) ListQueryParameterObject(org.camunda.bpm.engine.impl.db.ListQueryParameterObject) AuthorizationCheck(org.camunda.bpm.engine.impl.db.AuthorizationCheck) Test(org.junit.Test)

Aggregations

ListQueryParameterObject (org.camunda.bpm.engine.impl.db.ListQueryParameterObject)12 HashMap (java.util.HashMap)6 AuthorizationCheck (org.camunda.bpm.engine.impl.db.AuthorizationCheck)6 Test (org.junit.Test)6 QueryOrderingProperty (org.camunda.bpm.engine.impl.QueryOrderingProperty)3 QueryPropertyImpl (org.camunda.bpm.engine.impl.QueryPropertyImpl)2 List (java.util.List)1 DbEntityManager (org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)1