Search in sources :

Example 16 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class BlockExportGroups method removeSnapshot.

@FlashException(referrer = { "exportGroup" })
public static void removeSnapshot(String exportGroupId, String snapshotId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.removeVolume(uri(snapshotId));
    Task<ExportGroupRestRep> task = client.blockExports().update(uri(exportGroupId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.snapshot.removed", task.getOpId()));
    exportGroup(exportGroupId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) FlashException(controllers.util.FlashException)

Example 17 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class BlockSnapshots method deleteSnapshot.

@FlashException(referrer = { "snapshotDetails" })
public static void deleteSnapshot(String snapshotId) {
    if (StringUtils.isNotBlank(snapshotId)) {
        ViPRCoreClient client = BourneUtil.getViprClient();
        Tasks<BlockSnapshotRestRep> task = client.blockSnapshots().deactivate(uri(snapshotId), VolumeDeleteTypeEnum.FULL);
        flash.put("info", MessagesUtils.get("resources.snapshot.deactivate", snapshotId));
    }
    snapshotDetails(snapshotId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BlockSnapshotRestRep(com.emc.storageos.model.block.BlockSnapshotRestRep) FlashException(controllers.util.FlashException)

Example 18 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class FileVirtualPools method save.

@FlashException(keep = true, referrer = { "create", "edit" })
public static void save(FileVirtualPoolForm vpool) {
    if (vpool == null) {
        list();
    }
    vpool.deserialize();
    vpool.validate("vpool");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    try {
        FileVirtualPoolRestRep result = vpool.save();
        flash.success(MessagesUtils.get(SAVED_SUCCESS, result.getName()));
        backToReferrer();
    } catch (ViPRException e) {
        throwFlashException(vpool, e);
    }
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) ViPRException(com.emc.vipr.client.exceptions.ViPRException) FlashException(controllers.util.FlashException)

Example 19 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class SanSwitches method edit.

@FlashException("list")
public static void edit(String id) {
    NetworkSystemRestRep networkSystem = NetworkSystemUtils.getNetworkSystem(id);
    if (networkSystem == null) {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
    edit(new SanSwitchForm(networkSystem));
}
Also used : NetworkSystemRestRep(com.emc.storageos.model.network.NetworkSystemRestRep) FlashException(controllers.util.FlashException)

Example 20 with FlashException

use of controllers.util.FlashException in project coprhd-controller by CoprHD.

the class SanSwitches method save.

@FlashException(keep = true, referrer = { "create", "edit" })
public static void save(SanSwitchForm sanSwitch) {
    sanSwitch.validate("sanSwitch");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    Task<?> sanTask = sanSwitch.save();
    flash.success(MessagesUtils.get(SAVED, sanSwitch.name));
    JsonObject jobject = getCookieAsJson(VIPR_START_GUIDE);
    if (jobject != null && jobject.get(GUIDE_COMPLETED_STEP) != null && jobject.get(GUIDE_VISIBLE) != null) {
        if (jobject.get(GUIDE_COMPLETED_STEP).getAsInt() == 4 && jobject.get(GUIDE_VISIBLE).getAsBoolean()) {
            JsonObject dataObject = getCookieAsJson(GUIDE_DATA);
            JsonArray fabrics = dataObject.getAsJsonArray(GUIDE_FABRICS);
            if (fabrics == null) {
                fabrics = new JsonArray();
            }
            boolean addToCookie = true;
            for (Object fabricObject : fabrics) {
                JsonObject sanswitch = (JsonObject) fabricObject;
                if (sanswitch.get("id") != null) {
                    String fabricId = sanswitch.get("id").getAsString();
                    if (StringUtils.equals(fabricId, sanTask.getResourceId().toString())) {
                        // update case, don't add in cookie
                        addToCookie = false;
                        break;
                    }
                }
            }
            if (addToCookie) {
                JsonObject fabric = new JsonObject();
                fabric.addProperty("id", sanTask.getResourceId().toString());
                fabric.addProperty("name", sanSwitch.name);
                fabrics.add(fabric);
                dataObject.add("fabrics", fabrics);
                saveJsonAsCookie("GUIDE_DATA", dataObject);
            }
        }
    }
    list();
}
Also used : JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) JsonObject(com.google.gson.JsonObject) FlashException(controllers.util.FlashException)

Aggregations

FlashException (controllers.util.FlashException)122 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)45 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)9 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)9 URI (java.net.URI)9 ExportUpdateParam (com.emc.storageos.model.block.export.ExportUpdateParam)8 Restrictions (controllers.deadbolt.Restrictions)8 ArrayList (java.util.ArrayList)7 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)5 CopiesParam (com.emc.storageos.model.block.CopiesParam)4 SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)4 ExportRule (com.emc.storageos.model.file.ExportRule)4 ExportRules (com.emc.storageos.model.file.ExportRules)4 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)4 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)4 ServiceErrorException (com.emc.vipr.client.exceptions.ServiceErrorException)4 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)2