CLOUDSTACK-1989: Without this fix you can't query service offerings

that don't have a domain id set (null).

Tested via: Called "listServiceOfferings" using a simple perl script,
once with an ID, and once without an ID specified.

Signed-off-by: Chip Childers <chip.childers@gmail.com>
This commit is contained in:
Ryan Dietrich 2013-04-12 14:00:41 +01:00 committed by Chip Childers
parent accfccd83e
commit 38df62865d
1 changed files with 5 additions and 1 deletions

View File

@ -2119,7 +2119,11 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
domainRecord = _domainDao.findById(domainRecord.getParent());
domainIds.add(domainRecord.getId());
}
sc.addAnd("domainId", SearchCriteria.Op.IN, domainIds.toArray());
SearchCriteria<ServiceOfferingJoinVO> spc = _srvOfferingJoinDao.createSearchCriteria();
spc.addOr("domainId", SearchCriteria.Op.IN, domainIds.toArray());
spc.addOr("domainId", SearchCriteria.Op.NULL);
sc.addAnd("domainId", SearchCriteria.Op.SC, spc);
// include also public offering if no keyword, name and id specified
if ( keyword == null && name == null && id == null ){