@Override public PortForwardingRuleVO findByIdAndIp(long id, String secondaryIp) { SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create(); sc.setParameters("id", id); sc.setParameters("dstIp", secondaryIp); return findOneBy(sc); } }
@Override public List<PortForwardingRuleVO> listByDestIpAddr(String ip4Address) { SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create(); sc.setParameters("dstIp", ip4Address); return listBy(sc); }
protected PortForwardingRulesDaoImpl() { super(); AllFieldsSearch = createSearchBuilder(); AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ); AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ); AllFieldsSearch.done(); ApplicationSearch = createSearchBuilder(); ApplicationSearch.and("ipId", ApplicationSearch.entity().getSourceIpAddressId(), Op.EQ); ApplicationSearch.and("state", ApplicationSearch.entity().getState(), Op.NEQ); ApplicationSearch.done(); ActiveRulesSearch = createSearchBuilder(); ActiveRulesSearch.and("ipId", ActiveRulesSearch.entity().getSourceIpAddressId(), Op.EQ); ActiveRulesSearch.and("networkId", ActiveRulesSearch.entity().getNetworkId(), Op.EQ); ActiveRulesSearch.done(); AllRulesSearchByVM = createSearchBuilder(); AllRulesSearchByVM.and("vmId", AllRulesSearchByVM.entity().getVirtualMachineId(), Op.EQ); AllRulesSearchByVM.and("purpose", AllRulesSearchByVM.entity().getPurpose(), Op.EQ); AllRulesSearchByVM.done(); ActiveRulesSearchByAccount = createSearchBuilder(); ActiveRulesSearchByAccount.and("accountId", ActiveRulesSearchByAccount.entity().getAccountId(), Op.EQ); ActiveRulesSearchByAccount.and("state", ActiveRulesSearchByAccount.entity().getState(), Op.NEQ);
@Override public List<PortForwardingRuleVO> listByNetworkAndDestIpAddr(String ip4Address, long networkId) { SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create(); sc.setParameters("dstIp", ip4Address); sc.setParameters("networkId", networkId); return listBy(sc); }
@Override public List<PortForwardingRuleVO> listByIp(long ipId) { SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create(); sc.setParameters("ipId", ipId); sc.setParameters("purpose", Purpose.PortForwarding); return listBy(sc, null); }
@Override public List<PortForwardingRuleVO> listByVm(Long vmId) { SearchCriteria<PortForwardingRuleVO> sc = AllRulesSearchByVM.create(); sc.setParameters("vmId", vmId); sc.setParameters("purpose", Purpose.PortForwarding); return listBy(sc, null); }
@Override public List<PortForwardingRuleVO> listByNetwork(long networkId) { SearchCriteria<PortForwardingRuleVO> sc = AllFieldsSearch.create(); sc.setParameters("networkId", networkId); sc.setParameters("purpose", Purpose.PortForwarding); return listBy(sc); }
@Override public List<PortForwardingRuleVO> listForApplication(long ipId) { SearchCriteria<PortForwardingRuleVO> sc = ApplicationSearch.create(); sc.setParameters("ipId", ipId); sc.setParameters("state", State.Staged); sc.setParameters("purpose", Purpose.PortForwarding); return listBy(sc, null); }
@Override public List<PortForwardingRuleVO> listByIpAndNotRevoked(long ipId) { SearchCriteria<PortForwardingRuleVO> sc = ActiveRulesSearch.create(); sc.setParameters("ipId", ipId); sc.setParameters("state", State.Revoke); sc.setParameters("purpose", Purpose.PortForwarding); return listBy(sc, null); }
@Override public List<PortForwardingRuleVO> listByAccount(long accountId) { SearchCriteria<PortForwardingRuleVO> sc = ActiveRulesSearchByAccount.create(); sc.setParameters("accountId", accountId); sc.setParameters("state", State.Revoke); sc.setParameters("purpose", Purpose.PortForwarding); return listBy(sc); }
@Override public List<PortForwardingRuleVO> listByNetworkAndNotRevoked(long networkId) { SearchCriteria<PortForwardingRuleVO> sc = ActiveRulesSearch.create(); sc.setParameters("networkId", networkId); sc.setParameters("state", State.Revoke); sc.setParameters("purpose", Purpose.PortForwarding); return listBy(sc, null); }