use of play.mvc.Util 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);
}
}
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class ServiceCatalog method createBreadCrumbs.
/**
* Creates the breadcrumbs for the catalog service.
*
* @param service
* the catalog service.
* @return the breadcrumb list.
*/
@Util
public static List<BreadCrumb> createBreadCrumbs(String tenantId, CatalogServiceRestRep service) {
RelatedResourceRep categoryId = service.getCatalogCategory();
String parentId = getParentId(categoryId);
List<BreadCrumb> breadcrumbs = createBreadCrumbs(parentId, getCatalog(tenantId));
String id = service.getId() != null ? service.getId().toString() : "";
addBreadCrumb(breadcrumbs, id, service.getName(), service.getTitle());
return breadcrumbs;
}
use of play.mvc.Util in project coprhd-controller by CoprHD.
the class ServiceCatalog method addBreadCrumb.
/**
* Adds a breadcrumb to the end of the list, constructing its path based on the breadcrumb at the end of the list.
*
* @param breadcrumbs
* the list of breadcrumbs.
* @param id
* the breadcrumb ID.
* @param name
* the breadcrumb name, used to construct the path.
* @param title
* the breadcrumb title.
*/
@Util
public static void addBreadCrumb(List<BreadCrumb> breadcrumbs, String id, String name, String title) {
String path = getPath(getLastPath(breadcrumbs), name);
breadcrumbs.add(new BreadCrumb(id, name, title, path));
}
Aggregations