Search in sources :

Example 56 with FlashException

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

the class VirtualArrays method removeStoragePools.

/**
 * Removes a number of storage pools from the given virtual array, and redisplays the storage pools page.
 *
 * @param virtualArrayId
 *            the virtual array ID.
 * @param ids
 *            the IDs of the storage pools to remove.
 */
@FlashException
public static void removeStoragePools(String virtualArrayId, @As(",") String[] ids) {
    if ((ids != null) && (ids.length > 0)) {
        VirtualArrayRestRep virtualArray = getVirtualArray(virtualArrayId);
        updateStoragePools(uris(ids), removeVirtualArray(virtualArray));
    }
    storagePools(virtualArrayId);
}
Also used : VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) FlashException(controllers.util.FlashException)

Example 57 with FlashException

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

the class VirtualArrays method addStoragePorts.

/**
 * Adds a number of storage ports to the given virtual array, and redisplays the storage ports page.
 *
 * @param virtualArrayId
 *            the virtual array ID.
 * @param ids
 *            the IDs of the storage ports to add.
 */
@FlashException
public static void addStoragePorts(String virtualArrayId, @As(",") String[] ids) {
    if ((ids != null) && (ids.length > 0)) {
        VirtualArrayRestRep virtualArray = getVirtualArray(virtualArrayId);
        updateStoragePorts(uris(ids), addVirtualArray(virtualArray));
    }
    storagePorts(virtualArrayId);
}
Also used : VirtualArrayRestRep(com.emc.storageos.model.varray.VirtualArrayRestRep) FlashException(controllers.util.FlashException)

Example 58 with FlashException

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

the class FileProtectionPolicies method listJson.

@FlashException(value = "list", keep = true)
public static void listJson() {
    FilePolicyListRestRep viprSchedulePolicies = getViprClient().fileProtectionPolicies().listFilePolicies();
    List<ScheculePoliciesDataTable.FileProtectionPolicy> scheculePolicies = Lists.newArrayList();
    for (NamedRelatedResourceRep policy : viprSchedulePolicies.getFilePolicies()) {
        scheculePolicies.add(new ScheculePoliciesDataTable.FileProtectionPolicy(getViprClient().fileProtectionPolicies().getFilePolicy(policy.getId())));
    }
    renderJSON(DataTablesSupport.createJSON(scheculePolicies, params));
}
Also used : ScheculePoliciesDataTable(models.datatable.ScheculePoliciesDataTable) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) FilePolicyListRestRep(com.emc.storageos.model.file.policy.FilePolicyListRestRep) FlashException(controllers.util.FlashException)

Example 59 with FlashException

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

the class FileProtectionPolicies method unassign.

@FlashException(value = "list", keep = true)
public static void unassign(String ids) {
    FilePolicyRestRep filePolicyRestRep = getViprClient().fileProtectionPolicies().get(uri(ids));
    if (filePolicyRestRep != null) {
        AssignPolicyForm assignPolicy = new AssignPolicyForm().form(filePolicyRestRep);
        addRenderApplyPolicysAt();
        addAssignedProjectArgs(filePolicyRestRep);
        addAssignedVPoolArgs(filePolicyRestRep);
        render(assignPolicy);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, ids));
        list();
    }
}
Also used : FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) FlashException(controllers.util.FlashException)

Example 60 with FlashException

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

the class FileProtectionPolicies method saveUnAssignPolicy.

@FlashException(keep = true, referrer = { "unassign" })
public static void saveUnAssignPolicy(AssignPolicyForm assignPolicy) {
    if (assignPolicy == null) {
        Logger.error("No Unassign policy parameters passed");
        badRequest("No Unassign policy parameters passed");
        return;
    }
    assignPolicy.validate("UnassignPolicy");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    assignPolicy.id = params.get("id");
    FilePolicyUnAssignParam unAssignPolicyParam = new FilePolicyUnAssignParam();
    try {
        if (updateUnAssignPolicyParam(assignPolicy, unAssignPolicyParam)) {
            TaskResourceRep taskRes = getViprClient().fileProtectionPolicies().unassignPolicy(uri(assignPolicy.id), unAssignPolicyParam);
            if (isTaskSuccessful(assignPolicy.id, taskRes)) {
                flash.success(MessagesUtils.get("unAssignPolicy.request.saved", assignPolicy.policyName));
            }
        }
    } catch (Exception ex) {
        flash.error(ex.getMessage(), assignPolicy.policyName);
    }
    if (StringUtils.isNotBlank(assignPolicy.referrerUrl)) {
        redirect(assignPolicy.referrerUrl);
    } else {
        list();
    }
}
Also used : FilePolicyUnAssignParam(com.emc.storageos.model.file.policy.FilePolicyUnAssignParam) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) FlashException(controllers.util.FlashException) 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