protected boolean isEmpExists(String value) { if (this.employee.getID() != 0 && this.employee.getName().equalsIgnoreCase(value)) { return false; } Set<Payee> payees = getCompany().getPayees(); for (Payee payee : payees) { if (payee.getType() == Payee.TYPE_EMPLOYEE) { if (payee.getName().equals(value)) { return true; } } } return false; }
@Override public void migrate(Company company) throws AccounterException { log.info("Started Migrator24"); for (Payee payee : company.getPayees()) { Double pBalance = (Double) getSession() .getNamedQuery("get.Payee.Balance") .setParameter("payeeId", payee.getID()) .uniqueResult(); if (pBalance == null || DecimalUtil.isEquals(pBalance, 0.00D) || DecimalUtil.isEquals(pBalance, -0.00D)) { pBalance = 0.00D; } if (payee.isCustomer() && !DecimalUtil.isEquals(pBalance, 0.00D)) { pBalance = -pBalance; } if (DecimalUtil.isEquals(payee.getBalance(), pBalance)) { continue; } log.info( "***Updating Payee Balance: " + payee.getID() + " Name: " + payee.getName() + " with " + pBalance); payee.setBalance(pBalance); getSession().saveOrUpdate(payee); } log.info("Finished Migrator24"); }