Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.fugerit.java.doc.base.model.DocBase;

import lombok.Getter;
import org.fugerit.java.doc.base.process.DocProcessContext;

public class DocInput {

Expand All @@ -15,6 +16,8 @@ public class DocInput {

@Getter private int source;

@Getter private DocProcessContext context;

private DocBase doc;

public DocBase getDoc() {
Expand All @@ -31,11 +34,16 @@ public DocInput(String type, DocBase doc, Reader reader) {
}

public DocInput(String type, DocBase doc, Reader reader, int source) {
this(type, doc, reader, source, null);
}

public DocInput(String type, DocBase doc, Reader reader, int source, DocProcessContext context) {
super();
this.type = type;
this.reader = reader;
this.doc = doc;
this.source = source;
this.context = context;
}

public static DocInput newInput( String type, DocBase doc ) {
Expand All @@ -58,5 +66,12 @@ public static DocInput newInput( String type, DocBase doc, Reader reader, int so
return new DocInput( type, doc, reader, source );
}


public static DocInput newInput( String type, Reader reader, int source, DocProcessContext context ) {
return newInput( type, null, reader, source, context );
}

public static DocInput newInput( String type, DocBase doc, Reader reader, int source, DocProcessContext context ) {
return new DocInput( type, doc, reader, source, context );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2412,12 +2412,18 @@
}, {
"name" : "<init>",
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase", "java.io.Reader", "int" ]
}, {
"name" : "<init>",
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase", "java.io.Reader", "int", "org.fugerit.java.doc.base.process.DocProcessContext" ]
}, {
"name" : "equals",
"parameterTypes" : [ "java.lang.Object" ]
}, {
"name" : "getClass",
"parameterTypes" : [ ]
}, {
"name" : "getContext",
"parameterTypes" : [ ]
}, {
"name" : "getDoc",
"parameterTypes" : [ ]
Expand All @@ -2439,6 +2445,9 @@
}, {
"name" : "newInput",
"parameterTypes" : [ "java.lang.String", "java.io.Reader", "int" ]
}, {
"name" : "newInput",
"parameterTypes" : [ "java.lang.String", "java.io.Reader", "int", "org.fugerit.java.doc.base.process.DocProcessContext" ]
}, {
"name" : "newInput",
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase" ]
Expand All @@ -2448,6 +2457,9 @@
}, {
"name" : "newInput",
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase", "java.io.Reader", "int" ]
}, {
"name" : "newInput",
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase", "java.io.Reader", "int", "org.fugerit.java.doc.base.process.DocProcessContext" ]
}, {
"name" : "notify",
"parameterTypes" : [ ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.fugerit.java.doc.base.config.DocInput;
import org.fugerit.java.doc.base.facade.DocFacadeSource;
import org.fugerit.java.doc.base.model.DocBase;
import org.fugerit.java.doc.base.process.DocProcessContext;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand All @@ -17,24 +18,34 @@ class TestDocInput {
@Test
void test1() {
DocInput docInput = new DocInput( DocConfig.TYPE_PDF , new DocBase(), null );
log.info( "docInput : {}" , docInput );
log.info( "docInput 1 : {}" , docInput );
Assertions.assertNotNull( docInput.getDoc() );
}

@Test
void test2() {
try ( StringReader reader = new StringReader( "<doc/>" ) ) {
DocInput docInput = DocInput.newInput( DocConfig.TYPE_PDF , reader, DocFacadeSource.SOURCE_TYPE_XML );
log.info( "docInput : {}" , docInput );
log.info( "docInput 2 : {}" , docInput );
Assertions.assertNotNull( docInput.getDoc() );
}
}

@Test
void test3() {
DocInput docInput = new DocInput( DocConfig.TYPE_PDF , null, null );
log.info( "docInput : {}" , docInput );
log.info( "docInput 3 : {}" , docInput );
Assertions.assertNull( docInput.getDoc() );
}

@Test
void test4() {
DocInput docInput = DocInput.newInput(
DocConfig.TYPE_PDF , null,
DocFacadeSource.SOURCE_TYPE_XML,
DocProcessContext.newContext() );
log.info( "docInput 4 : {}" , docInput );
Assertions.assertNull( docInput.getDoc() );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public DocProcessData fullProcess( String chainId, DocProcessContext context, Do
log.debug( "overrideSourceType {}, for chainId : {}", overrideSourceType, chainId );
context.withSourceType( overrideSourceType );
}
DocInput docInput = this.docInputProcess.process( DocInput.newInput( handler.getType() , data.getCurrentXmlReader(), context.getSourceType() ) );
DocInput docInput = this.docInputProcess.process( DocInput.newInput( handler.getType() , data.getCurrentXmlReader(), context.getSourceType(), context ) );
handler.handle( docInput , docOutput );
return data;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

public interface FopConfig extends Serializable {

public FopFactory newFactory() throws ConfigException;
FopFactory newFactory() throws ConfigException;

}