use of org.eclipse.vorto.codegen.api.IGenerationResult in project vorto by eclipse.
the class WebDeviceGenerator method generate.
@Override
public IGenerationResult generate(InformationModel context, InvocationContext invocationContext, IVortoCodeGenProgressMonitor monitor) throws VortoCodeGeneratorException {
GenerationResultZip outputter = new GenerationResultZip(context, getServiceKey());
for (FunctionblockProperty property : context.getProperties()) {
ChainedCodeGeneratorTask<FunctionblockModel> generator = new ChainedCodeGeneratorTask<FunctionblockModel>();
generator.addTask(new GeneratorTaskFromFileTemplate<>(new ServiceClassTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new PageTemplate()));
generator.generate(property.getType(), invocationContext, outputter);
}
ChainedCodeGeneratorTask<InformationModel> generator = new ChainedCodeGeneratorTask<InformationModel>();
generator.addTask(new GeneratorTaskFromFileTemplate<>(new WebSocketConfigTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new PomFileTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new IndexHtmlFileTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new DeviceInfoTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new DeviceInfoServiceTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new ControllersScriptFileTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new AppScriptFileTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new ApplicationMainTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new CssTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new ApplicationYmlTemplate()));
generator.addTask(new GeneratorTaskFromFileTemplate<>(new ReadmeTemplate()));
generator.generate(context, invocationContext, outputter);
IGenerationResult javaResult = invocationContext.lookupGenerator(JavabeanGenerator.KEY).generate(context, invocationContext, monitor);
return GenerationResultBuilder.from(outputter).append(javaResult).build();
}
Aggregations