diff --git a/pom.xml b/pom.xml index af349a1..543d463 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ eu.europa.ted.eforms eforms-sdk-analyzer - 1.9.0 + 1.10.0 kjar eforms-sdk-analyzer @@ -29,14 +29,14 @@ ${project.artifactId}-${project.version} UTF-8 - 2023-08-24T14:17:24Z + 2023-11-20T13:50:04Z 11 ${java.version} ${java.version} - 1.0.5 + 1.2.0 2.0.0-alpha.1 diff --git a/src/main/java/eu/europa/ted/eforms/sdk/analysis/FactsLoader.java b/src/main/java/eu/europa/ted/eforms/sdk/analysis/FactsLoader.java index 9b2092a..9a1d1a9 100644 --- a/src/main/java/eu/europa/ted/eforms/sdk/analysis/FactsLoader.java +++ b/src/main/java/eu/europa/ted/eforms/sdk/analysis/FactsLoader.java @@ -11,12 +11,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xml.sax.SAXException; -import eu.europa.ted.eforms.sdk.analysis.domain.Label; + import eu.europa.ted.eforms.sdk.analysis.domain.SvrlReport; import eu.europa.ted.eforms.sdk.analysis.domain.XmlNotice; import eu.europa.ted.eforms.sdk.analysis.domain.codelist.Codelist; import eu.europa.ted.eforms.sdk.analysis.domain.field.Field; import eu.europa.ted.eforms.sdk.analysis.domain.field.XmlStructureNode; +import eu.europa.ted.eforms.sdk.analysis.domain.label.Label; import eu.europa.ted.eforms.sdk.analysis.domain.noticetype.DocumentType; import eu.europa.ted.eforms.sdk.analysis.domain.noticetype.NoticeType; import eu.europa.ted.eforms.sdk.analysis.domain.view.index.TedefoViewTemplateIndex; @@ -31,6 +32,7 @@ import eu.europa.ted.eforms.sdk.analysis.fact.NoticeTypeFact; import eu.europa.ted.eforms.sdk.analysis.fact.NoticeTypesIndexFact; import eu.europa.ted.eforms.sdk.analysis.fact.SvrlReportFact; +import eu.europa.ted.eforms.sdk.analysis.fact.TranslationsIndexFact; import eu.europa.ted.eforms.sdk.analysis.fact.ViewTemplateFact; import eu.europa.ted.eforms.sdk.analysis.fact.XmlNoticeFact; @@ -98,6 +100,15 @@ public DataStore loadNoticeTypesIndex() throws IOException return datastore; } + public DataStore loadTranslationsIndex() throws IOException { + logger.debug("Creating facts datastore for translations index"); + + final DataStore datastore = DataSource.createStore(); + datastore.add(new TranslationsIndexFact(sdkLoader.getTranslationsIndex())); + + return datastore; + } + public DataStore loadLabels() throws IOException, JAXBException, SAXException, ParserConfigurationException { logger.debug("Creating facts datastore for labels"); diff --git a/src/main/java/eu/europa/ted/eforms/sdk/analysis/SdkLoader.java b/src/main/java/eu/europa/ted/eforms/sdk/analysis/SdkLoader.java index 5210fe7..bc5ada3 100644 --- a/src/main/java/eu/europa/ted/eforms/sdk/analysis/SdkLoader.java +++ b/src/main/java/eu/europa/ted/eforms/sdk/analysis/SdkLoader.java @@ -27,7 +27,6 @@ import com.fasterxml.jackson.databind.SerializationFeature; import eu.europa.ted.eforms.sdk.SdkConstants.SdkResource; import eu.europa.ted.eforms.sdk.analysis.domain.EFormsTrackableEntity; -import eu.europa.ted.eforms.sdk.analysis.domain.Label; import eu.europa.ted.eforms.sdk.analysis.domain.SvrlReport; import eu.europa.ted.eforms.sdk.analysis.domain.XmlNotice; import eu.europa.ted.eforms.sdk.analysis.domain.codelist.Codelist; @@ -36,6 +35,9 @@ import eu.europa.ted.eforms.sdk.analysis.domain.field.Field; import eu.europa.ted.eforms.sdk.analysis.domain.field.FieldsAndNodes; import eu.europa.ted.eforms.sdk.analysis.domain.field.XmlStructureNode; +import eu.europa.ted.eforms.sdk.analysis.domain.label.Label; +import eu.europa.ted.eforms.sdk.analysis.domain.label.LanguageFileInfo; +import eu.europa.ted.eforms.sdk.analysis.domain.label.TranslationsIndex; import eu.europa.ted.eforms.sdk.analysis.domain.noticetype.NoticeSubTypeForIndex; import eu.europa.ted.eforms.sdk.analysis.domain.noticetype.NoticeType; import eu.europa.ted.eforms.sdk.analysis.domain.noticetype.NoticeTypeSdk; @@ -57,6 +59,9 @@ public class SdkLoader { public static final Path EXAMPLE_NOTICES = Path.of("examples", "notices"); public static final Path EXAMPLE_REPORTS = Path.of("examples", "reports"); + // TODO: Use constant from SdkResource in ECL when it is available (TEDEFO-2707) + public static final Path TRANSLATIONS_JSON = Path.of("translations", "translations.json"); + private final Path sdkRoot; private final ObjectMapper objectMapper; @@ -176,33 +181,33 @@ public NoticeTypeSdk getNoticeTypeSdk(String noticeId, Path sdkRoot) throws IOEx SdkResource.NOTICE_TYPES.getPath().toString(), MessageFormat.format("{0}.json", noticeId))); } + public TranslationsIndex getTranslationsIndex() throws IOException { + return loadJsonFile(TranslationsIndex.class, + Path.of(sdkRoot.toString(), TRANSLATIONS_JSON.toString())); + } + public Set