Search in sources :

Example 21 with Util

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);
        }
    }
}
Also used : ServiceItemRestRep(com.emc.vipr.model.catalog.ServiceItemRestRep) ServiceFieldTableRestRep(com.emc.vipr.model.catalog.ServiceFieldTableRestRep) HashMap(java.util.HashMap) ServiceFieldRestRep(com.emc.vipr.model.catalog.ServiceFieldRestRep) Parameter(com.emc.vipr.model.catalog.Parameter) CatalogServiceRestRep(com.emc.vipr.model.catalog.CatalogServiceRestRep) BourneUtil(util.BourneUtil) TaskUtil(com.emc.vipr.client.core.impl.TaskUtil) Util(play.mvc.Util)

Example 22 with Util

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;
}
Also used : RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) BreadCrumb(models.BreadCrumb) Util(play.mvc.Util)

Example 23 with Util

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));
}
Also used : BreadCrumb(models.BreadCrumb) Util(play.mvc.Util)

Aggregations

Util (play.mvc.Util)23 BourneUtil (util.BourneUtil)7 URI (java.net.URI)4 CatalogServiceRestRep (com.emc.vipr.model.catalog.CatalogServiceRestRep)3 UserInfo (models.security.UserInfo)3 ResourceType (com.emc.sa.util.ResourceType)2 URIUtil (com.emc.storageos.db.client.URIUtil)2 TaskUtil (com.emc.vipr.client.core.impl.TaskUtil)2 ExecutionWindowRestRep (com.emc.vipr.model.catalog.ExecutionWindowRestRep)2 Parameter (com.emc.vipr.model.catalog.Parameter)2 ServiceFieldRestRep (com.emc.vipr.model.catalog.ServiceFieldRestRep)2 BreadCrumb (models.BreadCrumb)2 DataObjectRestRep (com.emc.storageos.model.DataObjectRestRep)1 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 ACLAssignmentChanges (com.emc.storageos.model.auth.ACLAssignmentChanges)1 ACLEntry (com.emc.storageos.model.auth.ACLEntry)1 AuthnProviderRestRep (com.emc.storageos.model.auth.AuthnProviderRestRep)1 CopiesParam (com.emc.storageos.model.block.CopiesParam)1 Copy (com.emc.storageos.model.block.Copy)1 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)1