Merge pull request #1032 from dieu/org_names

Filter null organization in VCloud API
This commit is contained in:
Adrian Cole 2012-12-04 12:03:23 -08:00
commit 78e1524d6f
1 changed files with 4 additions and 2 deletions

View File

@ -35,6 +35,8 @@ import org.jclouds.vcloud.VCloudAsyncClient;
import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.Org;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
/** /**
* @author Adrian Cole * @author Adrian Cole
@ -54,14 +56,14 @@ public class OrgsForNames implements Function<Iterable<String>, Iterable<Org>> {
@Override @Override
public Iterable<Org> apply(Iterable<String> from) { public Iterable<Org> apply(Iterable<String> from) {
return Iterables2.concreteCopy(transformParallel(from, new Function<String, Future<? extends Org>>() { return Iterables.filter(transformParallel(from, new Function<String, Future<? extends Org>>() {
@Override @Override
public Future<Org> apply(String from) { public Future<Org> apply(String from) {
return aclient.getOrgClient().findOrgNamed(from); return aclient.getOrgClient().findOrgNamed(from);
} }
}, executor, null, logger, "organizations for names")); }, executor, null, logger, "organizations for names"), Predicates.notNull());
} }
} }