Skip to content

Commit

Permalink
Merge pull request #87 from OP-TED/release/0.10.0
Browse files Browse the repository at this point in the history
Merge release/0.10.0 into main
  • Loading branch information
bertrand-lorentz authored Dec 13, 2023
2 parents c4e0799 + 62d3175 commit 10eb691
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 22 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'
- name: Test package
run: mvn --batch-mode test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish package
run: mvn --batch-mode deploy -DskipTests
env:
Expand Down
19 changes: 12 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# eForms Notice Viewer 0.9.0 - Release Notes
# eForms Notice Viewer 0.10.0 - Release Notes

_The eForms Notice Viewer is a sample command line application that demonstrates how you can use the [eForms SDK](https://github.com/OP-TED/eForms-SDK) in a metadata driven application that visualises eForms notices._

---
## In this release:

This is the first version of the Notice Viewer, that uses the new, pre-release version 2.0.0-alpha.1 of the EFX Toolkit. As a result, the application:
## In this release

- Now supports EFX-2 templates, and therefore can visualise notices created with SDK-2.
- Can no longer visualise notices created with pre-release versions of SDK-1 (SDK 0.x.x).
This version of the Notice Viewer, uses the pre-release version 2.0.0-alpha.2 of the EFX Toolkit.

This release:

- Fixes a bug in label_from_key.ftl that caused erroneous rendering of some labels.
- Updates variable_expression.ftl to render a comma separated list from sequences of values.
- Improves unit testing.

---

Documentation for this sample application is available at: https://docs.ted.europa.eu/eforms/latest/notice-viewer

This version depends on:
- [EFX toolkit for Java](https://github.com/OP-TED/efx-toolkit-java) version 2.0.0-alpha.1.
- [eForms Core for Java](https://github.com/OP-TED/eforms-core-java) library version 1.0.5.

- [EFX toolkit for Java](https://github.com/OP-TED/efx-toolkit-java) version 2.0.0-alpha.2.
- [eForms Core for Java](https://github.com/OP-TED/eforms-core-java) library version 1.3.0.
11 changes: 7 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>eu.europa.ted.eforms</groupId>
<artifactId>eforms-notice-viewer</artifactId>
<version>0.9.0</version>
<version>0.10.0</version>

<name>eForms Notice Viewer</name>
<description>eForms Notice Viewer sample application.</description>
Expand Down Expand Up @@ -44,7 +44,7 @@
</distributionManagement>

<properties>
<project.build.outputTimestamp>2023-01-31T18:22:58Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2023-07-31T09:34:21Z</project.build.outputTimestamp>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

Expand All @@ -54,8 +54,8 @@
<maven.compiler.target>${java.version}</maven.compiler.target>

<!-- Versions - eForms -->
<version.efx-toolkit>2.0.0-alpha.1</version.efx-toolkit>
<version.eforms-core>1.0.5</version.eforms-core>
<version.efx-toolkit>2.0.0-alpha.2</version.efx-toolkit>
<version.eforms-core>1.3.0</version.eforms-core>

<!-- Versions - Third-party libraries -->
<version.antlr4>4.9.3</version.antlr4>
Expand Down Expand Up @@ -315,6 +315,9 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<argLine>-Duser.country=BE</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
Expand Down
27 changes: 22 additions & 5 deletions src/main/java/eu/europa/ted/eforms/viewer/DependencyFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,36 @@
import eu.europa.ted.efx.interfaces.TranslatorOptions;

public class DependencyFactory implements TranslatorDependencyFactory {
private Path sdkRoot;

@SuppressWarnings("unused")
private DependencyFactory() {}
final private Path sdkRoot;
final private boolean sdkSnapshotsAllowed;

/**
* Public constructor used by the EfxTranslator does not allow the use of
* SNAPSHOT versions of the SDK.
*
* @param sdkRoot The root directory where the SDK will be downloaded.
*/
public DependencyFactory(Path sdkRoot) {
this(sdkRoot, false);
}

/**
* Subclasses can use this constructor to allow the use of SNAPSHOT versions of
* the SDK.
*
* @param sdkRoot The root directory where the SDK will be downloaded.
* @param resolveSnapshots If true, SNAPSHOT versions of the SDK will be
* downloaded if needed.
*/
protected DependencyFactory(Path sdkRoot, boolean resolveSnapshots) {
this.sdkRoot = sdkRoot;
this.sdkSnapshotsAllowed = resolveSnapshots;
}

@Override
public SymbolResolver createSymbolResolver(String sdkVersion) {
try {
SdkDownloader.downloadSdk(sdkVersion, sdkRoot);
SdkDownloader.downloadSdk(sdkVersion, sdkRoot, this.sdkSnapshotsAllowed);

return ComponentFactory.getSymbolResolver(sdkVersion, sdkRoot);
} catch (InstantiationException | IOException e) {
Expand Down
7 changes: 4 additions & 3 deletions src/main/resources/templates/xsl_markup/label_from_key.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
- key: The key to use for rendering
- quantity: If pluralisation is required, then this contains the suffix that identifies the plural form of the label.
-->
<xsl:variable name="key" select="${key}"/>
<#if quantity?has_content>
<xsl:variable name="plural" select="concat(${key}, ted:plural-label-suffix(${quantity}))"/>
<span class="label"><xsl:value-of select="($labels//entry[@key=$plural]/text(), $labels//entry[@key=${key}}]/text(), concat('{', ${key}, '}'))[1]"/></span>
<xsl:variable name="plural" select="concat($key, ted:plural-label-suffix(${quantity}))"/>
<span class="label"><xsl:value-of select="($labels//entry[@key=$plural]/text(), $labels//entry[@key=$key}]/text(), concat('{', $key, '}'))[1]"/></span>
<#else>
<span class="label"><xsl:value-of select="($labels//entry[@key=${key}]/text(), concat('{', ${key}, '}'))[1]"/></span>
<span class="label"><xsl:value-of select="($labels//entry[@key=$key]/text(), concat('{', $key, '}'))[1]"/></span>
</#if>
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Available variables:
- expression: The variable expression to render
-->
<span class="value"><xsl:value-of select="${expression}"/></span>
<span class="value"><xsl:value-of separator=", " select="${expression}"/></span>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package eu.europa.ted.eforms.viewer;

import java.nio.file.Path;

/**
* Extends {@link DependencyFactory} to allow the use of SNAPSHOT versions when
* unit testing.
*/
public class DependencyFactoryForUnitTesting extends DependencyFactory {

public DependencyFactoryForUnitTesting(Path sdkRoot) {
super(sdkRoot, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void testEfxToXsl(String sdkVersion) throws IOException, InstantiationException
final String viewId = "X02";
final Path xsl =
XslGenerator.Builder
.create(new DependencyFactory(SDK_ROOT_DIR))
.create(new DependencyFactoryForUnitTesting(SDK_ROOT_DIR))
.build()
.generateFile(sdkVersion, NoticeViewer.getEfxPath(sdkVersion, viewId, SDK_ROOT_DIR),
NoticeViewerConstants.DEFAULT_TRANSLATOR_OPTIONS, true);
Expand Down Expand Up @@ -145,7 +145,7 @@ private void testGenerateHtmlFromString(final String language, final String noti
Files.readString(noticeXmlPath, NoticeViewerConstants.DEFAULT_CHARSET);
final Path xslPath =
XslGenerator.Builder
.create(new DependencyFactory(SDK_ROOT_DIR))
.create(new DependencyFactoryForUnitTesting(SDK_ROOT_DIR))
.build()
.generateFile(sdkVersion, NoticeViewer.getEfxPath(sdkVersion, viewId, SDK_ROOT_DIR),
NoticeViewerConstants.DEFAULT_TRANSLATOR_OPTIONS, true);
Expand Down

0 comments on commit 10eb691

Please sign in to comment.