@Override @Loggable(value = LogLevel.TRACE) @Transactional public void updateBalance(String id, BigDecimal amount) { Account acc = (Account) sessionFactory.getCurrentSession().get(Account.class, id, LockMode.UPGRADE); acc.setBalance(acc.getBalance().subtract(amount)); save(acc); }
Account temp = findAccount(accountID, 0, size, lastPos); if (temp!= null) { temp.setBalance(temp.getBalance() + adjustment); //updates temp currentBalance } else { System.out.println("No account found. "); }
public org.hl7.fhir.dstu3.model.Account convertAccount(org.hl7.fhir.instance.model.Account src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Account tgt = new org.hl7.fhir.dstu3.model.Account(); copyDomainResource(src, tgt); for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); if (src.hasName()) tgt.setName(src.getName()); if (src.hasType()) tgt.setType(convertCodeableConcept(src.getType())); tgt.setStatus(convertAccountStatus(src.getStatus())); tgt.setActive(convertPeriod(src.getActivePeriod())); tgt.setBalance(convertMoney(src.getBalance())); // tgt.setCoveragePeriod(convertPeriod(src.getCoveragePeriod())); tgt.setSubject(convertReference(src.getSubject())); tgt.setOwner(convertReference(src.getOwner())); tgt.setDescription(src.getDescription()); return tgt; }
public org.hl7.fhir.dstu3.model.Account convertAccount(org.hl7.fhir.instance.model.Account src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu3.model.Account tgt = new org.hl7.fhir.dstu3.model.Account(); copyDomainResource(src, tgt); for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t)); if (src.hasName()) tgt.setName(src.getName()); if (src.hasType()) tgt.setType(convertCodeableConcept(src.getType())); tgt.setStatus(convertAccountStatus(src.getStatus())); tgt.setActive(convertPeriod(src.getActivePeriod())); tgt.setBalance(convertMoney(src.getBalance())); // tgt.setCoveragePeriod(convertPeriod(src.getCoveragePeriod())); tgt.setSubject(convertReference(src.getSubject())); tgt.setOwner(convertReference(src.getOwner())); tgt.setDescription(src.getDescription()); return tgt; }