public static AccountDetailVO getAccountDetail(long csAccountId, long storagePoolId, AccountDetailsDao accountDetailsDao) { AccountDetailVO accountDetail = accountDetailsDao.findDetail(csAccountId, SolidFireUtil.getAccountKey(storagePoolId)); if (accountDetail == null || accountDetail.getValue() == null) { accountDetail = accountDetailsDao.findDetail(csAccountId, SolidFireUtil.ACCOUNT_ID); } return accountDetail; }
public static void updateCsDbWithSolidFireAccountInfo(long csAccountId, SolidFireUtil.SolidFireAccount sfAccount, long storagePoolId, AccountDetailsDao accountDetailsDao) { AccountDetailVO accountDetail = new AccountDetailVO(csAccountId, SolidFireUtil.getAccountKey(storagePoolId), String.valueOf(sfAccount.getId())); accountDetailsDao.persist(accountDetail); }
public static Map<String, String> getAccountDetails(long accountId) { Map<String, String> details = s_accountDetailsDao.findDetails(accountId); return details.isEmpty() ? null : details; }
throw new InvalidParameterValueException("unable to find account by id " + resourceId); AccountDetailVO accountDetailVO = _accountDetailsDao.findDetail(resourceId, name); if (accountDetailVO == null) { accountDetailVO = new AccountDetailVO(resourceId, name, value); _accountDetailsDao.persist(accountDetailVO); } else { accountDetailVO.setValue(value); _accountDetailsDao.update(accountDetailVO.getId(), accountDetailVO);
_accountDetailsDao.update(accountFinal.getId(), details);
@Override public long getSolidFireAccountId(String csAccountUuid, String storagePoolUuid) { long csAccountId = util.getAccountIdForAccountUuid(csAccountUuid); long storagePoolId = util.getStoragePoolIdForStoragePoolUuid(storagePoolUuid); AccountDetailVO accountDetail = accountDetailsDao.findDetail(csAccountId, SolidFireUtil.getAccountKey(storagePoolId)); if (accountDetail == null) { throw new CloudRuntimeException("Unable to find SF account for storage " + storagePoolUuid + " for CS account " + csAccountUuid); } String sfAccountId = accountDetail.getValue(); return Long.parseLong(sfAccountId); }
@Override public AccountVO doInTransaction(TransactionStatus status) { AccountVO account = _accountDao.persist(new AccountVO(accountName, domainId, networkDomain, accountType, roleId, uuid)); if (account == null) { throw new CloudRuntimeException("Failed to create account name " + accountName + " in domain id=" + domainId); } Long accountId = account.getId(); if (details != null) { _accountDetailsDao.persist(accountId, details); } // Create resource count records for the account _resourceCountDao.createResourceCounts(accountId, ResourceLimit.ResourceOwnerType.Account); // Create default security group _networkGroupMgr.createDefaultSecurityGroup(accountId); return account; } });