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 1
1
{
2
2
"title" : " Venus (Fugerit Document Generation Framework)" ,
3
3
"name" : " Venus" ,
4
- "version" : " 0.6.0 " ,
5
- "date" : " 20 /12/2022" ,
4
+ "version" : " 0.6.1 " ,
5
+ "date" : " 22 /12/2022" ,
6
6
"organization" : {
7
7
"name" : " Fugerit Org" ,
8
8
"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
+
1
6
0.6.0 (2022-12-20)
2
7
------------------
3
8
+ Added compatibility check for Tiff Image Validator (required java 9+ at runtime)
7
12
0.5.11 (2022-12-19)
8
13
------------------
9
14
+ 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)
10
16
11
17
0.5.10 (2022-12-12)
12
18
------------------
Original file line number Diff line number Diff line change 41
41
<artifactId >pdfbox</artifactId >
42
42
<version >${pdfbox-version} </version >
43
43
</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 >
44
55
45
56
</dependencies >
46
57
Original file line number Diff line number Diff line change 1
1
package org .fugerit .java .doc .val .pdf .boc ;
2
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
- }
3
+ @ Deprecated
4
+ public class PdfboxValidator extends org .fugerit .java .doc .val .pdf .box .PdfboxValidator {
37
5
38
6
}
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 2
2
3
3
import org .fugerit .java .doc .val .core .DocValidatorFacade ;
4
4
import 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 ;
6
6
import org .junit .Test ;
7
7
8
8
public class TestAllFacade extends TestDocValidatorFacade {
You can’t perform that action at this time.
0 commit comments