use of com.cloud.network.security.SecurityGroupRuleVO in project cloudstack by apache.
the class SecurityGroupRuleDaoImpl method remove.
@Override
@DB
public boolean remove(Long id) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
SecurityGroupRuleVO entry = findById(id);
if (entry != null) {
_tagsDao.removeByIdAndType(id, ResourceObjectType.SecurityGroupRule);
}
boolean result = super.remove(id);
txn.commit();
return result;
}
use of com.cloud.network.security.SecurityGroupRuleVO in project cloudstack by apache.
the class TaggedResourceManagerImpl method getAccountDomain.
private Pair<Long, Long> getAccountDomain(long resourceId, ResourceObjectType resourceType) {
Class<?> clazz = s_typeMap.get(resourceType);
Object entity = _entityMgr.findById(clazz, resourceId);
Long accountId = null;
Long domainId = null;
// if the resource type is a security group rule, get the accountId and domainId from the security group itself
if (resourceType == ResourceObjectType.SecurityGroupRule) {
SecurityGroupRuleVO rule = (SecurityGroupRuleVO) entity;
Object SecurityGroup = _entityMgr.findById(s_typeMap.get(ResourceObjectType.SecurityGroup), rule.getSecurityGroupId());
accountId = ((SecurityGroupVO) SecurityGroup).getAccountId();
domainId = ((SecurityGroupVO) SecurityGroup).getDomainId();
}
if (entity instanceof OwnedBy) {
accountId = ((OwnedBy) entity).getAccountId();
}
if (entity instanceof PartOf) {
domainId = ((PartOf) entity).getDomainId();
}
if (accountId == null) {
accountId = Account.ACCOUNT_ID_SYSTEM;
}
if ((domainId == null) || ((accountId != null) && (domainId.longValue() == -1))) {
domainId = _accountDao.getDomainIdForGivenAccountId(accountId);
}
return new Pair<Long, Long>(accountId, domainId);
}
Aggregations