Skip to content

Commit 2a95844

Browse files
committed
Added a catalog of sample documents in the playground
1 parent e011551 commit 2a95844

File tree

15 files changed

+239
-158
lines changed

15 files changed

+239
-158
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" : "0.8.0",
5-
"date" : "07/01/2023",
4+
"version" : "0.8.1",
5+
"date" : "15/01/2023",
66
"organization" : {
77
"name" : "Fugerit Org",
88
"url" : "https://www.fugerit.org"

docgen/release-notes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
+ Added methods to DocProcessContext for DocBase and DocType availability.
44
+ Added access to DocConfig static variables in Freemarker Chain process
55
+ Added new info doc-version-compatibility for handling behaviours in 1-x e 2-x doc versions.
6+
+ Added a sample documents catalog to the fj-doc-sample modules (accessible in the playgound application too)
67

78
0.8.0 (2023-01-07)
89
------------------

fj-doc-playground-quarkus/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ npm run start
4141
## functions available
4242
* Doc Xml Editor : allow for writing documents in XML/JSON/YAML, validating them and generating some output formats (currently PDF/XLSX/HTML) [covers fj-doc-mod* modules]
4343
* Doc Conversion : allow source conversion from/to XML/JSON/YAML [convers fj-doc-base* modules]
44-
* Doc Type Validator : allow validation of documents in various formats [covers fj-doc-val* modules]
44+
* Doc Type Validator : allow validation of documents in various formats [covers fj-doc-val* modules]
45+
46+
**NOTE**: A catalog of sample documents has been added to the Doc Xml Editor and Doc Conversion functionalities.

fj-doc-playground-quarkus/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@
8080
<groupId>org.fugerit.java</groupId>
8181
<artifactId>fj-doc-lib-simpletable</artifactId>
8282
</dependency>
83+
<dependency>
84+
<groupId>org.fugerit.java</groupId>
85+
<artifactId>fj-doc-sample</artifactId>
86+
</dependency>
8387
<dependency>
8488
<groupId>io.quarkus</groupId>
8589
<artifactId>quarkus-junit5</artifactId>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package org.fugerit.java.doc.playground.catalog;
2+
3+
import java.io.Reader;
4+
import java.util.stream.Collectors;
5+
6+
import org.fugerit.java.core.io.StreamIO;
7+
import org.fugerit.java.core.util.collection.OptionItem;
8+
import org.fugerit.java.doc.playground.convert.ConvertOutput;
9+
import org.fugerit.java.doc.sample.facade.DocCatalogSample;
10+
import org.slf4j.Logger;
11+
import org.slf4j.LoggerFactory;
12+
13+
import jakarta.enterprise.context.ApplicationScoped;
14+
import jakarta.ws.rs.GET;
15+
import jakarta.ws.rs.Path;
16+
import jakarta.ws.rs.PathParam;
17+
import jakarta.ws.rs.Produces;
18+
import jakarta.ws.rs.core.MediaType;
19+
import jakarta.ws.rs.core.Response;
20+
21+
@ApplicationScoped
22+
@Path("/catalog")
23+
public class CatalogRest {
24+
25+
private final static Logger logger = LoggerFactory.getLogger(CatalogRest.class);
26+
27+
@GET
28+
@Produces(MediaType.APPLICATION_JSON)
29+
@Path("/list")
30+
public Response catalogList() {
31+
Response res = Response.status(Response.Status.BAD_REQUEST).build();
32+
try {
33+
res = Response.ok().entity(
34+
DocCatalogSample.getInstance().getPlaygroundCoreCatalog()
35+
.stream().map(
36+
e -> new OptionItem( e.getId(), e.getDescription() )
37+
).collect( Collectors.toList() )
38+
).build();
39+
} catch (Exception e) {
40+
logger.info("Error : " + e, e);
41+
res = Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
42+
}
43+
return res;
44+
}
45+
46+
@GET
47+
@Produces(MediaType.APPLICATION_JSON)
48+
@Path("/entry/{id}")
49+
public Response catalogEntry( @PathParam("id") String id ) {
50+
Response res = Response.status(Response.Status.BAD_REQUEST).build();
51+
DocCatalogSample catalog = DocCatalogSample.getInstance();
52+
try ( Reader reader = catalog.entryReader( catalog.getPlaygroundCoreCatalog().get( id ) ) ) {
53+
ConvertOutput output = new ConvertOutput();
54+
output.setDocOutput( StreamIO.readString( reader ) );
55+
res = Response.ok().entity( output ).build();
56+
} catch (Exception e) {
57+
logger.info("Error : " + e, e);
58+
res = Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
59+
}
60+
return res;
61+
}
62+
63+
}

0 commit comments

Comments
 (0)