File tree Expand file tree Collapse file tree 15 files changed +263
-38
lines changed
main/java/org/fugerit/java/doc/val
java/test/org/fugerit/java/doc/val Expand file tree Collapse file tree 15 files changed +263
-38
lines changed Original file line number Diff line number Diff line change 11{
22 "title" : " Venus (Fugerit Document Generation Framework)" ,
33 "name" : " Venus" ,
4- "version" : " 0.6.0 " ,
5- "date" : " 20 /12/2022" ,
4+ "version" : " 0.6.1 " ,
5+ "date" : " 22 /12/2022" ,
66 "organization" : {
77 "name" : " Fugerit Org" ,
88 "url" : " https://www.fugerit.org"
Original file line number Diff line number Diff line change 1+ 0.6.1 (2022-12-22)
2+ ------------------
3+ + Added doc(x) and xls(x) validators
4+ + Corrected type in package name
5+
160.6.0 (2022-12-20)
27------------------
38+ Added compatibility check for Tiff Image Validator (required java 9+ at runtime)
7120.5.11 (2022-12-19)
813------------------
914+ Added doc type validation module (fj-doc-val)
15+ + Now fj-doc requires java9+ at build time (will be build with java 11) , java8 at runtime (some functionalities will not works)
1016
11170.5.10 (2022-12-12)
1218------------------
Original file line number Diff line number Diff line change 4141 <artifactId >pdfbox</artifactId >
4242 <version >${pdfbox-version} </version >
4343 </dependency >
44+
45+ <dependency >
46+ <groupId >org.apache.poi</groupId >
47+ <artifactId >poi-ooxml</artifactId >
48+ </dependency >
49+
50+ <dependency >
51+ <groupId >org.apache.poi</groupId >
52+ <artifactId >poi-scratchpad</artifactId >
53+ <version >${poi-version} </version >
54+ </dependency >
4455
4556 </dependencies >
4657
Original file line number Diff line number Diff line change 11package org .fugerit .java .doc .val .pdf .boc ;
22
3- import java .io .InputStream ;
4-
5- import org .apache .pdfbox .pdmodel .PDDocument ;
6- import org .fugerit .java .doc .val .core .DocTypeValidationResult ;
7- import org .fugerit .java .doc .val .core .DocTypeValidator ;
8- import org .fugerit .java .doc .val .core .basic .AbstractDocTypeValidator ;
9- import org .slf4j .Logger ;
10- import org .slf4j .LoggerFactory ;
11-
12- public class PdfboxValidator extends AbstractDocTypeValidator {
13-
14- private static final Logger logger = LoggerFactory .getLogger ( PdfboxValidator .class );
15-
16- public static final String EXTENSION = "PDF" ;
17-
18- public static final String MIME_TYPE = "application/pdf" ;
19-
20- public static final DocTypeValidator DEFAULT = new PdfboxValidator ();
21-
22- public PdfboxValidator () {
23- super ( MIME_TYPE , EXTENSION );
24- }
25-
26- @ Override
27- public DocTypeValidationResult validate (InputStream is ) {
28- DocTypeValidationResult result = DocTypeValidationResult .newFail ();
29- try {
30- PDDocument .load ( is );
31- result = DocTypeValidationResult .newOk ();
32- } catch (Exception e ) {
33- logger .warn ( "Failed check on pdf : " +e );
34- }
35- return result ;
36- }
3+ @ Deprecated
4+ public class PdfboxValidator extends org .fugerit .java .doc .val .pdf .box .PdfboxValidator {
375
386}
Original file line number Diff line number Diff line change 1+ package org .fugerit .java .doc .val .pdf .box ;
2+
3+ import java .io .InputStream ;
4+
5+ import org .apache .pdfbox .pdmodel .PDDocument ;
6+ import org .fugerit .java .doc .val .core .DocTypeValidationResult ;
7+ import org .fugerit .java .doc .val .core .DocTypeValidator ;
8+ import org .fugerit .java .doc .val .core .basic .AbstractDocTypeValidator ;
9+ import org .slf4j .Logger ;
10+ import org .slf4j .LoggerFactory ;
11+
12+ public class PdfboxValidator extends AbstractDocTypeValidator {
13+
14+ private static final Logger logger = LoggerFactory .getLogger ( PdfboxValidator .class );
15+
16+ public static final String EXTENSION = "PDF" ;
17+
18+ public static final String MIME_TYPE = "application/pdf" ;
19+
20+ public static final DocTypeValidator DEFAULT = new PdfboxValidator ();
21+
22+ public PdfboxValidator () {
23+ super ( MIME_TYPE , EXTENSION );
24+ }
25+
26+ @ Override
27+ public DocTypeValidationResult validate (InputStream is ) {
28+ DocTypeValidationResult result = DocTypeValidationResult .newFail ();
29+ try {
30+ PDDocument .load ( is );
31+ result = DocTypeValidationResult .newOk ();
32+ } catch (Exception e ) {
33+ logger .warn ( "Failed check on pdf : " +e );
34+ }
35+ return result ;
36+ }
37+
38+ }
Original file line number Diff line number Diff line change 1+ package org .fugerit .java .doc .val .poi ;
2+
3+ import java .io .InputStream ;
4+
5+ import org .apache .poi .hwpf .HWPFDocument ;
6+ import org .fugerit .java .doc .val .core .DocTypeValidationResult ;
7+ import org .fugerit .java .doc .val .core .DocTypeValidator ;
8+ import org .fugerit .java .doc .val .core .basic .AbstractDocTypeValidator ;
9+ import org .slf4j .Logger ;
10+ import org .slf4j .LoggerFactory ;
11+
12+ public class DocValidator extends AbstractDocTypeValidator {
13+
14+ private static final Logger logger = LoggerFactory .getLogger ( DocValidator .class );
15+
16+ public static final String EXTENSION = "DOC" ;
17+
18+ public static final String MIME_TYPE = "application/msword" ;
19+
20+ public static final DocTypeValidator DEFAULT = new DocValidator ();
21+
22+ public DocValidator () {
23+ super ( MIME_TYPE , EXTENSION );
24+ }
25+
26+ @ Override
27+ public DocTypeValidationResult validate (InputStream is ) {
28+ DocTypeValidationResult result = DocTypeValidationResult .newFail ();
29+ try ( HWPFDocument workbook = new HWPFDocument ( is ) ) {
30+ result = DocTypeValidationResult .newOk ();
31+ } catch (Exception e ) {
32+ logger .warn ( "Failed check on pdf : " +e );
33+ }
34+ return result ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 1+ package org .fugerit .java .doc .val .poi ;
2+
3+ import java .io .InputStream ;
4+
5+ import org .apache .poi .xwpf .usermodel .XWPFDocument ;
6+ import org .fugerit .java .doc .val .core .DocTypeValidationResult ;
7+ import org .fugerit .java .doc .val .core .DocTypeValidator ;
8+ import org .fugerit .java .doc .val .core .basic .AbstractDocTypeValidator ;
9+ import org .slf4j .Logger ;
10+ import org .slf4j .LoggerFactory ;
11+
12+ public class DocxValidator extends AbstractDocTypeValidator {
13+
14+ private static final Logger logger = LoggerFactory .getLogger ( DocxValidator .class );
15+
16+ public static final String EXTENSION = "DOCX" ;
17+
18+ public static final String MIME_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ;
19+
20+ public static final DocTypeValidator DEFAULT = new DocxValidator ();
21+
22+ public DocxValidator () {
23+ super ( MIME_TYPE , EXTENSION );
24+ }
25+
26+ @ Override
27+ public DocTypeValidationResult validate (InputStream is ) {
28+ DocTypeValidationResult result = DocTypeValidationResult .newFail ();
29+ try ( XWPFDocument workbook = new XWPFDocument ( is ) ) {
30+ result = DocTypeValidationResult .newOk ();
31+ } catch (Exception e ) {
32+ logger .warn ( "Failed check on pdf : " +e );
33+ }
34+ return result ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 1+ package org .fugerit .java .doc .val .poi ;
2+
3+ import java .io .InputStream ;
4+
5+ import org .apache .poi .hssf .usermodel .HSSFWorkbook ;
6+ import org .fugerit .java .doc .val .core .DocTypeValidationResult ;
7+ import org .fugerit .java .doc .val .core .DocTypeValidator ;
8+ import org .fugerit .java .doc .val .core .basic .AbstractDocTypeValidator ;
9+ import org .slf4j .Logger ;
10+ import org .slf4j .LoggerFactory ;
11+
12+ public class XlsValidator extends AbstractDocTypeValidator {
13+
14+ private static final Logger logger = LoggerFactory .getLogger ( XlsValidator .class );
15+
16+ public static final String EXTENSION = "XLS" ;
17+
18+ public static final String MIME_TYPE = "application/vnd.ms-excel" ;
19+
20+ public static final DocTypeValidator DEFAULT = new XlsValidator ();
21+
22+ public XlsValidator () {
23+ super ( MIME_TYPE , EXTENSION );
24+ }
25+
26+ @ Override
27+ public DocTypeValidationResult validate (InputStream is ) {
28+ DocTypeValidationResult result = DocTypeValidationResult .newFail ();
29+ try ( HSSFWorkbook workbook = new HSSFWorkbook ( is ) ) {
30+ result = DocTypeValidationResult .newOk ();
31+ } catch (Exception e ) {
32+ logger .warn ( "Failed check on pdf : " +e );
33+ }
34+ return result ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 1+ package org .fugerit .java .doc .val .poi ;
2+
3+ import java .io .InputStream ;
4+
5+ import org .apache .poi .xssf .usermodel .XSSFWorkbook ;
6+ import org .fugerit .java .doc .val .core .DocTypeValidationResult ;
7+ import org .fugerit .java .doc .val .core .DocTypeValidator ;
8+ import org .fugerit .java .doc .val .core .basic .AbstractDocTypeValidator ;
9+ import org .slf4j .Logger ;
10+ import org .slf4j .LoggerFactory ;
11+
12+ public class XlsxValidator extends AbstractDocTypeValidator {
13+
14+ private static final Logger logger = LoggerFactory .getLogger ( XlsxValidator .class );
15+
16+ public static final String EXTENSION = "XLSX" ;
17+
18+ public static final String MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ;
19+
20+ public static final DocTypeValidator DEFAULT = new XlsxValidator ();
21+
22+ public XlsxValidator () {
23+ super ( MIME_TYPE , EXTENSION );
24+ }
25+
26+ @ Override
27+ public DocTypeValidationResult validate (InputStream is ) {
28+ DocTypeValidationResult result = DocTypeValidationResult .newFail ();
29+ try ( XSSFWorkbook workbook = new XSSFWorkbook ( is ) ) {
30+ result = DocTypeValidationResult .newOk ();
31+ } catch (Exception e ) {
32+ logger .warn ( "Failed check on pdf : " +e );
33+ }
34+ return result ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 22
33import org .fugerit .java .doc .val .core .DocValidatorFacade ;
44import org .fugerit .java .doc .val .core .basic .ImageValidator ;
5- import org .fugerit .java .doc .val .pdf .boc .PdfboxValidator ;
5+ import org .fugerit .java .doc .val .pdf .box .PdfboxValidator ;
66import org .junit .Test ;
77
88public class TestAllFacade extends TestDocValidatorFacade {
You can’t perform that action at this time.
0 commit comments