Search in sources :

Example 1 with CatalogCategoryRestRep

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;
}
Also used : CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Example 2 with CatalogCategoryRestRep

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);
}
Also used : CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Example 3 with CatalogCategoryRestRep

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());
}
Also used : CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Example 4 with CatalogCategoryRestRep

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);
}
Also used : CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Example 5 with CatalogCategoryRestRep

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;
}
Also used : CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep) CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Aggregations

CatalogCategoryRestRep (com.emc.vipr.model.catalog.CatalogCategoryRestRep)20 CatalogServiceRestRep (com.emc.vipr.model.catalog.CatalogServiceRestRep)6 DataObjectRestRep (com.emc.storageos.model.DataObjectRestRep)2 UriBuilder (javax.ws.rs.core.UriBuilder)2 CatalogCategoryList (com.emc.vipr.model.catalog.CatalogCategoryList)1 CategoryInfo (com.emc.vipr.model.catalog.CategoryInfo)1