use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.
the class CatalogCategoryMapper method map.
public static CatalogCategoryRestRep map(CatalogCategory from) {
if (from == null) {
return null;
}
CatalogCategoryRestRep to = new CatalogCategoryRestRep();
mapDataObjectFields(from, to);
if (from.getTenant() != null) {
to.setTenant(toRelatedResource(ResourceTypeEnum.TENANT, uri(from.getTenant())));
}
if (from.getCatalogCategoryId() != null && isParent(from.getCatalogCategoryId()) == false) {
to.setCatalogCategory(toRelatedResource(ResourceTypeEnum.CATALOG_CATEGORY, from.getCatalogCategoryId().getURI()));
}
to.setTitle(from.getTitle());
to.setDescription(from.getDescription());
to.setImage(from.getImage());
to.setSortedIndex(from.getSortedIndex());
to.setVersion(from.getVersion());
return to;
}
use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.
the class EditCatalog method createServiceFromBase.
public static void createServiceFromBase(String baseService) {
CatalogCategoryRestRep parentCategory = CatalogCategoryUtils.getRootCategory();
ServiceForm service = new ServiceForm();
service.owningCategoryId = getId(parentCategory);
service.fromId = service.owningCategoryId;
service.baseService = baseService;
edit(service);
}
use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.
the class EditCatalog method moveUpCategory.
public static void moveUpCategory(String id) {
CatalogCategoryRestRep catalogCategory = CatalogCategoryUtils.getCatalogCategory(uri(id));
CatalogCategoryUtils.moveUpCategory(catalogCategory.getId());
categories(catalogCategory.getCatalogCategory().getId().toString());
}
use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.
the class EditCatalog method deleteCategory.
public static void deleteCategory(String categoryId) {
CatalogCategoryRestRep category = CatalogCategoryUtils.getCatalogCategory(uri(categoryId));
String title = category.getTitle();
String parentId = getParentId(category.getCatalogCategory());
CatalogCategoryUtils.deleteCatalogCategory(category.getId());
catalogUpdated(parentId, "Category deleted: %s", title);
}
use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.
the class CatalogApi method getCategoryOrService.
private static DataObjectRestRep getCategoryOrService(CatalogCategoryRestRep category, String subPath) {
if (category != null) {
List<CatalogServiceRestRep> catalogServices = CatalogServiceUtils.getCatalogServices(category);
for (CatalogServiceRestRep catalogService : catalogServices) {
if (StringUtils.equalsIgnoreCase(subPath, catalogService.getName())) {
return catalogService;
}
}
List<CatalogCategoryRestRep> subCatalogCategories = CatalogCategoryUtils.getCatalogCategories(category);
for (CatalogCategoryRestRep subCatalogCategory : subCatalogCategories) {
if (StringUtils.equalsIgnoreCase(subPath, subCatalogCategory.getName())) {
return subCatalogCategory;
}
}
}
return null;
}
Aggregations