-
Notifications
You must be signed in to change notification settings - Fork 14
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
LCC & VSC : add escaped id in metadata #544
Conversation
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.
Thank you for working quickly and yet without very clear specifications (my bad!).
I have a few minor comments and something (what should we do about the existing NodeMetadata constructor) I would like to discuss further with you!
node instanceof EquipmentNode ? ((EquipmentNode) node).getEquipmentId() : null, | ||
createNodeLabelMetadata(prefixId, node, nodeLabels))); | ||
|
||
addInfoComponentMetadata(metadata, node.getComponentType()); | ||
} | ||
|
||
private String getUnescapedId(Node node, String nodeEscapedId) { | ||
String unescapedId = null; | ||
if (node.getComponentType().compareTo(VSC_CONVERTER_STATION) == 0 || |
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.
if (node.getComponentType().compareTo(VSC_CONVERTER_STATION) == 0 || | |
if (node.getComponentType().equals(VSC_CONVERTER_STATION) || |
(same suggestion for the second part of the condition)
String unescapedId = null; | ||
if (node.getComponentType().compareTo(VSC_CONVERTER_STATION) == 0 || | ||
node.getComponentType().compareTo(LCC_CONVERTER_STATION) == 0) { | ||
unescapedId = IdUtil.unescapeId(nodeEscapedId); |
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 unescapedId is simply given by node.getId()
! I don't think the "real" node id is rewritten after the escapeId
operation.
Thus, the getUnescapedId(...)
function may only have one parameter (Node node
)
@@ -51,8 +53,21 @@ public static class NodeMetadata { | |||
|
|||
private final List<NodeLabelMetadata> labels; | |||
|
|||
public NodeMetadata(@JsonProperty("id") String escapedId, |
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.
True question: is there a need to keep this constructor? For example, for a Node
that is not an EquipmentNode
, the equipmentId
is null
and we do not have a specific method without the equipmentId
.
Since the method is public, it would cause a breaking change to delete it.
Is deprecating it in the first place the right thing to do?
@@ -149,6 +149,7 @@ void test() throws IOException { | |||
@Test | |||
void testGraphMetadataWithLine() throws IOException { | |||
GraphMetadata metadata = new GraphMetadata(new LayoutParameters()); | |||
metadata.addNodeMetadata(new GraphMetadata.NodeMetadata("STATION_EXEMPLE", "idSTATION_95_EXEMPLE", "vid1", null, LCC_CONVERTER_STATION, false, Direction.UNDEFINED, false, null, Collections.emptyList())); |
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.
EXEMPLE is a French word ;) I would suggest EXAMPLE instead!
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
Signed-off-by: Thomas ADAM <tadam@silicom.fr>
7ae1383
to
9a8dd77
Compare
Kudos, SonarCloud Quality Gate passed! |
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.
Thank you for your work!
Please check if the PR fulfills these requirements
Does this PR already have an issue describing the problem?
No
What kind of change does this PR introduce?
Feature
What is the current behavior?
In node metadata for VSC or LCC contains fields id & equipmentId.
But the field id is "ascii-encoded" & equipmentId is the HVDC line id.
What is the new behavior (if this is a feature change)?
Add in metadata the LCC or VSC id.