Search in sources :

Example 21 with FlashException

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

the class StorageProviders method edit.

@FlashException("list")
public static void edit(String id) {
    addReferenceData();
    StorageProviderRestRep provider = StorageProviderUtils.getStorageProvider(uri(id));
    if (provider != null) {
        StorageProviderForm smisProvider = new StorageProviderForm(provider);
        copyRenderArgsToAngular();
        angularRenderArgs().put("smisProvider", smisProvider);
        render(smisProvider);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
}
Also used : StorageProviderRestRep(com.emc.storageos.model.smis.StorageProviderRestRep) FlashException(controllers.util.FlashException)

Example 22 with FlashException

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

the class StorageProviders method save.

@FlashException(keep = true, referrer = { "create", "edit" })
public static void save(StorageProviderForm smisProvider) {
    smisProvider.validate("smisProvider");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    URI providerUri = smisProvider.save();
    flash.success(MessagesUtils.get(SAVED, smisProvider.name));
    // check if checklist is running on this step
    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() == 3 && jobject.get(GUIDE_VISIBLE).getAsBoolean()) {
            JsonObject dataObject = getCookieAsJson(GUIDE_DATA);
            JsonArray storage_systems = dataObject.getAsJsonArray(STORAGE_SYSTEMS);
            if (storage_systems == null) {
                storage_systems = new JsonArray();
            }
            boolean addToCookie = true;
            for (Object storageObject : storage_systems) {
                JsonObject storagearray = (JsonObject) storageObject;
                if (storagearray.get("id") != null) {
                    String arrayId = storagearray.get("id").getAsString();
                    if (StringUtils.equals(arrayId, providerUri.toString())) {
                        // update case, don't add in cookie
                        addToCookie = false;
                        break;
                    }
                }
            }
            if (addToCookie) {
                JsonObject storage = new JsonObject();
                storage.addProperty("id", providerUri.toString());
                storage.addProperty("name", smisProvider.name);
                storage_systems.add(storage);
                dataObject.add(STORAGE_SYSTEMS, storage_systems);
                saveJsonAsCookie(GUIDE_DATA, dataObject);
            }
            list();
        }
    }
    backToReferrer();
    list();
}
Also used : JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) JsonObject(com.google.gson.JsonObject) URI(java.net.URI) FlashException(controllers.util.FlashException)

Example 23 with FlashException

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

the class StorageSystems method dissociateProject.

@FlashException(keep = true, referrer = { "virtualNasServers" })
public static void dissociateProject(@As(",") String[] projectIdsToDissociate, String nasIds, String storageId) {
    if (projectIdsToDissociate != null && projectIdsToDissociate.length > 0) {
        for (String projectId : projectIdsToDissociate) {
            Set<String> vNASSet = new HashSet<String>();
            vNASSet.add(nasIds);
            VirtualNasParam vNasParam = new VirtualNasParam();
            vNasParam.setVnasServers(vNASSet);
            getViprClient().virtualNasServers().unassignVnasServers(uri(projectId), vNasParam);
        }
    }
    virtualNasServers(storageId);
}
Also used : VirtualNasParam(com.emc.storageos.model.project.VirtualNasParam) HashSet(java.util.HashSet) FlashException(controllers.util.FlashException)

Example 24 with FlashException

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

the class StorageSystems method savePool.

@FlashException(keep = true, referrer = { "editPool" })
public static void savePool(StorageArrayPoolForm storageArrayPool) {
    storageArrayPool.validate("storageArrayPool");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    StoragePoolRestRep pool = storageArrayPool.save();
    flash.success(MessagesUtils.get(SAVED_POOL, pool.getPoolName()));
    pools(stringId(pool.getStorageSystem()));
}
Also used : StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) FlashException(controllers.util.FlashException)

Example 25 with FlashException

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

the class Certificates method delete.

@FlashException(value = "list")
public static void delete(@As(",") List<String> ids) {
    TrustedCertificateChanges changes = new TrustedCertificateChanges();
    changes.setRemove(ids);
    api().updateTrustedCertificate(changes);
    flash.success(MessagesUtils.get("certificateChanges.submittedReconfigure"));
    list();
}
Also used : TrustedCertificateChanges(com.emc.vipr.model.keystore.TrustedCertificateChanges) 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