use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BlockProvider method getRpFailoverTargets.
protected List<AssetOption> getRpFailoverTargets(ViPRCoreClient client, VolumeRestRep volume) {
Map<String, String> targetVolumes = Maps.newLinkedHashMap();
URI protectionSetId = volume.getProtection().getRpRep().getProtectionSet().getId();
ProtectionSetRestRep localProtectionSet = client.blockVolumes().getProtectionSet(volume.getId(), protectionSetId);
String sourceSiteName = volume.getProtection().getRpRep().getInternalSiteName();
CachedResources<VirtualArrayRestRep> virtualArrays = new CachedResources<VirtualArrayRestRep>(client.varrays());
List<RelatedResourceRep> rpTargets = localProtectionSet.getVolumes();
for (VolumeRestRep protectionSetVolume : client.blockVolumes().getByRefs(rpTargets, RecoverPointPersonalityFilter.TARGET)) {
String targetSiteName = protectionSetVolume.getProtection().getRpRep().getInternalSiteName();
boolean isLocal = StringUtils.equals(sourceSiteName, targetSiteName);
String rpType = isLocal ? "local" : "remote";
VirtualArrayRestRep virtualArray = virtualArrays.get(protectionSetVolume.getVirtualArray());
String label = getMessage("recoverpoint.target", name(protectionSetVolume), rpType, name(virtualArray));
targetVolumes.put(stringId(protectionSetVolume), label);
}
List<AssetOption> options = Lists.newArrayList();
for (Map.Entry<String, String> entry : targetVolumes.entrySet()) {
options.add(new AssetOption(entry.getKey(), entry.getValue()));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BaseAssetOptionsProvider method createNamedResourceOptions.
protected List<AssetOption> createNamedResourceOptions(Collection<? extends NamedRelatedResourceRep> values) {
List<AssetOption> options = Lists.newArrayList();
for (NamedRelatedResourceRep value : values) {
options.add(createNamedResourceOption(value));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BaseAssetOptionsProvider method createOptions.
protected List<AssetOption> createOptions(Object[] values) {
List<AssetOption> options = Lists.newArrayList();
for (Object value : values) {
options.add(new AssetOption(value.toString(), value.toString()));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BaseAssetOptionsProvider method createOptions.
protected List<AssetOption> createOptions(Collection<? extends DataObject> values) {
List<AssetOption> options = Lists.newArrayList();
for (DataObject value : values) {
options.add(createOption(value));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.vipr.model.catalog.AssetOption in project coprhd-controller by CoprHD.
the class BaseAssetOptionsProvider method createStringOptions.
protected static List<AssetOption> createStringOptions(Collection<String> values) {
List<AssetOption> options = Lists.newArrayList();
for (String value : values) {
options.add(new AssetOption(value, value));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
Aggregations