Search in sources :

Example 16 with CatalogCategoryRestRep

use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.

the class EditCatalog method editCategory.

public static void editCategory(String categoryId, String fromId) {
    CatalogCategoryRestRep category = CatalogCategoryUtils.getCatalogCategory(uri(categoryId));
    CategoryForm form = new CategoryForm(category);
    form.fromId = StringUtils.defaultIfBlank(fromId, form.parentId);
    edit(form);
}
Also used : CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Example 17 with CatalogCategoryRestRep

use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.

the class EditCatalog method saveCategory.

public static void saveCategory(CategoryForm category) {
    // Set name before validation
    if (StringUtils.isNotBlank(category.title)) {
        category.name = category.title.replaceAll(" ", "");
    }
    category.validate("category");
    if (Validation.hasErrors()) {
        params.flash();
        Validation.keep();
        if (category.isNew()) {
            createCategory(category.parentId, category.fromId);
        } else {
            editCategory(category.id, category.fromId);
        }
    } else {
        CatalogCategoryRestRep catalogCategory = category.save();
        String parentId = getParentId(catalogCategory.getCatalogCategory());
        String fromId = StringUtils.defaultIfBlank(category.fromId, parentId);
        catalogUpdated(fromId, "Saved category: %s", catalogCategory.getTitle());
    }
}
Also used : CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Example 18 with CatalogCategoryRestRep

use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.

the class EditCatalog method services.

public static void services(String id) {
    List<CatalogServiceRestRep> catalogServices = null;
    if (StringUtils.isNotBlank(id)) {
        CatalogCategoryRestRep parent = CatalogCategoryUtils.getCatalogCategory(uri(id));
        catalogServices = CatalogServiceUtils.getCatalogServices(parent);
    }
    render(catalogServices);
}
Also used : CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep) CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Example 19 with CatalogCategoryRestRep

use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.

the class EditCatalog method createCategory.

public static void createCategory(String parentId, String fromId) {
    CatalogCategoryRestRep parent = CatalogCategoryUtils.getCatalogCategory(uri(parentId));
    CategoryForm category = new CategoryForm();
    category.parentId = getId(parent);
    category.fromId = StringUtils.defaultIfBlank(fromId, category.parentId);
    edit(category);
}
Also used : CatalogCategoryRestRep(com.emc.vipr.model.catalog.CatalogCategoryRestRep)

Example 20 with CatalogCategoryRestRep

use of com.emc.vipr.model.catalog.CatalogCategoryRestRep in project coprhd-controller by CoprHD.

the class ServiceCatalog method docCategory.

public static void docCategory(String categoryId) {
    if (categoryId == null) {
        redirect(DocUtils.getDocumentationLink());
    }
    CatalogCategoryRestRep category = CatalogCategoryUtils.getCatalogCategory(uri(categoryId));
    if (category == null) {
        redirect(DocUtils.getDocumentationLink());
    }
    // NOSONAR
    Logger.debug("Redirecting to doc page for category: " + category.getName());
    // ("Suppressing Sonar violation of Possible null pointer deference of category. In the previous if condition, category being null is handled.")
    redirect(DocUtils.getCatalogDocumentationLink(category.getName()));
}
Also used : 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