Search in sources :

Example 1 with MapItem

use of org.activiti.explorer.data.MapItem in project Activiti by Activiti.

the class TableDataQuery method loadItems.

public List<Item> loadItems(int start, int count) {
    TablePageQuery query = managementService.createTablePageQuery().tableName(tableName);
    if (sortPropertyIds != null && sortPropertyIds.length > 0) {
        for (int i = 0; i < sortPropertyIds.length; i++) {
            // all container properties for table data are Strings
            String column = (String) sortPropertyIds[i];
            if (sortPropertyIdsAscending[i] == true) {
                query.orderAsc(column);
            } else {
                query.orderDesc(column);
            }
        }
    }
    List<Map<String, Object>> rows = query.listPage(start, count).getRows();
    List<Item> items = new ArrayList<Item>();
    for (Map<String, Object> row : rows) {
        HashMap<String, Object> newRow = new HashMap<String, Object>();
        for (Entry<String, Object> rowEntry : row.entrySet()) {
            String key = rowEntry.getKey();
            if (key != null) {
                key = key.toUpperCase();
            }
            newRow.put(key, rowEntry.getValue());
        }
        items.add(new MapItem(newRow));
    }
    return items;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) MapItem(org.activiti.explorer.data.MapItem) Item(com.vaadin.data.Item) TablePageQuery(org.activiti.engine.management.TablePageQuery) MapItem(org.activiti.explorer.data.MapItem) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

Item (com.vaadin.data.Item)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TablePageQuery (org.activiti.engine.management.TablePageQuery)1 MapItem (org.activiti.explorer.data.MapItem)1