diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/DefaultContingencyList.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/DefaultContingencyList.java index b8e6b84341e..1b1172a2a21 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/DefaultContingencyList.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/DefaultContingencyList.java @@ -19,8 +19,8 @@ */ public class DefaultContingencyList implements ContingencyList { + public static final String TYPE = "default"; private final String name; - private final List contingencies; public DefaultContingencyList(Contingency... contingencies) { @@ -43,7 +43,7 @@ public String getName() { @Override public String getType() { - return "default"; + return TYPE; } public List getContingencies() { diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/HvdcLineCriterionContingencyList.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/HvdcLineCriterionContingencyList.java index 48ff9ab0e48..33eda322e61 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/HvdcLineCriterionContingencyList.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/HvdcLineCriterionContingencyList.java @@ -19,6 +19,8 @@ */ public class HvdcLineCriterionContingencyList extends AbstractLineCriterionContingencyList { + public static final String TYPE = "hvdcCriterion"; + public HvdcLineCriterionContingencyList(String name, TwoCountriesCriterion twoCountriesCriterion, TwoNominalVoltageCriterion twoNominalVoltageCriterion, List propertyCriteria, RegexCriterion regexCriterion) { @@ -27,6 +29,6 @@ public HvdcLineCriterionContingencyList(String name, TwoCountriesCriterion twoCo @Override public String getType() { - return "hvdcCriterion"; + return TYPE; } } diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/IdentifierContingencyList.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/IdentifierContingencyList.java index 4edef063b06..93043418c4e 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/IdentifierContingencyList.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/IdentifierContingencyList.java @@ -22,6 +22,7 @@ public class IdentifierContingencyList implements ContingencyList { private static final String VERSION = "1.2"; + public static final String TYPE = "identifier"; private final String name; private final List networkElementIdentifiers; @@ -41,7 +42,7 @@ public String getName() { @Override public String getType() { - return "identifier"; + return TYPE; } public List getIdentifiants() { diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/InjectionCriterionContingencyList.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/InjectionCriterionContingencyList.java index ba09c44e3e4..acbb67aa05b 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/InjectionCriterionContingencyList.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/InjectionCriterionContingencyList.java @@ -19,6 +19,7 @@ */ public class InjectionCriterionContingencyList extends AbstractEquipmentCriterionContingencyList { + public static final String TYPE = "injectionCriterion"; private final SingleCountryCriterion singleCountryCriterion; private final SingleNominalVoltageCriterion singleNominalVoltageCriterion; @@ -38,7 +39,7 @@ public InjectionCriterionContingencyList(String name, IdentifiableType identifia @Override public String getType() { - return "injectionCriterion"; + return TYPE; } @Override diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/LineCriterionContingencyList.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/LineCriterionContingencyList.java index b58d6d6e318..cc98c5f6141 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/LineCriterionContingencyList.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/LineCriterionContingencyList.java @@ -16,6 +16,8 @@ */ public class LineCriterionContingencyList extends AbstractLineCriterionContingencyList { + public static final String TYPE = "lineCriterion"; + public LineCriterionContingencyList(String name, TwoCountriesCriterion twoCountriesCriterion, TwoNominalVoltageCriterion twoNominalVoltageCriterion, @@ -25,6 +27,6 @@ public LineCriterionContingencyList(String name, @Override public String getType() { - return "lineCriterion"; + return TYPE; } } diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/ListOfContingencyLists.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/ListOfContingencyLists.java index b478b281dca..9b9d3fba2c2 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/ListOfContingencyLists.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/ListOfContingencyLists.java @@ -18,6 +18,8 @@ * @author Etienne Lesot {@literal } */ public class ListOfContingencyLists implements ContingencyList { + + public static final String TYPE = "list"; private final String name; private final List contingencyLists; @@ -33,7 +35,7 @@ public String getName() { @Override public String getType() { - return "list"; + return TYPE; } @Override diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/ThreeWindingsTransformerCriterionContingencyList.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/ThreeWindingsTransformerCriterionContingencyList.java index f6f1abc201a..c6206bf59c2 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/ThreeWindingsTransformerCriterionContingencyList.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/ThreeWindingsTransformerCriterionContingencyList.java @@ -19,6 +19,7 @@ */ public class ThreeWindingsTransformerCriterionContingencyList extends AbstractEquipmentCriterionContingencyList { + public static final String TYPE = "threeWindingsTransformerCriterion"; private final SingleCountryCriterion singleCountryCriterion; private final ThreeNominalVoltageCriterion threeNominalVoltageCriterion; @@ -33,7 +34,7 @@ public ThreeWindingsTransformerCriterionContingencyList(String name, @Override public String getType() { - return "threeWindingsTransformerCriterion"; + return TYPE; } @Override diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/TieLineCriterionContingencyList.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/TieLineCriterionContingencyList.java index 9b548813395..35a473fb060 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/TieLineCriterionContingencyList.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/TieLineCriterionContingencyList.java @@ -19,6 +19,8 @@ * @author Florian Dupuy {@literal } */ public class TieLineCriterionContingencyList extends AbstractEquipmentCriterionContingencyList { + + public static final String TYPE = "tieLineCriterion"; private final TwoCountriesCriterion twoCountriesCriterion; private final SingleNominalVoltageCriterion singleNominalVoltageCriterion; @@ -33,7 +35,7 @@ public TieLineCriterionContingencyList(String name, @Override public String getType() { - return "tieLineCriterion"; + return TYPE; } @Override diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/TwoWindingsTransformerCriterionContingencyList.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/TwoWindingsTransformerCriterionContingencyList.java index 99a841d0855..71ad00aebc2 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/TwoWindingsTransformerCriterionContingencyList.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/contingency/list/TwoWindingsTransformerCriterionContingencyList.java @@ -18,6 +18,8 @@ * @author Etienne Lesot {@literal } */ public class TwoWindingsTransformerCriterionContingencyList extends AbstractEquipmentCriterionContingencyList { + + public static final String TYPE = "twoWindingsTransformerCriterion"; private final SingleCountryCriterion singleCountryCriterion; private final TwoNominalVoltageCriterion twoNominalVoltageCriterion; @@ -32,7 +34,7 @@ public TwoWindingsTransformerCriterionContingencyList(String name, @Override public String getType() { - return "twoWindingsTransformerCriterion"; + return TYPE; } @Override diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/AbstractEquipmentCriterionContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/AbstractEquipmentCriterionContingencyListDeserializer.java index 4d45850c239..d235a573d38 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/AbstractEquipmentCriterionContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/AbstractEquipmentCriterionContingencyListDeserializer.java @@ -38,33 +38,45 @@ protected static class ParsingContext { } protected boolean deserializeCommonAttributes(JsonParser parser, DeserializationContext ctx, - ParsingContext parsingCtx, String name) throws IOException { + ParsingContext parsingCtx, String name, String expectedType) throws IOException { switch (name) { - case "name": + case "name" -> { parsingCtx.name = parser.nextTextValue(); return true; - case "countryCriterion": + } + case "countryCriterion" -> { parser.nextToken(); parsingCtx.countryCriterion = JsonUtil.readValue(ctx, parser, Criterion.class); return true; - case "nominalVoltageCriterion": + } + case "nominalVoltageCriterion" -> { parser.nextToken(); parsingCtx.nominalVoltageCriterion = JsonUtil.readValue(ctx, parser, Criterion.class); return true; - case "propertyCriteria": + } + case "propertyCriteria" -> { parser.nextToken(); parsingCtx.propertyCriteria = JsonUtil.readList(ctx, parser, Criterion.class); return true; - case "regexCriterion": + } + case "regexCriterion" -> { parser.nextToken(); parsingCtx.regexCriterion = JsonUtil.readValue(ctx, parser, Criterion.class); return true; - case "version": - case "type": + } + case "version" -> { parser.nextToken(); return true; - default: + } + case "type" -> { + if (!parser.nextTextValue().equals(expectedType)) { + throw new IllegalStateException("type should be: " + expectedType); + } + return true; + } + default -> { return false; + } } } diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyDeserializer.java index 11ac58fb2b9..1ca96a91cb0 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyDeserializer.java @@ -46,22 +46,16 @@ public Contingency deserialize(JsonParser parser, DeserializationContext deseria while (parser.nextToken() != JsonToken.END_OBJECT) { switch (parser.getCurrentName()) { - case "id": - id = parser.nextTextValue(); - break; - - case "elements": + case "id" -> id = parser.nextTextValue(); + case "elements" -> { parser.nextToken(); elements = JsonUtil.readList(deserializationContext, parser, ContingencyElement.class); - break; - - case "extensions": + } + case "extensions" -> { parser.nextToken(); extensions = JsonUtil.readExtensions(parser, deserializationContext, SUPPLIER.get()); - break; - - default: - throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); + } + default -> throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); } } diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyElementDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyElementDeserializer.java index 8386a7c5dd7..ca50e880da4 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyElementDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyElementDeserializer.java @@ -32,68 +32,33 @@ public ContingencyElement deserialize(JsonParser parser, DeserializationContext while (parser.nextToken() != JsonToken.END_OBJECT) { switch (parser.getCurrentName()) { - case "id": - id = parser.nextTextValue(); - break; - - case "voltageLevelId": - voltageLevelId = parser.nextTextValue(); - break; - - case "type": + case "id" -> id = parser.nextTextValue(); + case "voltageLevelId" -> voltageLevelId = parser.nextTextValue(); + case "type" -> { parser.nextToken(); type = JsonUtil.readValue(ctx, parser, ContingencyElementType.class); - break; - - default: - throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); + } + default -> throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); } } if (type != null) { - switch (type) { - case BRANCH: - return new BranchContingency(id, voltageLevelId); - - case GENERATOR: - return new GeneratorContingency(id); - - case STATIC_VAR_COMPENSATOR: - return new StaticVarCompensatorContingency(id); - - case SHUNT_COMPENSATOR: - return new ShuntCompensatorContingency(id); - - case HVDC_LINE: - return new HvdcLineContingency(id, voltageLevelId); - - case BUSBAR_SECTION: - return new BusbarSectionContingency(id); - - case DANGLING_LINE: - return new DanglingLineContingency(id); - - case LINE: - return new LineContingency(id, voltageLevelId); - - case TWO_WINDINGS_TRANSFORMER: - return new TwoWindingsTransformerContingency(id, voltageLevelId); - - case THREE_WINDINGS_TRANSFORMER: - return new ThreeWindingsTransformerContingency(id); - - case LOAD: - return new LoadContingency(id); - - case BUS: - return new BusContingency(id); - - case TIE_LINE: - return new TieLineContingency(id, voltageLevelId); - - default: - throw new IllegalStateException("Unexpected ContingencyElementType value: " + type); - } + return switch (type) { + case BRANCH -> new BranchContingency(id, voltageLevelId); + case GENERATOR -> new GeneratorContingency(id); + case STATIC_VAR_COMPENSATOR -> new StaticVarCompensatorContingency(id); + case SHUNT_COMPENSATOR -> new ShuntCompensatorContingency(id); + case HVDC_LINE -> new HvdcLineContingency(id, voltageLevelId); + case BUSBAR_SECTION -> new BusbarSectionContingency(id); + case DANGLING_LINE -> new DanglingLineContingency(id); + case LINE -> new LineContingency(id, voltageLevelId); + case TWO_WINDINGS_TRANSFORMER -> new TwoWindingsTransformerContingency(id, voltageLevelId); + case THREE_WINDINGS_TRANSFORMER -> new ThreeWindingsTransformerContingency(id); + case LOAD -> new LoadContingency(id); + case BUS -> new BusContingency(id); + case TIE_LINE -> new TieLineContingency(id, voltageLevelId); + default -> throw new IllegalStateException("Unexpected ContingencyElementType value: " + type); + }; } return null; diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyListDeserializer.java index 686894856d2..d7fd12e4cdf 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ContingencyListDeserializer.java @@ -28,29 +28,39 @@ public ContingencyList deserialize(JsonParser parser, DeserializationContext des while (parser.getCurrentName() != null) { if ("type".equals(parser.getCurrentName())) { switch (parser.nextTextValue()) { - case "default": + case "default" -> { DefaultContingencyListDeserializer defaultContingencyListDeserializer = new DefaultContingencyListDeserializer(); return defaultContingencyListDeserializer.deserialize(parser, deserializationContext); - case "injectionCriterion": + } + case "injectionCriterion" -> { InjectionCriterionContingencyListDeserializer injectionCriterionContingencyListDeserializer = new InjectionCriterionContingencyListDeserializer(); return injectionCriterionContingencyListDeserializer.deserialize(parser, deserializationContext); - case "hvdcCriterion": + } + case "hvdcCriterion" -> { HvdcLineCriterionContingencyListDeserializer hvdcLineCriterionContingencyListDeserializer = new HvdcLineCriterionContingencyListDeserializer(); return hvdcLineCriterionContingencyListDeserializer.deserialize(parser, deserializationContext); - case "lineCriterion": + } + case "lineCriterion" -> { LineCriterionContingencyListDeserializer lineCriterionContingencyListDeserializer = new LineCriterionContingencyListDeserializer(); return lineCriterionContingencyListDeserializer.deserialize(parser, deserializationContext); - case "twoWindingsTransformerCriterion": + } + case "twoWindingsTransformerCriterion" -> { TwoWindingsTransformerCriterionContingencyListDeserializer twoWindingsTransformerCriterionContingencyListDeserializer = new TwoWindingsTransformerCriterionContingencyListDeserializer(); return twoWindingsTransformerCriterionContingencyListDeserializer.deserialize(parser, deserializationContext); - case "threeWindingsTransformerCriterion": + } + case "threeWindingsTransformerCriterion" -> { ThreeWindingsTransformerCriterionContingencyListDeserializer threeWindingsTransformerCriterionContingencyListDeserializer = new ThreeWindingsTransformerCriterionContingencyListDeserializer(); return threeWindingsTransformerCriterionContingencyListDeserializer.deserialize(parser, deserializationContext); - case "list": + } + case "list" -> { ListOfContingencyListsDeserializer listOfContingencyListsDeserializer = new ListOfContingencyListsDeserializer(); return listOfContingencyListsDeserializer.deserialize(parser, deserializationContext); - default: - throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); + } + case "identifier" -> { + IdentifierContingencyListDeserializer identifierContingencyListDeserializer = new IdentifierContingencyListDeserializer(); + return identifierContingencyListDeserializer.deserialize(parser, deserializationContext); + } + default -> throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); } } parser.nextToken(); diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/CriterionDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/CriterionDeserializer.java index 0bcc1acc41a..bd46c2a56fc 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/CriterionDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/CriterionDeserializer.java @@ -44,82 +44,64 @@ public Criterion deserialize(JsonParser parser, DeserializationContext deseriali PropertyCriterion.SideToCheck sideToCheck = null; while (parser.nextToken() != JsonToken.END_OBJECT) { switch (parser.getCurrentName()) { - case "type": - type = Criterion.CriterionType.valueOf(parser.nextTextValue()); - break; - case "voltageInterval": + case "type" -> type = Criterion.CriterionType.valueOf(parser.nextTextValue()); + case "voltageInterval" -> { parser.nextToken(); voltageInterval = JsonUtil.readValue(deserializationContext, parser, SingleNominalVoltageCriterion.VoltageInterval.class); - break; - case "voltageInterval1": + } + case "voltageInterval1" -> { parser.nextToken(); voltageInterval1 = JsonUtil.readValue(deserializationContext, parser, SingleNominalVoltageCriterion.VoltageInterval.class); - break; - case "voltageInterval2": + } + case "voltageInterval2" -> { parser.nextToken(); voltageInterval2 = JsonUtil.readValue(deserializationContext, parser, SingleNominalVoltageCriterion.VoltageInterval.class); - break; - case "voltageInterval3": + } + case "voltageInterval3" -> { parser.nextToken(); voltageInterval3 = JsonUtil.readValue(deserializationContext, parser, SingleNominalVoltageCriterion.VoltageInterval.class); - break; - case "countries": + } + case "countries" -> { parser.nextToken(); countries = JsonUtil.readList(deserializationContext, parser, String.class); - break; - case "countries1": + } + case "countries1" -> { parser.nextToken(); countries1 = JsonUtil.readList(deserializationContext, parser, String.class); - break; - case "countries2": + } + case "countries2" -> { parser.nextToken(); countries2 = JsonUtil.readList(deserializationContext, parser, String.class); - break; - case "propertyKey": - propertyKey = parser.nextTextValue(); - break; - case "regex": - regex = parser.nextTextValue(); - break; - case "propertyValue": + } + case "propertyKey" -> propertyKey = parser.nextTextValue(); + case "regex" -> regex = parser.nextTextValue(); + case "propertyValue" -> { parser.nextToken(); propertyValues = JsonUtil.readList(deserializationContext, parser, String.class); - break; - case "equipmentToCheck": - equipmentToCheck = PropertyCriterion.EquipmentToCheck.valueOf(parser.nextTextValue()); - break; - case "sideToCheck": - sideToCheck = PropertyCriterion.SideToCheck.valueOf(parser.nextTextValue()); - break; - default: - throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); + } + case "equipmentToCheck" -> + equipmentToCheck = PropertyCriterion.EquipmentToCheck.valueOf(parser.nextTextValue()); + case "sideToCheck" -> sideToCheck = PropertyCriterion.SideToCheck.valueOf(parser.nextTextValue()); + default -> throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); } } if (type == null) { throw new IllegalArgumentException("type of criterion can not be null"); } - switch (type) { - case PROPERTY: - return new PropertyCriterion(propertyKey, propertyValues, equipmentToCheck, sideToCheck); - case SINGLE_COUNTRY: - return new SingleCountryCriterion(countries.stream().map(Country::valueOf).toList()); - case TWO_COUNTRY: - return new TwoCountriesCriterion(countries1.stream().map(Country::valueOf).toList(), - countries2.stream().map(Country::valueOf).toList()); - case SINGLE_NOMINAL_VOLTAGE: - return new SingleNominalVoltageCriterion(voltageInterval); - case TWO_NOMINAL_VOLTAGE: - return new TwoNominalVoltageCriterion(voltageInterval1, voltageInterval2); - case THREE_NOMINAL_VOLTAGE: - return new ThreeNominalVoltageCriterion(voltageInterval1, voltageInterval2, voltageInterval3); - case REGEX: - return new RegexCriterion(regex); - default: - throw new IllegalArgumentException("type is not correct"); - } + return switch (type) { + case PROPERTY -> new PropertyCriterion(propertyKey, propertyValues, equipmentToCheck, sideToCheck); + case SINGLE_COUNTRY -> new SingleCountryCriterion(countries.stream().map(Country::valueOf).toList()); + case TWO_COUNTRY -> new TwoCountriesCriterion(countries1.stream().map(Country::valueOf).toList(), + countries2.stream().map(Country::valueOf).toList()); + case SINGLE_NOMINAL_VOLTAGE -> new SingleNominalVoltageCriterion(voltageInterval); + case TWO_NOMINAL_VOLTAGE -> new TwoNominalVoltageCriterion(voltageInterval1, voltageInterval2); + case THREE_NOMINAL_VOLTAGE -> + new ThreeNominalVoltageCriterion(voltageInterval1, voltageInterval2, voltageInterval3); + case REGEX -> new RegexCriterion(regex); + }; } } diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/DefaultContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/DefaultContingencyListDeserializer.java index cb9053336f8..4b55540c902 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/DefaultContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/DefaultContingencyListDeserializer.java @@ -34,25 +34,18 @@ public DefaultContingencyList deserialize(JsonParser parser, DeserializationCont while (parser.nextToken() != JsonToken.END_OBJECT) { switch (parser.getCurrentName()) { - case "version": - parser.nextToken(); - break; - - case "name": - name = parser.nextTextValue(); - break; - - case "type": - parser.nextToken(); - break; - - case "contingencies": + case "version" -> parser.nextToken(); + case "name" -> name = parser.nextTextValue(); + case "type" -> { + if (!parser.nextTextValue().equals(DefaultContingencyList.TYPE)) { + throw new IllegalStateException("type should be: " + DefaultContingencyList.TYPE); + } + } + case "contingencies" -> { parser.nextToken(); contingencies = JsonUtil.readList(ctx, parser, Contingency.class); - break; - - default: - throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); + } + default -> throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); } } diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/HvdcLineCriterionContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/HvdcLineCriterionContingencyListDeserializer.java index 73e0fb160ce..633622813b3 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/HvdcLineCriterionContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/HvdcLineCriterionContingencyListDeserializer.java @@ -27,7 +27,8 @@ public HvdcLineCriterionContingencyListDeserializer() { public HvdcLineCriterionContingencyList deserialize(JsonParser parser, DeserializationContext deserializationContext) throws IOException { AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext parsingContext = new AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext(); parser.nextToken(); - JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, parsingContext, name)); + JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, + parsingContext, name, HvdcLineCriterionContingencyList.TYPE)); return new HvdcLineCriterionContingencyList(parsingContext.name, (TwoCountriesCriterion) parsingContext.countryCriterion, diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierContingencyListDeserializer.java index b68a525a22c..c58443afc4c 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierContingencyListDeserializer.java @@ -24,6 +24,7 @@ public class IdentifierContingencyListDeserializer extends StdDeserializer { private static final String CONTEXT_NAME = "identifierContingencyList"; + public static final String IDENTIFIER_LIST_VERSION = "identifierListVersion"; public IdentifierContingencyListDeserializer() { super(IdentifierContingencyList.class); @@ -34,34 +35,29 @@ public IdentifierContingencyList deserialize(JsonParser parser, DeserializationC String name = null; String version = null; List networkElementIdentifiers = Collections.emptyList(); - while (parser.nextToken() != JsonToken.END_OBJECT) { - switch (parser.getCurrentName()) { - case "version": + String test = parser.getCurrentName(); + switch (test) { + case "version" -> { version = parser.nextTextValue(); - deserializationContext.setAttribute("version", version); - break; - - case "identifiableType": - JsonUtil.assertLessThanOrEqualToReferenceVersion(CONTEXT_NAME, "identifiableType", version, "1.0"); + JsonUtil.setSourceVersion(deserializationContext, version, IDENTIFIER_LIST_VERSION); + } + case "identifiableType" -> { + JsonUtil.assertLessThanOrEqualToReferenceVersion(CONTEXT_NAME, "identifiableType", + version, "1.0"); parser.nextToken(); - break; - - case "name": - name = parser.nextTextValue(); - break; - - case "type": - parser.nextToken(); - break; - - case "identifiers": + } + case "name" -> name = parser.nextTextValue(); + case "type" -> { + if (!parser.nextTextValue().equals(IdentifierContingencyList.TYPE)) { + throw new IllegalStateException("type should be: " + IdentifierContingencyList.TYPE); + } + } + case "identifiers" -> { parser.nextToken(); networkElementIdentifiers = JsonUtil.readList(deserializationContext, parser, NetworkElementIdentifier.class); - break; - - default: - throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); + } + default -> throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); } } return new IdentifierContingencyList(name, networkElementIdentifiers); diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierContingencyListSerializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierContingencyListSerializer.java index fd42c85d740..90c1da4c995 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierContingencyListSerializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierContingencyListSerializer.java @@ -25,8 +25,8 @@ public IdentifierContingencyListSerializer() { @Override public void serialize(IdentifierContingencyList identifierContingencyList, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeStartObject(); - jsonGenerator.writeStringField("version", IdentifierContingencyList.getVersion()); jsonGenerator.writeStringField("type", identifierContingencyList.getType()); + jsonGenerator.writeStringField("version", IdentifierContingencyList.getVersion()); jsonGenerator.writeStringField("name", identifierContingencyList.getName()); serializerProvider.defaultSerializeField("identifiers", identifierContingencyList.getIdentifiants(), diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierDeserializer.java index 888e03a747c..7f0cf48085b 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/IdentifierDeserializer.java @@ -19,6 +19,8 @@ import java.util.Collections; import java.util.List; +import static com.powsybl.contingency.json.IdentifierContingencyListDeserializer.IDENTIFIER_LIST_VERSION; + /** * @author Etienne Lesot {@literal } */ @@ -37,56 +39,42 @@ public NetworkElementIdentifier deserialize(JsonParser parser, DeserializationCo String voltageLevelId1 = null; String voltageLevelId2 = null; String contingencyId = null; - String version = (String) deserializationContext.getAttribute("version"); + String version = JsonUtil.getSourceVersion(deserializationContext, IDENTIFIER_LIST_VERSION); List networkElementIdentifierList = Collections.emptyList(); char order = 0; while (parser.nextToken() != JsonToken.END_OBJECT) { switch (parser.getCurrentName()) { - case "type": - type = NetworkElementIdentifier.IdentifierType.valueOf(parser.nextTextValue()); - break; - case "identifier": - identifier = parser.nextTextValue(); - break; - case CONTINGENCY_ID: + case "type" -> type = NetworkElementIdentifier.IdentifierType.valueOf(parser.nextTextValue()); + case "identifier" -> identifier = parser.nextTextValue(); + case CONTINGENCY_ID -> { JsonUtil.assertGreaterOrEqualThanReferenceVersion(CONTEXT_NAME, CONTINGENCY_ID, version, "1.2"); contingencyId = parser.nextTextValue(); - break; - case "identifierList": + } + case "identifierList" -> { parser.nextToken(); networkElementIdentifierList = JsonUtil.readList(deserializationContext, parser, NetworkElementIdentifier.class); - break; - case "voltageLevelId1": - voltageLevelId1 = parser.nextTextValue(); - break; - case "voltageLevelId2": - voltageLevelId2 = parser.nextTextValue(); - break; - case "order": + } + case "voltageLevelId1" -> voltageLevelId1 = parser.nextTextValue(); + case "voltageLevelId2" -> voltageLevelId2 = parser.nextTextValue(); + case "order" -> { String orderStr = parser.nextTextValue(); if (orderStr.length() != 1) { throw new IllegalArgumentException("order is one character"); } order = orderStr.charAt(0); - break; - - default: - throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); + } + default -> throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); } } if (type == null) { throw new IllegalArgumentException("type of identifier can not be null"); } - switch (type) { - case ID_BASED: - return new IdBasedNetworkElementIdentifier(identifier, contingencyId); - case LIST: - return new NetworkElementIdentifierList(networkElementIdentifierList, contingencyId); - case VOLTAGE_LEVELS_AND_ORDER: - return new VoltageLevelAndOrderNetworkElementIdentifier(voltageLevelId1, voltageLevelId2, order, contingencyId); - default: - throw new IllegalArgumentException("type " + type + " does not exist"); - } + return switch (type) { + case ID_BASED -> new IdBasedNetworkElementIdentifier(identifier, contingencyId); + case LIST -> new NetworkElementIdentifierList(networkElementIdentifierList, contingencyId); + case VOLTAGE_LEVELS_AND_ORDER -> + new VoltageLevelAndOrderNetworkElementIdentifier(voltageLevelId1, voltageLevelId2, order, contingencyId); + }; } } diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/InjectionCriterionContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/InjectionCriterionContingencyListDeserializer.java index a8ff9ccf521..1c4df992e57 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/InjectionCriterionContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/InjectionCriterionContingencyListDeserializer.java @@ -31,7 +31,8 @@ public InjectionCriterionContingencyList deserialize(JsonParser parser, Deserial AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext parsingContext = new AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext(); parser.nextToken(); JsonUtil.parsePolymorphicObject(parser, name -> { - boolean found = deserializeCommonAttributes(parser, deserializationContext, parsingContext, name); + boolean found = deserializeCommonAttributes(parser, deserializationContext, parsingContext, + name, InjectionCriterionContingencyList.TYPE); if (found) { return true; } diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/LineCriterionContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/LineCriterionContingencyListDeserializer.java index 4cc480cae75..92abed417ff 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/LineCriterionContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/LineCriterionContingencyListDeserializer.java @@ -27,7 +27,8 @@ public LineCriterionContingencyListDeserializer() { public LineCriterionContingencyList deserialize(JsonParser parser, DeserializationContext deserializationContext) throws IOException { AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext parsingContext = new AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext(); parser.nextToken(); - JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, parsingContext, name)); + JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, + parsingContext, name, LineCriterionContingencyList.TYPE)); return new LineCriterionContingencyList(parsingContext.name, (TwoCountriesCriterion) parsingContext.countryCriterion, diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ListOfContingencyListsDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ListOfContingencyListsDeserializer.java index 08db6364dbd..6b506195a64 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ListOfContingencyListsDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ListOfContingencyListsDeserializer.java @@ -31,28 +31,20 @@ public ListOfContingencyListsDeserializer() { public ListOfContingencyLists deserialize(JsonParser parser, DeserializationContext deserializationContext) throws IOException { String name = null; List contingencyLists = Collections.emptyList(); - while (parser.nextToken() != JsonToken.END_OBJECT) { switch (parser.getCurrentName()) { - case "version": - parser.nextToken(); - break; - - case "name": - name = parser.nextTextValue(); - break; - - case "type": - parser.nextToken(); - break; - - case "contingencyLists": + case "version" -> deserializationContext.setAttribute("version", parser.nextTextValue()); + case "name" -> name = parser.nextTextValue(); + case "type" -> { + if (!parser.nextTextValue().equals(ListOfContingencyLists.TYPE)) { + throw new IllegalStateException("type should be: " + ListOfContingencyLists.TYPE); + } + } + case "contingencyLists" -> { parser.nextToken(); contingencyLists = JsonUtil.readList(deserializationContext, parser, ContingencyList.class); - break; - - default: - throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); + } + default -> throw new IllegalStateException("Unexpected field: " + parser.getCurrentName()); } } return new ListOfContingencyLists(name, contingencyLists); diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ThreeWindingsTransformerCriterionContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ThreeWindingsTransformerCriterionContingencyListDeserializer.java index dcc6362e420..74feaf025b1 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ThreeWindingsTransformerCriterionContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/ThreeWindingsTransformerCriterionContingencyListDeserializer.java @@ -27,7 +27,8 @@ public ThreeWindingsTransformerCriterionContingencyListDeserializer() { public ThreeWindingsTransformerCriterionContingencyList deserialize(JsonParser parser, DeserializationContext deserializationContext) throws IOException { AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext parsingContext = new AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext(); parser.nextToken(); - JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, parsingContext, name)); + JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, + parsingContext, name, ThreeWindingsTransformerCriterionContingencyList.TYPE)); return new ThreeWindingsTransformerCriterionContingencyList(parsingContext.name, (SingleCountryCriterion) parsingContext.countryCriterion, diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/TieLineCriterionContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/TieLineCriterionContingencyListDeserializer.java index 2d9741f731c..9f98db91bef 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/TieLineCriterionContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/TieLineCriterionContingencyListDeserializer.java @@ -29,7 +29,8 @@ public TieLineCriterionContingencyListDeserializer() { public TieLineCriterionContingencyList deserialize(JsonParser parser, DeserializationContext deserializationContext) throws IOException { ParsingContext parsingContext = new ParsingContext(); parser.nextToken(); - JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, parsingContext, name)); + JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, + parsingContext, name, TieLineCriterionContingencyList.TYPE)); return new TieLineCriterionContingencyList(parsingContext.name, (TwoCountriesCriterion) parsingContext.countryCriterion, diff --git a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/TwoWindingsTransformerCriterionContingencyListDeserializer.java b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/TwoWindingsTransformerCriterionContingencyListDeserializer.java index 6601ef6ab61..6da03dc5479 100644 --- a/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/TwoWindingsTransformerCriterionContingencyListDeserializer.java +++ b/contingency/contingency-api/src/main/java/com/powsybl/contingency/json/TwoWindingsTransformerCriterionContingencyListDeserializer.java @@ -27,8 +27,8 @@ public TwoWindingsTransformerCriterionContingencyListDeserializer() { public TwoWindingsTransformerCriterionContingencyList deserialize(JsonParser parser, DeserializationContext deserializationContext) throws IOException { AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext parsingContext = new AbstractEquipmentCriterionContingencyListDeserializer.ParsingContext(); parser.nextToken(); - JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, parsingContext, name)); - + JsonUtil.parsePolymorphicObject(parser, name -> deserializeCommonAttributes(parser, deserializationContext, + parsingContext, name, TwoWindingsTransformerCriterionContingencyList.TYPE)); return new TwoWindingsTransformerCriterionContingencyList(parsingContext.name, (SingleCountryCriterion) parsingContext.countryCriterion, (TwoNominalVoltageCriterion) parsingContext.nominalVoltageCriterion, diff --git a/contingency/contingency-api/src/test/java/com/powsybl/contingency/json/ListOfContingencyListsJsonTest.java b/contingency/contingency-api/src/test/java/com/powsybl/contingency/json/ListOfContingencyListsJsonTest.java index 0c5aac0f9ae..416e84a537a 100644 --- a/contingency/contingency-api/src/test/java/com/powsybl/contingency/json/ListOfContingencyListsJsonTest.java +++ b/contingency/contingency-api/src/test/java/com/powsybl/contingency/json/ListOfContingencyListsJsonTest.java @@ -13,6 +13,10 @@ import com.powsybl.contingency.*; import com.powsybl.contingency.contingency.list.*; import com.powsybl.contingency.contingency.list.criterion.*; +import com.powsybl.contingency.contingency.list.identifier.IdBasedNetworkElementIdentifier; +import com.powsybl.contingency.contingency.list.identifier.NetworkElementIdentifier; +import com.powsybl.contingency.contingency.list.identifier.NetworkElementIdentifierList; +import com.powsybl.contingency.contingency.list.identifier.VoltageLevelAndOrderNetworkElementIdentifier; import com.powsybl.iidm.network.Country; import com.powsybl.iidm.network.IdentifiableType; import org.junit.jupiter.api.Test; @@ -66,6 +70,13 @@ private static ListOfContingencyLists create() { contingencyLists.add(new ListOfContingencyLists("listslist2", Collections.singletonList(new DefaultContingencyList(new Contingency("contingency2", new HvdcLineContingency("HVDC1")))))); + List networkElementIdentifiers = new ArrayList<>(); + networkElementIdentifiers.add(new VoltageLevelAndOrderNetworkElementIdentifier("VL1", + "VL2", '1', "contingency1")); + networkElementIdentifiers.add(new IdBasedNetworkElementIdentifier("identifier", "contingency2")); + networkElementIdentifiers.add(new NetworkElementIdentifierList(Collections + .singletonList(new IdBasedNetworkElementIdentifier("identifier2")), "contingency3")); + contingencyLists.add(new IdentifierContingencyList("identifierlist", networkElementIdentifiers)); return new ListOfContingencyLists("listslist1", contingencyLists); } diff --git a/contingency/contingency-api/src/test/java/com/powsybl/contingency/json/NetworkElementIdentifierContingencyListJsonTest.java b/contingency/contingency-api/src/test/java/com/powsybl/contingency/json/NetworkElementIdentifierContingencyListJsonTest.java index cb391e90c65..ee0dca5c3d6 100644 --- a/contingency/contingency-api/src/test/java/com/powsybl/contingency/json/NetworkElementIdentifierContingencyListJsonTest.java +++ b/contingency/contingency-api/src/test/java/com/powsybl/contingency/json/NetworkElementIdentifierContingencyListJsonTest.java @@ -39,9 +39,10 @@ private static IdentifierContingencyList create() { List networkElementIdentifiers = new ArrayList<>(); networkElementIdentifiers.add(new IdBasedNetworkElementIdentifier("identifier", "contingencyId1")); networkElementIdentifiers.add(new IdBasedNetworkElementIdentifier("identifier2")); - networkElementIdentifiers.add(new VoltageLevelAndOrderNetworkElementIdentifier("vl1", "vl2", '1', "contingencyId2")); - networkElementIdentifiers.add(new NetworkElementIdentifierList(Collections.singletonList(new IdBasedNetworkElementIdentifier("identifier")), - "contingencyId3")); + networkElementIdentifiers.add(new VoltageLevelAndOrderNetworkElementIdentifier("vl1", + "vl2", '1', "contingencyId2")); + networkElementIdentifiers.add(new NetworkElementIdentifierList(Collections.singletonList(new + IdBasedNetworkElementIdentifier("identifier")), "contingencyId3")); return new IdentifierContingencyList("list1", networkElementIdentifiers); } diff --git a/contingency/contingency-api/src/test/resources/contingencyListsList.json b/contingency/contingency-api/src/test/resources/contingencyListsList.json index f1a88ab90b0..d1cc8274a37 100644 --- a/contingency/contingency-api/src/test/resources/contingencyListsList.json +++ b/contingency/contingency-api/src/test/resources/contingencyListsList.json @@ -139,5 +139,27 @@ } ] } ] } ] + }, { + "type" : "identifier", + "version" : "1.2", + "name" : "identifierlist", + "identifiers" : [ { + "type" : "VOLTAGE_LEVELS_AND_ORDER", + "contingencyId" : "contingency1", + "voltageLevelId1" : "VL1", + "voltageLevelId2" : "VL2", + "order" : "1" + }, { + "type" : "ID_BASED", + "contingencyId" : "contingency2", + "identifier" : "identifier" + }, { + "type" : "LIST", + "contingencyId" : "contingency3", + "identifierList" : [ { + "type" : "ID_BASED", + "identifier" : "identifier2" + } ] + } ] } ] } \ No newline at end of file diff --git a/contingency/contingency-api/src/test/resources/identifierContingencyList.json b/contingency/contingency-api/src/test/resources/identifierContingencyList.json index cfc97356344..4c24f732e5e 100644 --- a/contingency/contingency-api/src/test/resources/identifierContingencyList.json +++ b/contingency/contingency-api/src/test/resources/identifierContingencyList.json @@ -1,6 +1,6 @@ { - "version" : "1.2", "type" : "identifier", + "version" : "1.2", "name" : "list1", "identifiers" : [ { "type" : "ID_BASED", diff --git a/contingency/contingency-api/src/test/resources/identifierContingencyListReferenceForLessThan1_2.json b/contingency/contingency-api/src/test/resources/identifierContingencyListReferenceForLessThan1_2.json index 303f047eba5..c4ed366112b 100644 --- a/contingency/contingency-api/src/test/resources/identifierContingencyListReferenceForLessThan1_2.json +++ b/contingency/contingency-api/src/test/resources/identifierContingencyListReferenceForLessThan1_2.json @@ -1,6 +1,6 @@ { - "version" : "1.2", "type" : "identifier", + "version" : "1.2", "name" : "list1", "identifiers" : [ { "type" : "ID_BASED", diff --git a/contingency/contingency-api/src/test/resources/identifierContingencyListTest.json b/contingency/contingency-api/src/test/resources/identifierContingencyListTest.json index 30f93559140..1b71ecc5e81 100644 --- a/contingency/contingency-api/src/test/resources/identifierContingencyListTest.json +++ b/contingency/contingency-api/src/test/resources/identifierContingencyListTest.json @@ -1,6 +1,6 @@ { - "version" : "1.1", "type" : "identifier", + "version" : "1.1", "name" : "list1", "identifiers" : [ { "type" : "ID_BASED", diff --git a/contingency/contingency-api/src/test/resources/identifierContingencyListv1_0.json b/contingency/contingency-api/src/test/resources/identifierContingencyListv1_0.json index 715025c16bd..5bd64735566 100644 --- a/contingency/contingency-api/src/test/resources/identifierContingencyListv1_0.json +++ b/contingency/contingency-api/src/test/resources/identifierContingencyListv1_0.json @@ -1,6 +1,6 @@ { - "version" : "1.0", "type" : "identifier", + "version" : "1.0", "name" : "list1", "identifiableType" : "type", "identifiers" : [ { diff --git a/contingency/contingency-api/src/test/resources/identifierContingencyListv1_1.json b/contingency/contingency-api/src/test/resources/identifierContingencyListv1_1.json index 0d1e9ec2929..9af767c24fc 100644 --- a/contingency/contingency-api/src/test/resources/identifierContingencyListv1_1.json +++ b/contingency/contingency-api/src/test/resources/identifierContingencyListv1_1.json @@ -1,6 +1,6 @@ { - "version" : "1.1", "type" : "identifier", + "version" : "1.1", "name" : "list1", "identifiers" : [ { "type" : "ID_BASED",