use of com.developmentontheedge.be5.model.TableOperationPresentation in project be5 by DevelopmentOnTheEdge.
the class DocumentGeneratorImpl method presentOperation.
private TableOperationPresentation presentOperation(Query query, Operation operation) {
String visibleWhen = Operations.determineWhenVisible(operation);
String title = userAwareMeta.getLocalizedOperationTitle(query.getEntity().getName(), operation.getName());
// boolean requiresConfirmation = operation.isConfirm();
boolean isClientSide = Operations.isClientSide(operation);
Action action = null;
if (isClientSide) {
action = Action.call(Operations.asClientSide(operation).toHashUrl());
}
return new TableOperationPresentation(operation.getName(), title, visibleWhen, false, isClientSide, action);
}
use of com.developmentontheedge.be5.model.TableOperationPresentation in project be5 by DevelopmentOnTheEdge.
the class DocumentGeneratorImpl method collectOperations.
private List<TableOperationPresentation> collectOperations(Query query) {
List<TableOperationPresentation> operations = new ArrayList<>();
List<String> userRoles = UserInfoHolder.getCurrentRoles();
for (Operation operation : getQueryOperations(query)) {
if (Operations.isAllowed(operation, userRoles)) {
operations.add(presentOperation(query, operation));
}
}
operations.sort(Comparator.comparing(TableOperationPresentation::getTitle));
return operations;
}
use of com.developmentontheedge.be5.model.TableOperationPresentation 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