-
Notifications
You must be signed in to change notification settings - Fork 2
Tedefo 4805 efx rules translator #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rousso
wants to merge
6
commits into
develop
Choose a base branch
from
TEDEFO-4805-efx-rules-translator
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7209b30
Add EFX Rules to Schematron transpiler foundation
rousso e20dacf
Fix license text in multiple interface files
rousso 2095b7d
Added notice subtype handling to SdkSymbolResolver.
rousso d51c7c9
Add EFX Rules to Schematron translator
rousso 694a7bc
Refactor: Rename ValidatorMarkupGenerator to ValidatorGenerator and S…
rousso 673b2b1
EfxRulesTranslatorV2Test: Fix unit tests on Windows
bertrand-lorentz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/eu/europa/ted/eforms/sdk/schematron/SchematronAssert.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright 2022 European Union | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The copyright year should be 2025 or 2026. |
||
| * | ||
| * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European | ||
| * Commission – subsequent versions of the EUPL (the "Licence"); You may not use this work except in | ||
| * compliance with the Licence. You may obtain a copy of the Licence at: | ||
| * https://joinup.ec.europa.eu/software/page/eupl | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the Licence | ||
| * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
| * or implied. See the Licence for the specific language governing permissions and limitations under | ||
| * the Licence. | ||
| */ | ||
| package eu.europa.ted.eforms.sdk.schematron; | ||
|
|
||
| import eu.europa.ted.efx.model.Context; | ||
| import eu.europa.ted.efx.model.rules.ValidationRule; | ||
|
|
||
| /** | ||
| * Represents a Schematron <assert> element. | ||
| * Fires when the test expression evaluates to false. | ||
| */ | ||
| public class SchematronAssert extends SchematronTest { | ||
|
|
||
| public SchematronAssert(ValidationRule rule, Context ruleContext) { | ||
| super(rule, ruleContext); | ||
| } | ||
|
|
||
| @Override | ||
| public String getElementName() { | ||
| return "assert"; | ||
| } | ||
| } | ||
56 changes: 56 additions & 0 deletions
56
src/main/java/eu/europa/ted/eforms/sdk/schematron/SchematronDiagnostic.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Copyright 2022 European Union | ||
| * | ||
| * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European | ||
| * Commission – subsequent versions of the EUPL (the "Licence"); You may not use this work except in | ||
| * compliance with the Licence. You may obtain a copy of the Licence at: | ||
| * https://joinup.ec.europa.eu/software/page/eupl | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the Licence | ||
| * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
| * or implied. See the Licence for the specific language governing permissions and limitations under | ||
| * the Licence. | ||
| */ | ||
| package eu.europa.ted.eforms.sdk.schematron; | ||
|
|
||
| import eu.europa.ted.eforms.xpath.XPathProcessor; | ||
| import eu.europa.ted.efx.model.Context; | ||
|
|
||
| /** | ||
| * Represents a Schematron <diagnostic> element. | ||
| * Used in the <diagnostics> section of complete-validation.sch. | ||
| * Format: <diagnostic id="..." see="field:...">xpath</diagnostic> | ||
| */ | ||
| public class SchematronDiagnostic { | ||
|
|
||
| private final String id; | ||
| private final String seeAttribute; | ||
| private final String xpath; | ||
|
|
||
| private static String sanitize(String identifier) { | ||
| return identifier.replace("(", "_").replace(")", "_"); | ||
| } | ||
|
|
||
| public SchematronDiagnostic(Context subject, Context ruleContext) { | ||
| this.xpath = XPathProcessor.contextualize( | ||
| ruleContext.absolutePath().getScript(), subject.absolutePath().getScript()); | ||
| this.id = sanitize(ruleContext.symbol()) + "_" + sanitize(subject.symbol()); | ||
| String prefix = subject.isFieldContext() ? "field:" : "node:"; | ||
| this.seeAttribute = prefix + subject.symbol(); | ||
| } | ||
|
|
||
| /** Used by pattern.ftl and complete-validation.ftl */ | ||
| public String getId() { | ||
| return this.id; | ||
| } | ||
|
|
||
| /** Used by complete-validation.ftl */ | ||
| public String getSeeAttribute() { | ||
| return this.seeAttribute; | ||
| } | ||
|
|
||
| /** Used by complete-validation.ftl */ | ||
| public String getXpath() { | ||
| return this.xpath; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version dates back to 2021. The latest version is 2.3.34, from 2024, and its requirements are the same. So it would be better to use that version.