Search in sources :

Example 1 with FilePolicyUnAssignParam

use of com.emc.storageos.model.file.policy.FilePolicyUnAssignParam 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

TaskResourceRep (com.emc.storageos.model.TaskResourceRep)1 FilePolicyUnAssignParam (com.emc.storageos.model.file.policy.FilePolicyUnAssignParam)1 FlashException (controllers.util.FlashException)1