return ImmutableSet.copyOf(Iterables.filter(vAppTemplate.getChildren(), new Predicate<Vm>() {
// filter out vms in the vApp template with computer name that contains underscores, dots,
// or both.
@Override
public boolean apply(Vm input) {
GuestCustomizationSection guestCustomizationSection = vmApi.getGuestCustomizationSection(input.getId());
String computerName = guestCustomizationSection.getComputerName();
String retainComputerName = CharMatcher.inRange('0', '9').or(CharMatcher.inRange('a', 'z'))
.or(CharMatcher.inRange('A', 'Z')).or(CharMatcher.is('-')).retainFrom(computerName);
return computerName.equals(retainComputerName);
}
}));