-
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.
+ [New freemarker configuration model, compatibility mode](https://github.com/fugerit-org/fj-bom/issues/38) [TODO : xsd]
- Loading branch information
Showing
33 changed files
with
216 additions
and
269 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
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
9 changes: 9 additions & 0 deletions
9
...reemarker/src/main/java/org/fugerit/java/doc/freemarker/process/DefaultChainProvider.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,9 @@ | ||
package org.fugerit.java.doc.freemarker.process; | ||
|
||
import org.fugerit.java.core.util.filterchain.MiniFilterChain; | ||
|
||
public interface DefaultChainProvider { | ||
|
||
public MiniFilterChain newDefaultChain( String id ); | ||
|
||
} |
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
52 changes: 38 additions & 14 deletions
52
...ker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfig.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 |
---|---|---|
@@ -1,42 +1,66 @@ | ||
package org.fugerit.java.doc.freemarker.process; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.fugerit.java.core.cfg.xml.ListMapConfig; | ||
import org.fugerit.java.core.util.filterchain.MiniFilterChain; | ||
import org.fugerit.java.doc.base.process.DocProcessConfig; | ||
import org.fugerit.java.doc.base.process.DocProcessContext; | ||
import org.fugerit.java.doc.base.process.DocProcessData; | ||
|
||
import lombok.Getter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class FreemarkerDocProcessConfig extends DocProcessConfig implements Serializable { | ||
|
||
private static final long serialVersionUID = -6761081877582850120L; | ||
|
||
@Getter | ||
private ListMapConfig<ConfigInitModel> configInitList; | ||
|
||
@Getter | ||
private ListMapConfig<DocChainModel> docChainList; | ||
|
||
private Map<String, MiniFilterChain> additionalChans; | ||
|
||
protected FreemarkerDocProcessConfig() { | ||
this.configInitList = new ListMapConfig<>(); | ||
super(); | ||
this.docChainList = new ListMapConfig<>(); | ||
this.additionalChans = new HashMap<>(); | ||
} | ||
|
||
private DefaultChainProvider defaultChain; | ||
|
||
protected void setDefaultChain( DefaultChainProvider defaultChain ) { | ||
this.defaultChain = defaultChain; | ||
} | ||
|
||
protected DefaultChainProvider getDefaultChain() { | ||
return this.defaultChain; | ||
} | ||
|
||
public void process( String configId, String chainId, DocProcessContext context, DocProcessData data ) throws Exception { | ||
ConfigInitModel configInitModel = this.getConfigInitList().get( configId ); | ||
DocChainModel docChainModel = this.getChainOrDefault(chainId); | ||
configInitModel.process(docChainModel, context, data); | ||
public void process( String chainId, DocProcessContext context, DocProcessData data ) throws Exception { | ||
MiniFilterChain chain = this.getChainCache( chainId ); | ||
log.info( "chain list {}", this.getIdSet() ); | ||
chain.apply( context , data ); | ||
} | ||
|
||
private DocChainModel getChainOrDefault( String id ) { | ||
DocChainModel model = this.getDocChainList().get( id ); | ||
if ( model == null ) { | ||
model = new DocChainModel(); | ||
model.setId( id ); | ||
@Override | ||
public MiniFilterChain getChain(String id) throws Exception { | ||
MiniFilterChain chain = null; | ||
if ( this.getDataList( id ) != null ) { | ||
chain = this.getChain( id ); | ||
} else if ( this.additionalChans.containsKey( id ) ) { | ||
chain = this.additionalChans.get( id ); | ||
} else if ( this.getDefaultChain() != null ) { | ||
chain = this.getDefaultChain().newDefaultChain(id); | ||
this.addAdditionalChain(chain); | ||
} | ||
return model; | ||
return chain; | ||
} | ||
|
||
protected void addAdditionalChain( MiniFilterChain chain ) { | ||
this.additionalChans.put(chain.getChainId(), chain); | ||
} | ||
|
||
} |
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
Oops, something went wrong.