use of com.emc.vipr.client.core.filters.FilterChain in project coprhd-controller by CoprHD.
the class BlockProvider method getExportedVolumes.
@Asset("exportedBlockVolume")
@AssetDependencies("project")
public List<AssetOption> getExportedVolumes(AssetOptionsContext ctx, URI project) {
debug("getting source block volumes (project=%s)", project);
final ViPRCoreClient client = api(ctx);
// Filter volumes that are not RP Metadata
List<URI> volumeIds = getExportedVolumeIds(ctx, project);
FilterChain<VolumeRestRep> filter = new FilterChain<VolumeRestRep>(RecoverPointPersonalityFilter.METADATA.not());
filter.and(new BlockVolumeVMFSDatastoreFilter().not());
filter.and(new BlockVolumeBootVolumeFilter().not());
filter.and(new BlockVolumeMountPointFilter().not());
List<VolumeRestRep> volumes = client.blockVolumes().getByIds(volumeIds, filter);
return createVolumeWithVarrayOptions(client, volumes);
}
use of com.emc.vipr.client.core.filters.FilterChain in project coprhd-controller by CoprHD.
the class HostClusters method availableHostJson.
public static void availableHostJson(String id) {
final URI clusterId = uri(id);
ClusterRestRep cluster = ClusterUtils.getCluster(clusterId);
List<HostRestRep> hosts = null;
DefaultResourceFilter<HostRestRep> defaultHostResourceFilter = new DefaultResourceFilter<HostRestRep>() {
@Override
public boolean accept(HostRestRep hostRestRep) {
return hostRestRep.getCluster() == null || !hostRestRep.getCluster().getId().equals(clusterId);
}
};
// If we have existing hosts in the cluster, limit to that host type
List<HostRestRep> existingHosts = ClusterUtils.getHosts(uri(id));
if (!existingHosts.isEmpty()) {
FilterChain<HostRestRep> hostTypeFilter = new FilterChain<HostRestRep>(new HostTypeFilter(existingHosts.get(0).getType()));
hosts = getViprClient().hosts().getByTenant(cluster.getTenant().getId(), hostTypeFilter.and(defaultHostResourceFilter));
} else {
hosts = getViprClient().hosts().getByTenant(cluster.getTenant().getId(), defaultHostResourceFilter);
}
renderJSON(DataTablesSupport.createJSON(hosts, params));
}
Aggregations