use of com.developmentontheedge.be5.query.impl.model.TableModel in project be5 by DevelopmentOnTheEdge.
the class OperationHelper method getTagsFromCustomSelectionViewExecute.
//
// public Map<String, String> getTagsMapFromQuery( Map<String, String> parameters, String query, Object... params )
// {
// //return getTagsListFromQuery( Collections.emptyMap(), query, params );
// List<String[]> tags = db.selectList("SELECT " + valueColumnName + ", " + textColumnName + " FROM " + tableName,
// rs -> new String[]{rs.getString(valueColumnName), rs.getString(textColumnName)}
// );
// String[][] stockArr = new String[tags.size()][2];
// return tags.toArray(stockArr);
// }
private String[][] getTagsFromCustomSelectionViewExecute(Query query, Map<String, ?> parameters) {
String entityName = query.getEntity().getName();
// todo refactoring Be5QueryExecutor,
Map<String, String> stringStringMap = new HashMap<>();
// parameters.forEach((key, value) -> stringStringMap.put(key, value.toString()));
for (Map.Entry<String, ?> entry : parameters.entrySet()) {
if (entry.getValue() != null)
stringStringMap.put(entry.getKey(), entry.getValue().toString());
}
TableModel table = TableModel.from(query, stringStringMap, false, injector).limit(Integer.MAX_VALUE).build();
String[][] stockArr = new String[table.getRows().size()][2];
int i = 0;
for (TableModel.RowModel row : table.getRows()) {
String first = row.getCells().size() >= 1 ? row.getCells().get(0).content.toString() : "";
String second = row.getCells().size() >= 2 ? row.getCells().get(1).content.toString() : "";
stockArr[i++] = new String[] { first, userAwareMeta.getColumnTitle(entityName, second) };
}
return stockArr;
}
use of com.developmentontheedge.be5.query.impl.model.TableModel in project be5 by DevelopmentOnTheEdge.
the class TableRowsBuilder method build.
public List<RowT> build(TableModel tableModel) {
List<RowT> rows = new ArrayList<>();
for (RowModel rowModel : tableModel.getRows()) {
List<CellT> cells = new ArrayList<>();
for (CellModel cellModel : rowModel.getCells()) {
cells.add(createCell(cellModel));
}
rows.add(createRow(rowModel, cells));
}
return rows;
}
use of com.developmentontheedge.be5.query.impl.model.TableModel in project be5 by DevelopmentOnTheEdge.
the class DocumentGeneratorImpl method getTable.
public TablePresentation getTable(Query query, Map<String, String> parameters, int sortColumn, boolean sortDesc) {
List<TableOperationPresentation> operations = collectOperations(query);
final boolean selectable = !operations.isEmpty() && query.getType() == QueryType.D1;
int limit = userAwareMeta.getQuerySettings(query).getMaxRecordsPerPage();
if (limit == 0) {
// todo delete defaultPageLimit, use getQuerySettings(query).getMaxRecordsPerPage()
limit = Integer.parseInt(getLayoutObject(query).getOrDefault("defaultPageLimit", coreUtils.getSystemSetting("be5_defaultPageLimit", "10")).toString());
}
TableModel table = TableModel.from(query, parameters, selectable, injector).sortOrder(sortColumn, sortDesc).limit(limit).build();
return getTable(query, parameters, table);
}
Aggregations