-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modification by filter (without formula data migration) (#526)
Signed-off-by: Thang PHAM <[email protected]
- Loading branch information
Showing
50 changed files
with
3,580 additions
and
657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/org/gridsuite/modification/server/dto/ModificationByAssignmentInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Copyright (c) 2024, 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 org.gridsuite.modification.server.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonTypeName; | ||
import com.powsybl.commons.report.ReportNode; | ||
import com.powsybl.iidm.network.IdentifiableType; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.ModificationType; | ||
import org.gridsuite.modification.server.dto.annotation.ModificationErrorTypeName; | ||
import org.gridsuite.modification.server.dto.byfilter.assignment.AssignmentInfos; | ||
import org.gridsuite.modification.server.entities.equipment.modification.byfilter.ModificationByAssignmentEntity; | ||
import org.gridsuite.modification.server.modifications.byfilter.ModificationByAssignment; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
@JsonTypeName("MODIFICATION_BY_ASSIGNMENT") | ||
@ModificationErrorTypeName("MODIFICATION_BY_ASSIGNMENT_ERROR") | ||
@ToString(callSuper = true) | ||
@Schema(description = "Modification by assignment") | ||
public class ModificationByAssignmentInfos extends ModificationInfos { | ||
@Schema(description = "Equipment type") | ||
private IdentifiableType equipmentType; | ||
|
||
@Schema(description = "list of modifications") | ||
private List<? extends AssignmentInfos<?>> assignmentInfosList; | ||
|
||
@Override | ||
public ModificationByAssignmentEntity toEntity() { | ||
return new ModificationByAssignmentEntity(this); | ||
} | ||
|
||
@Override | ||
public ModificationByAssignment toModification() { | ||
return new ModificationByAssignment(this); | ||
} | ||
|
||
@Override | ||
public ReportNode createSubReportNode(ReportNode reportNode) { | ||
return reportNode.newReportNode().withMessageTemplate(ModificationType.MODIFICATION_BY_ASSIGNMENT.name(), "Modification by filter").add(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/org/gridsuite/modification/server/dto/byfilter/AbstractAssignmentInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Copyright (c) 2024, 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 org.gridsuite.modification.server.dto.byfilter; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.dto.FilterInfos; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
public abstract class AbstractAssignmentInfos { | ||
@Schema(description = "id") | ||
private UUID id; | ||
|
||
@Schema(description = "List of filters") | ||
private List<FilterInfos> filters; | ||
|
||
@Schema(description = "Edited field") | ||
private String editedField; | ||
|
||
@JsonIgnore | ||
public String getEditedFieldLabel() { | ||
return editedField; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/org/gridsuite/modification/server/dto/byfilter/DataType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright (c) 2024, 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 org.gridsuite.modification.server.dto.byfilter; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
public enum DataType { | ||
ENUM, | ||
BOOLEAN, | ||
INTEGER, | ||
DOUBLE, | ||
PROPERTY | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/org/gridsuite/modification/server/dto/byfilter/assignment/AssignmentInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* Copyright (c) 2024, 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 org.gridsuite.modification.server.dto.byfilter.assignment; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonSubTypes; | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.dto.byfilter.AbstractAssignmentInfos; | ||
import org.gridsuite.modification.server.dto.byfilter.DataType; | ||
import org.gridsuite.modification.server.entities.equipment.modification.byfilter.assignment.AssignmentEntity; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
property = "dataType", | ||
include = JsonTypeInfo.As.EXISTING_PROPERTY) | ||
@JsonSubTypes({ | ||
@JsonSubTypes.Type(value = BooleanAssignmentInfos.class, name = "BOOLEAN"), | ||
@JsonSubTypes.Type(value = EnumAssignmentInfos.class, name = "ENUM"), | ||
@JsonSubTypes.Type(value = DoubleAssignmentInfos.class, name = "DOUBLE"), | ||
@JsonSubTypes.Type(value = IntegerAssignmentInfos.class, name = "INTEGER"), | ||
@JsonSubTypes.Type(value = PropertyAssignmentInfos.class, name = "PROPERTY"), | ||
}) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@Getter | ||
@Setter | ||
public class AssignmentInfos<T> extends AbstractAssignmentInfos { | ||
@Schema(description = "Value") | ||
private T value; | ||
|
||
public DataType getDataType() { | ||
throw new UnsupportedOperationException("This method should not be called"); | ||
} | ||
|
||
@JsonIgnore | ||
public AssignmentEntity toEntity() { | ||
return new AssignmentEntity(this); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ava/org/gridsuite/modification/server/dto/byfilter/assignment/BooleanAssignmentInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright (c) 2024, 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 org.gridsuite.modification.server.dto.byfilter.assignment; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.dto.byfilter.DataType; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
public class BooleanAssignmentInfos extends AssignmentInfos<Boolean> { | ||
@Override | ||
@JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||
public DataType getDataType() { | ||
return DataType.BOOLEAN; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...java/org/gridsuite/modification/server/dto/byfilter/assignment/DoubleAssignmentInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright (c) 2024, 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 org.gridsuite.modification.server.dto.byfilter.assignment; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.dto.byfilter.DataType; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
public class DoubleAssignmentInfos extends AssignmentInfos<Double> { | ||
@Override | ||
@JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||
public DataType getDataType() { | ||
return DataType.DOUBLE; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...n/java/org/gridsuite/modification/server/dto/byfilter/assignment/EnumAssignmentInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright (c) 2024, 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 org.gridsuite.modification.server.dto.byfilter.assignment; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.dto.byfilter.DataType; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
public class EnumAssignmentInfos extends AssignmentInfos<String> { | ||
@Override | ||
@JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||
public DataType getDataType() { | ||
return DataType.ENUM; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ava/org/gridsuite/modification/server/dto/byfilter/assignment/IntegerAssignmentInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright (c) 2024, 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 org.gridsuite.modification.server.dto.byfilter.assignment; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.dto.byfilter.DataType; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
public class IntegerAssignmentInfos extends AssignmentInfos<Integer> { | ||
@Override | ||
@JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||
public DataType getDataType() { | ||
return DataType.INTEGER; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...va/org/gridsuite/modification/server/dto/byfilter/assignment/PropertyAssignmentInfos.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright (c) 2024, 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 org.gridsuite.modification.server.dto.byfilter.assignment; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.dto.byfilter.DataType; | ||
import org.gridsuite.modification.server.entities.equipment.modification.byfilter.assignment.AssignmentEntity; | ||
|
||
/** | ||
* @author Thang PHAM <quyet-thang.pham at rte-france.com> | ||
*/ | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
public class PropertyAssignmentInfos extends AssignmentInfos<String> { | ||
@Schema(description = "Property name") | ||
@Getter | ||
private String propertyName; | ||
|
||
@Override | ||
@JsonProperty(access = JsonProperty.Access.READ_ONLY) | ||
public DataType getDataType() { | ||
return DataType.PROPERTY; | ||
} | ||
|
||
@JsonIgnore | ||
@Override | ||
public String getEditedFieldLabel() { | ||
return propertyName + " " + super.getEditedFieldLabel(); | ||
} | ||
|
||
@Override | ||
public AssignmentEntity toEntity() { | ||
AssignmentEntity assignmentEntity = super.toEntity(); | ||
assignmentEntity.setPropertyName(propertyName); | ||
return assignmentEntity; | ||
} | ||
} |
Oops, something went wrong.