Search in sources :

Example 1 with TSMasterDataDefinitionModel

use of io.vertigo.studio.plugins.mda.domain.ts.model.TSMasterDataDefinitionModel in project vertigo by KleeGroup.

the class TSGeneratorPlugin method generateTsMasterData.

private void generateTsMasterData(final FileGeneratorConfig fileGeneratorConfig, final MdaResultBuilder mdaResultBuilder) {
    final MasterDataValues masterDataValues = masterDataManagerOpt.isPresent() ? masterDataManagerOpt.get().getValues() : new MasterDataValues();
    final List<TSMasterDataDefinitionModel> tsMasterDataDefinitionModels = Home.getApp().getDefinitionSpace().getAll(DtDefinition.class).stream().filter(dtDefinition -> dtDefinition.getStereotype() == DtStereotype.StaticMasterData).map(dtDefinition -> new TSMasterDataDefinitionModel(dtDefinition, masterDataValues.getOrDefault(dtDefinition.getClassCanonicalName(), Collections.emptyMap()))).collect(Collectors.toList());
    final Map<String, Object> model = new MapBuilder<String, Object>().put("masterdatas", tsMasterDataDefinitionModels).build();
    FileGenerator.builder(fileGeneratorConfig).withModel(model).withFileName("masterdata.ts").withGenSubDir(targetSubDir).withPackageName("").withTemplateName("domain/ts/template/ts_masterdata.ftl").build().generateFile(mdaResultBuilder);
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) DtStereotype(io.vertigo.dynamo.domain.metamodel.DtStereotype) MapBuilder(io.vertigo.util.MapBuilder) TSDtDefinitionModel(io.vertigo.studio.plugins.mda.domain.ts.model.TSDtDefinitionModel) HashMap(java.util.HashMap) FileGeneratorConfig(io.vertigo.studio.plugins.mda.FileGeneratorConfig) MasterDataValues(io.vertigo.studio.masterdata.MasterDataValues) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Home(io.vertigo.app.Home) TSMasterDataDefinitionModel(io.vertigo.studio.plugins.mda.domain.ts.model.TSMasterDataDefinitionModel) List(java.util.List) GeneratorPlugin(io.vertigo.studio.impl.mda.GeneratorPlugin) FileGenerator(io.vertigo.studio.plugins.mda.FileGenerator) MdaResultBuilder(io.vertigo.studio.mda.MdaResultBuilder) Map(java.util.Map) Assertion(io.vertigo.lang.Assertion) Entry(java.util.Map.Entry) DomainUtil(io.vertigo.studio.plugins.mda.util.DomainUtil) Optional(java.util.Optional) Named(javax.inject.Named) MasterDataManager(io.vertigo.studio.masterdata.MasterDataManager) Collections(java.util.Collections) MapBuilder(io.vertigo.util.MapBuilder) MasterDataValues(io.vertigo.studio.masterdata.MasterDataValues) TSMasterDataDefinitionModel(io.vertigo.studio.plugins.mda.domain.ts.model.TSMasterDataDefinitionModel)

Aggregations

Home (io.vertigo.app.Home)1 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)1 DtStereotype (io.vertigo.dynamo.domain.metamodel.DtStereotype)1 Assertion (io.vertigo.lang.Assertion)1 GeneratorPlugin (io.vertigo.studio.impl.mda.GeneratorPlugin)1 MasterDataManager (io.vertigo.studio.masterdata.MasterDataManager)1 MasterDataValues (io.vertigo.studio.masterdata.MasterDataValues)1 MdaResultBuilder (io.vertigo.studio.mda.MdaResultBuilder)1 FileGenerator (io.vertigo.studio.plugins.mda.FileGenerator)1 FileGeneratorConfig (io.vertigo.studio.plugins.mda.FileGeneratorConfig)1 TSDtDefinitionModel (io.vertigo.studio.plugins.mda.domain.ts.model.TSDtDefinitionModel)1 TSMasterDataDefinitionModel (io.vertigo.studio.plugins.mda.domain.ts.model.TSMasterDataDefinitionModel)1 DomainUtil (io.vertigo.studio.plugins.mda.util.DomainUtil)1 MapBuilder (io.vertigo.util.MapBuilder)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1