Package org.activiti.engine.management

Examples of org.activiti.engine.management.TablePage


public class TablePageQueryTest extends PluggableActivitiTestCase {
 
  public void testGetTablePage() {
    List<String> taskIds = generateDummyTasks(20);
   
    TablePage tablePage = managementService.createTablePageQuery()
      .tableName("ACT_RU_TASK")
      .listPage(0, 5);
   
    assertEquals(0, tablePage.getFirstResult());
    assertEquals(5, tablePage.getSize());
    assertEquals(5, tablePage.getRows().size());
    assertEquals(20, tablePage.getTotal());
   
    tablePage = managementService.createTablePageQuery()
      .tableName("ACT_RU_TASK")
      .listPage(14, 10);
   
    assertEquals(14, tablePage.getFirstResult());
    assertEquals(6, tablePage.getSize());
    assertEquals(6, tablePage.getRows().size());
    assertEquals(20, tablePage.getTotal());

    taskService.deleteTasks(taskIds, true);
  }
View Full Code Here


 
  public void testGetSortedTablePage() {
    List<String> taskIds = generateDummyTasks(15);
   
    // With an ascending sort
    TablePage tablePage = managementService.createTablePageQuery()
      .tableName("ACT_RU_TASK")
      .orderAsc("NAME_")
      .listPage(1, 7);
    String[] expectedTaskNames = new String[] {"B", "C", "D", "E", "F", "G", "H"};
    verifyTaskNames(expectedTaskNames, tablePage.getRows());
   
    // With a descending sort
    tablePage = managementService.createTablePageQuery()
      .tableName("ACT_RU_TASK")
      .orderDesc("NAME_")
      .listPage(6, 8);
    expectedTaskNames = new String[] {"I", "H", "G", "F", "E", "D", "C", "B"} ;
    verifyTaskNames(expectedTaskNames, tablePage.getRows());
   
    taskService.deleteTasks(taskIds, true);
  }
View Full Code Here

  @Test
  public void testGetTablePage() {
    List<String> taskIds = generateDummyTasks(20);
   
    ManagementService managementService = activitiRule.getManagementService();
    TablePage tablePage = managementService.createTablePageQuery()
      .tableName("ACT_RU_TASK")
      .listPage(0, 5);
   
    assertEquals(0, tablePage.getFirstResult());
    assertEquals(5, tablePage.getSize());
    assertEquals(5, tablePage.getRows().size());
    assertEquals(20, tablePage.getTotal());
   
    tablePage = managementService.createTablePageQuery()
      .tableName("ACT_RU_TASK")
      .listPage(14, 10);
   
    assertEquals(14, tablePage.getFirstResult());
    assertEquals(6, tablePage.getSize());
    assertEquals(6, tablePage.getRows().size());
    assertEquals(20, tablePage.getTotal());

    TaskService taskService = activitiRule.getTaskService();
    taskService.deleteTasks(taskIds, true);
  }
View Full Code Here

  public void testGetSortedTablePage() {
    List<String> taskIds = generateDummyTasks(15);
   
    // With an ascending sort
    ManagementService managementService = activitiRule.getManagementService();
    TablePage tablePage = managementService.createTablePageQuery()
      .tableName("ACT_RU_TASK")
      .orderAsc("NAME_")
      .listPage(1, 7);
    String[] expectedTaskNames = new String[] {"B", "C", "D", "E", "F", "G", "H"};
    verifyTaskNames(expectedTaskNames, tablePage.getRows());
   
    // With a descending sort
    tablePage = managementService.createTablePageQuery()
      .tableName("ACT_RU_TASK")
      .orderDesc("NAME_")
      .listPage(6, 8);
    expectedTaskNames = new String[] {"I", "H", "G", "F", "E", "D", "C", "B"} ;
    verifyTaskNames(expectedTaskNames, tablePage.getRows());
   
    TaskService taskService = activitiRule.getTaskService();
    taskService.deleteTasks(taskIds, true);
  }
View Full Code Here

      else {
        query.orderDesc(sort);
      }
    }

    TablePage tablePage = query.listPage(start, size);
   
    ObjectNode responseJSON = new ObjectMapper().createObjectNode();
    responseJSON.put("sort", sort);
    responseJSON.put("order", order);
    responseJSON.put("start", tablePage.getFirstResult());
    responseJSON.put("size", tablePage.getSize());
    responseJSON.put("total", tablePage.getTotal());
   
    ArrayNode tableArray = new ObjectMapper().createArrayNode();
   
    for (Map<String, Object> row : tablePage.getRows()) {
      ObjectNode columnJSON = new ObjectMapper().createObjectNode();
      for (String name : row.keySet()) {
        if(row.get(name) instanceof byte[]) {
          columnJSON.put(name, ((byte[]) row.get(name)).length);
        } else if(row.get(name) instanceof Date) {
View Full Code Here

      tablePageQuery.orderDesc(orderDesc);
      response.setOrder("desc");
      response.setSort(orderDesc);
    }
   
    TablePage listPage = tablePageQuery.listPage(start, size);
    response.setSize(((Long) listPage.getSize()).intValue());
    response.setStart(((Long) listPage.getFirstResult()).intValue());
    response.setTotal(listPage.getTotal());
    response.setData(listPage.getRows());
   
    return response;
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public TablePage getTablePage(TablePageQueryImpl tablePageQuery, int firstResult, int maxResults) {

    TablePage tablePage = new TablePage();

    @SuppressWarnings("rawtypes")
    List tableData = getDbSqlSession().getSqlSession()
      .selectList("selectTableData", tablePageQuery, new RowBounds(firstResult, maxResults));

    tablePage.setTableName(tablePageQuery.getTableName());
    tablePage.setTotal(getTableCount(tablePageQuery.getTableName()));
    tablePage.setRows((List<Map<String,Object>>)tableData);
    tablePage.setFirstResult(firstResult);
   
    return tablePage;
  }
View Full Code Here

    assertEquals(taskService.createTaskQuery().taskCandidateUser("user1").count(), 0);
    assertEquals(taskService.createTaskQuery().taskCandidateUser("user2").count(), 0);
    assertEquals(taskService.createTaskQuery().taskCandidateUser("user3").count(), 0);

    ManagementService managementService = activitiRule.getManagementService();
    TablePage listPage = managementService.createTablePageQuery().tableName(managementService.getTableName(IdentityLinkEntity.class)).listPage(0, 100);
    List<Map<String, Object>> rows = listPage.getRows();
    for (Map<String, Object> map : rows) {
      Set<Entry<String, Object>> entrySet = map.entrySet();
      for (Entry<String, Object> entry : entrySet) {
        // System.out.println("key=" + entry.getKey() + ", value=" +
        if (entry.getKey().equals("TYPE_")) {
View Full Code Here

 
  public void testGetTablePage() {
    String tablePrefix = processEngineConfiguration.getDatabaseTablePrefix();
    List<String> taskIds = generateDummyTasks(20);
   
    TablePage tablePage = managementService.createTablePageQuery()
      .tableName(tablePrefix+"ACT_RU_TASK")
      .listPage(0, 5);
   
    assertEquals(0, tablePage.getFirstResult());
    assertEquals(5, tablePage.getSize());
    assertEquals(5, tablePage.getRows().size());
    assertEquals(20, tablePage.getTotal());
   
    tablePage = managementService.createTablePageQuery()
      .tableName(tablePrefix+"ACT_RU_TASK")
      .listPage(14, 10);
   
    assertEquals(14, tablePage.getFirstResult());
    assertEquals(6, tablePage.getSize());
    assertEquals(6, tablePage.getRows().size());
    assertEquals(20, tablePage.getTotal());

    taskService.deleteTasks(taskIds, true);
  }
View Full Code Here

  public void testGetSortedTablePage() {
    String tablePrefix = processEngineConfiguration.getDatabaseTablePrefix();
    List<String> taskIds = generateDummyTasks(15);
   
    // With an ascending sort
    TablePage tablePage = managementService.createTablePageQuery()
      .tableName(tablePrefix+"ACT_RU_TASK")
      .orderAsc("NAME_")
      .listPage(1, 7);
    String[] expectedTaskNames = new String[] {"B", "C", "D", "E", "F", "G", "H"};
    verifyTaskNames(expectedTaskNames, tablePage.getRows());
   
    // With a descending sort
    tablePage = managementService.createTablePageQuery()
      .tableName(tablePrefix+"ACT_RU_TASK")
      .orderDesc("NAME_")
      .listPage(6, 8);
    expectedTaskNames = new String[] {"I", "H", "G", "F", "E", "D", "C", "B"} ;
    verifyTaskNames(expectedTaskNames, tablePage.getRows());
   
    taskService.deleteTasks(taskIds, true);
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.management.TablePage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.