List of usage examples for org.hibernate.criterion Restrictions neProperty
public static PropertyExpression neProperty(String propertyName, String otherPropertyName)
From source file:org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao.java
License:Open Source License
/** * Returns the list of credit payments for the selected business partner that belongs to the legal * entity's natural tree of the given organization *//* w w w . j a va 2s . c om*/ public List<FIN_Payment> getCustomerPaymentsWithCredit(Organization org, BusinessPartner bp, boolean isReceipt) { try { OBContext.setAdminMode(true); OBCriteria<FIN_Payment> obcPayment = OBDal.getInstance().createCriteria(FIN_Payment.class); obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_BUSINESSPARTNER, bp)); obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_RECEIPT, isReceipt)); obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_GENERATEDCREDIT, BigDecimal.ZERO)); obcPayment.add( Restrictions.neProperty(FIN_Payment.PROPERTY_GENERATEDCREDIT, FIN_Payment.PROPERTY_USEDCREDIT)); final Organization legalEntity = FIN_Utility.getLegalEntityOrg(org); Set<String> orgIds = OBContext.getOBContext().getOrganizationStructureProvider() .getChildTree(legalEntity.getId(), true); obcPayment.add(Restrictions.in("organization.id", orgIds)); obcPayment.addOrderBy(FIN_Payment.PROPERTY_PAYMENTDATE, true); obcPayment.addOrderBy(FIN_Payment.PROPERTY_DOCUMENTNO, true); List<FIN_Payment> paymentList = new ArrayList<FIN_Payment>(); for (FIN_Payment fp : obcPayment.list()) { if ((FIN_Utility.seqnumberpaymentstatus(fp.getStatus())) >= (FIN_Utility .seqnumberpaymentstatus(FIN_Utility.invoicePaymentStatus(fp)))) { paymentList.add(fp); } } return paymentList; } finally { OBContext.restorePreviousMode(); } }
From source file:org.openbravo.erpReports.RptC_Bpartner.java
License:Open Source License
public List<FIN_Payment> getCustomerPaymentsWithCredit(BusinessPartner bp, boolean isReceipt) { OBCriteria<FIN_Payment> obcPayment = OBDal.getInstance().createCriteria(FIN_Payment.class); obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_BUSINESSPARTNER, bp)); obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_RECEIPT, isReceipt)); obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_GENERATEDCREDIT, BigDecimal.ZERO)); obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_STATUS, "RPAP")); obcPayment.add(//from w ww . j ava2 s . c om Restrictions.neProperty(FIN_Payment.PROPERTY_GENERATEDCREDIT, FIN_Payment.PROPERTY_USEDCREDIT)); obcPayment.addOrderBy(FIN_Payment.PROPERTY_PAYMENTDATE, true); obcPayment.addOrderBy(FIN_Payment.PROPERTY_DOCUMENTNO, true); return obcPayment.list(); }
From source file:to.etc.domui.hibernate.model.CriteriaCreatingVisitor.java
License:Open Source License
@Override public void visitPropertyJoinComparison(@NonNull QPropertyJoinComparison comparison) throws Exception { String alias = m_parentAlias + "." + parseSubcriteria(comparison.getParentProperty()); switch (comparison.getOperation()) { default:/*w ww . j av a 2s . c o m*/ throw new QQuerySyntaxException("Unsupported parent-join operation: " + comparison.getOperation()); case EQ: m_last = Restrictions.eqProperty(alias, comparison.getSubProperty()); break; case NE: m_last = Restrictions.neProperty(alias, comparison.getSubProperty()); break; case LT: m_last = Restrictions.ltProperty(alias, comparison.getSubProperty()); break; case LE: m_last = Restrictions.leProperty(alias, comparison.getSubProperty()); break; case GT: m_last = Restrictions.gtProperty(alias, comparison.getSubProperty()); break; case GE: m_last = Restrictions.geProperty(alias, comparison.getSubProperty()); break; } }