@@ -45,6 +45,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
4545 protected final SearchBuilder <DomainRouterVO > AllFieldsSearch ;
4646 protected final SearchBuilder <DomainRouterVO > IdNetworkIdStatesSearch ;
4747 protected final SearchBuilder <DomainRouterVO > HostUpSearch ;
48+ protected final SearchBuilder <DomainRouterVO > StateNetworkTypeSearch ;
4849 NetworkDaoImpl _networksDao = ComponentLocator .inject (NetworkDaoImpl .class );
4950
5051 protected DomainRouterDaoImpl () {
@@ -73,6 +74,13 @@ protected DomainRouterDaoImpl() {
7374 joinNetwork .and ("guestType" , joinNetwork .entity ().getGuestType (), Op .EQ );
7475 HostUpSearch .join ("network" , joinNetwork , joinNetwork .entity ().getId (), HostUpSearch .entity ().getNetworkId (), JoinType .INNER );
7576 HostUpSearch .done ();
77+
78+ StateNetworkTypeSearch = createSearchBuilder ();
79+ StateNetworkTypeSearch .and ("state" , StateNetworkTypeSearch .entity ().getState (), Op .EQ );
80+ SearchBuilder <NetworkVO > joinStateNetwork = _networksDao .createSearchBuilder ();
81+ joinStateNetwork .and ("guestType" , joinStateNetwork .entity ().getGuestType (), Op .EQ );
82+ StateNetworkTypeSearch .join ("network" , joinStateNetwork , joinStateNetwork .entity ().getId (), StateNetworkTypeSearch .entity ().getNetworkId (), JoinType .INNER );
83+ StateNetworkTypeSearch .done ();
7684
7785 }
7886
@@ -178,4 +186,12 @@ public List<DomainRouterVO> listActive(long networkId) {
178186 sc .setParameters ("states" , State .Running , State .Migrating , State .Stopping , State .Starting );
179187 return listBy (sc );
180188 }
189+
190+ @ Override
191+ public List <DomainRouterVO > listByStateAndNetworkType (State state , GuestIpType ipType ) {
192+ SearchCriteria <DomainRouterVO > sc = StateNetworkTypeSearch .create ();
193+ sc .setParameters ("state" , state );
194+ sc .setJoinParameters ("network" , "guestType" , ipType );
195+ return listBy (sc );
196+ }
181197}
0 commit comments