Skip to content

Commit

Permalink
Merge pull request #251 from com-pas/develop
Browse files Browse the repository at this point in the history
New release
  • Loading branch information
Dennis Labordus authored Jul 12, 2022
2 parents 1a26b6e + 74a9771 commit 136dbc5
Show file tree
Hide file tree
Showing 41 changed files with 741 additions and 627 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Set up JDK 1.11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v20
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
shell: bash
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
- name: Set up JDK 1.11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v20
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 1.11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
Expand Down
20 changes: 18 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
6 changes: 6 additions & 0 deletions app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ SPDX-License-Identifier: Apache-2.0
</dependency>

<!-- Test Dependencies -->
<dependency>
<groupId>org.lfenergy.compas.cim.mapping</groupId>
<artifactId>service</artifactId>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
@RegisterForReflection(targets = {
com.powsybl.triplestore.impl.rdf4j.TripleStoreFactoryServiceRDF4J.class,
org.lfenergy.compas.core.jaxrs.model.ErrorResponse.class,
org.lfenergy.compas.core.jaxrs.model.ErrorMessage.class
org.lfenergy.compas.core.jaxrs.model.ErrorMessage.class,
javax.xml.namespace.QName.class
})
public class CompasCimMappingConfiguration {
@Produces
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.cim.mapping.rest.v1.model;

import org.lfenergy.compas.cim.mapping.model.AbstractPojoTester;

class MapRequestTest extends AbstractPojoTester {
@Override
protected Class<?> getClassToBeTested() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// SPDX-License-Identifier: Apache-2.0
package org.lfenergy.compas.cim.mapping.rest.v1.model;

import org.lfenergy.compas.cim.mapping.model.AbstractPojoTester;

class MapResponseTest extends AbstractPojoTester {
@Override
protected Class<?> getClassToBeTested() {
Expand Down
21 changes: 17 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ SPDX-License-Identifier: Apache-2.0

<properties>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Expand All @@ -26,10 +25,10 @@ SPDX-License-Identifier: Apache-2.0

<compas.core.version>0.9.1</compas.core.version>

<quarkus.platform.version>2.10.1.Final</quarkus.platform.version>
<quarkus.platform.version>2.10.2.Final</quarkus.platform.version>
<microprofile-openapi-api.version>3.0</microprofile-openapi-api.version>
<slf4j.version>1.7.36</slf4j.version>
<powsybl.version>4.9.1</powsybl.version>
<powsybl.version>4.9.2</powsybl.version>
<mapstruct.version>1.5.2.Final</mapstruct.version>
<openpojo.version>0.9.1</openpojo.version>
</properties>
Expand Down Expand Up @@ -112,6 +111,13 @@ SPDX-License-Identifier: Apache-2.0
</dependency>

<!-- Test -->
<dependency>
<groupId>org.lfenergy.compas.cim.mapping</groupId>
<artifactId>service</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>com.openpojo</groupId>
<artifactId>openpojo</artifactId>
Expand Down Expand Up @@ -156,6 +162,13 @@ SPDX-License-Identifier: Apache-2.0
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Expand Down
327 changes: 327 additions & 0 deletions postman/cim-mapping.collection.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions postman/cim-mapping.collection.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2022 Alliander N.V.

SPDX-License-Identifier: Apache-2.0
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ protected abstract TSubstation mapSubstationToTSubstation(CgmesSubstation substa
protected void afterSubstationToTSubstation(CgmesSubstation substation,
@MappingTarget TSubstation tSubstation,
@Context CimToSclMapperContext context) {
context.getVoltageLevelsBySubstation(substation.getId())
context.getVoltageLevelsBySubstation(substation.id())
.stream()
.map(voltageLevel -> mapVoltageLevelToTVoltageLevel(voltageLevel, context))
.forEach(tVoltageLevel -> tSubstation.getVoltageLevel().add(tVoltageLevel));

// PowerTransformers coupled to the Bay Level.
context.getTransformers(substation.getId())
context.getTransformers(substation.id())
.stream()
.map(transformer -> mapTransformerToTPowerTransformer(transformer, context))
.forEach(tPowerTransformer -> tSubstation.getPowerTransformer().add(tPowerTransformer));
Expand All @@ -90,18 +90,18 @@ protected void afterVoltageLevelToTVoltageLevel(CgmesVoltageLevel cgmesVoltageLe
@Context CimToSclMapperContext context) {
// First we need to process the BusbarSections before the Bays.
// This way the Connectivity Nodes from the BusbarSections are known to the Terminals in the Bay.
context.getBusbarSectionsByEquipmentContainer(cgmesVoltageLevel.getId())
context.getBusbarSectionsByEquipmentContainer(cgmesVoltageLevel.id())
.stream()
.map(cgmesBusbarSection -> mapBusbarSectionBayToTBay(cgmesBusbarSection, cgmesVoltageLevel, tVoltageLevel, context))
.forEach(tBay -> tVoltageLevel.getBay().add(tBay));

context.getBaysByVoltageLevel(cgmesVoltageLevel.getId())
context.getBaysByVoltageLevel(cgmesVoltageLevel.id())
.stream()
.map(bay -> mapBayToTBay(bay, cgmesVoltageLevel, tVoltageLevel, context))
.forEach(tBay -> tVoltageLevel.getBay().add(tBay));

// PowerTransformers coupled to the Bay Level.
context.getTransformers(cgmesVoltageLevel.getId())
context.getTransformers(cgmesVoltageLevel.id())
.stream()
.map(transformer -> mapTransformerToTPowerTransformer(transformer, context))
.forEach(tPowerTransformer -> tVoltageLevel.getPowerTransformer().add(tPowerTransformer));
Expand All @@ -117,8 +117,8 @@ protected abstract TBay mapBusbarSectionBayToTBay(CgmesBusbarSection cgmesBusbar
protected void afterBusbarSectionBayToTBay(CgmesBusbarSection cgmesBusbarSection,
@MappingTarget TBay tBay,
@Context CimToSclMapperContext context) {
context.getConnectivityNodeByBusbarSection(cgmesBusbarSection.getId()).stream()
.filter(cn -> !context.containsTConnectivityNode(cn.getId()))
context.getConnectivityNodeByBusbarSection(cgmesBusbarSection.id()).stream()
.filter(cn -> !context.containsTConnectivityNode(cn.id()))
.map(cn -> mapConnectivityNodeToTConnectivityNode(cn, context))
.forEach(tConnectivityNode -> tBay.getConnectivityNode().add(tConnectivityNode));
}
Expand All @@ -136,20 +136,20 @@ protected void afterBayToTBay(CgmesBay cgmesBay,
@Context CimToSclMapperContext context) {
// First we will process the Connectivity Nodes, because their path names are needed in the Terminal
// of a Conduction Equipment.
context.getConnectivityNodeByBay(cgmesBay.getId())
context.getConnectivityNodeByBay(cgmesBay.id())
.stream()
.filter(cn -> !context.containsTConnectivityNode(cn.getId()))
.filter(cn -> !context.containsTConnectivityNode(cn.id()))
.map(cn -> mapConnectivityNodeToTConnectivityNode(cn, context))
.forEach(tConnectivityNode -> tBay.getConnectivityNode().add(tConnectivityNode));

// Now we can process the Conduction Equipment with their terminals.
context.getSwitches(cgmesBay.getId())
context.getSwitches(cgmesBay.id())
.stream()
.map(cgmesSwitch -> mapSwitchToTConductingEquipment(cgmesSwitch, tVoltageLevel, context))
.forEach(tConductingEquipment -> tBay.getConductingEquipment().add(tConductingEquipment));

// PowerTransformers coupled to the Bay Level.
context.getTransformers(cgmesBay.getId())
context.getTransformers(cgmesBay.id())
.stream()
.map(transformer -> mapTransformerToTPowerTransformer(transformer, context))
.forEach(tPowerTransformer -> tBay.getPowerTransformer().add(tPowerTransformer));
Expand All @@ -166,7 +166,7 @@ protected void afterTransformerToTPowerTransformer(CgmesTransformer transformer,
@MappingTarget TPowerTransformer tPowerTransformer,
@Context CimToSclMapperContext context) {
// PowerTransformer Ends coupled to the PowerTransformer.
context.getTransformerEnds(transformer.getId())
context.getTransformerEnds(transformer.id())
.stream()
.map(transformerEnd -> mapTransformerEndToTTransformerWinding(transformerEnd, context))
.forEach(tTransformerWinding -> tPowerTransformer.getTransformerWinding().add(tTransformerWinding));
Expand All @@ -182,13 +182,13 @@ protected void afterTransformerEndToTTransformerWinding(CgmesTransformerEnd tran
@MappingTarget TTransformerWinding tTransformerWinding,
@Context CimToSclMapperContext context) {
// Convert the Ratio-/PhaseTapChanger from IEC CIM to IEC 61850.
context.getTapChanger(transformerEnd.getId())
context.getTapChanger(transformerEnd.id())
.ifPresent(cgmesTapChanger -> {
var tTapChanger = mapTapChangerToTTapChanger(cgmesTapChanger, context);
tTransformerWinding.setTapChanger(tTapChanger);
});

context.getTerminalById(transformerEnd.getTerminalId())
context.getTerminalById(transformerEnd.terminalId())
.ifPresent(cgmesTerminal -> {
var tTerminal = mapTerminalToTTerminal(cgmesTerminal, context);
tTransformerWinding.getTerminal().add(tTerminal);
Expand All @@ -211,11 +211,11 @@ protected void afterConnectivityNodeToTConnectivityNode(CgmesConnectivityNode cg
@Context CimToSclMapperContext context) {
var pathName = context.createPathName();
tConnectivityNode.setPathName(pathName);
context.saveTConnectivityNode(cgmesConnectivityNode.getId(), tConnectivityNode);
context.saveTConnectivityNode(cgmesConnectivityNode.id(), tConnectivityNode);
}

@Mapping(target = "name", source = "nameOrId")
@Mapping(target = "type", expression = "java( org.lfenergy.compas.cim.mapping.model.SwitchType.convertSwitchType(cgmesSwitch.getType()).name() )")
@Mapping(target = "type", expression = "java( org.lfenergy.compas.cim.mapping.model.SwitchType.convertSwitchType(cgmesSwitch.type()).name() )")
protected abstract TConductingEquipment mapSwitchToTConductingEquipment(CgmesSwitch cgmesSwitch,
@Context TVoltageLevel tVoltageLevel,
@Context CimToSclMapperContext context);
Expand All @@ -226,20 +226,20 @@ protected void afterSwitchToTConductingEquipment(CgmesSwitch cgmesSwitch,
@Context TVoltageLevel tVoltageLevel,
@Context CimToSclMapperContext context) {
// For DCLineSegment the nomFreq from the Voltage Level to 0
if (DC_LINE_SEGMENT_TYPE.equals(cgmesSwitch.getType())) {
if (DC_LINE_SEGMENT_TYPE.equals(cgmesSwitch.type())) {
tVoltageLevel.setNomFreq(BigDecimal.ZERO);
}

context.getTerminalsByConductingEquipment(cgmesSwitch.getId())
context.getTerminalsByConductingEquipment(cgmesSwitch.id())
.stream()
.map(cgmesTerminal -> mapTerminalToTTerminal(cgmesTerminal, context))
.forEach(tTerminal -> tConductingEquipment.getTerminal().add(tTerminal));
}


@Mapping(target = "name", source = "nameOrId")
@Mapping(target = "connectivityNode", expression = "java( context.getPathnameFromConnectivityNode(cgmesTerminal.getConnectivityNodeId()).orElse(null) )")
@Mapping(target = "CNodeName", expression = "java( context.getNameFromConnectivityNode(cgmesTerminal.getConnectivityNodeId()).orElse(null) )")
@Mapping(target = "connectivityNode", expression = "java( context.getPathnameFromConnectivityNode(cgmesTerminal.connectivityNodeId()).orElse(null) )")
@Mapping(target = "CNodeName", expression = "java( context.getNameFromConnectivityNode(cgmesTerminal.connectivityNodeId()).orElse(null) )")
protected abstract TTerminal mapTerminalToTTerminal(CgmesTerminal cgmesTerminal,
@Context CimToSclMapperContext context);

Expand Down
Loading

0 comments on commit 136dbc5

Please sign in to comment.