eliminating use of multiple variables; using the same var for all protocols (denoting ports for tcp/udp and type/code for icmp)

This commit is contained in:
abhishek 2011-01-11 14:18:19 -08:00
parent 2e84e9fc92
commit e28882b8ee

View File

@ -613,21 +613,21 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager, SecurityG
return null;
}
}
IngressRuleVO ingressRule = _ingressRuleDao.findByProtoPortsAndAllowedGroupId(securityGroup.getId(), protocol, startPort != null ? startPort : startPortOrType, endPort != null ? endPort : endPortOrCode, ngVO.getId());
IngressRuleVO ingressRule = _ingressRuleDao.findByProtoPortsAndAllowedGroupId(securityGroup.getId(), protocol, startPortOrType, endPortOrCode, ngVO.getId());
if (ingressRule != null) {
continue; //rule already exists.
}
ingressRule = new IngressRuleVO(securityGroup.getId(), startPort != null ? startPort : startPortOrType, endPort != null ? endPort : endPortOrCode, protocol, ngVO.getId(), ngVO.getName(), ngVO.getAccountName());
ingressRule = new IngressRuleVO(securityGroup.getId(), startPortOrType, endPortOrCode, protocol, ngVO.getId(), ngVO.getName(), ngVO.getAccountName());
ingressRule = _ingressRuleDao.persist(ingressRule);
newRules.add(ingressRule);
}
if(cidrList != null) {
for (String cidr: cidrList) {
IngressRuleVO ingressRule = _ingressRuleDao.findByProtoPortsAndCidr(securityGroup.getId(),protocol, startPort != null ? startPort : startPortOrType, endPort != null ? endPort : endPortOrCode, cidr);
IngressRuleVO ingressRule = _ingressRuleDao.findByProtoPortsAndCidr(securityGroup.getId(),protocol, startPortOrType, endPortOrCode, cidr);
if (ingressRule != null) {
continue;
}
ingressRule = new IngressRuleVO(securityGroup.getId(), startPort != null ? startPort : startPortOrType, endPort != null ? endPort : endPortOrCode, protocol, cidr);
ingressRule = new IngressRuleVO(securityGroup.getId(), startPortOrType, endPortOrCode, protocol, cidr);
ingressRule = _ingressRuleDao.persist(ingressRule);
newRules.add(ingressRule);
}