/** * Simple call to {@link CallContext#current()} to retrieve the current calling account. * This method facilitates unit testing, it avoids mocking static methods. */ protected Account getCurrentAccount() { return CallContext.current().getCallingAccount(); }
@Override public long getEntityOwnerId() { Account caller = CallContext.current().getCallingAccount(); return caller.getAccountId(); }
@Override public long getEntityOwnerId() { Account account = CallContext.current().getCallingAccount(); if (account != null) { return account.getId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked }
public String getAccountName() { if (accountName == null) { return CallContext.current().getCallingAccount().getAccountName(); } return accountName; }
@Override public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getId(); } }
@Override public long getEntityOwnerId() { Account account = CallContext.current().getCallingAccount(); if (account != null) { return account.getId(); } return Account.ACCOUNT_ID_SYSTEM; }
@Override public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getId(); } }
@Override public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getId(); } }
@Override public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getId(); } }
@Override public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getId(); } }
@Override public long getEntityOwnerId() { Account account = CallContext.current().getCallingAccount(); if (account != null) { return account.getId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked }
@Override public long getEntityOwnerId() { Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true); if (accountId == null) { accountId = CallContext.current().getCallingAccount().getId(); } return accountId; }
@Override public long getEntityOwnerId() { Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } return accountId; }
@Override public long getEntityOwnerId() { Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } return accountId; }
@Override public long getEntityOwnerId() { Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true); if (accountId == null) { return CallContext.current().getCallingAccount().getId(); } return accountId; }
@Override @ActionEvent(eventType = EventTypes.EVENT_FIREWALL_UPDATE, eventDescription = "updating firewall rule", async = true) public FirewallRule updateIngressFirewallRule(long ruleId, String customId, Boolean forDisplay) { Account caller = CallContext.current().getCallingAccount(); return updateFirewallRule(ruleId, customId, caller, forDisplay); }
@Override public boolean revokeIngressFirewallRule(long ruleId, boolean apply) { Account caller = CallContext.current().getCallingAccount(); long userId = CallContext.current().getCallingUserId(); return revokeFirewallRule(ruleId, apply, caller, userId); }
@Override @ActionEvent(eventType = EventTypes.EVENT_FIREWALL_EGRESS_CLOSE, eventDescription = "revoking egress firewall rule", async = true) public boolean revokeEgressFirewallRule(long ruleId, boolean apply) { Account caller = CallContext.current().getCallingAccount(); long userId = CallContext.current().getCallingUserId(); return revokeFirewallRule(ruleId, apply, caller, userId); }
@Override @ActionEvent(eventType = EventTypes.EVENT_STATIC_ROUTE_DELETE, eventDescription = "deleting static route") public boolean revokeStaticRoute(final long routeId) throws ResourceUnavailableException { final Account caller = CallContext.current().getCallingAccount(); final StaticRouteVO route = _staticRouteDao.findById(routeId); if (route == null) { throw new InvalidParameterValueException("Unable to find static route by id"); } _accountMgr.checkAccess(caller, null, false, route); markStaticRouteForRevoke(route, caller); return applyStaticRoutesForVpc(route.getVpcId()); }
@Override public List<NuageVspDomainTemplateResponse> listNuageVspDomainTemplates(ListNuageVspDomainTemplatesCmd cmd){ long domainId; if (cmd.getDomainId() != null) { domainId = cmd.getDomainId(); } else { domainId = CallContext.current().getCallingAccount().getDomainId(); } return listNuageVspDomainTemplates(domainId, cmd.getKeyword(), cmd.getZoneId(), cmd.getPhysicalNetworkId()); }