-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Implemented new FreeMarkerSkipProcessStep #225 * Remove sonar cloud issues * Added skipfm step documentation #225
- Loading branch information
Showing
12 changed files
with
152 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...arker/src/main/java/org/fugerit/java/doc/freemarker/config/FreeMarkerSkipProcessStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.fugerit.java.doc.freemarker.config; | ||
|
||
import freemarker.cache.TemplateLoader; | ||
import freemarker.template.Configuration; | ||
import org.fugerit.java.core.io.StreamIO; | ||
import org.fugerit.java.core.lang.helpers.StringUtils; | ||
import org.fugerit.java.doc.base.process.DocProcessContext; | ||
import org.fugerit.java.doc.base.process.DocProcessData; | ||
|
||
import java.io.Reader; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.Properties; | ||
|
||
public class FreeMarkerSkipProcessStep extends FreeMarkerProcessStep { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = -7009153804877056158L; | ||
|
||
public static final String ATT_TEMPLATE_PATH = "template-path"; | ||
public static final String CHAIN_ID_PARAM = "chainId"; | ||
|
||
public static final String ATT_MAP_ALL = "map-all"; | ||
public static final String ATT_MAP_ATTS = "map-atts"; | ||
|
||
@Override | ||
public int process(DocProcessContext context, DocProcessData data) throws Exception { | ||
Properties atts = this.getCustomConfig(); | ||
// override template path | ||
if ( StringUtils.isEmpty( this.getParam01() ) ) { | ||
this.setParam01( FreeMarkerComplexProcessStep.overrideTemplatePath( atts, this.getChainId() ) ); | ||
} | ||
Configuration cfg = (Configuration) context.getAttribute( FreeMarkerConstants.ATT_FREEMARKER_CONFIG ); | ||
TemplateLoader templateLoader = cfg.getTemplateLoader(); | ||
String path = this.getParam01(); | ||
Object templateSource = templateLoader.findTemplateSource( path ); | ||
try (Reader reader = templateLoader.getReader( templateSource, StandardCharsets.UTF_8.name() ) ) { | ||
data.setCurrentXmlData(StreamIO.readString(reader)); | ||
} | ||
return CONTINUE; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters