Skip to content
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

Refactoring XML IIDM serialization classes #2481

Merged
merged 6 commits into from
Mar 14, 2023
Merged

Refactoring XML IIDM serialization classes #2481

merged 6 commits into from
Mar 14, 2023

Conversation

miovd
Copy link
Contributor

@miovd miovd commented Mar 1, 2023

Please check if the PR fulfills these requirements (please use '[x]' to check the checkboxes, or submit the PR and then click the checkboxes)

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem ? If so, link to this issue using '#XXX' and skip the rest
No but it has been discussed in PR about replacing DanglingLine by HalfLine

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Refactoring (XIIDM serialization) to be less strict for complex equipments (shunt compensators and in the future, tie lines)

Does this PR introduce a breaking change or deprecate an API? If yes, check the following:

  • The Breaking Change or Deprecated label has been added
  • The migration guide has been updated in the github wiki (What changes might users need to make in their application due to this PR?)
    Might create issues in extensions serialization elsewhere

@miovd miovd marked this pull request as ready for review March 6, 2023 08:52
@miovd miovd requested a review from flo-dup March 6, 2023 08:52
@annetill annetill requested a review from geofjamg March 6, 2023 12:43
miovd added 2 commits March 8, 2023 14:50
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
@miovd miovd force-pushed the refactoring_xiidm branch from f7f4a24 to 1ce7f7c Compare March 8, 2023 14:20
Comment on lines 29 to 31
protected void readUntilEndRootElement(XMLStreamReader reader, XmlUtil.XmlEventHandler eventHandler) throws XMLStreamException {
XmlUtil.readUntilEndElement(getRootElementName(), reader, eventHandler);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There are some code duplicates, like here, or in read (getting id, name and fictitious), or maybe also readSubElements. Shouldn't we factorize them? That would lead to some utils method in AbstractIdentifiableXml. You didn't do it because you didn't want to put any reading in AbstractIdentifiableXml?

toApply.forEach(consumer -> consumer.accept(identifiable));
}

public final void read(Supplier<A> createAdder, Function<A, T> create, NetworkXmlReaderContext context) throws XMLStreamException {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could do as the simple one for creating the adder, that is adding a createAdder(voltageLevel), which could therefore remain in AbstractIdentifiableXml. And then we could also leave in AbstractIdentifiableXml an abstract read(P, NetworkXmlReaderContext).

Copy link
Contributor

Choose a reason for hiding this comment

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

I forgot the Function<A, T> create which is needed. We could do the same, that is, an abstract method which returns the adder. Or, better! in fact we could write adder.add() as I'd really like to add add methods in the Adders

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this PR, if your change in IIDM network is not passed, I will create an abstract method to add but I'm keeping it in mind!

miovd added 2 commits March 14, 2023 09:54
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
@miovd miovd requested a review from flo-dup March 14, 2023 09:30
Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 8 Code Smells

91.3% 91.3% Coverage
0.0% 0.0% Duplication

@miovd miovd merged commit 14ceffa into main Mar 14, 2023
@miovd miovd deleted the refactoring_xiidm branch March 14, 2023 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants