use of com.openshift.restclient.model.image.ITagReference in project jbosstools-openshift by jbosstools.
the class ApplicationSourceTreeItems method loadImageStreams.
private Collection<IApplicationSource> loadImageStreams(IProject project, Connection conn) {
final Collection<IImageStream> streams = conn.getResources(ResourceKind.IMAGE_STREAM, project.getNamespaceName());
try {
if (StringUtils.isNotBlank(conn.getClusterNamespace())) {
Collection<IImageStream> commonStreams = conn.getResources(ResourceKind.IMAGE_STREAM, (String) conn.getClusterNamespace());
commonStreams.stream().filter(s -> !streams.contains(s)).forEach(s -> streams.add(s));
}
} catch (OpenShiftException e) {
OpenShiftUIActivator.log(IStatus.ERROR, e.getLocalizedMessage(), e);
}
Collection<IApplicationSource> sources = new ArrayList<>();
for (IImageStream is : streams) {
List<ITagReference> tags = is.getTags().stream().filter(t -> t.isAnnotatedWith(OpenShiftAPIAnnotations.TAGS) && ArrayUtils.contains(t.getAnnotation(OpenShiftAPIAnnotations.TAGS).split(","), BUILDER_TAG)).collect(Collectors.toList());
if (!tags.isEmpty()) {
tags.forEach(t -> sources.add(new ImageStreamApplicationSource(is, t)));
}
}
return sources;
}
Aggregations