Skip to content

Tedefo 4805 efx rules translator - #40

Merged
bertrand-lorentz merged 7 commits into
developfrom
TEDEFO-4805-efx-rules-translator
Feb 2, 2026
Merged

Tedefo 4805 efx rules translator#40
bertrand-lorentz merged 7 commits into
developfrom
TEDEFO-4805-efx-rules-translator

Conversation

@rousso

Copy link
Copy Markdown
Contributor

No description provided.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for notice type/subtype handling and introduces new component types (EFX_RULES_TRANSLATOR and VALIDATOR_GENERATOR) to the SDK component factory. The primary additions include a new entity class for notice subtypes and a repository to manage them.

Key changes:

  • Introduces SdkNoticeSubtype entity class to represent notice subtypes from the SDK's notice-types.json file
  • Adds SdkNoticeTypeRepository to load and manage notice subtype data
  • Extends component type enumeration to support EFX rules translator and validator generator functionality

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
FileDescription
SdkNoticeSubtype.javaNew abstract entity class representing notice subtypes with fields for subTypeId, documentType, and type
SdkNoticeTypeRepository.javaNew repository class extending MapFromJson to load notice subtypes from JSON
SdkEntityFactory.javaAdds factory method getSdkNoticeType to instantiate SdkNoticeSubtype implementations
SdkComponentType.javaExtends enum with NOTICE_TYPE, EFX_RULES_TRANSLATOR, and VALIDATOR_GENERATOR component types
SdkConstants.javaAdds NOTICE_TYPES_JSON_SUBTYPES_KEY constant for JSON parsing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsrc/main/java/eu/europa/ted/eforms/sdk/entity/SdkNoticeSubtype.java Outdated
Comment threadsrc/main/java/eu/europa/ted/eforms/sdk/entity/SdkNoticeSubtype.java Outdated
@roussorousso self-assigned this Dec 26, 2025

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsrc/main/java/eu/europa/ted/eforms/sdk/entity/SdkEntityFactory.java Outdated

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +62 to +64
public int compareTo(SdkNoticeSubtype o) {
return this.subTypeId.compareTo(o.subTypeId);
}

CopilotAIDec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compareTo method can throw a NullPointerException if subTypeId is null. The JsonNode constructor (line 21) uses asText(null) which can return null. Consider adding null safety checks or using Objects.compare with a null-safe comparator, similar to how SdkCodelist handles this (see SdkCodelist.java:67-69).

Copilot uses AI. Check for mistakes.
Comment on lines +30 to +32
public String getId() {
return subTypeId;
}

CopilotAIDec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getId() method returns subTypeId which can be null (set via asText(null) in the JsonNode constructor at line 21). This could cause NullPointerException in callers who expect a non-null value, such as in SdkNoticeTypeRepository.java:26 where it's used as a map key, and in the compareTo method. Consider validating that critical fields like subTypeId are non-null after construction, or document that null is a valid return value.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +23
this.subTypeId = json.get("subTypeId").asText(null);
this.documentType = json.get("documentType").asText(null);
this.type = json.get("type").asText(null);

CopilotAIDec 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JsonNode constructor does not validate that required JSON fields (subTypeId, documentType, type) exist before accessing them. If json.get("subTypeId") returns null, calling asText(null) on it will throw a NullPointerException. Consider adding null checks or using safer accessor methods like json.has("subTypeId") before accessing, consistent with how SdkNode handles optional fields (see SdkNode.java:27).

Suggested change
this.subTypeId = json.get("subTypeId").asText(null);
this.documentType = json.get("documentType").asText(null);
this.type = json.get("type").asText(null);
if (json == null) {
thrownewIllegalArgumentException("json must not be null when creating SdkNoticeSubtype");
}
JsonNodesubTypeIdNode = json.get("subTypeId");
JsonNodedocumentTypeNode = json.get("documentType");
JsonNodetypeNode = json.get("type");
if (subTypeIdNode == null || documentTypeNode == null || typeNode == null) {
thrownewIllegalArgumentException("Missing required fields (subTypeId, documentType, type) in notice subtype JSON: " + json);
}
this.subTypeId = subTypeIdNode.asText(null);
this.documentType = documentTypeNode.asText(null);
this.type = typeNode.asText(null);

Copilot uses AI. Check for mistakes.
@bertrand-lorentz

Copy link
Copy Markdown
Contributor

Is this ready for review ? I'm not indicated as a reviewer.

@bertrand-lorentzbertrand-lorentz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can go as-is, but please have a look at my comments on the enum value, and the missing update of README files.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The 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.

*/
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,

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
ContributorAuthor

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.

CopilotAI commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

@rousso I've opened a new pull request, #41, to work on those changes. Once the pull request is ready, I'll request review from you.

CopilotAI commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

@rousso I've opened a new pull request, #42, to work on those changes. Once the pull request is ready, I'll request review from you.

CopilotAIand others added 2 commits January 6, 2026 19:33
* Initial plan
* Add SdkNoticeTypeRepository reference to README
Co-authored-by: rousso <91379+rousso@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rousso <91379+rousso@users.noreply.github.com>
* Initial plan
* Add SdkNoticeSubtype reference to entity README
Co-authored-by: rousso <91379+rousso@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: rousso <91379+rousso@users.noreply.github.com>
@bertrand-lorentz
bertrand-lorentz merged commit 860c50e into developFeb 2, 2026
5 checks passed
@bertrand-lorentz
bertrand-lorentz deleted the TEDEFO-4805-efx-rules-translator branch February 2, 2026 08:39
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@rousso@bertrand-lorentz