use of com.emc.vipr.model.catalog.CatalogImageList in project coprhd-controller by CoprHD.
the class CatalogImages method listByTenant.
@Override
public List<NamedRelatedResourceRep> listByTenant(URI tenantId) {
UriBuilder uriBuilder = client.uriBuilder(PathConstants.CATALOG_IMAGE_URL);
if (tenantId != null) {
uriBuilder = uriBuilder.queryParam(SearchConstants.TENANT_ID_PARAM, tenantId);
}
CatalogImageList response = client.getURI(CatalogImageList.class, uriBuilder.build());
return ResourceUtils.defaultList(response.getCatalogImages());
}
use of com.emc.vipr.model.catalog.CatalogImageList in project coprhd-controller by CoprHD.
the class CatalogImageService method getCatalogImages.
/**
* Gets the list of catalog images
*
* @param tenantId the URN of a tenant
* @brief List Catalog Images
* @return a list of catalog images
* @throws DatabaseException when a DB error occurs
*/
@GET
@Path("")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public CatalogImageList getCatalogImages(@DefaultValue("") @QueryParam(SearchConstants.TENANT_ID_PARAM) String tenantId) throws DatabaseException {
StorageOSUser user = getUserFromContext();
if (StringUtils.isBlank(tenantId)) {
tenantId = user.getTenantId();
}
verifyAuthorizedInTenantOrg(uri(tenantId), getUserFromContext());
List<CatalogImage> catalogImages = catalogImageManager.getCatalogImages(uri(tenantId));
CatalogImageList list = new CatalogImageList();
for (CatalogImage catalogImage : catalogImages) {
NamedRelatedResourceRep resourceRep = toNamedRelatedResource(ResourceTypeEnum.CATALOG_IMAGE, catalogImage.getId(), catalogImage.getLabel());
list.getCatalogImages().add(resourceRep);
}
return list;
}
Aggregations