/** * Gets the ordered detail list. Used in the reports * * @return the ordered detail list */ @Transient public List getOrderedDetailList() { try { IManagerBean offerDetailBean = BeanManager.getManagerBean(OfferDetail.class); Criteria criteria = new Criteria(); criteria.addEqualExpression( offerDetailBean.getFieldName(ICommercialAlias.OFFER_DETAIL_OFFER_ID), getId()); criteria.addOrder( offerDetailBean.getFieldName(ICommercialAlias.OFFER_DETAIL_ITEM_PRODUCT_TYPE)); criteria.addOrder(offerDetailBean.getFieldName(ICommercialAlias.OFFER_DETAIL_ID)); return offerDetailBean.getList(criteria); } catch (ManagerBeanException e) { LOGGER.log(Level.SEVERE, "Error obtaining offerDetail list", e); } return null; }
/** * Gets the criteria. * * @param values the values * @param bean the bean * @return the criteria * @throws ManagerBeanException the manager bean exception * @throws ExpressionException the expression exception */ private Criteria getCriteria(IManagerBean bean, Object[] values) throws ManagerBeanException, ExpressionException { Criteria criteria = null; if (values != null) { criteria = new Criteria(); String prefix = ClassUtils.getShortClassName(bean.getPOJOClass()) + "_"; for (int i = 0; i < values.length; i++) { String fieldName = bean.getFieldName(prefix + getForeignJoinProperties().get(i)); if (values[i] != null) { criteria.addExpression(fieldName, values[i].toString()); } else { criteria.addNullExpression(fieldName); } } } return criteria; }