Search in sources :

Example 11 with ServiceDescriptorRestRep

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

the class ServiceDescriptorService method getServiceDescriptors.

/**
 * List service descriptors
 *
 * @prereq none
 * @brief List service descriptors
 * @return List of service descriptors
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("")
public ServiceDescriptorList getServiceDescriptors() {
    Collection<ServiceDescriptor> descriptors = this.serviceDescriptors.listDescriptors(Locale.getDefault());
    descriptors.addAll(workflowServiceDescriptor.listDescriptors());
    List<ServiceDescriptorRestRep> serviceDescriptors = Lists.newArrayList();
    for (ServiceDescriptor descriptor : descriptors) {
        serviceDescriptors.add(map(descriptor));
    }
    ServiceDescriptorList serviceDescriptorList = new ServiceDescriptorList(serviceDescriptors);
    return serviceDescriptorList;
}
Also used : ServiceDescriptorRestRep(com.emc.vipr.model.catalog.ServiceDescriptorRestRep) WorkflowServiceDescriptor(com.emc.sa.catalog.WorkflowServiceDescriptor) ServiceDescriptor(com.emc.sa.descriptor.ServiceDescriptor) ServiceDescriptorList(com.emc.vipr.model.catalog.ServiceDescriptorList) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 12 with ServiceDescriptorRestRep

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

the class ServiceDescriptorMapper method map.

public static ServiceDescriptorRestRep map(ServiceDescriptor from) {
    if (from == null) {
        return null;
    }
    ServiceDescriptorRestRep to = new ServiceDescriptorRestRep();
    to.setCategory(from.getCategory());
    to.setDescription(from.getDescription());
    to.setDestructive(from.isDestructive());
    to.setUseModal(from.isUseModal());
    to.setModalTitle(from.getModalTitle());
    to.setServiceId(from.getServiceId());
    to.setTitle(from.getTitle());
    to.setRoles(from.getRoles());
    to.getItems().addAll(map(from.getItems().values()));
    return to;
}
Also used : ServiceDescriptorRestRep(com.emc.vipr.model.catalog.ServiceDescriptorRestRep)

Example 13 with ServiceDescriptorRestRep

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

the class CatalogApi method createAndValidateOrder.

private static OrderCreateParam createAndValidateOrder(String serviceId) {
    CatalogServiceRestRep service = CatalogServiceUtils.getCatalogService(uri(serviceId));
    ServiceDescriptorRestRep descriptor = service.getServiceDescriptor();
    // Filter out actual Service Parameters
    Map<String, String> parameters = parseParameters(service, descriptor);
    if (Validation.hasErrors()) {
        response.status = HttpStatus.SC_BAD_REQUEST;
        renderApi(getValidationErrors());
    }
    // Create request and perform selection
    OrderCreateParam order = createOrder(service, descriptor, parameters);
    return order;
}
Also used : ServiceDescriptorRestRep(com.emc.vipr.model.catalog.ServiceDescriptorRestRep) OrderCreateParam(com.emc.vipr.model.catalog.OrderCreateParam) CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep)

Example 14 with ServiceDescriptorRestRep

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

the class Orders method receipt.

public static void receipt(String orderId) {
    OrderDetails details = new OrderDetails(orderId);
    Models.checkAccess(details.order.getTenant());
    fetchData(details);
    ServiceDescriptorRestRep descriptor = details.catalogService.getServiceDescriptor();
    addBreadCrumbToRenderArgs(id(details.order.getTenant()), details.catalogService);
    render(orderId, details, descriptor);
}
Also used : ServiceDescriptorRestRep(com.emc.vipr.model.catalog.ServiceDescriptorRestRep)

Aggregations

ServiceDescriptorRestRep (com.emc.vipr.model.catalog.ServiceDescriptorRestRep)14 CatalogServiceRestRep (com.emc.vipr.model.catalog.CatalogServiceRestRep)7 CatalogServiceFieldRestRep (com.emc.vipr.model.catalog.CatalogServiceFieldRestRep)3 ServiceFieldRestRep (com.emc.vipr.model.catalog.ServiceFieldRestRep)3 AssetOption (com.emc.vipr.model.catalog.AssetOption)2 WorkflowServiceDescriptor (com.emc.sa.catalog.WorkflowServiceDescriptor)1 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)1 TaskUtil (com.emc.vipr.client.core.impl.TaskUtil)1 OrderCreateParam (com.emc.vipr.model.catalog.OrderCreateParam)1 Reference (com.emc.vipr.model.catalog.Reference)1 ServiceDescriptorList (com.emc.vipr.model.catalog.ServiceDescriptorList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Gson (com.google.gson.Gson)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Util (play.mvc.Util)1