final List<Host> definedOnHosts =
getVMSVirtualDomainInfo().getDefinedOnHosts();
final Map<String, Integer> networksIntersection = netInterfaceService.getNetworksIntersection(definedOnHosts);
final List<Value> commonNetworks = new ArrayList<Value>();
commonNetworks.add(new StringValue());
commonNetworks.add(new StringValue("0.0.0.0", "All Interfaces/0.0.0.0"));
commonNetworks.add(new StringValue("127.0.0.1", "localhost/127.0.0.1"));
if (networksIntersection != null) {
for (final String netIp : networksIntersection.keySet()) {
final Value network = new StringValue(netIp);
commonNetworks.add(network);
}
}
return commonNetworks.toArray(
new StringValue[commonNetworks.size()]);
} else if (GraphicsData.KEYMAP.equals(param)) {
List<Value> keymaps = null;
final List<Host> definedOnHosts =
getVMSVirtualDomainInfo().getDefinedOnHosts();
for (final Host host : definedOnHosts) {
if (keymaps == null) {
keymaps = new ArrayList<Value>();
keymaps.add(new StringValue());
keymaps.addAll(host.getAvailableQemuKeymaps());
} else {
final Set<Value> hostKeymaps = host.getAvailableQemuKeymaps();
final List<Value> newKeymaps = new ArrayList<Value>();
newKeymaps.add(new StringValue());
for (final Value km : keymaps) {
if (km != null && hostKeymaps.contains(km)) {
newKeymaps.add(km);
}
}
keymaps = newKeymaps;
}
}
if (keymaps == null) {
return new StringValue[]{new StringValue()};
}
return keymaps.toArray(new Value[keymaps.size()]);
}
return POSSIBLE_VALUES.get(param);
}