use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class FileProvider method getFilePolicies.
@Asset("fileFilePolicy")
@AssetDependencies({ "project", "fileFilesystemAssociation" })
public List<AssetOption> getFilePolicies(AssetOptionsContext ctx, URI project, URI fsId) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
for (FilePolicyRestRep policyRestRep : getAllFileSystemLevelPolicies(ctx)) {
options.add(new AssetOption(policyRestRep.getId(), policyRestRep.getName()));
}
if (options != null && !options.isEmpty()) {
AssetOptionsUtils.sortOptionsByLabel(options);
}
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class FileProvider method getFileFilesystemSourceArrayForAssociation.
@Asset("fileFilesystemSourceArray")
@AssetDependencies("fileFilesystemAssociation")
public List<AssetOption> getFileFilesystemSourceArrayForAssociation(AssetOptionsContext ctx, URI fsId) {
ViPRCoreClient client = api(ctx);
VirtualArrayRestRep vArray = null;
List<AssetOption> options = Lists.newArrayList();
FileShareRestRep fsObj = client.fileSystems().get(fsId);
if (fsObj != null) {
vArray = client.varrays().get(fsObj.getVirtualArray().getId());
options.add(createBaseResourceOption(vArray));
}
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class FileProvider method createFilesystemOptions.
/**
* Create filesystem options from the list of filesystems, filtering using the given predicate
*
* @return The list of AssetOptions
*/
protected List<AssetOption> createFilesystemOptions(Collection<FileShareRestRep> filesystems, Predicate predicate) {
CollectionUtils.filter(filesystems, predicate);
List<AssetOption> options = Lists.newArrayList();
for (FileShareRestRep fs : filesystems) {
options.add(new AssetOption(fs.getId(), getLabel(fs)));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class FileProvider method getExportedSubdirectory.
@Asset("subDirectory")
@AssetDependencies("fileExportedFilesystem")
public List<AssetOption> getExportedSubdirectory(AssetOptionsContext ctx, URI fileExportedFilesystem) {
List<AssetOption> options = Lists.newArrayList();
List<ExportRule> exports = api(ctx).fileSystems().getExport(fileExportedFilesystem, true, null);
for (ExportRule export : exports) {
AssetOption tempOption;
if (StringUtils.isEmpty(getSubDir(ctx, export))) {
tempOption = new AssetOption("!No subdirectory", "No subdirectory");
} else {
tempOption = new AssetOption(getSubDir(ctx, export), getSubDir(ctx, export));
}
if (!options.contains(tempOption)) {
options.add(tempOption);
}
}
AssetOptionsUtils.sortOptionsByKey(options);
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class FileProvider method getFileExports.
@Asset("fileExports")
@AssetDependencies("fileFilesystem")
public List<AssetOption> getFileExports(AssetOptionsContext ctx, URI fileFilesystem) {
List<AssetOption> options = Lists.newArrayList();
for (FileSystemExportParam export : listFileExports(ctx, fileFilesystem)) {
options.add(new AssetOption(export.getMountPoint(), export.getMountPoint()));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
Aggregations