ENTAXY-374 release 1.8.2
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base.connecting</groupId>
|
||||
<artifactId>generator</artifactId>
|
||||
<version>1.8.1</version>
|
||||
<version>1.8.2</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -20,7 +20,6 @@
|
||||
<bundle.osgi.export.pkg>
|
||||
ru.entaxy.esb.platform.runtime.base.connecting.generator.ftl
|
||||
</bundle.osgi.export.pkg>
|
||||
<freemarker.version>2.3.29</freemarker.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -105,6 +105,22 @@ public class FTLGenerator extends AbstractSelfPublishGenerator<FTLGenerator>
|
||||
return generateForTemplate(template, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGeneratable(Map<String, Object> properties) throws Exception {
|
||||
prepareTemplate(properties);
|
||||
if (template == null)
|
||||
return false;
|
||||
URL templateURL = template.getTemplateLocation()==null
|
||||
?FrameworkUtil.getBundle(FTLGenerator.class).getEntry(DEFAULT_TEMPLATE_PATH)
|
||||
:template.getTemplateLocation();
|
||||
try {
|
||||
Template temp = getTemplateByFullName(templateURL, template.getTemplateFullName());
|
||||
return (temp != null);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Generated generateForTemplate(ru.entaxy.base.generator.template.Template template,
|
||||
Map<String, Object> properties) throws Exception {
|
||||
|
||||
@ -194,19 +210,19 @@ public class FTLGenerator extends AbstractSelfPublishGenerator<FTLGenerator>
|
||||
if (this.template != null)
|
||||
return;
|
||||
|
||||
Map<String, Object> finalPropertes = new HashMap<>();
|
||||
finalPropertes.putAll(initialProperties);
|
||||
finalPropertes.putAll(generationProperties);
|
||||
Map<String, Object> finalProperties = new HashMap<>();
|
||||
finalProperties.putAll(initialProperties);
|
||||
finalProperties.putAll(generationProperties);
|
||||
|
||||
TemplateImpl temp = new TemplateImpl();
|
||||
temp.setBundleContext(
|
||||
(BundleContext)finalPropertes.getOrDefault(Generator.PROP_TARGET_BUNDLE_CONTEXT
|
||||
(BundleContext)finalProperties.getOrDefault(Generator.PROP_TARGET_BUNDLE_CONTEXT
|
||||
, FrameworkUtil.getBundle(FTLGenerator.class).getBundleContext())
|
||||
);
|
||||
temp.setTemplateName((String)finalPropertes.getOrDefault(PROP_TEMPLATE_NAME
|
||||
, (String)finalPropertes.getOrDefault(Generator.PROP_USAGE_TYPE
|
||||
temp.setTemplateName((String)finalProperties.getOrDefault(PROP_TEMPLATE_NAME
|
||||
, (String)finalProperties.getOrDefault(Generator.PROP_USAGE_TYPE
|
||||
, "root")));
|
||||
temp.setPath((String)finalPropertes.getOrDefault(PROP_TEMPLATE_NAME
|
||||
temp.setPath((String)finalProperties.getOrDefault(PROP_TEMPLATE_NAME
|
||||
, DEFAULT_TEMPLATE_PATH)
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user