use of org.eclipse.vorto.core.api.model.mapping.MappingModel in project vorto by eclipse.
the class VortoService method getMappings.
public List<MappingModel> getMappings(String generatorKey, String namespace, String name, String version) {
Optional<byte[]> mappingResources = downloadUrl(urlForMapping(generatorKey, namespace, name, version));
if (mappingResources.isPresent()) {
IModelWorkspace workspace = IModelWorkspace.newReader().addZip(new ZipInputStream(new ByteArrayInputStream(mappingResources.get()))).read();
List<Model> models = workspace.get().stream().filter(p -> p instanceof MappingModel).collect(Collectors.toList());
return models.stream().map(MappingModel.class::cast).collect(Collectors.toList());
} else {
return Collections.emptyList();
}
}
use of org.eclipse.vorto.core.api.model.mapping.MappingModel in project vorto by eclipse.
the class CodeGenerationController method createInvocationContext.
private InvocationContext createInvocationContext(InformationModel model, String targetPlatform, Map<String, String> requestParams) {
byte[] mappingResources = downloadMappingModel(model, targetPlatform);
IModelWorkspace workspace = IModelWorkspace.newReader().addZip(new ZipInputStream(new ByteArrayInputStream(mappingResources))).read();
List<MappingModel> mappingModels = workspace.get().stream().filter(p -> p instanceof MappingModel).map(MappingModel.class::cast).collect(Collectors.toList());
return new InvocationContext(mappingModels, lookupService, requestParams);
}
Aggregations