Skip to content

Commit f04148b

Browse files
authored
Merge pull request #44 from fugerit-org/feature/issue_43_pdf_a
Feature/issue 43 pdf a
2 parents 0567c12 + 5a5351a commit f04148b

File tree

42 files changed

+580
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+580
-348
lines changed

docgen/parameters.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"title" : "Venus (Fugerit Document Generation Framework)",
33
"name": "Venus",
4-
"version" : "1.3.0-rc.007",
5-
"date" : "12/07/2023",
4+
"version" : "1.3.1-rc.001",
5+
"date" : "13/07/2023",
66
"organization" : {
77
"name" : "Fugerit Org",
88
"url" : "https://www.fugerit.org"

docgen/release-notes.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
1.3.0-rc.007 (2023-07-12)
1+
1.3.1-rc.001 (2023-07-13)
22
------------------
3-
+ [New freemarker configuration model, compatibility mode](https://github.com/fugerit-org/fj-bom/issues/38)
3+
+ [[fj-doc-mod-fop] add pdf/a support](https://github.com/fugerit-org/fj-doc/issues/43)
4+
5+
1.3.0-rc.007 (2023-07-12)
6+
------------------
7+
+ [New freemarker configuration model, compatibility mode](https://github.com/fugerit-org/fj-doc/issues/38)
48

59
1.3.0-rc.004 (2023-07-11)
610
------------------
711
+ fj-bom updated to 1.2.3
812

913
1.3.0-rc.001 (2023-07-09)
1014
------------------
11-
+ [New freemarker configuration model](https://github.com/fugerit-org/fj-bom/issues/38)
15+
+ [New freemarker configuration model](https://github.com/fugerit-org/fj-doc/issues/38)
1216

1317
1.2.0-rc.001 (2023-07-07)
1418
------------------

fj-doc-base-json/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>1.3.0-rc.007</version>
10+
<version>1.3.1-rc.001</version>
1111
</parent>
1212

1313
<name>fj-doc-base-json</name>

fj-doc-base-yaml/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>1.3.0-rc.007</version>
10+
<version>1.3.1-rc.001</version>
1111
</parent>
1212

1313
<name>fj-doc-base-yaml</name>

fj-doc-base/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>org.fugerit.java</groupId>
99
<artifactId>fj-doc</artifactId>
10-
<version>1.3.0-rc.007</version>
10+
<version>1.3.1-rc.001</version>
1111
</parent>
1212

1313
<name>fj-doc-base</name>

fj-doc-base/src/main/docs/fdp_xsd_config_ref.html

Lines changed: 206 additions & 14 deletions
Large diffs are not rendered by default.

fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ public class DocConfig {
77
public static final String TYPE_XML = "xml";
88

99
public static final String TYPE_PDF = "pdf";
10+
public static final String FORMAT_PDF_A_1A = "PDF/A-1a";
11+
public static final String FORMAT_PDF_A_1B = "PDF/A-1b";
1012

1113
public static final String TYPE_RTF = "rtf";
1214

fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocTypeHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public interface DocTypeHandler extends KeyString {
1212

1313
String getMime();
1414

15+
String getFormat();
16+
1517
Charset getCharset();
1618

1719
void handle( DocInput docInput, DocOutput docOutput ) throws Exception;

fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocTypeHandlerDefault.java

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
import org.w3c.dom.Element;
1111
import org.w3c.dom.NodeList;
1212

13+
import lombok.AccessLevel;
14+
import lombok.Setter;
15+
import lombok.extern.slf4j.Slf4j;
16+
17+
@Slf4j
1318
public class DocTypeHandlerDefault extends XMLConfigurableObject implements DocTypeHandler, Serializable {
1419

1520
/**
@@ -19,6 +24,8 @@ public class DocTypeHandlerDefault extends XMLConfigurableObject implements DocT
1924

2025
public static final String TAG_NAME_CONFIG = "config";
2126

27+
public static final String TAG_NAME_CONFIG_ALT = "docHandlerCustomConfig";
28+
2229
public static final String ATT_NAME_CHARSET = "charset";
2330

2431
private String type;
@@ -27,6 +34,8 @@ public class DocTypeHandlerDefault extends XMLConfigurableObject implements DocT
2734

2835
private String mime;
2936

37+
@Setter(value = AccessLevel.PROTECTED) private String format;
38+
3039
private Charset charset;
3140

3241
@Override
@@ -40,7 +49,7 @@ public String getMime() {
4049

4150
@Override
4251
public String getKey() {
43-
return createKey( this.getType() , this.getModule() ) ;
52+
return createKey( this.getFormat() , this.getModule() ) ;
4453
}
4554

4655
@Override
@@ -53,6 +62,11 @@ public String getModule() {
5362
return module;
5463
}
5564

65+
@Override
66+
public String getFormat() {
67+
return StringUtils.valueWithDefault( this.format , this.getType() );
68+
}
69+
5670
@Override
5771
public Charset getCharset() {
5872
return charset;
@@ -64,10 +78,15 @@ public void handle(DocInput docInput, DocOutput docOutput) throws Exception {
6478
}
6579

6680
public DocTypeHandlerDefault(String type, String module, String mime, Charset charset) {
81+
this( type, module, mime, charset, null );
82+
}
83+
84+
public DocTypeHandlerDefault(String type, String module, String mime, Charset charset, String format) {
6785
super();
6886
this.type = type;
6987
this.module = module;
7088
this.mime = mime;
89+
this.format = format;
7190
this.charset = DocCharsetProvider.getDefaultProvider().resolveCharset(charset);
7291
}
7392

@@ -87,17 +106,37 @@ protected void handleConfigTag( Element config ) throws ConfigException {
87106

88107
}
89108

90-
@Override
91-
public void configure(Element tag) throws ConfigException {
92-
NodeList nl = tag.getElementsByTagName( TAG_NAME_CONFIG );
109+
private Element lookupConfig( Element tag, String tagName ) {
110+
Element configTag = null;
111+
NodeList nl = tag.getElementsByTagName( tagName );
93112
if ( nl.getLength() > 0 ) {
94-
Element config = (Element)nl.item( 0 );
95-
String charsetAtt = config.getAttribute( ATT_NAME_CHARSET );
113+
configTag = (Element)nl.item( 0 );
114+
String charsetAtt = configTag.getAttribute( ATT_NAME_CHARSET );
96115
if ( StringUtils.isNotEmpty( charsetAtt ) ) {
97116
this.charset = Charset.forName( charsetAtt );
98117
}
99-
this.handleConfigTag(config);
118+
}
119+
return configTag;
120+
}
121+
122+
@Override
123+
public void configure(Element tag) throws ConfigException {
124+
log.info( "configure : {}", tag.getAttribute( "id" ) );
125+
Element configTag = this.lookupConfig(tag, TAG_NAME_CONFIG_ALT );
126+
if ( configTag == null ) {
127+
configTag = this.lookupConfig(tag, TAG_NAME_CONFIG );
128+
}
129+
if ( configTag != null ) {
130+
this.handleConfigTag(configTag);
100131
}
101132
}
102133

134+
@Override
135+
public String toString() {
136+
return this.getClass().getSimpleName()+" [type=" + type + ", module=" + module + ", format=" + format + "]";
137+
}
138+
139+
140+
141+
103142
}

fj-doc-base/src/main/java/org/fugerit/java/doc/base/facade/DocHandlerFacade.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import org.fugerit.java.doc.base.config.DocInput;
1313
import org.fugerit.java.doc.base.config.DocOutput;
1414
import org.fugerit.java.doc.base.config.DocTypeHandler;
15-
import org.slf4j.Logger;
16-
import org.slf4j.LoggerFactory;
15+
16+
import lombok.extern.slf4j.Slf4j;
1717

1818
/**
1919
* DocHandlerFacade
@@ -24,10 +24,9 @@
2424
* @author fugerit
2525
*
2626
*/
27+
@Slf4j
2728
public class DocHandlerFacade implements Serializable {
2829

29-
private static final Logger logger = LoggerFactory.getLogger( DocHandlerFacade.class );
30-
3130
/**
3231
*
3332
*/
@@ -47,30 +46,33 @@ public DocHandlerFacade() {
4746
}
4847

4948
private void doRegister( DocTypeHandler handler, String id ) {
50-
logger.info( "Registering handler with id {} : {}", id, handler.getClass().getName() );
49+
log.info( "Registering handler with id {} : {}", id, handler.getClass().getName() );
5150
this.mapHandlers.put( id, handler );
52-
ListMapStringKey<DocTypeHandler> list = this.mapTypeHandlers.get( handler.getType() );
51+
ListMapStringKey<DocTypeHandler> list = this.mapTypeHandlers.get( handler.getFormat() );
5352
if ( list == null ) {
5453
list = new ListMapStringKey<DocTypeHandler>();
55-
this.mapTypeHandlers.put( handler.getType() , list );
54+
this.mapTypeHandlers.put( handler.getFormat() , list );
5655
}
5756
list.add( handler );
5857
}
5958

6059
public void registerHandler( DocTypeHandler handler, boolean registerForType, boolean errorOnDuplicate ) throws Exception {
6160
doRegister( handler, handler.getKey() );
6261
if ( registerForType ) {
62+
String format = handler.getFormat();
6363
String type = handler.getType();
64-
DocTypeHandler previous = this.mapHandlers.get( type );
64+
DocTypeHandler previous = this.mapHandlers.get( format );
6565
if ( previous != null ) {
6666
if ( errorOnDuplicate ) {
67-
throw new ConfigException( "Duplicate handler for type : "+type );
67+
throw new ConfigException( "Duplicate handler for format : "+format+" (type:"+type+")" );
6868
} else {
69-
logger.warn( "Warning duplicate handler for type, {} will replace {}", type, handler.getKey(), previous.getKey() );
69+
log.warn( "Warning duplicate handler for format, {} will replace {}", format, handler.getKey(), previous.getKey() );
7070
}
7171
}
72-
doRegister(handler, type);
72+
doRegister(handler, format);
7373
}
74+
log.info( "list keys current -> {} : list {}", handler, this.mapHandlers.keySet() );
75+
log.debug( "test" );
7476
}
7577

7678
public void registerHandler( DocTypeHandler handler ) throws Exception {

0 commit comments

Comments
 (0)