Search in sources :

Example 6 with CatalogServiceRestRep

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

the class EditCatalog method copyService.

public static void copyService(String serviceId, String fromId) {
    CatalogServiceRestRep catalogService = CatalogServiceUtils.getCatalogService(uri(serviceId));
    ServiceForm service = new ServiceForm(catalogService);
    service.id = null;
    service.copiedFrom = serviceId;
    service.title = Messages.get("EditCatalog.copyOf", service.title);
    service.fromId = StringUtils.defaultIfBlank(fromId, service.owningCategoryId);
    edit(service);
}
Also used : CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep)

Example 7 with CatalogServiceRestRep

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

the class EditCatalog method moveDownService.

public static void moveDownService(String id) {
    CatalogServiceRestRep catalogService = CatalogServiceUtils.getCatalogService(uri(id));
    CatalogServiceUtils.moveDownService(catalogService.getId());
    services(catalogService.getCatalogCategory().getId().toString());
}
Also used : CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep)

Example 8 with CatalogServiceRestRep

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

the class EditCatalog method saveService.

public static void saveService(ServiceForm service) {
    // Set name before validation
    if (StringUtils.isNotBlank(service.title)) {
        service.name = service.title.replaceAll(" ", "");
    }
    service.validate("service");
    if (validation.hasErrors()) {
        params.flash();
        validation.keep();
        if (service.isCopy()) {
            copyService(service.copiedFrom, service.fromId);
        } else if (service.isNew()) {
            createService(service.owningCategoryId, service.fromId);
        } else {
            editService(service.id, service.fromId);
        }
    } else {
        CatalogServiceRestRep catalogService = service.save();
        String parentId = getParentId(catalogService.getCatalogCategory());
        String fromId = StringUtils.defaultIfBlank(service.fromId, parentId);
        catalogUpdated(fromId, "EditCatalog.savedService", catalogService.getTitle());
    }
}
Also used : CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep)

Example 9 with CatalogServiceRestRep

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

the class CatalogApi method serviceDescriptor.

public static void serviceDescriptor(String serviceId) {
    CatalogServiceRestRep service = CatalogServiceUtils.getCatalogService(uri(serviceId));
    ServiceDescriptorRestRep descriptor = service.getServiceDescriptor();
    // Remove any locked fields so user does not see things they cannot change
    for (CatalogServiceFieldRestRep catalogServiceField : service.getCatalogServiceFields()) {
        if (catalogServiceField.getOverride()) {
            ServiceFieldRestRep serviceField = ServiceDescriptorUtils.getField(descriptor, catalogServiceField.getName());
            descriptor.getItems().remove(serviceField);
        }
    }
    renderPrettyJson(descriptor);
}
Also used : ServiceDescriptorRestRep(com.emc.vipr.model.catalog.ServiceDescriptorRestRep) CatalogServiceFieldRestRep(com.emc.vipr.model.catalog.CatalogServiceFieldRestRep) CatalogServiceFieldRestRep(com.emc.vipr.model.catalog.CatalogServiceFieldRestRep) ServiceFieldRestRep(com.emc.vipr.model.catalog.ServiceFieldRestRep) CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep)

Example 10 with CatalogServiceRestRep

use of com.emc.vipr.model.catalog.CatalogServiceRestRep 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

CatalogServiceRestRep (com.emc.vipr.model.catalog.CatalogServiceRestRep)29 ServiceDescriptorRestRep (com.emc.vipr.model.catalog.ServiceDescriptorRestRep)7 CatalogCategoryRestRep (com.emc.vipr.model.catalog.CatalogCategoryRestRep)6 ViPRCatalogClient2 (com.emc.vipr.client.ViPRCatalogClient2)4 ApprovalRestRep (com.emc.vipr.model.catalog.ApprovalRestRep)3 CatalogServiceFieldRestRep (com.emc.vipr.model.catalog.CatalogServiceFieldRestRep)3 OrderRestRep (com.emc.vipr.model.catalog.OrderRestRep)3 ServiceFieldRestRep (com.emc.vipr.model.catalog.ServiceFieldRestRep)3 Util (play.mvc.Util)3 CatalogServiceField (com.emc.storageos.db.client.model.uimodels.CatalogServiceField)2 DataObjectRestRep (com.emc.storageos.model.DataObjectRestRep)2 TaskUtil (com.emc.vipr.client.core.impl.TaskUtil)2 Parameter (com.emc.vipr.model.catalog.Parameter)2 URI (java.net.URI)2 HashMap (java.util.HashMap)2 DateTime (org.joda.time.DateTime)2 BourneUtil (util.BourneUtil)2 WorkflowServiceDescriptor (com.emc.sa.catalog.WorkflowServiceDescriptor)1 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)1 CatalogService (com.emc.storageos.db.client.model.uimodels.CatalogService)1