private void updateAccount(final UUID accountId, final AccountData account, final boolean treatNullValueAsReset, final CallContext context) throws AccountApiException { final AccountModelDao updatedAccountModelDao = new AccountModelDao(accountId, null, null, account, false); accountDao.update(updatedAccountModelDao, treatNullValueAsReset, internalCallContextFactory.createInternalCallContext(accountId, context)); }
@Override public void updateBCD(final String externalKey, final int bcd, final InternalCallContext context) throws AccountApiException { final Account currentAccount = getAccountByKey(externalKey, context); if (currentAccount == null) { throw new AccountApiException(ErrorCode.ACCOUNT_DOES_NOT_EXIST_FOR_KEY, externalKey); } if (currentAccount.getBillCycleDayLocal() != DefaultMutableAccountData.DEFAULT_BILLING_CYCLE_DAY_LOCAL) { throw new AccountApiException(ErrorCode.ACCOUNT_UPDATE_FAILED); } final MutableAccountData mutableAccountData = currentAccount.toMutableAccountData(); mutableAccountData.setBillCycleDayLocal(bcd); final AccountModelDao accountToUpdate = new AccountModelDao(currentAccount.getId(), mutableAccountData); bcdCacheController.remove(currentAccount.getId()); bcdCacheController.putIfAbsent(currentAccount.getId(), new Integer(bcd)); accountDao.update(accountToUpdate, true, context); }
@Test(groups = "slow", description = "Test Account DAO: basic update (2)") public void testShouldBeAbleToUpdateSomeFields() throws Exception { final AccountModelDao account = createTestAccount(); accountDao.create(account, internalCallContext); refreshCallContext(account.getId()); final MutableAccountData otherAccount = new DefaultAccount(account).toMutableAccountData(); otherAccount.setAddress1(UUID.randomUUID().toString()); otherAccount.setEmail(UUID.randomUUID().toString()); final AccountModelDao newAccount = new AccountModelDao(account.getId(), otherAccount); accountDao.update(newAccount, true, internalCallContext); final AccountModelDao retrievedAccount = accountDao.getById(account.getId(), internalCallContext); checkAccountsEqual(retrievedAccount, newAccount); }
.build(); final AccountModelDao updatedAccount = new AccountModelDao(account.getId(), accountData); accountDao.update(updatedAccount, true, internalCallContext); .build(); final AccountModelDao updatedAccount2 = new AccountModelDao(account.getId(), accountData2); accountDao.update(updatedAccount2, true, internalCallContext);
private void updateAccount(final UUID accountId, final AccountData account, final boolean treatNullValueAsReset, final CallContext context) throws AccountApiException { final AccountModelDao updatedAccountModelDao = new AccountModelDao(accountId, null, null, account, false); accountDao.update(updatedAccountModelDao, treatNullValueAsReset, internalCallContextFactory.createInternalCallContext(accountId, context)); }
@Override public void updateBCD(final String externalKey, final int bcd, final InternalCallContext context) throws AccountApiException { final Account currentAccount = getAccountByKey(externalKey, context); if (currentAccount == null) { throw new AccountApiException(ErrorCode.ACCOUNT_DOES_NOT_EXIST_FOR_KEY, externalKey); } if (currentAccount.getBillCycleDayLocal() != DefaultMutableAccountData.DEFAULT_BILLING_CYCLE_DAY_LOCAL) { throw new AccountApiException(ErrorCode.ACCOUNT_UPDATE_FAILED); } final MutableAccountData mutableAccountData = currentAccount.toMutableAccountData(); mutableAccountData.setBillCycleDayLocal(bcd); final AccountModelDao accountToUpdate = new AccountModelDao(currentAccount.getId(), mutableAccountData); bcdCacheController.remove(currentAccount.getId()); bcdCacheController.putIfAbsent(currentAccount.getId(), new Integer(bcd)); accountDao.update(accountToUpdate, true, context); }