use of com.emc.vipr.model.catalog.CatalogServiceRestRep in project coprhd-controller by CoprHD.
the class CatalogApi method invokeByPath.
public static void invokeByPath(String sp1, String sp2, String sp3, String sp4, String sp5) {
CatalogCategoryRestRep catalog = CatalogCategoryUtils.getRootCategory();
DataObjectRestRep results = findCategoryOrService(catalog, sp1, sp2, sp3, sp4, sp5);
if (results != null && results instanceof CatalogServiceRestRep) {
CatalogServiceRestRep catalogService = (CatalogServiceRestRep) results;
runCatalogService(catalogService.getId().toString());
} else {
notFound();
}
}
use of com.emc.vipr.model.catalog.CatalogServiceRestRep 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;
}
use of com.emc.vipr.model.catalog.CatalogServiceRestRep in project coprhd-controller by CoprHD.
the class CatalogApi method browseCatalog.
public static void browseCatalog(String sp1, String sp2, String sp3, String sp4, String sp5) {
CatalogCategoryRestRep catalogCategory = CatalogCategoryUtils.getRootCategory();
DataObjectRestRep result = findCategoryOrService(catalogCategory, sp1, sp2, sp3, sp4, sp5);
if (result instanceof CatalogCategoryRestRep) {
renderApi(newCategoryInfo((CatalogCategoryRestRep) result));
} else if (result instanceof CatalogServiceRestRep) {
renderApi(newServiceInfo((CatalogServiceRestRep) result));
}
}
use of com.emc.vipr.model.catalog.CatalogServiceRestRep in project coprhd-controller by CoprHD.
the class Orders method addParametersToFlash.
@Util
private static void addParametersToFlash(OrderRestRep order) {
CatalogServiceRestRep service = CatalogServiceUtils.getCatalogService(uri(order.getCatalogService().getId().toString()));
HashMap<String, String> tableParams = new HashMap<String, String>();
if (service == null || service.getServiceDescriptor() == null) {
flash.error("order.submitFailedWithDetail", " The Workflow or Service Descriptor is deleted");
Logger.error("Service Descriptor not found");
throw new IllegalStateException("No Service Descriptor found. Might be Customservices Workflow is deleted ");
}
for (ServiceItemRestRep item : service.getServiceDescriptor().getItems()) {
if (item.isTable()) {
for (ServiceFieldRestRep tableItem : ((ServiceFieldTableRestRep) item).getItems()) {
tableParams.put(tableItem.getName(), item.getName());
}
}
}
for (Parameter parameter : order.getParameters()) {
// Do not add encrypted values to the flash scope
if (parameter.isEncrypted()) {
continue;
}
List<String> values = TextUtils.parseCSV(parameter.getValue());
for (int i = 0; i < values.size(); i++) {
String value = values.get(i);
String name = parameter.getLabel();
if (tableParams.containsKey(name)) {
name = tableParams.get(name) + "[" + i + "]." + name;
}
flash.put(name, value);
}
}
}
Aggregations