use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class FileSnapshots method addSnapShotSubDir.
/**
* This method called when user adds sub directory.
*
* @param id
* id of the file system.
* @param shareName
* shareName of the sub directory.
* @param subDirectory
* name of the sub directory.
* @param description
* Given description during creation of sub directory.
*/
@FlashException(referrer = { "snapshot" })
public static void addSnapShotSubDir(String id, String shareName, String subDirectroy, String description) {
ViPRCoreClient client = BourneUtil.getViprClient();
FileSystemShareParam param = new FileSystemShareParam();
param.setShareName(shareName);
if (subDirectroy != null && !"".equals(subDirectroy)) {
param.setSubDirectory(subDirectroy);
}
if (description != null && !"".equals(description)) {
param.setDescription(description);
}
client.fileSnapshots().share(uri(id), param);
flash.put("info", MessagesUtils.get("resources.filesystem.subdir.add"));
snapshot(id);
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class FileSnapshots method deleteFileSnapshot.
@FlashException(referrer = { "snapshot" })
public static void deleteFileSnapshot(String fileSnapshotId) {
if (StringUtils.isNotBlank(fileSnapshotId)) {
ViPRCoreClient client = BourneUtil.getViprClient();
Task<FileSnapshotRestRep> task = client.fileSnapshots().deactivate(uri(fileSnapshotId));
flash.put("info", MessagesUtils.get("resources.filesnapshot.deactivate"));
}
snapshot(fileSnapshotId);
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class FileSystems method fileSystemQuotaDirectories.
@FlashException(referrer = { "fileSystem" })
public static void fileSystemQuotaDirectories(String fileSystemId) {
ViPRCoreClient client = BourneUtil.getViprClient();
List<QuotaDirectoryRestRep> quotas = client.quotaDirectories().getByFileSystem(uri(fileSystemId));
render(quotas);
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class FileSystems method saveAce.
/**
* This method called When user Modifies ACE.
*
* @param shareACL
* Form Data from modify screen.
*/
@FlashException(referrer = { "fileSystem" })
public static void saveAce(ShareACLForm shareACL) {
String name = params.get("name");
String type = params.get("type");
String domain = params.get("domain");
String shareName = params.get("shareName");
String fileSystemId = params.get("fileSystemId");
String permission = shareACL.permission;
List<ShareACL> ace = new ArrayList<ShareACL>();
ShareACL shareAcl = new ShareACL();
ShareACLs aclsToModify = new ShareACLs();
if ("GROUP".equalsIgnoreCase(type)) {
shareAcl.setGroup(name);
} else {
shareAcl.setUser(name);
}
shareAcl.setPermission(permission);
if (domain != null && !"".equals(domain)) {
shareAcl.setDomain(domain);
}
ace.add(shareAcl);
aclsToModify.setShareACLs(ace);
FileCifsShareACLUpdateParams input = new FileCifsShareACLUpdateParams();
input.setAclsToModify(aclsToModify);
ViPRCoreClient client = BourneUtil.getViprClient();
client.fileSystems().updateShareACL(uri(fileSystemId), shareName, input);
listAcl(fileSystemId, shareName);
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class FileSystems method removeNfsAcl.
@FlashException(referrer = { "fileSystem" })
public static void removeNfsAcl(@As(",") String[] ids) {
List<NfsACE> aces = Lists.newArrayList();
String fileSystem = null;
String subDir = null;
String fsMountPath = null;
if (ids != null && ids.length > 0) {
for (String id : ids) {
String type = NfsACLForm.extractTypeFromId(id);
String name = NfsACLForm.extractNameFromId(id);
String domain = NfsACLForm.extractDomainFromId(id);
String permissions = NfsACLForm.extractPermissionsFromId(id);
String permissionType = NfsACLForm.extractPermissionTypeFromId(id);
fileSystem = NfsACLForm.extractFileSystemFromId(id);
subDir = NfsACLForm.extractSubDirFromId(id);
fsMountPath = NfsACLForm.extractMounPathFromId(id);
NfsACE ace = new NfsACE();
ace.setUser(name);
ace.setType(type);
ace.setPermissions(permissions.replaceAll("/", ","));
ace.setPermissionType(permissionType);
if (domain != null && !"".equals(domain) && !"null".equals(domain)) {
ace.setDomain(domain);
}
aces.add(ace);
}
FileNfsACLUpdateParams input = new FileNfsACLUpdateParams();
input.setAcesToDelete(aces);
if (subDir != null && !"null".equals(subDir)) {
input.setSubDir(subDir);
}
ViPRCoreClient client = BourneUtil.getViprClient();
client.fileSystems().updateNfsACL(uri(fileSystem), input);
}
flash.success(MessagesUtils.get(DELETED));
listNfsAcl(fileSystem, fsMountPath, subDir);
}
Aggregations