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);
}
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);
}
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);
}
}
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));
}
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();
}
Aggregations