Search in sources :

Example 26 with CatalogCategory

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);
}
Also used : CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory)

Example 27 with CatalogCategory

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);
}
Also used : CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory)

Example 28 with CatalogCategory

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;
}
Also used : NamedURI(com.emc.storageos.db.client.model.NamedURI) CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory)

Example 29 with CatalogCategory

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);
    }
}
Also used : CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory) CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService)

Example 30 with CatalogCategory

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);
    }
}
Also used : CatalogServiceField(com.emc.storageos.db.client.model.uimodels.CatalogServiceField) NamedURI(com.emc.storageos.db.client.model.NamedURI) CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI)

Aggregations

CatalogCategory (com.emc.storageos.db.client.model.uimodels.CatalogCategory)36 NamedURI (com.emc.storageos.db.client.model.NamedURI)12 CatalogCategoryMapper.createNewCatalogCategory (com.emc.sa.api.mapper.CatalogCategoryMapper.createNewCatalogCategory)9 Path (javax.ws.rs.Path)9 BaseModelTest (com.emc.sa.model.BaseModelTest)7 ModelClient (com.emc.sa.model.dao.ModelClient)7 CatalogService (com.emc.storageos.db.client.model.uimodels.CatalogService)7 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)7 URI (java.net.URI)7 Consumes (javax.ws.rs.Consumes)7 Produces (javax.ws.rs.Produces)7 Test (org.junit.Test)7 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)6 PUT (javax.ws.rs.PUT)4 CatalogServiceField (com.emc.storageos.db.client.model.uimodels.CatalogServiceField)3 POST (javax.ws.rs.POST)3 CatalogACLInputFilter (com.emc.sa.api.utils.CatalogACLInputFilter)2 WorkflowServiceDescriptor (com.emc.sa.catalog.WorkflowServiceDescriptor)2 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)2 GET (javax.ws.rs.GET)2