Skip to content

Commit

Permalink
Revert "Ensure that mrid are used when importing GLSK CIM and not rdf…
Browse files Browse the repository at this point in the history
…id (#34)"

This reverts commit d2446a0.

Signed-off-by: VEDELAGO MIORA <miora.ralambotiana@rte-france.com>
  • Loading branch information
miovd committed Jun 27, 2022
1 parent 7bebdc8 commit 2ea288d
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,14 @@ public class CimGlskRegisteredResource extends AbstractGlskRegisteredResource {

public CimGlskRegisteredResource(Element element) {
Objects.requireNonNull(element);
this.mRID = removeRdfPrefix(element.getElementsByTagName("mRID").item(0).getTextContent());
this.mRID = element.getElementsByTagName("mRID").item(0).getTextContent();
this.name = element.getElementsByTagName("name").item(0).getTextContent();
this.participationFactor = getContentAsDoubleOrNull(element, "sK_ResourceCapacity.defaultCapacity");
this.maximumCapacity = getContentAsDoubleOrNull(element, "resourceCapacity.maximumCapacity");
this.minimumCapacity = getContentAsDoubleOrNull(element, "resourceCapacity.minimumCapacity");
}

private static String removeRdfPrefix(String s) {
String s1 = s;
// rdf:ID is the mRID plus an underscore added at the beginning of the string
// We may decide if we want to preserve or not the underscore
if (s1.length() > 0 && s1.charAt(0) == '_') {
s1 = s1.substring(1);
}
return s1;
}

private static Double getContentAsDoubleOrNull(Element baseElement, String tag) {
private Double getContentAsDoubleOrNull(Element baseElement, String tag) {
return baseElement.getElementsByTagName(tag).getLength() == 0 ? null :
Double.parseDouble(baseElement.getElementsByTagName(tag).item(0).getTextContent());
}
Expand Down

0 comments on commit 2ea288d

Please sign in to comment.