From 7cc8087fa6df13d61eb4c7b71722ec09832e5686 Mon Sep 17 00:00:00 2001 From: abhishek Date: Tue, 19 Oct 2010 14:42:09 -0700 Subject: [PATCH] bug 6361: more name changes from network group to security group --- ...RulesVO.java => SecurityGroupRulesVO.java} | 6 +- ...upWorkVO.java => SecurityGroupWorkVO.java} | 6 +- .../security/dao/NetworkGroupRulesDao.java | 10 ++-- .../dao/NetworkGroupRulesDaoImpl.java | 24 ++++---- .../security/dao/NetworkGroupWorkDao.java | 14 ++--- .../security/dao/NetworkGroupWorkDaoImpl.java | 58 +++++++++---------- .../api/commands/ListNetworkGroupsCmd.java | 4 +- .../AuthorizeNetworkGroupIngressExecutor.java | 6 +- .../executor/NetworkGroupResultObject.java | 6 +- .../security/SecurityGroupListener.java | 2 +- .../security/SecurityGroupManager.java | 2 +- .../security/SecurityGroupManagerImpl.java | 28 ++++----- 12 files changed, 83 insertions(+), 83 deletions(-) rename core/src/com/cloud/network/security/{NetworkGroupRulesVO.java => SecurityGroupRulesVO.java} (87%) rename core/src/com/cloud/network/security/{NetworkGroupWorkVO.java => SecurityGroupWorkVO.java} (95%) diff --git a/core/src/com/cloud/network/security/NetworkGroupRulesVO.java b/core/src/com/cloud/network/security/SecurityGroupRulesVO.java similarity index 87% rename from core/src/com/cloud/network/security/NetworkGroupRulesVO.java rename to core/src/com/cloud/network/security/SecurityGroupRulesVO.java index cffd84eed42..6f01ecc020a 100644 --- a/core/src/com/cloud/network/security/NetworkGroupRulesVO.java +++ b/core/src/com/cloud/network/security/SecurityGroupRulesVO.java @@ -13,7 +13,7 @@ import javax.persistence.Table; @Table(name=("network_group")) @SecondaryTable(name="network_ingress_rule", join="left", pkJoinColumns={@PrimaryKeyJoinColumn(name="id", referencedColumnName="network_group_id")}) -public class NetworkGroupRulesVO { +public class SecurityGroupRulesVO { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") @@ -58,9 +58,9 @@ public class NetworkGroupRulesVO { @Column(name="allowed_ip_cidr", table="network_ingress_rule", insertable=false, updatable=false, nullable=true) private String allowedSourceIpCidr = null; - public NetworkGroupRulesVO() { } + public SecurityGroupRulesVO() { } - public NetworkGroupRulesVO(Long id, String name, String description, Long domainId, Long accountId, String accountName, Long ruleId, int startPort, int endPort, String protocol, Long allowedNetworkId, String allowedNetworkGroup, String allowedNetGrpAcct, String allowedSourceIpCidr) { + public SecurityGroupRulesVO(Long id, String name, String description, Long domainId, Long accountId, String accountName, Long ruleId, int startPort, int endPort, String protocol, Long allowedNetworkId, String allowedNetworkGroup, String allowedNetGrpAcct, String allowedSourceIpCidr) { this.id = id; this.name = name; this.description = description; diff --git a/core/src/com/cloud/network/security/NetworkGroupWorkVO.java b/core/src/com/cloud/network/security/SecurityGroupWorkVO.java similarity index 95% rename from core/src/com/cloud/network/security/NetworkGroupWorkVO.java rename to core/src/com/cloud/network/security/SecurityGroupWorkVO.java index 4f58478345c..e95031e8aac 100644 --- a/core/src/com/cloud/network/security/NetworkGroupWorkVO.java +++ b/core/src/com/cloud/network/security/SecurityGroupWorkVO.java @@ -34,7 +34,7 @@ import com.cloud.utils.db.GenericDao; @Entity @Table(name="op_nwgrp_work") -public class NetworkGroupWorkVO { +public class SecurityGroupWorkVO { public enum Step { Scheduled, Processing, @@ -70,7 +70,7 @@ public class NetworkGroupWorkVO { private Long logsequenceNumber = null; - protected NetworkGroupWorkVO() { + protected SecurityGroupWorkVO() { } public Long getId() { @@ -97,7 +97,7 @@ public class NetworkGroupWorkVO { - public NetworkGroupWorkVO(Long instanceId, Long serverId, Date created, + public SecurityGroupWorkVO(Long instanceId, Long serverId, Date created, Step step, Date dateTaken) { super(); this.instanceId = instanceId; diff --git a/core/src/com/cloud/network/security/dao/NetworkGroupRulesDao.java b/core/src/com/cloud/network/security/dao/NetworkGroupRulesDao.java index cf632b88bfb..6c7c09b19fd 100644 --- a/core/src/com/cloud/network/security/dao/NetworkGroupRulesDao.java +++ b/core/src/com/cloud/network/security/dao/NetworkGroupRulesDao.java @@ -2,28 +2,28 @@ package com.cloud.network.security.dao; import java.util.List; -import com.cloud.network.security.NetworkGroupRulesVO; +import com.cloud.network.security.SecurityGroupRulesVO; import com.cloud.utils.db.GenericDao; -public interface NetworkGroupRulesDao extends GenericDao { +public interface NetworkGroupRulesDao extends GenericDao { /** * List a network group and associated ingress rules * @param accountId the account id of the owner of the network group * @param groupName the name of the group for which to list rules * @return the list of ingress rules associated with the network group (and network group info) */ - List listNetworkGroupRules(long accountId, String groupName); + List listNetworkGroupRules(long accountId, String groupName); /** * List network groups and associated ingress rules * @param accountId the id of the account for which to list groups and associated rules * @return the list of network groups with associated ingress rules */ - List listNetworkGroupRules(long accountId); + List listNetworkGroupRules(long accountId); /** * List all network groups and associated ingress rules * @return the list of network groups with associated ingress rules */ - List listNetworkGroupRules(); + List listNetworkGroupRules(); } diff --git a/core/src/com/cloud/network/security/dao/NetworkGroupRulesDaoImpl.java b/core/src/com/cloud/network/security/dao/NetworkGroupRulesDaoImpl.java index 87c8ca52664..eeb1b71643c 100644 --- a/core/src/com/cloud/network/security/dao/NetworkGroupRulesDaoImpl.java +++ b/core/src/com/cloud/network/security/dao/NetworkGroupRulesDaoImpl.java @@ -4,16 +4,16 @@ import java.util.List; import javax.ejb.Local; -import com.cloud.network.security.NetworkGroupRulesVO; +import com.cloud.network.security.SecurityGroupRulesVO; import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; @Local(value={NetworkGroupRulesDao.class}) -public class NetworkGroupRulesDaoImpl extends GenericDaoBase implements NetworkGroupRulesDao { - private SearchBuilder AccountGroupNameSearch; - private SearchBuilder AccountSearch; +public class NetworkGroupRulesDaoImpl extends GenericDaoBase implements NetworkGroupRulesDao { + private SearchBuilder AccountGroupNameSearch; + private SearchBuilder AccountSearch; protected NetworkGroupRulesDaoImpl() { AccountGroupNameSearch = createSearchBuilder(); @@ -27,16 +27,16 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase listNetworkGroupRules() { - Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, null, null); + public List listNetworkGroupRules() { + Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null); return listAll(searchFilter); } @Override - public List listNetworkGroupRules(long accountId, String groupName) { - Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, null, null); + public List listNetworkGroupRules(long accountId, String groupName) { + Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null); - SearchCriteria sc = AccountGroupNameSearch.create(); + SearchCriteria sc = AccountGroupNameSearch.create(); sc.setParameters("accountId", accountId); sc.setParameters("name", groupName); @@ -44,9 +44,9 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase listNetworkGroupRules(long accountId) { - Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, null, null); - SearchCriteria sc = AccountSearch.create(); + public List listNetworkGroupRules(long accountId) { + Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null); + SearchCriteria sc = AccountSearch.create(); sc.setParameters("accountId", accountId); return listBy(sc, searchFilter); diff --git a/core/src/com/cloud/network/security/dao/NetworkGroupWorkDao.java b/core/src/com/cloud/network/security/dao/NetworkGroupWorkDao.java index 8eda8a0a95b..64429ba6c61 100644 --- a/core/src/com/cloud/network/security/dao/NetworkGroupWorkDao.java +++ b/core/src/com/cloud/network/security/dao/NetworkGroupWorkDao.java @@ -21,17 +21,17 @@ package com.cloud.network.security.dao; import java.util.Date; import java.util.List; -import com.cloud.network.security.NetworkGroupWorkVO; -import com.cloud.network.security.NetworkGroupWorkVO.Step; +import com.cloud.network.security.SecurityGroupWorkVO; +import com.cloud.network.security.SecurityGroupWorkVO.Step; import com.cloud.utils.db.GenericDao; -public interface NetworkGroupWorkDao extends GenericDao { - NetworkGroupWorkVO findByVmId(long vmId, boolean taken); +public interface NetworkGroupWorkDao extends GenericDao { + SecurityGroupWorkVO findByVmId(long vmId, boolean taken); - NetworkGroupWorkVO findByVmIdStep(long vmId, Step step); + SecurityGroupWorkVO findByVmIdStep(long vmId, Step step); - NetworkGroupWorkVO take(long serverId); + SecurityGroupWorkVO take(long serverId); void updateStep(Long vmId, Long logSequenceNumber, Step done); @@ -39,7 +39,7 @@ public interface NetworkGroupWorkDao extends GenericDao findUnfinishedWork(Date timeBefore); + List findUnfinishedWork(Date timeBefore); } diff --git a/core/src/com/cloud/network/security/dao/NetworkGroupWorkDaoImpl.java b/core/src/com/cloud/network/security/dao/NetworkGroupWorkDaoImpl.java index 75b2d2ec370..fa8adc0f59a 100644 --- a/core/src/com/cloud/network/security/dao/NetworkGroupWorkDaoImpl.java +++ b/core/src/com/cloud/network/security/dao/NetworkGroupWorkDaoImpl.java @@ -24,8 +24,8 @@ import java.util.List; import javax.ejb.Local; import com.cloud.ha.WorkVO; -import com.cloud.network.security.NetworkGroupWorkVO; -import com.cloud.network.security.NetworkGroupWorkVO.Step; +import com.cloud.network.security.SecurityGroupWorkVO; +import com.cloud.network.security.SecurityGroupWorkVO.Step; import com.cloud.utils.db.Filter; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; @@ -35,13 +35,13 @@ import com.cloud.utils.db.SearchCriteria.Op; import com.cloud.utils.exception.CloudRuntimeException; @Local(value={NetworkGroupWorkDao.class}) -public class NetworkGroupWorkDaoImpl extends GenericDaoBase implements NetworkGroupWorkDao { - private SearchBuilder VmIdTakenSearch; - private SearchBuilder VmIdSeqNumSearch; - private SearchBuilder VmIdUnTakenSearch; - private SearchBuilder UntakenWorkSearch; - private SearchBuilder VmIdStepSearch; - private SearchBuilder CleanupSearch; +public class NetworkGroupWorkDaoImpl extends GenericDaoBase implements NetworkGroupWorkDao { + private SearchBuilder VmIdTakenSearch; + private SearchBuilder VmIdSeqNumSearch; + private SearchBuilder VmIdUnTakenSearch; + private SearchBuilder UntakenWorkSearch; + private SearchBuilder VmIdStepSearch; + private SearchBuilder CleanupSearch; protected NetworkGroupWorkDaoImpl() { @@ -86,29 +86,29 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase sc = taken?VmIdTakenSearch.create():VmIdUnTakenSearch.create(); + public SecurityGroupWorkVO findByVmId(long vmId, boolean taken) { + SearchCriteria sc = taken?VmIdTakenSearch.create():VmIdUnTakenSearch.create(); sc.setParameters("vmId", vmId); return findOneIncludingRemovedBy(sc); } @Override - public NetworkGroupWorkVO take(long serverId) { + public SecurityGroupWorkVO take(long serverId) { final Transaction txn = Transaction.currentTxn(); try { - final SearchCriteria sc = UntakenWorkSearch.create(); + final SearchCriteria sc = UntakenWorkSearch.create(); sc.setParameters("step", Step.Scheduled); - final Filter filter = new Filter(NetworkGroupWorkVO.class, null, true, 0l, 1l);//FIXME: order desc by update time? + final Filter filter = new Filter(SecurityGroupWorkVO.class, null, true, 0l, 1l);//FIXME: order desc by update time? txn.start(); - final List vos = lock(sc, filter, true); + final List vos = lock(sc, filter, true); if (vos.size() == 0) { txn.commit(); return null; } - NetworkGroupWorkVO work = null; - for (NetworkGroupWorkVO w: vos) { + SecurityGroupWorkVO work = null; + for (SecurityGroupWorkVO w: vos) { //ensure that there is no job in Processing state for the same VM if ( findByVmIdStep(w.getInstanceId(), Step.Processing) == null) { work = w; @@ -121,7 +121,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase sc = VmIdSeqNumSearch.create(); + SearchCriteria sc = VmIdSeqNumSearch.create(); sc.setParameters("vmId", vmId); sc.setParameters("seqno", logSequenceNumber); final Filter filter = new Filter(WorkVO.class, null, true, 0l, 1l); - final List vos = lock(sc, filter, true); + final List vos = lock(sc, filter, true); if (vos.size() == 0) { txn.commit(); return; } - NetworkGroupWorkVO work = vos.get(0); + SecurityGroupWorkVO work = vos.get(0); work.setStep(step); update(work.getId(), work); @@ -157,8 +157,8 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase sc = VmIdStepSearch.create(); + public SecurityGroupWorkVO findByVmIdStep(long vmId, Step step) { + SearchCriteria sc = VmIdStepSearch.create(); sc.setParameters("vmId", vmId); sc.setParameters("step", step); return findOneIncludingRemovedBy(sc); @@ -169,7 +169,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase sc = CleanupSearch.create(); + final SearchCriteria sc = CleanupSearch.create(); sc.setParameters("taken", timeBefore); sc.setParameters("step", Step.Done); @@ -191,14 +191,14 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase findUnfinishedWork(Date timeBefore) { - final SearchCriteria sc = CleanupSearch.create(); + public List findUnfinishedWork(Date timeBefore) { + final SearchCriteria sc = CleanupSearch.create(); sc.setParameters("taken", timeBefore); sc.setParameters("step", Step.Processing); - List result = listIncludingRemovedBy(sc); + List result = listIncludingRemovedBy(sc); - NetworkGroupWorkVO work = createForUpdate(); + SecurityGroupWorkVO work = createForUpdate(); work.setStep(Step.Error); update(work, sc); diff --git a/server/src/com/cloud/api/commands/ListNetworkGroupsCmd.java b/server/src/com/cloud/api/commands/ListNetworkGroupsCmd.java index 3e489e0e54f..d4fa13e85cb 100644 --- a/server/src/com/cloud/api/commands/ListNetworkGroupsCmd.java +++ b/server/src/com/cloud/api/commands/ListNetworkGroupsCmd.java @@ -32,7 +32,7 @@ import com.cloud.api.response.ListResponse; import com.cloud.api.response.NetworkGroupResponse; import com.cloud.async.executor.IngressRuleResultObject; import com.cloud.async.executor.NetworkGroupResultObject; -import com.cloud.network.security.NetworkGroupRulesVO; +import com.cloud.network.security.SecurityGroupRulesVO; @Implementation(method="searchForNetworkGroupRules", manager=Manager.NetworkGroupManager) public class ListNetworkGroupsCmd extends BaseListCmd { @@ -87,7 +87,7 @@ public class ListNetworkGroupsCmd extends BaseListCmd { @Override @SuppressWarnings("unchecked") public ListResponse getResponse() { - List networkGroups = (List)getResponseObject(); + List networkGroups = (List)getResponseObject(); List groupResultObjs = NetworkGroupResultObject.transposeNetworkGroups(networkGroups); ListResponse response = new ListResponse(); diff --git a/server/src/com/cloud/async/executor/AuthorizeNetworkGroupIngressExecutor.java b/server/src/com/cloud/async/executor/AuthorizeNetworkGroupIngressExecutor.java index a9b070ca62e..fedf75882a1 100644 --- a/server/src/com/cloud/async/executor/AuthorizeNetworkGroupIngressExecutor.java +++ b/server/src/com/cloud/async/executor/AuthorizeNetworkGroupIngressExecutor.java @@ -11,7 +11,7 @@ import com.cloud.async.AsyncJobResult; import com.cloud.async.AsyncJobVO; import com.cloud.async.BaseAsyncJobExecutor; import com.cloud.network.security.IngressRuleVO; -import com.cloud.network.security.NetworkGroupRulesVO; +import com.cloud.network.security.SecurityGroupRulesVO; import com.cloud.network.security.NetworkGroupVO; import com.cloud.serializer.GsonHelper; import com.cloud.server.ManagementServer; @@ -67,9 +67,9 @@ public class AuthorizeNetworkGroupIngressExecutor extends BaseAsyncJobExecutor { private NetworkGroupResultObject composeResultObject(ManagementServer ms, Long accountId, String groupName, List addedRules) { NetworkGroupVO networkGroup = ms.findNetworkGroupByName(accountId, groupName); - List groupRules = new ArrayList(); + List groupRules = new ArrayList(); for (IngressRuleVO ingressRule : addedRules) { - NetworkGroupRulesVO groupRule = new NetworkGroupRulesVO(networkGroup.getId(), networkGroup.getName(), networkGroup.getDescription(), networkGroup.getDomainId(), + SecurityGroupRulesVO groupRule = new SecurityGroupRulesVO(networkGroup.getId(), networkGroup.getName(), networkGroup.getDescription(), networkGroup.getDomainId(), networkGroup.getAccountId(), networkGroup.getAccountName(), ingressRule.getId(), ingressRule.getStartPort(), ingressRule.getEndPort(), ingressRule.getProtocol(), ingressRule.getAllowedNetworkId(), ingressRule.getAllowedNetworkGroup(), ingressRule.getAllowedNetGrpAcct(), ingressRule.getAllowedSourceIpCidr()); diff --git a/server/src/com/cloud/async/executor/NetworkGroupResultObject.java b/server/src/com/cloud/async/executor/NetworkGroupResultObject.java index c14acedec44..9b8c5cd25bc 100644 --- a/server/src/com/cloud/async/executor/NetworkGroupResultObject.java +++ b/server/src/com/cloud/async/executor/NetworkGroupResultObject.java @@ -3,7 +3,7 @@ package com.cloud.async.executor; import java.util.ArrayList; import java.util.List; -import com.cloud.network.security.NetworkGroupRulesVO; +import com.cloud.network.security.SecurityGroupRulesVO; import com.cloud.serializer.Param; public class NetworkGroupResultObject { @@ -96,7 +96,7 @@ public class NetworkGroupResultObject { this.ingressRules = ingressRules; } - public static List transposeNetworkGroups(List groups) { + public static List transposeNetworkGroups(List groups) { List resultObjects = new ArrayList(); if ((groups != null) && !groups.isEmpty()) { @@ -104,7 +104,7 @@ public class NetworkGroupResultObject { NetworkGroupResultObject currentGroup = null; List processedGroups = new ArrayList(); - for (NetworkGroupRulesVO netGroupRule : groups) { + for (SecurityGroupRulesVO netGroupRule : groups) { Long groupId = netGroupRule.getId(); if (!processedGroups.contains(groupId)) { processedGroups.add(groupId); diff --git a/server/src/com/cloud/network/security/SecurityGroupListener.java b/server/src/com/cloud/network/security/SecurityGroupListener.java index 6467a7807dc..01fc623e489 100644 --- a/server/src/com/cloud/network/security/SecurityGroupListener.java +++ b/server/src/com/cloud/network/security/SecurityGroupListener.java @@ -34,7 +34,7 @@ import com.cloud.agent.api.PingRoutingWithNwGroupsCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.host.HostVO; import com.cloud.host.Status; -import com.cloud.network.security.NetworkGroupWorkVO.Step; +import com.cloud.network.security.SecurityGroupWorkVO.Step; import com.cloud.network.security.dao.NetworkGroupWorkDao; /** diff --git a/server/src/com/cloud/network/security/SecurityGroupManager.java b/server/src/com/cloud/network/security/SecurityGroupManager.java index 0ab536c467c..0dea5928f6d 100644 --- a/server/src/com/cloud/network/security/SecurityGroupManager.java +++ b/server/src/com/cloud/network/security/SecurityGroupManager.java @@ -70,7 +70,7 @@ public interface SecurityGroupManager extends Manager { * The search terms are specified in the search criteria. * @return the list of network groups and associated ingress rules */ - public List searchForNetworkGroupRules(ListNetworkGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException; + public List searchForNetworkGroupRules(ListNetworkGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException; public void fullSync(long agentId, HashMap> newGroupStates); diff --git a/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java b/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java index 111aaf29428..99c9d2d15b6 100644 --- a/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java +++ b/server/src/com/cloud/network/security/SecurityGroupManagerImpl.java @@ -57,7 +57,7 @@ import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; import com.cloud.exception.ResourceInUseException; -import com.cloud.network.security.NetworkGroupWorkVO.Step; +import com.cloud.network.security.SecurityGroupWorkVO.Step; import com.cloud.network.security.dao.IngressRuleDao; import com.cloud.network.security.dao.NetworkGroupDao; import com.cloud.network.security.dao.NetworkGroupRulesDao; @@ -319,7 +319,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager { Transaction txn = Transaction.currentTxn(); txn.start(); VmRulesetLogVO log = null; - NetworkGroupWorkVO work = null; + SecurityGroupWorkVO work = null; UserVm vm = null; try { vm = _userVMDao.acquire(vmId); @@ -339,7 +339,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager { } work = _workDao.findByVmIdStep(vmId, Step.Scheduled); if (work == null) { - work = new NetworkGroupWorkVO(vmId, null, null, NetworkGroupWorkVO.Step.Scheduled, null); + work = new SecurityGroupWorkVO(vmId, null, null, SecurityGroupWorkVO.Step.Scheduled, null); work = _workDao.persist(work); } @@ -998,7 +998,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager { if (s_logger.isTraceEnabled()) { s_logger.trace("Checking the database"); } - final NetworkGroupWorkVO work = _workDao.take(_serverId); + final SecurityGroupWorkVO work = _workDao.take(_serverId); if (work == null) { return; } @@ -1192,7 +1192,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager { } @Override - public List searchForNetworkGroupRules(ListNetworkGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException { + public List searchForNetworkGroupRules(ListNetworkGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException { Account account = (Account)UserContext.current().getAccountObject(); Long domainId = cmd.getDomainId(); String accountName = cmd.getAccountName(); @@ -1250,10 +1250,10 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager { } } - Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal()); + Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal()); Object keyword = cmd.getKeyword(); - SearchBuilder sb = _networkGroupRulesDao.createSearchBuilder(); + SearchBuilder sb = _networkGroupRulesDao.createSearchBuilder(); sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ); sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ); sb.and("domainId", sb.entity().getDomainId(), SearchCriteria.Op.EQ); @@ -1265,13 +1265,13 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager { sb.join("domainSearch", domainSearch, sb.entity().getDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER); } - SearchCriteria sc = sb.create(); + SearchCriteria sc = sb.create(); if (accountId != null) { sc.setParameters("accountId", accountId); if (networkGroup != null) { sc.setParameters("name", networkGroup); } else if (keyword != null) { - SearchCriteria ssc = _networkGroupRulesDao.createSearchCriteria(); + SearchCriteria ssc = _networkGroupRulesDao.createSearchCriteria(); ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%"); ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%"); sc.addAnd("name", SearchCriteria.Op.SC, ssc); @@ -1290,13 +1290,13 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager { return _networkGroupRulesDao.search(sc, searchFilter); } - private List listNetworkGroupRulesByVM(long vmId) { - List results = new ArrayList(); + private List listNetworkGroupRulesByVM(long vmId) { + List results = new ArrayList(); List networkGroupMappings = _networkGroupVMMapDao.listByInstanceId(vmId); if (networkGroupMappings != null) { for (NetworkGroupVMMapVO networkGroupMapping : networkGroupMappings) { NetworkGroupVO group = _networkGroupDao.findById(networkGroupMapping.getNetworkGroupId()); - List rules = _networkGroupRulesDao.listNetworkGroupRules(group.getAccountId(), networkGroupMapping.getGroupName()); + List rules = _networkGroupRulesDao.listNetworkGroupRules(group.getAccountId(), networkGroupMapping.getGroupName()); if (rules != null) { results.addAll(rules); } @@ -1337,11 +1337,11 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager { private void cleanupUnfinishedWork() { Date before = new Date(System.currentTimeMillis() - 30*1000l); - List unfinished = _workDao.findUnfinishedWork(before); + List unfinished = _workDao.findUnfinishedWork(before); if (unfinished.size() > 0) { s_logger.info("Network Group Work cleanup found " + unfinished.size() + " unfinished work items older than " + before.toString()); Set affectedVms = new HashSet(); - for (NetworkGroupWorkVO work: unfinished) { + for (SecurityGroupWorkVO work: unfinished) { affectedVms.add(work.getInstanceId()); } scheduleRulesetUpdateToHosts(affectedVms, false, null);