Search in sources :

Example 6 with ComputeImageServerRestRep

use of com.emc.storageos.model.compute.ComputeImageServerRestRep in project coprhd-controller by CoprHD.

the class ComputeSystems method edit.

public static void edit(String id) {
    try {
        addReferenceData();
        ComputeSystemRestRep computeSystem = ComputeSystemUtils.getComputeSystem(id);
        if (computeSystem != null) {
            if (computeSystem.getVlans() != null) {
                List<StringOption> vlanOptions = new ArrayList<StringOption>();
                vlanOptions.add(VlanListTypes.option(VlanListTypes.NO_OSINSTALL_NONE));
                List<String> vlanList = new ArrayList<String>(Arrays.asList(computeSystem.getVlans().split(",")));
                for (String vlan : vlanList) {
                    vlanOptions.add(VlanListTypes.option(vlan));
                }
                renderArgs.put("computeSystemVlanList", vlanOptions);
            }
            List<StringOption> computeImageServerOptions = new ArrayList<StringOption>();
            computeImageServerOptions.add(ComputeImageServerListTypes.option(ComputeImageServerListTypes.NO_COMPUTE_IMAGE_SERVER_NONE));
            List<ComputeImageServerRestRep> computeImageServersList = ComputeImageServerUtils.getComputeImageServers();
            if (computeImageServersList != null) {
                List<String> computeImageServersArrayList = new ArrayList<String>();
                for (ComputeImageServerRestRep cisrr : computeImageServersList) {
                    if (cisrr.getComputeImageServerStatus().equalsIgnoreCase(AVAILABLE)) {
                        computeImageServersArrayList.add(cisrr.getName());
                    }
                }
                for (String imageServerId : computeImageServersArrayList) {
                    computeImageServerOptions.add(ComputeImageServerListTypes.option(imageServerId));
                }
                renderArgs.put("availableComputeImageServersList", computeImageServerOptions);
            }
            ComputeSystemForm computeSystems = new ComputeSystemForm(computeSystem);
            render("@edit", computeSystems);
        } else {
            flash.error(MessagesUtils.get(UNKNOWN, id));
            list();
        }
    } catch (Exception e) {
        flashException(e);
        list();
    }
}
Also used : StringOption(util.StringOption) ArrayList(java.util.ArrayList) ComputeSystemRestRep(com.emc.storageos.model.compute.ComputeSystemRestRep) Common.flashException(controllers.Common.flashException) URISyntaxException(java.net.URISyntaxException) FlashException(controllers.util.FlashException) ComputeImageServerRestRep(com.emc.storageos.model.compute.ComputeImageServerRestRep)

Example 7 with ComputeImageServerRestRep

use of com.emc.storageos.model.compute.ComputeImageServerRestRep in project coprhd-controller by CoprHD.

the class ComputeSystems method create.

public static void create() {
    addReferenceData();
    ComputeSystemForm computeSystems = new ComputeSystemForm();
    // put all "initial create only" defaults here rather than field
    // initializers
    List<ComputeImageServerRestRep> computeImageServersList = ComputeImageServerUtils.getComputeImageServers();
    if (computeImageServersList != null) {
        List<StringOption> computeImageServerOptions = new ArrayList<StringOption>();
        List<String> computeImageServersArrayList = new ArrayList<String>();
        computeImageServerOptions.add(ComputeImageServerListTypes.option(ComputeImageServerListTypes.NO_COMPUTE_IMAGE_SERVER_NONE));
        for (ComputeImageServerRestRep cisrr : computeImageServersList) {
            if (cisrr.getComputeImageServerStatus().equalsIgnoreCase(AVAILABLE)) {
                computeImageServersArrayList.add(cisrr.getName());
            }
        }
        for (String imageServerId : computeImageServersArrayList) {
            computeImageServerOptions.add(ComputeImageServerListTypes.option(imageServerId));
        }
        renderArgs.put("availableComputeImageServersList", computeImageServerOptions);
    }
    computeSystems.portNumber = getDefaultPort(DefaultComputeSystemPortMap.port443);
    computeSystems.useSSL = true;
    render("@edit", computeSystems);
}
Also used : StringOption(util.StringOption) ArrayList(java.util.ArrayList) ComputeImageServerRestRep(com.emc.storageos.model.compute.ComputeImageServerRestRep)

Aggregations

ComputeImageServerRestRep (com.emc.storageos.model.compute.ComputeImageServerRestRep)7 FlashException (controllers.util.FlashException)2 URISyntaxException (java.net.URISyntaxException)2 ArrayList (java.util.ArrayList)2 StringOption (util.StringOption)2 ComputeImage (com.emc.storageos.db.client.model.ComputeImage)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 RestLinkRep (com.emc.storageos.model.RestLinkRep)1 ComputeSystemRestRep (com.emc.storageos.model.compute.ComputeSystemRestRep)1 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)1 Common.flashException (controllers.Common.flashException)1 ComputeImageServerInfo (models.datatable.ComputeImageServersDataTable.ComputeImageServerInfo)1