Fix listImageStores to only list store with Image role, excluding those

cache stores since they are also stored in image_store table.
This commit is contained in:
Min Chen 2013-05-09 21:43:52 -07:00
parent f965e2d892
commit 6f4fcf741c
3 changed files with 10 additions and 2 deletions

View File

@ -31,5 +31,5 @@ public interface ImageStoreDao extends GenericDao<ImageStoreVO, Long> {
public List<ImageStoreVO> findByProvider(String provider);
public List<ImageStoreVO> findByScope(ZoneScope scope);
public List<ImageStoreVO> findImageCacheByScope(ZoneScope scope);
public List<ImageStoreVO> listImageStores();
}

View File

@ -92,7 +92,7 @@ public class ImageStoreProviderManagerImpl implements ImageStoreProviderManager
@Override
public List<DataStore> listImageStores() {
List<ImageStoreVO> stores = dataStoreDao.listAll();
List<ImageStoreVO> stores = dataStoreDao.listImageStores();
List<DataStore> imageStores = new ArrayList<DataStore>();
for (ImageStoreVO store : stores) {
imageStores.add(getImageStore(store.getId()));

View File

@ -96,4 +96,12 @@ public class ImageStoreDaoImpl extends GenericDaoBase<ImageStoreVO, Long> implem
return listBy(sc);
}
@Override
public List<ImageStoreVO> listImageStores() {
SearchCriteria<ImageStoreVO> sc = createSearchCriteria();
sc.addAnd("role", SearchCriteria.Op.EQ, DataStoreRole.Image);
return listBy(sc);
}
}