List of usage examples for org.apache.commons.lang ArrayUtils removeElement
public static short[] removeElement(short[] array, short element)
Removes the first occurrence of the specified element from the specified array.
From source file:com.ucuenca.pentaho.plugin.step.ontologymapping.OntoMapDialog.java
/** * Gets the Output Fields of a previous step * @param stepName//from w ww . jav a2 s . c om * @param filter * @return * @throws KettleException */ private String[] getStepFieldsMeta(String stepName, Object... filter) throws KettleException { filter = filter != null ? filter : new String[] {}; String[] fieldNames; if (stepName != null && stepName.length() > 0) { fieldNames = transMeta.getStepFields(stepName).getFieldNames(); } else { throw new KettleException("No Data step defined"); } Object[] fields = fieldNames; for (Object field : filter) { fields = ArrayUtils.removeElement(fields, field); } return Arrays.asList(fields).toArray(new String[fields.length]); }
From source file:com.flexive.ejb.beans.AccountEngineBean.java
/** * Helper function.//from ww w . j a v a 2 s .co m * * @param ticket the ticket of the calling user * @param name the name filter * @param loginName the login name filter * @param email the email filter * @param isActive the is active filter * @param isConfirmed the is confirmed filter * @param mandatorId the mandator id filter * @param isInRole the role filter * @param isInGroup the group filter * @param isCountOnly the "count only" option * @return the sql filter String * @throws FxNoAccessException if the user does not have access */ private String _buildSearchStmt(UserTicket ticket, String name, String loginName, String email, Boolean isActive, Boolean isConfirmed, Long mandatorId, int[] isInRole, long[] isInGroup, boolean isCountOnly) throws FxNoAccessException { // Do no filter GROUP_UNDEFINED (=null value) if (isInGroup != null) { isInGroup = ArrayUtils.removeElement(isInGroup, UserGroup.GROUP_UNDEFINED); } // Determine if group/role filter options are enabled final boolean filterByGrp = (isInGroup != null && isInGroup.length > 0); final boolean filterByRole = (isInRole != null && isInRole.length > 0); // Determine the mandator, and check its security long _mandatorId = (mandatorId == null) ? ticket.getMandatorId() : mandatorId; if (_mandatorId < 0 && !ticket.isGlobalSupervisor()) throw new FxNoAccessException(LOG, "ex.account.loadFailed.wrongMandator"); // Do case insensitive search if (email != null) email = email.toUpperCase(); if (name != null) name = name.toUpperCase(); if (loginName != null) loginName = loginName.toUpperCase(); final String TRUE = StorageManager.getBooleanTrueExpression(); String curSql = "SELECT " + "" + (isCountOnly ? "COUNT(*)" : // 1 2 3 4 5 6 "usr.ID,usr.EMAIL,usr.CONTACT_ID,usr.MANDATOR,usr.LANG,usr.VALID_FROM," + // 7 8 9 10 11 "usr.VALID_TO,usr.DESCRIPTION,usr.USERNAME,usr.LOGIN_NAME,usr.IS_ACTIVE," + // 12 13 14 "usr.IS_VALIDATED,usr.ALLOW_MULTILOGIN,usr.UPDATETOKEN," + // 15 16 17 18 "usr.CREATED_BY,usr.CREATED_AT,usr.MODIFIED_BY,usr.MODIFIED_AT," + // 19 20 "usr.REST_TOKEN,usr.REST_EXPIRES") + " FROM " + TBL_ACCOUNTS + " usr WHERE ID!=" + Account.NULL_ACCOUNT + " " + ((_mandatorId == -1) ? "" : " AND (usr.MANDATOR=" + _mandatorId + " OR usr.ID<=" + Account.USER_GLOBAL_SUPERVISOR + ")") + ((name != null && name.length() > 0) ? " AND UPPER(usr.USERNAME) LIKE '%" + name + "%'" : "") + ((loginName != null && loginName.length() > 0) ? " AND UPPER(usr.LOGIN_NAME) LIKE '%" + loginName + "%'" : "") + ((email != null && email.length() > 0) ? " AND UPPER(usr.EMAIL) LIKE '%" + email + "%'" : "") + ((isActive != null) ? " AND usr.IS_ACTIVE" + (isActive ? "=" : "<>") + TRUE : "") + ((isConfirmed != null) ? " AND usr.IS_VALIDATED" + (isConfirmed ? "=" : "<>") + TRUE : "") + // Group link ((!filterByGrp) ? "" : " AND EXISTS (SELECT 1 FROM " + TBL_ASSIGN_GROUPS + " grp WHERE grp.ACCOUNT=usr.ID AND grp.USERGROUP IN (" + StringUtils.join(ArrayUtils.toObject(isInGroup), ',') + "))") + // Role link ((!filterByRole) ? "" : " AND (EXISTS (SELECT 1 FROM " + TBL_ROLE_MAPPING + " rol WHERE rol.ACCOUNT=usr.ID and rol.ROLE IN (" + StringUtils.join(ArrayUtils.toObject(isInRole), ',') + ")) OR " + "EXISTS (SELECT 1 FROM " + TBL_ROLE_MAPPING + " rol, " + TBL_ASSIGN_GROUPS + " grp WHERE " + "grp.ACCOUNT=usr.ID AND rol.USERGROUP=grp.USERGROUP AND rol.ROLE IN (" + StringUtils.join(ArrayUtils.toObject(isInRole), ',') + ")))") + // Order (isCountOnly ? "" : " ORDER by usr.LOGIN_NAME"); if (LOG.isDebugEnabled()) LOG.debug(curSql); return curSql; }
From source file:com.turborep.turbotracker.banking.service.BankingServiceImpl.java
@SuppressWarnings("unchecked") @Override/*from w w w. java2s .c o m*/ public PrintCheckBean printCheck(Motransaction theMotransaction, Integer checkNumber, Integer yearID, Integer periodID, String userName, Integer userID) throws BankingException { PrintCheckBean aPrintBean = new PrintCheckBean(); Session aSession = itsSessionFactory.openSession(); Transaction aTransaction = null; String deletetemCheck = null, billArrayQuery = null, rxAddressIDQuery = null, vendorPayBeanQuery = null; StringBuffer totalAmountQuery = null; Molinkage aMolinkage = new Molinkage(); Integer moLinkageId = null; Integer moTransactionId = null; Integer moLinkageDetailID = null; Integer[] rxMasterID = null; ArrayList<Integer> rxMasterID1 = new ArrayList<Integer>(); ArrayList<BigDecimal> creditAmtUsed = new ArrayList<BigDecimal>(); BigDecimal[] totalAmount = new BigDecimal[0]; BigDecimal[] totalAmount1 = null; BigDecimal balAmount = new BigDecimal(0); BigDecimal balcalculationAmount = new BigDecimal(0); MoAccount aMoaccount = new MoAccount(); checkDate = theMotransaction.getTransactionDate(); int i = 0; int j = 0; try { aTransaction = aSession.beginTransaction(); aTransaction.begin(); deletetemCheck = "DELETE FROM moVendorCheckTemp"; aSession.createSQLQuery(deletetemCheck).executeUpdate(); billArrayQuery = "select veBillID from veBillPay where moAccountId=" + theMotransaction.getMoAccountId() + " and userID =" + userID; Query aQuery = aSession.createSQLQuery(billArrayQuery); List<?> billIds = aQuery.list(); billId = new Integer[aQuery.list().size()]; for (i = 0; i < billIds.size(); i++) billId[i] = (Integer) billIds.get(i); String rxMasterList = "SELECT BillPayUniqueIDs.rxMasterID FROM (SELECT rxMasterID FROM (SELECT veBill.rxMasterID FROM veBill LEFT JOIN veBillPay ON veBill.veBillID = veBillPay.veBillID WHERE veBillPay.ApplyingAmount<>0 and veBillPay.moAccountId=" + theMotransaction.getMoAccountId() + " and veBillPay.userID = " + userID + ") AS BillPayIDs GROUP BY rxMasterID) AS BillPayUniqueIDs " + "INNER JOIN rxMaster ON BillPayUniqueIDs.rxMasterID = rxMaster.rxMasterID ORDER BY Name;"; Query aQuery1 = aSession.createSQLQuery(rxMasterList); itsLogger.info(aQuery1.toString()); List<?> rxMasterLists = aQuery1.list(); rxMasterID = new Integer[aQuery1.list().size()]; for (i = 0; i < rxMasterLists.size(); i++) { rxMasterID[i] = (Integer) rxMasterLists.get(i); } int counting = 0; totalAmount1 = new BigDecimal[rxMasterID.length]; for (i = 0; i < rxMasterID.length; i++) { totalAmountQuery = new StringBuffer( "SELECT SUM(P.ApplyingAmount) AS CheckAmount FROM veBillPay AS P INNER JOIN veBill AS B ON P.veBillID = B.veBillID Where P.moAccountId=" + theMotransaction.getMoAccountId() + " and P.userID = " + userID + " and (B.rxMasterID =").append(rxMasterID[i]).append(")"); Query aQuery2 = aSession.createSQLQuery(totalAmountQuery.toString()); List<?> totalList = aQuery2.list(); for (j = 0; j < totalList.size(); j++) { if ((BigDecimal) totalList.get(j) != null) { BigDecimal amt = (BigDecimal) totalList.get(j); if (amt.signum() < 0) { rxMasterID1.add(rxMasterID[i]); creditAmtUsed.add((BigDecimal) totalList.get(j)); } else { totalAmount1[counting] = (BigDecimal) totalList.get(j); counting++; } } } } for (int t = 0; t < rxMasterID1.size(); t++) { rxMasterID = (Integer[]) ArrayUtils.removeElement(rxMasterID, rxMasterID1.get(t)); itsLogger.info("rxMasterID::" + rxMasterID1.get(t)); } if (rxMasterID.length > 0) { //Get rxAddress Information from normal payment rxAddressID = new Integer[rxMasterID.length]; for (i = 0; i < rxMasterID.length; i++) { rxAddressIDQuery = "SELECT rxAddressID FROM rxAddress WHERE rxMasterID= " + rxMasterID[i] + " and IsRemitTo = 1"; Query aQuery3 = aSession.createSQLQuery(rxAddressIDQuery); List<?> rxAddressList = aQuery3.list(); if (rxAddressList.size() > 0) { rxAddressID[i] = (Integer) rxAddressList.get(0); } else { rxAddressIDQuery = "SELECT rxAddressID FROM rxAddress WHERE rxMasterID= " + rxMasterID[i] + " limit 1"; aQuery3 = aSession.createSQLQuery(rxAddressIDQuery); rxAddressList = aQuery3.list(); rxAddressID[i] = (Integer) rxAddressList.get(0); } } } else { //Get rxAddress Information from credit payment rxAddressID = new Integer[rxMasterID1.size()]; for (i = 0; i < rxMasterID1.size(); i++) { rxAddressIDQuery = "SELECT rxAddressID FROM rxAddress WHERE rxMasterID= " + rxMasterID1.get(i) + " limit 1"; Query aQuery3 = aSession.createSQLQuery(rxAddressIDQuery); itsLogger.info("Query2 " + aQuery3.toString()); List<?> rxAddressList = aQuery3.list(); for (j = 0; j < rxAddressList.size(); j++) { if ((Integer) rxAddressList.get(j) != null) rxAddressID[i] = (Integer) rxAddressList.get(j); } } } aMolinkage.setDummyVal(true); moLinkageId = (Integer) aSession.save(aMolinkage); int chkno = 0; chkno = checkNumber; if (counting != 0) // Normal Payment { totalAmount = new BigDecimal[counting]; for (int t = 0; t < counting; t++) { totalAmount[t] = totalAmount1[t]; } for (i = 0; i < rxMasterID.length; i++) { List<VendorPayBean> payBeanlist = new ArrayList<VendorPayBean>(); vendorPayBeanQuery = "SELECT veBillPay.veBillPayID, veBillPay.veBillID, veBillPay.ApplyingAmount, veBillPay.DiscountAmount," + "veBill.BillDate,veBill.InvoiceNumber,veBill.BillAmount,veBill.AppliedAmount,vePO.PONumber FROM veBill " + "LEFT JOIN veBillPay ON veBill.veBillID = veBillPay.veBillID LEFT JOIN vePO ON veBill.vePOID = vePO.vePOID " + "WHERE veBillPay.ApplyingAmount<>0 AND veBillPay.moAccountId=" + theMotransaction.getMoAccountId() + " AND veBillPay.userID = " + userID + " AND veBill.rxMasterID= " + rxMasterID[i] + " ORDER BY veBill.InvoiceNumber, veBill.BillDate"; Query aQuery4 = aSession.createSQLQuery(vendorPayBeanQuery); payBeanlist = aQuery4.list(); if (payBeanlist.size() <= 25) // pick invoice count less than 25 for particular vendor { balAmount = new BigDecimal(0); ArrayList<VendorPayBean> payBean = new ArrayList<VendorPayBean>(); balAmount = balAmount.add(totalAmount[i].negate()); Motransaction aMotransaction = new Motransaction(); aMotransaction.setRxMasterId(rxMasterID[i]); aMotransaction.setRxAddressId(rxAddressID[i]); aMotransaction.setCheckType(theMotransaction.getCheckType()); aMotransaction.setTransactionDate(theMotransaction.getTransactionDate()); aMotransaction.setMoAccountId(theMotransaction.getMoAccountId()); aMotransaction.setPrinted(theMotransaction.getPrinted()); aMotransaction.setAmount(totalAmount[i].negate()); balcalculationAmount = balcalculationAmount.add(balAmount); // for each Amount aMotransaction.setBalance(theMotransaction.getBalance().add(balcalculationAmount)); aMotransaction.setCoAccountId(theMotransaction.getCoAccountId()); aMotransaction.setReference("" + chkno); aMotransaction.setUniquechkRef("" + chkno); aMotransaction.setMoTransactionTypeId(theMotransaction.getMoTransactionTypeId()); aMotransaction.setDescription("Vendor Write Checks"); aMotransaction.setVoid_((byte) 0); aMotransaction.setReconciled((byte) 0); aMotransaction.setDirectDeposit((byte) 0); aMotransaction.setTempRec((byte) 0); aMotransaction.setPageflagVoid(false); moTransactionId = (Integer) aSession.save(aMotransaction); Iterator<?> aIterator = aQuery4.list().iterator(); while (aIterator.hasNext()) { Object[] aObj = (Object[]) aIterator.next(); VendorPayBean aPayBean = new VendorPayBean(); aPayBean.setVebillpayId((Integer) aObj[0]); aPayBean.setVebillID((Integer) aObj[1]); aPayBean.setApplyingAmount((BigDecimal) aObj[2]); aPayBean.setDiscountAmount((BigDecimal) aObj[3]); payBean.add(aPayBean); WritecheckDetails wcObj = new WritecheckDetails(); wcObj.setWcDetailsID(1); wcObj.setMoAccountID(theMotransaction.getMoAccountId()); wcObj.setMoTransactionId(moTransactionId); wcObj.setMoTransactionDate(theMotransaction.getTransactionDate()); wcObj.setMoTransAmount(totalAmount[i].negate()); wcObj.setMoLinkappliedAmount((BigDecimal) aObj[2]); wcObj.setMoLinkdiscount((BigDecimal) aObj[3]); wcObj.setCheckno("" + chkno); wcObj.setUserID(userID); wcObj.setRxMasterID(rxMasterID[i]); wcObj.setRxAddressID(rxAddressID[i]); wcObj.setVeBillID((Integer) aObj[1]); wcObj.setVeBillDate((Date) aObj[4]); wcObj.setInvoiceNumber((String) aObj[5]); wcObj.setVeBillAmount((BigDecimal) aObj[6]); wcObj.setVeBillAppliedAmt((BigDecimal) aObj[7]); wcObj.setPoNumber((String) aObj[8]); wcObj.setVoidStatus(0); wcObj.setVeBillBalance(((BigDecimal) aObj[6] != null ? (BigDecimal) aObj[6] : BigDecimal.ZERO).subtract( ((BigDecimal) aObj[2] != null ? (BigDecimal) aObj[2] : BigDecimal.ZERO) .add((BigDecimal) aObj[3] != null ? (BigDecimal) aObj[3] : BigDecimal.ZERO))); aSession.save(wcObj); } /*String billtoRxmasterQuery = "SELECT vb.veBillID FROM veBillPay as vp INNER JOIN veBill as vb on vp.veBillID = vb.veBillID WHERE vb.rxMasterID ="+rxMasterID[i]+";"; List<?> billList = aSession.createSQLQuery(billtoRxmasterQuery).list();*/ for (j = 0; j < payBean.size(); j++) { Molinkagedetail aMolinkagedetail = new Molinkagedetail(); aMolinkagedetail.setVeBillId(payBean.get(j).getVebillID()); aMolinkagedetail.setAmount(payBean.get(j).getApplyingAmount()); aMolinkagedetail.setMoLinkageId(moLinkageId); aMolinkagedetail.setDiscount(payBean.get(j).getDiscountAmount()); aMolinkagedetail.setMoTransactionId(moTransactionId); moLinkageDetailID = (Integer) aSession.save(aMolinkagedetail); Vebill aVebill = new Vebill(); aVebill = (Vebill) aSession.get(Vebill.class, payBean.get(j).getVebillID()); BigDecimal appliedAmount = aVebill.getAppliedAmount(); BigDecimal billAmount = aVebill.getBillAmount(); appliedAmount = appliedAmount.add(payBean.get(j).getApplyingAmount()) .add(payBean.get(j).getDiscountAmount()); aVebill.setAppliedAmount(appliedAmount); aVebill.setCreditUsed("0"); if (appliedAmount.compareTo(billAmount) == 0) aVebill.setTransactionStatus(2); else aVebill.setTransactionStatus(1); aSession.update(aVebill); /**Created by: Leo ID:110 * Date:04/07/2015 * Purpose: To store payment history */ if (payBean.get(j).getApplyingAmount().signum() > 0) { VeBillPaymentHistory aVeBillPaymentHistory = new VeBillPaymentHistory(); aVeBillPaymentHistory.setVeBillID(payBean.get(j).getVebillID()); aVeBillPaymentHistory.setCheckNo("" + chkno); aVeBillPaymentHistory.setDatePaid(theMotransaction.getTransactionDate()); aVeBillPaymentHistory.setAmountVal(payBean.get(j).getApplyingAmount()); aSession.save(aVeBillPaymentHistory); } //added by prasant if (payBean.get(j).getApplyingAmount().signum() < 0) { System.out.println( "======================================================================================================="); System.out.println( "Normal Payment To store payment history when amount is credit chk:" + chkno + "Amount" + payBean.get(j).getApplyingAmount()); System.out.println( "======================================================================================================="); VeBillPaymentHistory aVeBillPaymentHistory = new VeBillPaymentHistory(); aVeBillPaymentHistory.setVeBillID(payBean.get(j).getVebillID()); aVeBillPaymentHistory.setCheckNo("" + chkno); aVeBillPaymentHistory.setDatePaid(theMotransaction.getTransactionDate()); aVeBillPaymentHistory.setAmountVal(payBean.get(j).getApplyingAmount()); aSession.save(aVeBillPaymentHistory); } //end } Movendorchecktemp amoVendorCheckTemp = new Movendorchecktemp(); amoVendorCheckTemp.setMoTransactionId(moTransactionId); aSession.save(amoVendorCheckTemp); chkno++; } else { int veBilllistCount = payBeanlist.size() / 25; // "segment spliting" for pdf and generate new check no for each page if ((payBeanlist.size() % 25) > 0) // add 1 segment if remainder comes veBilllistCount += 1; int valSublist = 0; for (int cb = 1; cb <= veBilllistCount; cb++) { valSublist = (cb - 1) * 25; // calculation part for picking data from arralist. balAmount = new BigDecimal(0); ArrayList<VendorPayBean> payBean = new ArrayList<VendorPayBean>(); balAmount = balAmount.add(totalAmount[i].negate()); Motransaction aMotransaction = new Motransaction(); aMotransaction.setRxMasterId(rxMasterID[i]); aMotransaction.setRxAddressId(rxAddressID[i]); aMotransaction.setTransactionDate(theMotransaction.getTransactionDate()); aMotransaction.setMoAccountId(theMotransaction.getMoAccountId()); aMotransaction.setPrinted(theMotransaction.getPrinted()); aMotransaction.setCoAccountId(theMotransaction.getCoAccountId()); aMotransaction.setReference("" + chkno); aMotransaction.setMoTransactionTypeId(theMotransaction.getMoTransactionTypeId()); if (cb == 1) { aMotransaction.setUniquechkRef("" + chkno); aMotransaction.setDescription("Vendor Write Checks"); aMotransaction.setCheckType(theMotransaction.getCheckType()); aMotransaction.setAmount(totalAmount[i].negate()); balcalculationAmount = balcalculationAmount.add(balAmount); // for each Amount aMotransaction.setBalance(theMotransaction.getBalance().add(balcalculationAmount)); aMotransaction.setVoid_((byte) 0); aMotransaction.setPageflagVoid(false); } else { aMotransaction.setUniquechkRef("" + (chkno - (cb - 1))); aMotransaction.setDescription("***VOID***"); aMotransaction.setStatus(true); aMotransaction.setAmount(BigDecimal.ZERO); aMotransaction.setVoid_((byte) 0); aMotransaction.setPageflagVoid(true); balcalculationAmount = balcalculationAmount.add(BigDecimal.ZERO); // for each Amount aMotransaction.setBalance(theMotransaction.getBalance().add(balcalculationAmount)); } aMotransaction.setReconciled((byte) 0); aMotransaction.setDirectDeposit((byte) 0); aMotransaction.setTempRec((byte) 0); moTransactionId = (Integer) aSession.save(aMotransaction); Iterator<?> aIterator = null; if (cb * 25 < payBeanlist.size()) // pick data from list using index aIterator = aQuery4.list().subList(valSublist, cb * 25).iterator(); else aIterator = aQuery4.list().subList(valSublist, payBeanlist.size()).iterator(); while (aIterator.hasNext()) { Object[] aObj = (Object[]) aIterator.next(); VendorPayBean aPayBean = new VendorPayBean(); aPayBean.setVebillpayId((Integer) aObj[0]); aPayBean.setVebillID((Integer) aObj[1]); aPayBean.setApplyingAmount((BigDecimal) aObj[2]); aPayBean.setDiscountAmount((BigDecimal) aObj[3]); payBean.add(aPayBean); WritecheckDetails wcObj = new WritecheckDetails(); wcObj.setWcDetailsID(1); wcObj.setMoAccountID(theMotransaction.getMoAccountId()); wcObj.setMoTransactionId(moTransactionId); wcObj.setMoTransactionDate(theMotransaction.getTransactionDate()); wcObj.setMoTransAmount(totalAmount[i].negate()); wcObj.setMoLinkappliedAmount((BigDecimal) aObj[2]); wcObj.setMoLinkdiscount((BigDecimal) aObj[3]); wcObj.setCheckno("" + chkno); wcObj.setUserID(userID); wcObj.setRxMasterID(rxMasterID[i]); wcObj.setRxAddressID(rxAddressID[i]); wcObj.setVeBillID((Integer) aObj[1]); wcObj.setVeBillDate((Date) aObj[4]); wcObj.setInvoiceNumber((String) aObj[5]); wcObj.setVeBillAmount((BigDecimal) aObj[6]); wcObj.setVeBillAppliedAmt((BigDecimal) aObj[7]); wcObj.setPoNumber((String) aObj[8]); wcObj.setVeBillBalance( ((BigDecimal) aObj[6] != null ? (BigDecimal) aObj[6] : BigDecimal.ZERO) .subtract(((BigDecimal) aObj[2] != null ? (BigDecimal) aObj[2] : BigDecimal.ZERO).add( (BigDecimal) aObj[3] != null ? (BigDecimal) aObj[3] : BigDecimal.ZERO))); if (valSublist > 0) wcObj.setVoidStatus(1); else wcObj.setVoidStatus(0); aSession.save(wcObj); } /*String billtoRxmasterQuery = "SELECT vb.veBillID FROM veBillPay as vp INNER JOIN veBill as vb on vp.veBillID = vb.veBillID WHERE vb.rxMasterID ="+rxMasterID[i]+";"; List<?> billList = aSession.createSQLQuery(billtoRxmasterQuery).list();*/ for (j = 0; j < payBean.size(); j++) { Molinkagedetail aMolinkagedetail = new Molinkagedetail(); aMolinkagedetail.setVeBillId(payBean.get(j).getVebillID()); aMolinkagedetail.setAmount(payBean.get(j).getApplyingAmount()); aMolinkagedetail.setMoLinkageId(moLinkageId); aMolinkagedetail.setDiscount(payBean.get(j).getDiscountAmount()); aMolinkagedetail.setMoTransactionId(moTransactionId); moLinkageDetailID = (Integer) aSession.save(aMolinkagedetail); Vebill aVebill = new Vebill(); aVebill = (Vebill) aSession.get(Vebill.class, payBean.get(j).getVebillID()); BigDecimal appliedAmount = aVebill.getAppliedAmount(); BigDecimal billAmount = aVebill.getBillAmount(); appliedAmount = appliedAmount.add(payBean.get(j).getApplyingAmount()) .add(payBean.get(j).getDiscountAmount()); aVebill.setAppliedAmount(appliedAmount); aVebill.setCreditUsed("0"); if (appliedAmount.compareTo(billAmount) == 0) aVebill.setTransactionStatus(2); else aVebill.setTransactionStatus(1); aSession.update(aVebill); /**Created by: Leo ID:110 * Date:04/07/2015 * Purpose: To store payment history */ if (payBean.get(j).getApplyingAmount().signum() > 0) { VeBillPaymentHistory aVeBillPaymentHistory = new VeBillPaymentHistory(); aVeBillPaymentHistory.setVeBillID(payBean.get(j).getVebillID()); aVeBillPaymentHistory.setCheckNo("" + chkno); aVeBillPaymentHistory.setDatePaid(theMotransaction.getTransactionDate()); aVeBillPaymentHistory.setAmountVal(payBean.get(j).getApplyingAmount()); aSession.save(aVeBillPaymentHistory); } } Movendorchecktemp amoVendorCheckTemp = new Movendorchecktemp(); amoVendorCheckTemp.setMoTransactionId(moTransactionId); aSession.save(amoVendorCheckTemp); chkno++; } } } /**Inserting GlTransaction*/ payingVendorBillDiscount1(theMotransaction.getMoAccountId(), checkNumber, yearID, periodID, userName, theMotransaction.getTransactionDate(), userID); /** Delete VeBillPay **/ String rxMasterIds = StringUtils.join(rxMasterID, ','); if (rxMasterID.length > 0) { vendorPayBeanQuery = "DELETE FROM veBillPay WHERE veBillPayID IN (SELECT * FROM (SELECT vP.veBillPayID FROM veBillPay vP,veBill v WHERE vP.moAccountId=" + theMotransaction.getMoAccountId() + " AND vP.userID = " + userID + " AND vP.veBillID = v.veBillID AND v.rxMasterID IN (" + rxMasterIds + ")) AS subQuery)"; aSession.createSQLQuery(vendorPayBeanQuery).executeUpdate(); } BigDecimal totalamount = new BigDecimal(0); for (i = 0; i < totalAmount.length; i++) { if (totalAmount[i] != null) totalamount = totalamount.add(totalAmount[i]); } aMoaccount = (MoAccount) aSession.get(MoAccount.class, theMotransaction.getMoAccountId()); aMoaccount.setNextCheckNumber(chkno); //BigDecimal openBalance = aMoaccount.getOpenBalance(); /*openBalance = openBalance.subtract(totalamount); aMoaccount.setOpenBalance(openBalance);*/ BigDecimal substractions = aMoaccount.getSubtractions(); substractions = substractions.add(totalamount); aMoaccount.setSubtractions(substractions); aSession.update(aMoaccount); aTransaction.commit(); } else // Credit Payment { /**Created by: Leo ID:110 * Date:04/06/2015 * Purpose: for credit payments */ String creditVeBillID = ""; for (i = 0; i < rxMasterID1.size(); i++) { // iterate credit rxMasterIDs balAmount = new BigDecimal(0); ArrayList<VendorPayBean> payBean = new ArrayList<VendorPayBean>(); BigDecimal pickNegativeAmt = new BigDecimal(0); vendorPayBeanQuery = "SELECT veBillPay.veBillPayID, veBillPay.veBillID, veBillPay.ApplyingAmount, veBillPay.DiscountAmount " + "FROM veBill LEFT JOIN veBillPay ON veBill.veBillID = veBillPay.veBillID " + "WHERE veBillPay.ApplyingAmount<>0 AND veBillPay.moAccountId=" + theMotransaction.getMoAccountId() + " and veBillPay.userID = " + userID + " And veBill.rxMasterID= " + rxMasterID1.get(i) + " ORDER BY veBill.InvoiceNumber, veBill.BillDate;"; Query aQuery4 = aSession.createSQLQuery(vendorPayBeanQuery); // get All veBillPay Details Iterator<?> aIterator = aQuery4.list().iterator(); while (aIterator.hasNext()) { Object[] aObj = (Object[]) aIterator.next(); VendorPayBean aPayBean = new VendorPayBean(); aPayBean.setVebillpayId((Integer) aObj[0]); aPayBean.setVebillID((Integer) aObj[1]); aPayBean.setApplyingAmount((BigDecimal) aObj[2]); aPayBean.setDiscountAmount((BigDecimal) aObj[3]); if (aPayBean.getApplyingAmount().signum() < 0) { pickNegativeAmt = pickNegativeAmt.add(aPayBean.getApplyingAmount()); //sum of negative Amount only if (creditVeBillID.equals("")) // Get All veBill IDs creditVeBillID = "" + (Integer) aObj[1]; else creditVeBillID = creditVeBillID + "," + (Integer) aObj[1]; } payBean.add(aPayBean); } balAmount = balAmount.add(pickNegativeAmt.negate().add(creditAmtUsed.get(i))); // sum of all applying amt without credit Amount for (j = 0; j < payBean.size(); j++) { // Iterate veBill IDs Vebill aVebill = new Vebill(); aVebill = (Vebill) aSession.get(Vebill.class, payBean.get(j).getVebillID()); BigDecimal appliedAmount = aVebill.getAppliedAmount(); BigDecimal billAmount = aVebill.getBillAmount(); itsLogger.info(payBean.get(j).getApplyingAmount()); /** * Note: Credit bill don't update check no. credit used bills only need check no. */ if (payBean.get(j).getApplyingAmount().signum() < 0) // check whether Applying Amt is in negative value { if (payBean.get(j).getApplyingAmount().negate().compareTo(balAmount) == 1) // check credit amount is greater or not { appliedAmount = appliedAmount.add(balAmount.negate()) .add(payBean.get(j).getDiscountAmount()); aVebill.setAppliedAmount(appliedAmount); } else { appliedAmount = appliedAmount.add(payBean.get(j).getApplyingAmount()) .add(payBean.get(j).getDiscountAmount()); aVebill.setAppliedAmount(appliedAmount); balAmount = balAmount.add(payBean.get(j).getApplyingAmount()); } aVebill.setCreditUsed("0"); itsLogger.info(balAmount); } else { /**Created by: Leo ID:110 * Date:04/07/2015 * Purpose: To store payment history */ appliedAmount = appliedAmount.add(payBean.get(j).getApplyingAmount()) .add(payBean.get(j).getDiscountAmount()); VeBillPaymentHistory aVeBillPaymentHistory = new VeBillPaymentHistory(); aVeBillPaymentHistory.setVeBillID(payBean.get(j).getVebillID()); aVeBillPaymentHistory.setCheckNo("" + chkno); aVeBillPaymentHistory.setDatePaid(theMotransaction.getTransactionDate()); aVeBillPaymentHistory.setAmountVal(appliedAmount); aSession.save(aVeBillPaymentHistory); aVebill.setAppliedAmount(appliedAmount); if (aVebill.getCreditUsed() != null && !aVebill.getCreditUsed().equals("0")) aVebill.setCreditUsed(aVebill.getCreditUsed() + "," + creditVeBillID); else aVebill.setCreditUsed("" + creditVeBillID); itsLogger.info(appliedAmount); } if (appliedAmount.compareTo(billAmount) == 0) aVebill.setTransactionStatus(2); else aVebill.setTransactionStatus(1); aSession.update(aVebill); } Movendorchecktemp amoVendorCheckTemp = new Movendorchecktemp(); amoVendorCheckTemp.setMoTransactionId(moTransactionId); aSession.save(amoVendorCheckTemp); chkno++; } aMoaccount = (MoAccount) aSession.get(MoAccount.class, theMotransaction.getMoAccountId()); aMoaccount.setNextCheckNumber(chkno); aSession.update(aMoaccount); aTransaction.commit(); } if (rxMasterID.length > 0) { aPrintBean.setReference("Success"); } else { aPrintBean.setReference("Error"); } } catch (Exception e) { itsLogger.error(e.getMessage(), e); aTransaction.rollback(); if (rxMasterID.length > 0) { aPrintBean.setReference("Success"); } else { aPrintBean.setReference("Error"); } BankingException aBankingException = new BankingException(e.getMessage(), e); throw aBankingException; } finally { aSession.flush(); aSession.close(); deletetemCheck = null; billArrayQuery = null; rxAddressIDQuery = null; vendorPayBeanQuery = null; totalAmountQuery = null; } return aPrintBean; }
From source file:nl.kpmg.lcm.common.data.metadata.MetaData.java
private final <T> T get(Map map, String[] path) { if (path.length == 0) { return null; } else if (map.containsKey(path[0])) { Object value = map.get(path[0]); if (path.length == 1) { return (T) value; } else {/*from ww w .j a v a2 s. com*/ return get((Map) value, (String[]) ArrayUtils.removeElement(path, path[0])); } } else { return null; } }
From source file:nl.kpmg.lcm.common.data.metadata.MetaData.java
private void set(final Map map, final String[] path, final Object value) throws Exception { if (path.length == 0) { throw new Exception("Errrrr"); } else if (path.length == 1) { map.put(path[0], value);//from ww w .j av a 2 s .c om } else if (map.containsKey(path[0])) { Class<? extends Object> elementClass = map.get(path[0]).getClass(); if (Map.class.isAssignableFrom(elementClass)) { set((Map) map.get(path[0]), (String[]) ArrayUtils.removeElement(path, path[0]), value); } else { throw new Exception("Trying to traverse deeper but this path element isn't a map"); } } else { HashMap newMap = new HashMap(); map.put(path[0], newMap); set(newMap, (String[]) ArrayUtils.removeElement(path, path[0]), value); } }
From source file:nl.kpmg.lcm.Main.java
/** * Main method./*from ww w . ja va2 s . c om*/ * * @param args * @throws IOException */ public static void main(String[] args) throws IOException { try { if (args.length == 0) { throw new InvalidArgumentsException("No command found"); } final String command = args[0]; final String[] arguments = (String[]) ArrayUtils.removeElement(args, command); if (command.equals("server")) { LOG.info("Starting LCM server"); final Server server = new Server(); server.start(); } else if (command.equals("ui")) { LOG.info("Starting LCM UI"); final UI ui = new UI(); ui.start(); } else if (command.equals("cli")) { LOG.info("Cli not implemented yet."); } else if (command.equals("help")) { if (arguments.length == 1) { displayHelp(arguments[0]); } else { displayHelp(); } } else { throw new InvalidArgumentsException(String.format("Caught a unhandled command: %s", command)); } } catch (InvalidArgumentsException e) { displayHelp(e); } catch (ServerException ex) { LOG.error("Failed starting the server", ex); } }
From source file:org.agnitas.web.RecipientAction.java
/** * Process the specified HTTP request, and create the corresponding HTTP * response (or forward to another web component that will create it). * Return an <code>ActionForward</code> instance describing where and how * control should be forwarded, or <code>null</code> if the response has * already been completed.<br>/*ww w.j a va 2 s . co m*/ * <br> * ACTION_LIST: initializes the list of columns-widths according to number of columns selected by user;<br> * checks if the number of selected columns is less or equal than max-value (currently 8):<br> * - if max value exceeded - puts error to page and restores the list of selected columns from previous time<br> * - if the selected column number <= max-value - stores the current selection to be used for future calls<br> * forwards to list. * <br><br> * ACTION_VIEW: loads recipient to form, puts list of mailinglists to request and forwards to "view" * <br><br> * ACTION_SAVE: If the request parameter "cancel.x" is set - just forwards to "list". In other case saves * changed or new recipient to the database; also saves the recipient bindings to mailinglists * <br><br> * ACTION_NEW: if the request parameter "cancel.x" is set - just forwards to "list", otherwise forwards * to the page where user can fill the data for a new recipient * <br><br> * ACTION_CONFIRM_DELETE: loads recipient into form and forwards to jsp with confirmation about deletion * of current recipient * <br><br> * ACTION_DELETE: if the request parameter "kill" is set - removes the recipient from database (otherwise * returns to previous page) * <br><br> * ACTION_VIEW_WITHOUT_LOAD: forwards to view page without loading the recipient data from DB. * Used as input page for struts-action in struts-config.xml. If the error occurs while saving the recipient - * this action is used (as we don't need to load recipient data again) * <br><br> * Any other ACTION_* would cause a forward to "list" * <br><br> * If the destination is "list" - calls a FutureHolder to get the list of recipients. While FutureHolder is running * destination is "loading". After FutureHolder is finished destination is "list". * * @param form data for the action filled by the jsp * @param req request from jsp. * @param res response * @param mapping The ActionMapping used to select this instance * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet exception occurs * * @return destination specified in struts-config.xml to forward to next jsp */ @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { // Validate the request parameters specified by the user RecipientForm aForm = null; ActionMessages errors = new ActionErrors(); ActionMessages messages = new ActionMessages(); ActionForward destination = null; if (!AgnUtils.isUserLoggedIn(req)) { return mapping.findForward("logon"); } if (form != null) { aForm = (RecipientForm) form; } else { aForm = new RecipientForm(); } this.updateRecipientFormProperties(req, aForm); if (aForm.getDelete().isSelected()) { aForm.setAction(ACTION_CONFIRM_DELETE); } if (aForm.getAction() == ACTION_LIST) { String[] selectedFields = aForm.getSelectedFields(); if (selectedFields != null && selectedFields.length > 0) { aForm.setSelectedFields((String[]) ArrayUtils.removeElement(selectedFields, DUMMY_RECIPIENT_FIELD)); } } try { switch (aForm.getAction()) { case ACTION_LIST: if (allowed("recipient.show", req)) { destination = mapping.findForward("list"); int length = aForm.getSelectedFields().length; if (aForm.getColumnwidthsList() == null) { aForm.setColumnwidthsList(getInitializedColumnWidthList(length + 1)); } if (length > 8) { aForm.setSelectedFields(aForm.getSelectedFieldsOld()); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.maximum.recipient.columns")); aForm.addErrors(errors); } else { aForm.setSelectedFieldsOld(aForm.getSelectedFields()); } } else { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.permissionDenied")); } break; case ACTION_VIEW: if (allowed("recipient.show", req)) { if (req.getParameter("recipientID") != null) { loadRecipient(aForm, req); aForm.setAction(RecipientAction.ACTION_SAVE); } else { loadDefaults(aForm, req); aForm.setAction(RecipientAction.ACTION_NEW); } req.setAttribute("mailinglists", mailinglistDao.getMailinglists(AgnUtils.getCompanyID(req))); destination = mapping.findForward("view"); } else { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.permissionDenied")); } break; case ACTION_SAVE: if (allowed("recipient.change", req)) { if (req.getParameter("cancel.x") == null) { saveRecipient(aForm, req); aForm.setAction(RecipientAction.ACTION_LIST); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.changes_saved")); aForm.setMessages(new ActionMessages(messages)); } destination = mapping.findForward("list"); } else { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.permissionDenied")); } break; case ACTION_NEW: if (allowed("recipient.new", req)) { if (req.getParameter("cancel.x") == null) { aForm.setRecipientID(0); if (saveRecipient(aForm, req)) { aForm.setAction(RecipientAction.ACTION_LIST); destination = mapping.findForward("list"); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.changes_saved")); aForm.setMessages(new ActionMessages(messages)); } else { errors.add("NewRecipient", new ActionMessage("error.subscriber.insert_in_db_error")); aForm.setAction(RecipientAction.ACTION_VIEW); destination = mapping.findForward("view"); } req.setAttribute("mailinglists", mailinglistDao.getMailinglists(AgnUtils.getCompanyID(req))); } else { destination = mapping.findForward("list"); } } else { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.permissionDenied")); } break; case ACTION_CONFIRM_DELETE: if (allowed("recipient.delete", req)) { loadRecipient(aForm, req); destination = mapping.findForward("delete"); } else { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.permissionDenied")); } break; case ACTION_DELETE: if (allowed("recipient.delete", req)) { if (req.getParameter("kill") != null) { deleteRecipient(aForm, req); aForm.setAction(RecipientAction.ACTION_LIST); destination = mapping.findForward("list"); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.changes_saved")); aForm.setMessages(new ActionMessages(messages)); } } else { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.permissionDenied")); } break; case ACTION_VIEW_WITHOUT_LOAD: if (allowed("recipient.show", req)) { req.setAttribute("mailinglists", mailinglistDao.getMailinglists(AgnUtils.getCompanyID(req))); destination = mapping.findForward("view"); aForm.setAction(RecipientAction.ACTION_SAVE); } else { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.permissionDenied")); } break; default: aForm.setAction(RecipientAction.ACTION_LIST); if (allowed("recipient.show", req)) { destination = mapping.findForward("list"); if (aForm.getColumnwidthsList() == null) { int length = aForm.getSelectedFields().length; aForm.setColumnwidthsList(getInitializedColumnWidthList(length + 1)); } } else { errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.permissionDenied")); } } } catch (Exception e) { AgnUtils.logger().error("execute: " + e + "\n" + AgnUtils.getStackTrace(e)); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.exception")); } if (destination != null && "list".equals(destination.getName())) { try { Map<String, String> fieldsMap = getRecipientFieldsNames(AgnUtils.getCompanyID(req), aForm.getAdminId()); Set<String> recipientDbColumns = fieldsMap.keySet(); req.setAttribute("fieldsMap", fieldsMap); setNumberOfRows(req, aForm); destination = mapping.findForward("loading"); String key = FUTURE_TASK + "@" + req.getSession(false).getId(); if (!futureHolder.containsKey(key)) { Future<PaginatedList> recipientListFuture = getRecipientListFuture(req, aForm, recipientDbColumns); futureHolder.put(key, recipientListFuture); } if (futureHolder.containsKey(key) && futureHolder.get(key).isDone()) { req.setAttribute("recipientList", futureHolder.get(key).get()); req.setAttribute("mailinglists", mailinglistDao.getMailinglists(AgnUtils.getCompanyID(req))); req.setAttribute("targets", targetDao.getTargets(AgnUtils.getCompanyID(req))); destination = mapping.findForward("list"); PaginatedList resultingList = (PaginatedList) futureHolder.get(key).get(); if (resultingList == null) { aForm.setDeactivatePagination(false); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.errorneous_recipient_search")); } else { aForm.setAll(resultingList.getFullListSize()); messages.add(aForm.getMessages()); aForm.setMessages(null); errors.add(aForm.getErrors()); aForm.resetErrors(); } aForm.setRefreshMillis(RecipientForm.DEFAULT_REFRESH_MILLIS); futureHolder.remove(key); } else { if (aForm.getRefreshMillis() < 1000) { // raise the refresh time aForm.setRefreshMillis(aForm.getRefreshMillis() + 50); } aForm.setError(false); } } catch (Exception e) { AgnUtils.logger().error("recipientList: " + e + "\n" + AgnUtils.getStackTrace(e)); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.exception")); aForm.setError(true); // do not refresh when an error has been occurred } if (aForm.isDeactivatePagination()) { Company company = AgnUtils.getCompany(req); int maxRecipients = company.getMaxRecipients(); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("recipient.search.max_recipients", maxRecipients)); } } // this is a hack for the recipient-search / recipient overview. if (destination != null && "list".equals(destination.getName())) { // check if we are in search-mode if (!aForm.isOverview()) { // check if it is the last element in filter if (aForm.getNumTargetNodes() == 0 && aForm.getListID() == 0 && aForm.getTargetID() == 0 && aForm.getUser_type().equals("E") && aForm.getUser_status() == 0) { aForm.setAction(7); destination = mapping.findForward("search"); } } } // Report any errors we have discovered back to the original form if (!errors.isEmpty()) { saveErrors(req, errors); // return new ActionForward(mapping.getForward()); } // Report any message (non-errors) we have discovered if (!messages.isEmpty()) { saveMessages(req, messages); } return destination; }
From source file:org.apache.gora.compiler.cli.GoraCompilerCLI.java
public static void main(String[] args) { if (args.length == 1 && (args[0].equals("--help") || args[0].equals("-h"))) { printHelp();/* w w w . j ava2 s . c o m*/ System.exit(0); } if (args.length < 2) { LOG.error("Must supply at least one source file and an output directory."); printHelp(); System.exit(1); } // Setting the default license header to ASLv2 LicenseHeaders licenseHeader = new LicenseHeaders("ASLv2"); // Checking for user provided license for (int i = 0; i < args.length; i++) { if ("-license".equals(args[i])) { if (i == args.length - 1) { LOG.error("Must supply a valid license id."); printHelp(); System.exit(1); } if (licenseHeader.isValidLicense(args[i + 1])) { licenseHeader.setLicenseName(args[i + 1]); args = (String[]) ArrayUtils.removeElement(args, args[i + 1]); args = (String[]) ArrayUtils.removeElement(args, args[i]); } else { LOG.error("Must supply a valid license id."); printHelp(); System.exit(1); } } } File outputDir = new File(args[args.length - 1]); if (!outputDir.isDirectory()) { LOG.error("Must supply a directory for output"); printHelp(); System.exit(1); } // Processing input directory or input files File inputDir = new File(args[0]); File[] inputFiles = null; if (inputDir.isDirectory()) { if (inputDir.length() > 0) inputFiles = inputDir.listFiles(); else { LOG.error("Input directory must include at least one file."); printHelp(); System.exit(1); } } else { inputFiles = new File[args.length - 1]; for (int i = 0; i < inputFiles.length; i++) { File inputFile = new File(args[i]); if (!inputFile.isFile()) { LOG.error("Input must be a file."); printHelp(); System.exit(1); } inputFiles[i] = inputFile; } } try { GoraCompiler.compileSchema(inputFiles, outputDir, licenseHeader); LOG.info("Compiler executed SUCCESSFULL."); } catch (IOException e) { LOG.error("Error while compiling schema files. Check that the schemas are properly formatted."); printHelp(); throw new RuntimeException(e); } }
From source file:org.apache.wookie.w3c.util.LocalizationUtils.java
/** * Filters a set of elements using the locales and returns a copy of the array * containing only elements that match the locales, or that are not localized * if there are no matches/*from ww w . j av a 2s.c o m*/ * @param elements * @param locales * @return a copy of the array of elements only containing the filtered elements */ protected static ILocalizedElement[] filter(ILocalizedElement[] elements, List<ULocale> locales) { for (ILocalizedElement element : elements) { String lang = element.getLang(); boolean found = false; for (ULocale locale : locales) { if (locale.toLanguageTag().equalsIgnoreCase(lang)) found = true; } if (!found && lang != null) elements = (ILocalizedElement[]) ArrayUtils.removeElement(elements, element); } // Strip out non-localized elements only if there are localized elements left if (elements.length > 0) { if (elements[0].getLang() != null) { for (ILocalizedElement element : elements) { if (element.getLang() == null) elements = (ILocalizedElement[]) ArrayUtils.removeElement(elements, element); } } } return elements; }
From source file:org.appverse.web.framework.backend.api.converters.helpers.ConverterUtils.java
/** * Obtain a list of field declared by a bean class and superclasses * // w ww . ja v a 2s. c o m * @param bean * Bean to get the fields * @return Array of fields declared by bean class and superclasses * @throws Exception */ private static Field[] getBeanFields(AbstractBean bean) throws Exception { // Fields added to AbstractBean by ConverterAspect String[] ignoreFields = ((Detachable) bean).getDetachableFields(); Class<?> clazz = bean.getClass(); // Get the all fields declared by the class Field[] fields = clazz.getDeclaredFields(); // For all superclasses until arrive to AbstractBean (including // AbstractBean)... while (clazz.getSuperclass() != null && AbstractBean.class.isAssignableFrom(clazz.getSuperclass())) { clazz = clazz.getSuperclass(); // Add the clazz declared fields to field list fields = (Field[]) ArrayUtils.addAll(fields, clazz.getDeclaredFields()); } // Remove from the list fields added by the converters aspect to // Abstract // bean for (Field field : fields) { if (ArrayUtils.contains(ignoreFields, field.getName())) { fields = (Field[]) ArrayUtils.removeElement(fields, field); } } return fields; }