@@ -107,7 +107,8 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
107107 protected SearchBuilder <VMInstanceVO > IdsPowerStateSelectSearch ;
108108 GenericSearchBuilder <VMInstanceVO , Integer > CountByOfferingId ;
109109 GenericSearchBuilder <VMInstanceVO , Integer > CountUserVmNotInDomain ;
110- SearchBuilder <VMInstanceVO > DeleteProtectedVmSearch ;
110+ SearchBuilder <VMInstanceVO > DeleteProtectedVmSearchByAccount ;
111+ SearchBuilder <VMInstanceVO > DeleteProtectedVmSearchByDomainIds ;
111112
112113 @ Inject
113114 ResourceTagDao tagsDao ;
@@ -370,12 +371,19 @@ protected void init() {
370371 CountUserVmNotInDomain .and ("domainIdsNotIn" , CountUserVmNotInDomain .entity ().getDomainId (), Op .NIN );
371372 CountUserVmNotInDomain .done ();
372373
373- DeleteProtectedVmSearch = createSearchBuilder ();
374- DeleteProtectedVmSearch .selectFields (DeleteProtectedVmSearch .entity ().getUuid ());
375- DeleteProtectedVmSearch .and (ApiConstants .ACCOUNT_ID , DeleteProtectedVmSearch .entity ().getAccountId (), Op .EQ );
376- DeleteProtectedVmSearch .and (ApiConstants .DELETE_PROTECTION , DeleteProtectedVmSearch .entity ().isDeleteProtection (), Op .EQ );
377- DeleteProtectedVmSearch .and (ApiConstants .REMOVED , DeleteProtectedVmSearch .entity ().getRemoved (), Op .NULL );
378- DeleteProtectedVmSearch .done ();
374+ DeleteProtectedVmSearchByAccount = createSearchBuilder ();
375+ DeleteProtectedVmSearchByAccount .selectFields (DeleteProtectedVmSearchByAccount .entity ().getUuid ());
376+ DeleteProtectedVmSearchByAccount .and (ApiConstants .ACCOUNT_ID , DeleteProtectedVmSearchByAccount .entity ().getAccountId (), Op .EQ );
377+ DeleteProtectedVmSearchByAccount .and (ApiConstants .DELETE_PROTECTION , DeleteProtectedVmSearchByAccount .entity ().isDeleteProtection (), Op .EQ );
378+ DeleteProtectedVmSearchByAccount .and (ApiConstants .REMOVED , DeleteProtectedVmSearchByAccount .entity ().getRemoved (), Op .NULL );
379+ DeleteProtectedVmSearchByAccount .done ();
380+
381+ DeleteProtectedVmSearchByDomainIds = createSearchBuilder ();
382+ DeleteProtectedVmSearchByDomainIds .selectFields (DeleteProtectedVmSearchByDomainIds .entity ().getUuid ());
383+ DeleteProtectedVmSearchByDomainIds .and (ApiConstants .DOMAIN_IDS , DeleteProtectedVmSearchByDomainIds .entity ().getDomainId (), Op .IN );
384+ DeleteProtectedVmSearchByDomainIds .and (ApiConstants .DELETE_PROTECTION , DeleteProtectedVmSearchByDomainIds .entity ().isDeleteProtection (), Op .EQ );
385+ DeleteProtectedVmSearchByDomainIds .and (ApiConstants .REMOVED , DeleteProtectedVmSearchByDomainIds .entity ().getRemoved (), Op .NULL );
386+ DeleteProtectedVmSearchByDomainIds .done ();
379387 }
380388
381389 @ Override
@@ -1307,9 +1315,17 @@ public List<VMInstanceVO> listByIdsIncludingRemoved(List<Long> ids) {
13071315
13081316 @ Override
13091317 public List <VMInstanceVO > listDeleteProtectedVmsByAccountId (long accountId ) {
1310- SearchCriteria <VMInstanceVO > sc = DeleteProtectedVmSearch .create ();
1318+ SearchCriteria <VMInstanceVO > sc = DeleteProtectedVmSearchByAccount .create ();
13111319 sc .setParameters (ApiConstants .ACCOUNT_ID , accountId );
13121320 sc .setParameters (ApiConstants .DELETE_PROTECTION , true );
13131321 return listBy (sc );
13141322 }
1323+
1324+ @ Override
1325+ public List <VMInstanceVO > listDeleteProtectedVmsByDomainIds (List <Long > domainIds ) {
1326+ SearchCriteria <VMInstanceVO > sc = DeleteProtectedVmSearchByDomainIds .create ();
1327+ sc .setParameters (ApiConstants .DOMAIN_IDS , domainIds );
1328+ sc .setParameters (ApiConstants .DELETE_PROTECTION , true );
1329+ return listBy (sc );
1330+ }
13151331}
0 commit comments