mirror of https://github.com/apache/jclouds.git
it is possible that for access control reasons, templates in trmk can be null
This commit is contained in:
parent
e85155aced
commit
e5c1c45ed2
|
@ -61,6 +61,8 @@ public class ImageForVCloudExpressVAppTemplate implements Function<VAppTemplate,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Image apply(VAppTemplate from) {
|
public Image apply(VAppTemplate from) {
|
||||||
|
if (from == null)
|
||||||
|
return null;
|
||||||
ImageBuilder builder = new ImageBuilder();
|
ImageBuilder builder = new ImageBuilder();
|
||||||
builder.ids(from.getHref().toASCIIString());
|
builder.ids(from.getHref().toASCIIString());
|
||||||
builder.uri(from.getHref());
|
builder.uri(from.getHref());
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.trmk.vcloud_0_8.compute.functions;
|
package org.jclouds.trmk.vcloud_0_8.compute.functions;
|
||||||
|
|
||||||
|
import static com.google.common.base.Predicates.notNull;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Provider;
|
import javax.inject.Provider;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
@ -29,7 +31,7 @@ import org.jclouds.trmk.vcloud_0_8.domain.VAppTemplate;
|
||||||
import org.jclouds.trmk.vcloud_0_8.functions.AllCatalogItemsInOrg;
|
import org.jclouds.trmk.vcloud_0_8.functions.AllCatalogItemsInOrg;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.FluentIterable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
@ -54,7 +56,9 @@ public class ImagesInVCloudExpressOrg implements Function<Org, Iterable<? extend
|
||||||
public Iterable<? extends Image> apply(Org from) {
|
public Iterable<? extends Image> apply(Org from) {
|
||||||
Iterable<? extends CatalogItem> catalogs = allCatalogItemsInOrg.apply(from);
|
Iterable<? extends CatalogItem> catalogs = allCatalogItemsInOrg.apply(from);
|
||||||
Iterable<? extends VAppTemplate> vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs);
|
Iterable<? extends VAppTemplate> vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs);
|
||||||
return Iterables.transform(vAppTemplates, imageForVAppTemplateProvider.get().withParent(from));
|
return FluentIterable.from(vAppTemplates)
|
||||||
|
.transform(imageForVAppTemplateProvider.get().withParent(from))
|
||||||
|
.filter(notNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue