use of org.olat.resource.accesscontrol.ui.OrderTableItem.Status in project OpenOLAT by OpenOLAT.
the class ACFrontendManager method findOrderItems.
@Override
public List<OrderTableItem> findOrderItems(OLATResource resource, IdentityRef delivery, Long orderNr, Date from, Date to, OrderStatus[] status, int firstResult, int maxResults, List<UserPropertyHandler> userPropertyHandlers, SortKey... orderBy) {
List<AccessMethod> methods = methodManager.getAllMethods();
Map<String, AccessMethod> methodMap = new HashMap<>();
for (AccessMethod method : methods) {
methodMap.put(method.getKey().toString(), method);
}
List<RawOrderItem> rawOrders = orderManager.findNativeOrderItems(resource, delivery, orderNr, from, to, status, firstResult, maxResults, userPropertyHandlers, orderBy);
List<OrderTableItem> items = new ArrayList<>(rawOrders.size());
for (RawOrderItem rawOrder : rawOrders) {
String orderStatusStr = rawOrder.getOrderStatus();
OrderStatus orderStatus = OrderStatus.valueOf(orderStatusStr);
Status finalStatus = getStatus(orderStatusStr, rawOrder.getTrxStatus(), rawOrder.getPspTrxStatus());
String methodIds = rawOrder.getTrxMethodIds();
List<AccessMethod> orderMethods = new ArrayList<>(2);
if (StringHelper.containsNonWhitespace(methodIds)) {
String[] methodIdArr = methodIds.split(",");
for (String methodId : methodIdArr) {
if (methodMap.containsKey(methodId)) {
orderMethods.add(methodMap.get(methodId));
}
}
}
OrderTableItem item = new OrderTableItem(rawOrder.getOrderKey(), rawOrder.getOrderNr(), rawOrder.getTotal(), rawOrder.getCreationDate(), orderStatus, finalStatus, rawOrder.getDeliveryKey(), rawOrder.getUsername(), rawOrder.getUserProperties(), orderMethods);
item.setResourceDisplayname(rawOrder.getResourceName());
items.add(item);
}
return items;
}
use of org.olat.resource.accesscontrol.ui.OrderTableItem.Status in project openolat by klemens.
the class ACFrontendManager method findOrderItems.
@Override
public List<OrderTableItem> findOrderItems(OLATResource resource, IdentityRef delivery, Long orderNr, Date from, Date to, OrderStatus[] status, int firstResult, int maxResults, List<UserPropertyHandler> userPropertyHandlers, SortKey... orderBy) {
List<AccessMethod> methods = methodManager.getAllMethods();
Map<String, AccessMethod> methodMap = new HashMap<>();
for (AccessMethod method : methods) {
methodMap.put(method.getKey().toString(), method);
}
List<RawOrderItem> rawOrders = orderManager.findNativeOrderItems(resource, delivery, orderNr, from, to, status, firstResult, maxResults, userPropertyHandlers, orderBy);
List<OrderTableItem> items = new ArrayList<>(rawOrders.size());
for (RawOrderItem rawOrder : rawOrders) {
String orderStatusStr = rawOrder.getOrderStatus();
OrderStatus orderStatus = OrderStatus.valueOf(orderStatusStr);
Status finalStatus = getStatus(orderStatusStr, rawOrder.getTrxStatus(), rawOrder.getPspTrxStatus());
String methodIds = rawOrder.getTrxMethodIds();
List<AccessMethod> orderMethods = new ArrayList<>(2);
if (StringHelper.containsNonWhitespace(methodIds)) {
String[] methodIdArr = methodIds.split(",");
for (String methodId : methodIdArr) {
if (methodMap.containsKey(methodId)) {
orderMethods.add(methodMap.get(methodId));
}
}
}
OrderTableItem item = new OrderTableItem(rawOrder.getOrderKey(), rawOrder.getOrderNr(), rawOrder.getTotal(), rawOrder.getCreationDate(), orderStatus, finalStatus, rawOrder.getDeliveryKey(), rawOrder.getUsername(), rawOrder.getUserProperties(), orderMethods);
item.setResourceDisplayname(rawOrder.getResourceName());
items.add(item);
}
return items;
}
Aggregations