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;
}
Aggregations