Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification by filter (without formula data migration) #526

Merged
merged 56 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b949a9a
Modification by filter
thangqp Aug 1, 2024
dc12a0f
Add changelog file
thangqp Aug 1, 2024
f85cb80
change naming
thangqp Aug 1, 2024
4968e1a
Merge from main
thangqp Aug 21, 2024
2a84f1c
Renaming
thangqp Aug 21, 2024
e4902f1
Enhance reuse
thangqp Aug 21, 2024
b83e7a8
refactor entities by filter
thangqp Aug 22, 2024
405d8c8
Merge from main
thangqp Aug 26, 2024
54aaadf
Using JOIN strategy for tables
thangqp Aug 27, 2024
ce031c0
Compilation issue
thangqp Aug 27, 2024
1b75aef
Migration formula data
thangqp Aug 28, 2024
300e26c
Correct dataType null in dto
thangqp Aug 29, 2024
81d8fa0
Modification by filter (without formula data migration)
thangqp Sep 2, 2024
6fbb9e7
Merge branch 'main' into modification_by_filter_no_migration_data
thangqp Sep 2, 2024
68277b8
Merge branch 'main' into modification_by_filter_no_migration_data
thangqp Sep 2, 2024
2e6305a
Report rectification
thangqp Sep 2, 2024
6e2c497
Merge branch 'modification_by_filter_no_migration_data' of https://gi…
thangqp Sep 2, 2024
f1b02db
add support enum, boolean, string data types
thangqp Sep 3, 2024
c25ffa3
add default case
thangqp Sep 3, 2024
f761ba1
Remove STRING data type
thangqp Sep 4, 2024
72783fa
compilation error
thangqp Sep 4, 2024
22e8458
code clean
thangqp Sep 4, 2024
0cbafe5
untyping value
thangqp Sep 4, 2024
d2ed37c
NPE with property
thangqp Sep 5, 2024
097f1fe
Tests
thangqp Sep 5, 2024
aafd7a6
clean code
thangqp Sep 5, 2024
6dca611
Merge branch 'main' into modification_by_filter_no_migration_data
thangqp Sep 6, 2024
b867e95
merge from main
thangqp Sep 9, 2024
f1dce77
remove TODO
thangqp Sep 9, 2024
932e7b5
Voltage Level test
thangqp Sep 10, 2024
cd12300
Battery test
thangqp Sep 10, 2024
efaacad
Shunt compensator test
thangqp Sep 10, 2024
f1d4fbc
2WT test
thangqp Sep 10, 2024
7c53cf1
Test for property
thangqp Sep 10, 2024
2964647
Merge branch 'main' into modification_by_filter_no_migration_data
thangqp Sep 10, 2024
328a825
Merge branch 'main' into modification_by_filter_no_migration_data
thangqp Sep 11, 2024
cb66651
add @NotNull annotation
thangqp Sep 12, 2024
715f81a
Renaming to assignment
thangqp Sep 12, 2024
14ad0ff
Merge branch 'main' into modification_by_filter_no_migration_data
thangqp Sep 12, 2024
eba41e9
correct remarks
thangqp Sep 12, 2024
5968284
Unit test fail
thangqp Sep 12, 2024
8781f3b
Merge branch 'main' into modification_by_filter_no_migration_data
Mathieu-Deharbe Sep 17, 2024
0177a47
correct for comments of Mathieu
thangqp Sep 17, 2024
4c626cc
Merge from main
thangqp Sep 26, 2024
1823ef9
fix unused report
thangqp Sep 26, 2024
bab677c
fix test
thangqp Sep 27, 2024
42be9a0
fix failed test
thangqp Sep 30, 2024
0bf48c3
keep editable check
thangqp Sep 30, 2024
62bd6de
keep test valid
thangqp Sep 30, 2024
57a61f7
clean test
thangqp Sep 30, 2024
9372489
clean test
thangqp Sep 30, 2024
76e7807
Parse int
thangqp Oct 1, 2024
ef1ba44
revert to parseDouble
thangqp Oct 1, 2024
fa0a5fa
When exception show warning and not stop next application
thangqp Oct 1, 2024
6638553
Merge branch 'main' into modification_by_filter_no_migration_data
thangqp Oct 3, 2024
ec90b8f
Merge branch 'main' into modification_by_filter_no_migration_data
thangqp Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public enum ModificationType {
TABULAR_MODIFICATION(PreloadingStrategy.COLLECTION),
TABULAR_CREATION(PreloadingStrategy.COLLECTION),
BY_FORMULA_MODIFICATION(PreloadingStrategy.COLLECTION),
MODIFICATION_BY_ASSIGNMENT(PreloadingStrategy.COLLECTION),
COMPOSITE_MODIFICATION(PreloadingStrategy.COLLECTION);

private final PreloadingStrategy strategy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public enum Type {
CREATE_CONVERTER_STATION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
MODIFY_CONVERTER_STATION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
BY_FORMULA_MODIFICATION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
MODIFICATION_BY_ASSIGNMENT_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
HVDC_LINE_NOT_FOUND(HttpStatus.NOT_FOUND),
COMPOSITE_MODIFICATION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR),
WRONG_HVDC_ANGLE_DROOP_ACTIVE_POWER_CONTROL(HttpStatus.BAD_REQUEST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import lombok.experimental.SuperBuilder;
import org.gridsuite.modification.server.ModificationType;
import org.gridsuite.modification.server.dto.annotation.ModificationErrorTypeName;
import org.gridsuite.modification.server.dto.formula.FormulaInfos;
import org.gridsuite.modification.server.entities.equipment.modification.ByFormulaModificationEntity;
import org.gridsuite.modification.server.modifications.ByFormulaModification;
import org.gridsuite.modification.server.dto.byfilter.formula.FormulaInfos;
import org.gridsuite.modification.server.entities.equipment.modification.byfilter.ByFormulaModificationEntity;
import org.gridsuite.modification.server.modifications.byfilter.ByFormulaModification;

import java.util.List;

Expand Down Expand Up @@ -57,6 +57,6 @@ public ByFormulaModification toModification() {

@Override
public ReportNode createSubReportNode(ReportNode reportNode) {
return reportNode.newReportNode().withMessageTemplate(ModificationType.BY_FORMULA_MODIFICATION.name(), "By formula modification").add();
return reportNode.newReportNode().withMessageTemplate(ModificationType.BY_FORMULA_MODIFICATION.name(), "Modification by formula").add();
}
}
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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
@JsonSubTypes.Type(value = ConverterStationCreationInfos.class),
@JsonSubTypes.Type(value = TabularModificationInfos.class),
@JsonSubTypes.Type(value = ByFormulaModificationInfos.class),
@JsonSubTypes.Type(value = ModificationByAssignmentInfos.class),
@JsonSubTypes.Type(value = VscModificationInfos.class),
@JsonSubTypes.Type(value = ConverterStationModificationInfos.class),
@JsonSubTypes.Type(value = TabularCreationInfos.class),
Expand Down
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;
}
}
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
}
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);
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
Loading
Loading