-
Notifications
You must be signed in to change notification settings - Fork 0
feat(core): add entity graph endpoint and service #56
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
Draft
brandPittCode
wants to merge
38
commits into
main
Choose a base branch
from
feat/entity-graph
base: main
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.
Draft
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
d807c69
feat(core): add post entity
RVANDO12 e26e26c
feat(core): fix sonar issue and copilot review
RVANDO12 fd1b354
feat(core): fix sonar review
RVANDO12 a859554
feat(core): fix sonar qube and test
RVANDO12 3958089
feat(core): fix validation type check
RVANDO12 fb272c2
feat(core): fix review
RVANDO12 6f466d6
feat(core): fix end of file
RVANDO12 6db02d4
feat(core): call entity template service in entity service
brandPittCode d914968
Merge branch 'main' into feat/entity/post
brandPittCode a1212e0
feat(core): update the validate template methods calls
brandPittCode a24bb98
Merge branch 'main' into feat/entity/post
brandPittCode 30f86d6
feat(core): update the validate template methods calls
brandPittCode 5f12fec
feat(core): fix review
RVANDO12 ecc92b2
feat(core): add a entity graph service and endpoint
brandPittCode 1293b54
feat(core): add a entity graph service and endpoint
brandPittCode 7411267
feat(core): add a entity graph service and endpoint
brandPittCode 7e9c556
feat(core): add a entity graph service and endpoint
brandPittCode b68ba4d
feat(entity-graph): add a entity graph service and endpoint
brandPittCode dd5536a
feat(entity-graph): add a entity graph service and endpoint
brandPittCode 3b8c995
feat(entity-graph): add a entity graph service and endpoint
brandPittCode 579397f
Merge branch 'feat/entity/post' into feat/entity-graph
brandPittCode 1586490
Merge branch 'main' into feat/entity-graph
brandPittCode 545078b
feat(entity-graph): add a entity graph service and endpoint
brandPittCode b89ec6d
feat(core): add a entity graph service and endpoint
brandPittCode 63072ef
feat(core): add a entity graph service and endpoint
brandPittCode ce8afc9
feat(core): add a entity graph service and endpoint
brandPittCode 8ef61d4
Merge branch 'main' into feat/entity-graph
brandPittCode d8b8830
feat(core): add a entity graph service and endpoint
brandPittCode cfc1c51
feat(core): add a entity graph service and endpoint
brandPittCode 984db20
feat(core): add a entity graph service and endpoint
brandPittCode f3fbb2f
Merge branch 'main' into feat/entity-graph
brandPittCode 1929d86
feat(core): add a entity graph service and endpoint
brandPittCode ad8296b
feat(core): add a entity graph service and endpoint
brandPittCode 586863c
Merge branch 'main' into feat/entity-graph
brandPittCode 5f7d991
feat(core): add a entity graph service and endpoint
brandPittCode 9fa0d9a
Merge branch 'feat/entity-graph' of https://github.com/Decathlon/inte…
brandPittCode 447cc84
feat(core): add a entity graph service and endpoint
brandPittCode 7d5a3e5
feat(core): add a entity graph service and endpoint
brandPittCode 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
28 changes: 28 additions & 0 deletions
28
...va/com/decathlon/idp_core/domain/exception/entity/InvalidEntityCompositeKeyException.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,28 @@ | ||
| package com.decathlon.idp_core.domain.exception.entity; | ||
|
|
||
| /// Exception thrown when an entity composite key format is invalid. | ||
| /// | ||
| /// Composite keys must follow the format "templateIdentifier:identifier" | ||
| /// where both parts are non-empty strings separated by a single colon. | ||
| /// | ||
| /// **Business context:** | ||
| /// - Composite keys are used to uniquely identify entities across templates | ||
| /// - The same identifier can exist in multiple templates, so both parts are required | ||
| /// - This exception indicates a malformed key that cannot be parsed | ||
| /// | ||
| /// **HTTP mapping:** 400 Bad Request (client error — invalid input format) | ||
| public class InvalidEntityCompositeKeyException extends RuntimeException { | ||
|
|
||
| private final String invalidKey; | ||
|
|
||
| public InvalidEntityCompositeKeyException(String invalidKey) { | ||
| super(String.format( | ||
| "Invalid entity composite key format: '%s'. Expected format: 'templateIdentifier:identifier'", | ||
| invalidKey)); | ||
| this.invalidKey = invalidKey; | ||
| } | ||
|
|
||
| public String getInvalidKey() { | ||
| return invalidKey; | ||
| } | ||
| } |
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
40 changes: 40 additions & 0 deletions
40
src/main/java/com/decathlon/idp_core/domain/model/entity/EntityCompositeKey.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,40 @@ | ||
| package com.decathlon.idp_core.domain.model.entity; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| import com.decathlon.idp_core.domain.exception.entity.InvalidEntityCompositeKeyException; | ||
|
|
||
| /** | ||
| * Composite key for uniquely identifying an entity across templates. Since the | ||
| * same identifier can exist in different templates, we need both fields. | ||
| */ | ||
| public record EntityCompositeKey(String templateIdentifier, String identifier) { | ||
| public static EntityCompositeKey fromString(String compositeKey) { | ||
| String[] parts = compositeKey.split(":", 2); | ||
| if (parts.length != 2) { | ||
| throw new InvalidEntityCompositeKeyException(compositeKey); | ||
| } | ||
| return new EntityCompositeKey(parts[0], parts[1]); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return templateIdentifier + ":" + identifier; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) | ||
| return true; | ||
| if (o == null || getClass() != o.getClass()) | ||
| return false; | ||
| EntityCompositeKey that = (EntityCompositeKey) o; | ||
| return Objects.equals(templateIdentifier, that.templateIdentifier) | ||
| && Objects.equals(identifier, that.identifier); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(templateIdentifier, identifier); | ||
| } | ||
| } | ||
Empty file.
Empty file.
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
29 changes: 29 additions & 0 deletions
29
src/main/java/com/decathlon/idp_core/domain/model/entity_graph/EntityGraphNode.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,29 @@ | ||
| package com.decathlon.idp_core.domain.model.entity_graph; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import com.decathlon.idp_core.domain.model.entity.Property; | ||
|
|
||
| /// A node in the entity relationship graph, containing summary information | ||
| /// and its resolved relations (recursively up to a configurable depth). | ||
| /// | ||
| /// **Business purpose:** | ||
| /// - Visualizing entity dependency graphs | ||
| /// - Understanding relationship chains between entities | ||
| /// - Providing a hierarchical view of entity connections | ||
| /// | ||
| /// @param templateIdentifier the template identifier this entity belongs to | ||
| /// @param identifier the business identifier of the entity | ||
| /// @param name the human-readable name of the entity | ||
| /// @param properties the entity's property instances; empty when not requested | ||
| /// @param relations the resolved outbound relations with their target graph nodes | ||
| /// @param relationsAsTarget incoming relations where this entity is the target | ||
| public record EntityGraphNode(String templateIdentifier, String identifier, String name, | ||
| List<Property> properties, List<EntityGraphRelation> relations, | ||
| List<EntityGraphRelation> relationsAsTarget) { | ||
| public EntityGraphNode { | ||
| properties = properties != null ? List.copyOf(properties) : List.of(); | ||
| relations = relations != null ? List.copyOf(relations) : List.of(); | ||
| relationsAsTarget = relationsAsTarget != null ? List.copyOf(relationsAsTarget) : List.of(); | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/decathlon/idp_core/domain/model/entity_graph/EntityGraphRelation.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,17 @@ | ||
| package com.decathlon.idp_core.domain.model.entity_graph; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| /// Represents a single named relation in the entity graph with its resolved target nodes. | ||
| /// | ||
| /// **Business purpose:** | ||
| /// - Groups related entities under their relation name | ||
| /// - Enables graph traversal by relation type | ||
| /// | ||
| /// @param name the relation name as defined in the entity template | ||
| /// @param targets the resolved target entity graph nodes (recursively populated up to depth) | ||
|
brandPittCode marked this conversation as resolved.
|
||
| public record EntityGraphRelation(String name, List<EntityGraphNode> targets) { | ||
| public EntityGraphRelation { | ||
| targets = targets != null ? List.copyOf(targets) : List.of(); | ||
| } | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.