use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogBuilder method clearCategory.
public void clearCategory(CatalogCategory category) {
models.delete(models.catalogServices().findByCatalogCategory(category.getId()));
List<CatalogCategory> children = models.catalogCategories().findSubCatalogCategories(category.getId());
for (CatalogCategory child : children) {
clearCategory(child);
}
models.delete(category);
}
use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogCategoryManagerImpl method upgradeCatalog.
public void upgradeCatalog(URI tenantId) throws IOException {
CatalogCategory rootCategory = getOrCreateRootCategory(tenantId);
com.emc.sa.catalog.CategoryDef newCatalog = CatalogBuilder.readCatalogDef(getDefaultCatalog());
log.info(String.format("Updating Service catalog for tenant %s", tenantId));
upgradeCategory(rootCategory, newCatalog);
rootCategory.setVersion(newCatalog.version);
client.save(rootCategory);
}
use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogCategoryManagerImpl method createCategory.
private CatalogCategory createCategory(String tenant, CategoryDef def, CatalogCategory parentCategory) {
CatalogBuilder builder = new CatalogBuilder(client, serviceDescriptors);
NamedURI namedUri = new NamedURI(parentCategory.getId(), parentCategory.getLabel());
CatalogCategory newCategory = builder.createCategory(tenant, def, namedUri);
newCategory.setSortedIndex(null);
client.save(newCategory);
return newCategory;
}
use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogCategoryManagerImpl method deleteCategoryContents.
private void deleteCategoryContents(CatalogCategory catalogCategory) {
List<CatalogCategory> categories = getSubCategories(catalogCategory.getId());
for (CatalogCategory subCategory : categories) {
deleteCatalogCategory(subCategory);
}
List<CatalogService> services = catalogServiceManager.getCatalogServices(catalogCategory.getId());
for (CatalogService service : services) {
catalogServiceManager.deleteCatalogService(service);
}
}
use of com.emc.storageos.db.client.model.uimodels.CatalogCategory in project coprhd-controller by CoprHD.
the class CatalogServiceManagerImpl method deleteCatalogService.
public void deleteCatalogService(CatalogService catalogService) {
CatalogCategory parentCatalogCategory = catalogCategoryManager.getCatalogCategoryById(catalogService.getCatalogCategoryId().getURI());
URI tenantId = uri(parentCatalogCategory.getTenant());
if (isServiceUsedForOrders(tenantId, catalogService)) {
URI deletedCategoryURI = URI.create(CatalogCategory.DELETED_CATEGORY);
String deletedCategoryLabel = CatalogCategory.DELETED_CATEGORY;
catalogService.setCatalogCategoryId(new NamedURI(deletedCategoryURI, deletedCategoryLabel));
client.save(catalogService);
} else {
List<CatalogServiceField> serviceFields = getCatalogServiceFields(catalogService.getId());
log.debug(String.format("Deleting Service Fields: %s", catalogService.getTitle()));
client.delete(serviceFields);
log.info(String.format("Deleting Service: %s", catalogService.getTitle()));
client.delete(catalogService);
}
}
Aggregations