use of com.emc.vipr.model.catalog.CatalogImageRestRep in project coprhd-controller by CoprHD.
the class CatalogImages method save.
private static CatalogImageRestRep save(String id, String name, File file) {
CatalogImageRestRep catalogImage = null;
if (StringUtils.isNotBlank(id)) {
CatalogImageUpdateParam updateParam = new CatalogImageUpdateParam();
writeCommon(name, file, updateParam);
catalogImage = CatalogImageUtils.updateCatalogImage(uri(id), updateParam);
} else {
CatalogImageCreateParam createParam = new CatalogImageCreateParam();
createParam.setTenant(uri(Models.currentAdminTenant()));
writeCommon(name, file, createParam);
catalogImage = CatalogImageUtils.createCatalogImage(createParam);
}
return catalogImage;
}
use of com.emc.vipr.model.catalog.CatalogImageRestRep in project coprhd-controller by CoprHD.
the class EditCatalog method loadImageOptions.
private static List<Option> loadImageOptions() {
VirtualFile imageDir = Play.getVirtualFile("public/img/serviceCatalog");
List<Option> images = Lists.newArrayList();
for (VirtualFile f : imageDir.list()) {
String label = f.getName().replaceAll("(icon_|.png)", "");
images.add(new Option(f.getName(), label));
}
for (CatalogImageRestRep image : CatalogImageUtils.getCatalogImages()) {
String filename = StringUtils.substringBeforeLast(image.getName(), ".");
images.add(new Option(image.getId().toString(), filename));
}
Collections.sort(images, new BeanComparator("value", new StringComparator(false)));
return images;
}
Aggregations