use of com.emc.vipr.model.catalog.CatalogImageRestRep in project coprhd-controller by CoprHD.
the class CatalogImageMapper method map.
public static CatalogImageRestRep map(CatalogImage from) {
if (from == null) {
return null;
}
CatalogImageRestRep to = new CatalogImageRestRep();
mapDataObjectFields(from, to);
if (from.getTenant() != null) {
to.setTenant(toRelatedResource(ResourceTypeEnum.TENANT, uri(from.getTenant())));
}
to.setContentType(from.getContentType());
to.setData(from.getData());
return to;
}
use of com.emc.vipr.model.catalog.CatalogImageRestRep in project coprhd-controller by CoprHD.
the class CatalogImages method listJson.
public static void listJson() {
List<CatalogImageDataTable.ImageInfo> imageInfos = Lists.newArrayList();
List<CatalogImageRestRep> catalogImages = CatalogImageUtils.getCatalogImages();
for (CatalogImageRestRep catalogImage : catalogImages) {
imageInfos.add(new CatalogImageDataTable.ImageInfo(catalogImage));
}
renderJSON(DataTablesSupport.createJSON(imageInfos, params));
}
use of com.emc.vipr.model.catalog.CatalogImageRestRep in project coprhd-controller by CoprHD.
the class CatalogImages method saveJson.
public static void saveJson(String name, @Required File file) {
if (Validation.hasErrors()) {
List<ValidationResponse> response = ValidationResponse.collectErrors();
renderJSON(response);
}
CatalogImageRestRep image = save(null, name, file);
renderJSON(ValidationResponse.valid(image.getId().toString()));
}
use of com.emc.vipr.model.catalog.CatalogImageRestRep in project coprhd-controller by CoprHD.
the class CatalogImages method edit.
public static void edit(String id) {
CatalogImageRestRep image = CatalogImageUtils.getCatalogImage(uri(id));
String name = image.getName();
render(id, name);
}
use of com.emc.vipr.model.catalog.CatalogImageRestRep in project coprhd-controller by CoprHD.
the class CatalogImages method view.
public static void view(String id) {
CatalogImageRestRep image = CatalogImageUtils.getCatalogImage(uri(id));
String name = image.getName();
String contentType = image.getContentType();
byte[] data = image.getData();
int length = data.length;
renderBinary(new ByteArrayInputStream(data), name, length, contentType, false);
}
Aggregations