-
Notifications
You must be signed in to change notification settings - Fork 1
Tedefo 4805 efx rules translator #40
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
Changes from 3 commits
5e3f420
c724b0b
0331b91
7d77eff
dd51af2
a73e4fc
2eb247e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| package eu.europa.ted.eforms.sdk.component; | ||
|
|
||
| /** | ||
| * Enumeration of component types that can be registered with the SDK component factory. | ||
| * Enumeration of component types that can be registered with the SDK component | ||
| * factory. | ||
| */ | ||
| public enum SdkComponentType { | ||
| FIELD, NODE, CODELIST, EFX_EXPRESSION_TRANSLATOR, EFX_TEMPLATE_TRANSLATOR, SYMBOL_RESOLVER, SCRIPT_GENERATOR, MARKUP_GENERATOR; | ||
| FIELD, NODE, CODELIST, NOTICE_TYPE, EFX_EXPRESSION_TRANSLATOR, EFX_TEMPLATE_TRANSLATOR, EFX_RULES_TRANSLATOR, | ||
| SYMBOL_RESOLVER, SCRIPT_GENERATOR, MARKUP_GENERATOR, VALIDATOR_GENERATOR; | ||
| } | ||
|
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. Similar classes in this folder are described in the README file in the folder. So this new class should also be described in this README, for consistency.
Contributor
Author
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. @copilot please address this remark by adding an adequate reference to this class in the respected README file. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| package eu.europa.ted.eforms.sdk.entity; | ||
|
|
||
| import java.util.Objects; | ||
| import com.fasterxml.jackson.databind.JsonNode; | ||
|
|
||
| /** | ||
| * Represents a notice subtype from the SDK's notice-types.json file. | ||
| */ | ||
| public abstract class SdkNoticeSubtype { | ||
|
rousso marked this conversation as resolved.
Outdated
|
||
| private final String subTypeId; | ||
| private final String documentType; | ||
| private final String type; | ||
|
|
||
| protected SdkNoticeSubtype(String subTypeId, String documentType, String type) { | ||
| this.subTypeId = subTypeId; | ||
| this.documentType = documentType; | ||
| this.type = type; | ||
| } | ||
|
|
||
| protected SdkNoticeSubtype(JsonNode json) { | ||
| this.subTypeId = json.get("subTypeId").asText(); | ||
| this.documentType = json.get("documentType").asText(); | ||
| this.type = json.get("type").asText(); | ||
|
rousso marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| /** | ||
| * Returns the notice subtype ID (e.g., "1", "3", "CEI", "E1", "X01"). | ||
| * This is the primary identifier used for phase generation. | ||
| */ | ||
| public String getId() { | ||
| return subTypeId; | ||
| } | ||
|
Comment on lines
+30
to
+32
|
||
|
|
||
| public String getSubTypeId() { | ||
| return subTypeId; | ||
| } | ||
|
|
||
| public String getDocumentType() { | ||
| return documentType; | ||
| } | ||
|
|
||
| public String getType() { | ||
| return type; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (obj == null) { | ||
| return false; | ||
| } | ||
| if (getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| SdkNoticeSubtype other = (SdkNoticeSubtype) obj; | ||
| return Objects.equals(subTypeId, other.subTypeId); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(subTypeId); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return subTypeId; | ||
|
rousso marked this conversation as resolved.
|
||
| } | ||
| } | ||
|
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. Similar classes in this folder are described in the README file in the folder. So this new class should also be described in this README, for consistency.
Contributor
Author
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. @copilot please address this remark by adding an adequate reference to this class in the respected README file. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package eu.europa.ted.eforms.sdk.repository; | ||
|
|
||
| import java.nio.file.Path; | ||
| import com.fasterxml.jackson.databind.JsonNode; | ||
| import com.fasterxml.jackson.databind.node.ArrayNode; | ||
| import eu.europa.ted.eforms.sdk.SdkConstants; | ||
| import eu.europa.ted.eforms.sdk.entity.SdkEntityFactory; | ||
| import eu.europa.ted.eforms.sdk.entity.SdkNoticeSubtype; | ||
|
|
||
| /** | ||
| * Repository for SDK notice types loaded from notice-types.json. | ||
| * Maps notice subtype IDs (e.g., "1", "3", "CEI", "E1", "X01") to SdkNoticeSubtype objects. | ||
| */ | ||
| public class SdkNoticeTypeRepository extends MapFromJson<SdkNoticeSubtype> { | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| public SdkNoticeTypeRepository(String sdkVersion, Path jsonPath) throws InstantiationException { | ||
| super(sdkVersion, jsonPath); | ||
| } | ||
|
|
||
| @Override | ||
| protected void populateMap(final JsonNode json) throws InstantiationException { | ||
| final ArrayNode noticeTypes = (ArrayNode) json.get(SdkConstants.NOTICE_TYPES_JSON_SUBTYPES_KEY); | ||
| for (final JsonNode noticeType : noticeTypes) { | ||
| final SdkNoticeSubtype sdkNoticeType = SdkEntityFactory.getSdkNoticeType(sdkVersion, noticeType); | ||
|
rousso marked this conversation as resolved.
Outdated
|
||
| put(sdkNoticeType.getId(), sdkNoticeType); | ||
|
rousso marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
| } | ||
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.
The value name "NOTICE_TYPE" is inconsistent with the corresponding class SdkNoticeSubtype, but it corresponds to the folder named "notice-types" in the SDK.
So I'm not sure which is the best name here.
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.
I am not sure either... We will have a name finalisation debate before we release the SDK. The subtypes are a common naming problem but there are others like for example the fact that we interchangeably use the terms "string" and "text" in the grammar. We will deal with any such remaining naming issues when all else i ready.