Skip to content

Add Line segments infos into database for line creation#787

Open
basseche wants to merge 1 commit intomainfrom
add_LineSegments_LineCreation
Open

Add Line segments infos into database for line creation#787
basseche wants to merge 1 commit intomainfrom
add_LineSegments_LineCreation

Conversation

@basseche
Copy link
Copy Markdown
Contributor

PR Summary

Add Line segments entity table related to line creation

@basseche basseche self-assigned this Mar 24, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

Warning

Rate limit exceeded

@basseche has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e3f6f8d9-ef94-4196-b490-eea2c1875380

📥 Commits

Reviewing files that changed from the base of the PR and between 6b7538f and 5ff3748.

📒 Files selected for processing (5)
  • pom.xml
  • src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.java
  • src/main/resources/db/changelog/changesets/changelog_20260324T101024Z.xml
  • src/main/resources/db/changelog/db.changelog-master.yaml
📝 Walkthrough

Walkthrough

The changes introduce support for managing line segments within line creation entities. A new LineSegmentEntity JPA entity is added to persist line segment data, with LineCreationEntity updated to maintain a one-to-many relationship to line segments. A corresponding database migration is included, and the network-modification dependency is updated to version 0.73.0-SNAPSHOT.

Changes

Cohort / File(s) Summary
Dependency Update
pom.xml
Updated network-modification.version from 0.72.0 to 0.73.0-SNAPSHOT, which affects the resolved version of the managed org.gridsuite:gridsuite-network-modification dependency.
Line Segment Entity Model
src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.java
New JPA entity class persisting line segment data with fields for segment type, distance value, area, temperature, and shape factor. Includes static conversion utilities to map between LineSegmentEntity and LineSegmentInfos objects.
Line Creation Entity Update
src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java
Added @OneToMany relationship to LineSegmentEntity with cascade-all and orphan removal enabled. Updated constructors and assignment methods to populate line segments from LineCreationInfos. Modified toLineCreationInfosBuilder() to include converted line segment data in the output.
Database Schema Migration
src/main/resources/db/changelog/db.changelog-master.yaml
Added Flyway Liquibase changelog include entry for changesets/changelog_20260324T101024Z.xml to apply the new line segments table schema to the database.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add Line segments infos into database for line creation' accurately summarizes the main change: adding a new LineSegmentEntity and database table to support line segments in the line creation process.
Description check ✅ Passed The description 'Add Line segments entity table related to line creation' is directly related to the changeset, which introduces LineSegmentEntity, database schema updates, and integration with LineCreationEntity.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java`:
- Around line 44-49: LineCreationEntity currently maps the
List<LineSegmentEntity> lineSegments without preserving order; update the
mapping on lineSegments to add an `@OrderColumn` (e.g., `@OrderColumn`(name =
"line_segments_order") or similar) so the list index is persisted and round-trip
order is stable, and explicitly set the join table name in the `@JoinTable` (e.g.,
name = "line_creation_line_segments") rather than relying on Hibernate defaults
so Liquibase schema matches; keep the existing joinColumns, inverseJoinColumns
and uniqueConstraints but move them into the explicitly named `@JoinTable` and
ensure the OrderColumn column name does not conflict with existing constraints.

In
`@src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.java`:
- Around line 66-75: fromLineSegmentsEntity currently dereferences its input
list and will NPE if lineSegmentEntities is null; make it null-safe by returning
Collections.emptyList() (or new ArrayList<>()) when lineSegmentEntities is null,
otherwise map each LineSegmentEntity to a LineSegmentInfos as it does now,
updating the method body in fromLineSegmentsEntity to check for null before
iterating; this mirrors the null-safety in toLineSegmentEntities and avoids
breaking LineCreationEntity.toLineCreationInfosBuilder.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e37c68b4-5f4e-4f48-8d9e-95d0b0d7429d

📥 Commits

Reviewing files that changed from the base of the PR and between 5bfaf54 and 6b7538f.

📒 Files selected for processing (4)
  • pom.xml
  • src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineSegmentEntity.java
  • src/main/resources/db/changelog/db.changelog-master.yaml

Signed-off-by: basseche <bassel.el-cheikh_externe@rte-france.com>
@basseche basseche force-pushed the add_LineSegments_LineCreation branch from c09f515 to 5ff3748 Compare March 24, 2026 13:20
Sign up for free to 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.

1 participant