Skip to content

Commit 9cdbc8d

Browse files
committed
Fix chain parent handling
1 parent 58a514e commit 9cdbc8d

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/LegacyConfigRead.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import javax.xml.parsers.DocumentBuilder;
66
import javax.xml.parsers.DocumentBuilderFactory;
77

8+
import org.fugerit.java.core.lang.helpers.StringUtils;
89
import org.fugerit.java.doc.freemarker.config.FreeMarkerProcessStep;
910
import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
1011
import org.fugerit.java.doc.freemarker.tool.model.ChainModel;
@@ -31,8 +32,12 @@ public static ConfigModel readConfig( InputStream is ) throws Exception {
3132
for ( int k=0; k<chainTagList.getLength(); k++ ) {
3233
Element currentChainTag = (Element) chainTagList.item( k );
3334
String chainId = currentChainTag.getAttribute( "id" );
35+
String extendsAtt = currentChainTag.getAttribute( "extends" );
3436
log.info( "current chain id {}", chainId );
3537
ChainModel chainModel = new ChainModel(chainId);
38+
if ( StringUtils.isNotEmpty( extendsAtt ) ) {
39+
chainModel.setParent( extendsAtt );
40+
}
3641
configModel.getChainList().add(chainModel);
3742
NodeList stepTagList = currentChainTag.getElementsByTagName( "step" );
3843
for ( int i=0; i<stepTagList.getLength(); i++ ) {

fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/tool/model/ChainModel.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class ChainModel implements Serializable {
1515

1616
private String id;
1717

18+
private String parent;
19+
1820
public ChainModel( String id ) {
1921
this.setId( id );
2022
this.stepList = new ArrayList<>();

fj-doc-freemarker/src/main/resources/fj_doc_freemarker_config/template/freemarker-doc-process-config-stub.ftl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xsi:schemaLocation="https://freemarkerdocprocess.fugerit.org https://www.fugerit.org/data/java/doc/xsd/freemarker-doc-process-1-0.xsd" >
66

77
<!--
8-
Configuration stub version : 002 (2023-07-18)
8+
Configuration stub version : 003 (2023-07-19)
99
-->
1010

1111
<#assign stubHandler=stubParams['stub-handler']!'1'>
@@ -109,7 +109,7 @@
109109

110110
<#if (configModel)??>
111111
<#list configModel.chainList as chainModel>
112-
<docChain id="${chainModel.id}">
112+
<docChain id="${chainModel.id}"<#if (chainModel.parent)??> parent="${chainModel.parent}"</#if>>
113113
<#list chainModel.stepList as stepModel>
114114
<chainStep stepType="${stepModel.type}"<#if stepModel.type == 'complex'><#list stepModel.attNames as currentAttName> ${currentAttName}="${stepModel.atts[currentAttName]}"</#list></#if>>
115115
<#if stepModel.type == 'map'>
@@ -122,6 +122,10 @@
122122
${currentAttName}="${stepModel.atts[currentAttName]}"
123123
</#list>
124124
/>
125+
<#elseif stepModel.type == 'function'>
126+
<#list stepModel.attNames as currentAttName>
127+
<function name="${currentAttName}" value="${stepModel.atts[currentAttName]}"/>
128+
</#list>
125129
<#elseif stepModel.type == 'complex'>
126130
<#else>
127131
<!-- custom step, additional configuration may be needed -->

0 commit comments

Comments
 (0)