From 93b72f17709f416b031c780d3435dcde01fa7c64 Mon Sep 17 00:00:00 2001 From: Slimane AMAR Date: Tue, 18 Apr 2023 19:14:32 +0200 Subject: [PATCH] Remove hack for GeneratorActivePowerControlXmlSerializer class Signed-off-by: Slimane AMAR --- ...eratorActivePowerControlXmlSerializer.java | 79 ------------------- 1 file changed, 79 deletions(-) delete mode 100644 src/main/java/com/powsybl/network/conversion/server/GeneratorActivePowerControlXmlSerializer.java diff --git a/src/main/java/com/powsybl/network/conversion/server/GeneratorActivePowerControlXmlSerializer.java b/src/main/java/com/powsybl/network/conversion/server/GeneratorActivePowerControlXmlSerializer.java deleted file mode 100644 index 23c18010..00000000 --- a/src/main/java/com/powsybl/network/conversion/server/GeneratorActivePowerControlXmlSerializer.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (c) 2022, RTE (http://www.rte-france.com) - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -package com.powsybl.network.conversion.server; - -import com.google.auto.service.AutoService; -import com.powsybl.commons.extensions.ExtensionXmlSerializer; -import com.powsybl.commons.xml.XmlReaderContext; -import com.powsybl.commons.xml.XmlUtil; -import com.powsybl.commons.xml.XmlWriterContext; -import com.powsybl.iidm.network.Injection; -import com.powsybl.iidm.network.extensions.ActivePowerControl; -import com.powsybl.iidm.network.extensions.ActivePowerControlAdder; - -import javax.xml.stream.XMLStreamException; -import java.io.InputStream; - -/** - * HACK!!! this class should be included in iidm-cvg-extensions. To remove when migration to rte-core 3.10.0. - * - * @author Geoffroy Jamgotchian - */ -@AutoService(ExtensionXmlSerializer.class) -public class GeneratorActivePowerControlXmlSerializer> implements ExtensionXmlSerializer> { - - @Override - public String getExtensionName() { - return "generatorActivePowerControl"; - } - - @Override - public String getCategoryName() { - return "network"; - } - - @Override - public Class> getExtensionClass() { - return ActivePowerControl.class; - } - - @Override - public boolean hasSubElements() { - return false; - } - - @Override - public InputStream getXsdAsStream() { - return getClass().getResourceAsStream("/xsd/generatorActivePowerControl.xsd"); - } - - @Override - public String getNamespaceUri() { - return "http://www.itesla_project.eu/schema/iidm/ext/generator_active_power_control/1_0"; - } - - @Override - public String getNamespacePrefix() { - return "gapc"; - } - - @Override - public void write(ActivePowerControl activePowerControl, XmlWriterContext context) throws XMLStreamException { - throw new IllegalStateException("Should never be called"); - } - - @Override - public ActivePowerControl read(T identifiable, XmlReaderContext context) { - boolean participate = XmlUtil.readBoolAttribute(context.getReader(), "participate"); - float droop = XmlUtil.readFloatAttribute(context.getReader(), "droop"); - identifiable.newExtension(ActivePowerControlAdder.class) - .withParticipate(participate) - .withDroop(droop) - .add(); - return identifiable.getExtension(ActivePowerControl.class); - } -}