use of org.olat.resource.accesscontrol.OrderStatus in project openolat by klemens.
the class ACOrderDAO method findOrdersByDelivery.
public List<Order> findOrdersByDelivery(Identity delivery, OrderStatus... status) {
StringBuilder sb = new StringBuilder();
sb.append("select order from ").append(OrderImpl.class.getName()).append(" order").append(" where order.delivery.key=:deliveryKey");
if (status != null && status.length > 0) {
sb.append(" and order.orderStatusStr in (:status)");
}
TypedQuery<Order> query = dbInstance.getCurrentEntityManager().createQuery(sb.toString(), Order.class).setParameter("deliveryKey", delivery.getKey());
if (status != null && status.length > 0) {
List<String> statusStr = new ArrayList<String>();
for (OrderStatus s : status) {
statusStr.add(s.name());
}
query.setParameter("status", statusStr);
}
List<Order> orders = query.getResultList();
return orders;
}
use of org.olat.resource.accesscontrol.OrderStatus in project openolat by klemens.
the class OrderStatusRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Object val, int row, FlexiTableComponent source, URLBuilder ubu, Translator translator) {
if (val instanceof OrderStatus) {
OrderStatus status = (OrderStatus) val;
String name = status.name().toLowerCase();
sb.append("<i class='o_icon o_icon-fw o_ac_order_status_");
sb.append(name);
sb.append("_icon'> </i>");
} else if (val instanceof OrderTableItem) {
OrderTableItem item = (OrderTableItem) val;
switch(item.getStatus()) {
case ERROR:
sb.append("<i class='o_icon o_icon-fw o_ac_order_status_error_icon'> </i>");
break;
case WARNING:
sb.append("<i class='o_icon o_icon-fw o_ac_order_status_warning_icon'> </i>");
break;
case CANCELED:
sb.append("<i class='o_icon o_icon-fw o_ac_order_status_canceled_icon'> </i>");
break;
default:
sb.append("<i class='o_icon o_icon-fw o_ac_order_status_payed_icon'> </i>");
}
}
}
Aggregations