Search in sources :

Example 1 with WorkflowServiceDescriptor

use of com.emc.sa.catalog.WorkflowServiceDescriptor in project coprhd-controller by CoprHD.

the class OrderService method createNewOrder.

public Order createNewOrder(StorageOSUser user, URI tenantId, OrderCreateParam createParam) {
    ArgValidator.checkFieldNotNull(createParam.getCatalogService(), "catalogService");
    CatalogService service = catalogServiceManager.getCatalogServiceById(createParam.getCatalogService());
    if (service == null) {
        throw APIException.badRequests.orderServiceNotFound(asString(createParam.getCatalogService()));
    }
    final ServiceDescriptor descriptor = ServiceDescriptorUtil.getServiceDescriptorByName(serviceDescriptors, workflowServiceDescriptor, service.getBaseService());
    if (descriptor == null) {
        throw APIException.badRequests.orderServiceDescriptorNotFound(service.getBaseService());
    }
    // Getting and setting workflow document (if its workflow service)
    if (null != descriptor.getWorkflowId()) {
        final String workflowDocument = catalogServiceManager.getWorkflowDocument(service.getBaseService());
        if (null == workflowDocument) {
            throw APIException.badRequests.workflowNotFound(service.getBaseService());
        }
        createParam.setWorkflowDocument(workflowDocument);
    }
    Order order = createNewObject(tenantId, createParam);
    addLockedFields(service.getId(), descriptor, createParam);
    validateParameters(descriptor, createParam.getParameters(), service.getMaxSize());
    List<OrderParameter> orderParams = createOrderParameters(order, createParam, encryptionProvider);
    orderManager.createOrder(order, orderParams, user);
    return order;
}
Also used : Order(com.emc.storageos.db.client.model.uimodels.Order) ServiceDescriptor(com.emc.sa.descriptor.ServiceDescriptor) WorkflowServiceDescriptor(com.emc.sa.catalog.WorkflowServiceDescriptor) OrderParameter(com.emc.storageos.db.client.model.uimodels.OrderParameter) CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) URIUtil.asString(com.emc.storageos.db.client.URIUtil.asString)

Aggregations

WorkflowServiceDescriptor (com.emc.sa.catalog.WorkflowServiceDescriptor)1 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)1 URIUtil.asString (com.emc.storageos.db.client.URIUtil.asString)1 CatalogService (com.emc.storageos.db.client.model.uimodels.CatalogService)1 Order (com.emc.storageos.db.client.model.uimodels.Order)1 OrderParameter (com.emc.storageos.db.client.model.uimodels.OrderParameter)1