Search in sources :

Example 1 with StringOption

use of util.StringOption in project coprhd-controller by CoprHD.

the class WorkflowBuilder method setRestCallResources.

private static void setRestCallResources() {
    final List<StringOption> restCallAuthTypes = new ArrayList<StringOption>();
    restCallAuthTypes.add(new StringOption(AuthType.NONE.toString(), Messages.get("rest.authType.noAuth")));
    restCallAuthTypes.add(new StringOption(AuthType.BASIC.toString(), Messages.get("rest.authType.basicAuth")));
    renderArgs.put("restCallAuthTypes", restCallAuthTypes);
}
Also used : StringOption(util.StringOption) ArrayList(java.util.ArrayList)

Example 2 with StringOption

use of util.StringOption in project coprhd-controller by CoprHD.

the class ComputeVirtualPools method getServiceProfileTemplates.

public static void getServiceProfileTemplates(ComputeVirtualPoolsForm computeVirtualPool) {
    List<ComputeSystemRestRep> allComputes = Lists.newArrayList();
    List<StringOption> templateList = Lists.newArrayList();
    List<String> temps = Lists.newArrayList();
    if (computeVirtualPool.id != null) {
        ComputeVirtualPoolRestRep computePool = ComputeVirtualPoolUtils.getComputeVirtualPool(computeVirtualPool.id);
        for (NamedRelatedResourceRep tmp : computePool.getServiceProfileTemplates()) {
            temps.add(tmp.getId().toString());
        }
    }
    Map<String, Set<String>> csTemplatesMap = new HashMap<String, Set<String>>();
    Map<String, String> computeSystemsMap = new HashMap<String, String>();
    Map<String, String> templatesMap = new HashMap<String, String>();
    if (computeVirtualPool.virtualArrays != null) {
        for (String arrayId : computeVirtualPool.virtualArrays) {
            List<ComputeSystemRestRep> arrayComputes = VirtualArrayUtils.getComputeSystems(uri(arrayId));
            for (ComputeSystemRestRep acomp : arrayComputes) {
                String compId = acomp.getId().toString();
                if (!computeSystemsMap.containsKey(compId)) {
                    computeSystemsMap.put(compId, acomp.getName());
                }
                Set<String> spts = csTemplatesMap.get(compId);
                if (spts == null) {
                    spts = new HashSet<String>();
                }
                for (NamedRelatedResourceRep spt : acomp.getServiceProfileTemplates()) {
                    spts.add(spt.getId().toString());
                    if (!templatesMap.containsKey(spt.getId().toString())) {
                        templatesMap.put(spt.getId().toString(), spt.getName());
                    }
                }
                csTemplatesMap.put(compId, spts);
            }
        }
        for (Entry<String, Set<String>> comp : csTemplatesMap.entrySet()) {
            Set<String> compTemplates = comp.getValue();
            if (compTemplates != null && !compTemplates.isEmpty()) {
                String systemName = ComputeSystemTypes.getDisplayValue(ComputeSystemTypes.UCS) + " " + computeSystemsMap.get(comp.getKey());
                computeVirtualPool.systems.add(new StringOption(comp.getKey(), systemName));
                List<StringOption> templateOptions = Lists.newArrayList();
                templateOptions.add(new StringOption("NONE", ""));
                for (String template : compTemplates) {
                    templateOptions.add(new StringOption(template, templatesMap.get(template)));
                    if (!temps.isEmpty()) {
                        for (String templateId : temps) {
                            if (templateId.contains(template)) {
                                templateList.add(new StringOption(comp.getKey(), template));
                            }
                        }
                    }
                }
                computeVirtualPool.systemOptions.put(comp.getKey(), templateOptions);
            }
        }
        computeVirtualPool.selectedTemplates = "{}";
        if (!templateList.isEmpty()) {
            String jsonString = "{\"";
            for (int index = 0; index < templateList.size(); index++) {
                if (jsonString.indexOf("urn") > 0) {
                    jsonString = jsonString + ",\"";
                }
                jsonString = jsonString + templateList.get(index).id + "\":\"" + templateList.get(index).name + "\"";
            }
            jsonString = jsonString + "}";
            computeVirtualPool.selectedTemplates = jsonString;
        }
    } else {
        computeVirtualPool.selectedTemplates = "{}";
    }
    render("@templates", computeVirtualPool);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) ComputeVirtualPoolRestRep(com.emc.storageos.model.vpool.ComputeVirtualPoolRestRep) StringOption(util.StringOption) ComputeSystemRestRep(com.emc.storageos.model.compute.ComputeSystemRestRep)

Example 3 with StringOption

use of util.StringOption in project coprhd-controller by CoprHD.

the class VCenters method renderTenantOptions.

private static void renderTenantOptions() {
    if (TenantUtils.canReadAllTenantsForVcenters() && VCenterUtils.canUpdateVcenterACLs()) {
        List<StringOption> tenantOptions = dataObjectOptions(await(new TenantsCall().asPromise()));
        renderArgs.put("tenantOptions", tenantOptions);
        List<StringOption> tenantOptionsWithNone = new ArrayList<StringOption>();
        tenantOptionsWithNone.add(new StringOption(NullColumnValueGetter.getNullStr().toString(), "None"));
        tenantOptionsWithNone.addAll(tenantOptions);
        renderArgs.put("tenantOptionsWithNone", tenantOptionsWithNone);
    }
}
Also used : StringOption(util.StringOption) TenantsCall(jobs.vipr.TenantsCall) ArrayList(java.util.ArrayList)

Example 4 with StringOption

use of util.StringOption in project coprhd-controller by CoprHD.

the class StorageSystems method createPort.

public static void createPort(String id) {
    StorageSystemRestRep storageSystem = StorageSystemUtils.getStorageSystem(id);
    StringOption[] portTypeOptions = { new StringOption("", ""), new StringOption("IP", StringOption.getDisplayValue("IP", "storageArrayPort.portTypes")), new StringOption("FC", StringOption.getDisplayValue("FC", "storageArrayPort.portTypes")) };
    renderArgs.put("portTypeOptions", Arrays.asList(portTypeOptions));
    render(storageSystem);
}
Also used : StringOption(util.StringOption) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep)

Example 5 with StringOption

use of util.StringOption in project coprhd-controller by CoprHD.

the class Certificates method list.

@FlashException
public static void list() {
    CertificateDataTable dataTable = new CertificateDataTable();
    List<StringOption> options = Lists.newArrayList();
    options.add(new StringOption("true", MessagesUtils.get("common.yes")));
    options.add(new StringOption("false", MessagesUtils.get("common.no")));
    TruststoreSettings certificateSettings = null;
    certificateSettings = api().getTruststoreSettings();
    angularRenderArgs().putAll(ImmutableMap.of("options", options, "certificateSettings", certificateSettings));
    render(dataTable);
}
Also used : StringOption(util.StringOption) CertificateDataTable(models.datatable.CertificateDataTable) TruststoreSettings(com.emc.vipr.model.keystore.TruststoreSettings) FlashException(controllers.util.FlashException)

Aggregations

StringOption (util.StringOption)44 ArrayList (java.util.ArrayList)26 StorageSystemTypeRestRep (com.emc.storageos.model.storagesystem.type.StorageSystemTypeRestRep)20 StorageSystemTypeList (com.emc.storageos.model.storagesystem.type.StorageSystemTypeList)19 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)4 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)3 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)3 FlashException (controllers.util.FlashException)3 ComputeImageServerRestRep (com.emc.storageos.model.compute.ComputeImageServerRestRep)2 ComputeSystemRestRep (com.emc.storageos.model.compute.ComputeSystemRestRep)2 StorageSystemRestRep (com.emc.storageos.model.systems.StorageSystemRestRep)2 URI (java.net.URI)2 DataObjectRestRep (com.emc.storageos.model.DataObjectRestRep)1 AuthnProviderRestRep (com.emc.storageos.model.auth.AuthnProviderRestRep)1 CustomServicesPrimitiveResourceList (com.emc.storageos.model.customservices.CustomServicesPrimitiveResourceList)1 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)1 BucketRestRep (com.emc.storageos.model.object.BucketRestRep)1 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)1 ComputeVirtualPoolRestRep (com.emc.storageos.model.vpool.ComputeVirtualPoolRestRep)1 TruststoreSettings (com.emc.vipr.model.keystore.TruststoreSettings)1