Skip to content

Commit

Permalink
Renaming to assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
thangqp committed Sep 12, 2024
1 parent cb66651 commit 715f81a
Show file tree
Hide file tree
Showing 32 changed files with 543 additions and 497 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public enum ModificationType {
TABULAR_MODIFICATION(PreloadingStrategy.COLLECTION),
TABULAR_CREATION(PreloadingStrategy.COLLECTION),
BY_FORMULA_MODIFICATION(PreloadingStrategy.COLLECTION),
BY_SIMPLE_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,7 +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),
BY_SIMPLE_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 @@ -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
Expand Up @@ -18,9 +18,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.byfilter.simple.AbstractSimpleModificationByFilterInfos;
import org.gridsuite.modification.server.entities.equipment.modification.byfilter.BySimpleModificationEntity;
import org.gridsuite.modification.server.modifications.byfilter.BySimpleModification;
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;

Expand All @@ -31,29 +31,29 @@
@NoArgsConstructor
@Getter
@Setter
@JsonTypeName("BY_SIMPLE_MODIFICATION")
@ModificationErrorTypeName("BY_SIMPLE_MODIFICATION_ERROR")
@JsonTypeName("MODIFICATION_BY_ASSIGNMENT")
@ModificationErrorTypeName("MODIFICATION_BY_ASSIGNMENT_ERROR")
@ToString(callSuper = true)
@Schema(description = "Modification by simple assignment")
public class BySimpleModificationInfos extends ModificationInfos {
@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 AbstractSimpleModificationByFilterInfos<?>> simpleModificationInfosList;
private List<? extends AssignmentInfos<?>> assignmentInfosList;

@Override
public BySimpleModificationEntity toEntity() {
return new BySimpleModificationEntity(this);
public ModificationByAssignmentEntity toEntity() {
return new ModificationByAssignmentEntity(this);
}

@Override
public BySimpleModification toModification() {
return new BySimpleModification(this);
public ModificationByAssignment toModification() {
return new ModificationByAssignment(this);
}

@Override
public ReportNode createSubReportNode(ReportNode reportNode) {
return reportNode.newReportNode().withMessageTemplate(ModificationType.BY_SIMPLE_MODIFICATION.name(), "By filter modification").add();
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,7 +68,7 @@
@JsonSubTypes.Type(value = ConverterStationCreationInfos.class),
@JsonSubTypes.Type(value = TabularModificationInfos.class),
@JsonSubTypes.Type(value = ByFormulaModificationInfos.class),
@JsonSubTypes.Type(value = BySimpleModificationInfos.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
Expand Up @@ -25,7 +25,7 @@
@NoArgsConstructor
@Getter
@Setter
public abstract class AbstractModificationByFilterInfos {
public abstract class AbstractAssignmentInfos {
@Schema(description = "id")
private UUID id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.gridsuite.modification.server.dto.byfilter.simple;
package org.gridsuite.modification.server.dto.byfilter.assignment;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
Expand All @@ -16,9 +16,9 @@
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.gridsuite.modification.server.dto.byfilter.AbstractModificationByFilterInfos;
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.simple.SimpleModificationEntity;
import org.gridsuite.modification.server.entities.equipment.modification.byfilter.simple.AssignmentEntity;

/**
* @author Thang PHAM <quyet-thang.pham at rte-france.com>
Expand All @@ -28,25 +28,27 @@
property = "dataType",
include = JsonTypeInfo.As.EXISTING_PROPERTY)
@JsonSubTypes({
@JsonSubTypes.Type(value = BooleanModificationByFilterInfos.class, name = "BOOLEAN"),
@JsonSubTypes.Type(value = EnumModificationByFilterInfos.class, name = "ENUM"),
@JsonSubTypes.Type(value = DoubleModificationByFilterInfos.class, name = "DOUBLE"),
@JsonSubTypes.Type(value = IntegerModificationByFilterInfos.class, name = "INTEGER"),
@JsonSubTypes.Type(value = PropertyModificationByFilterInfos.class, name = "PROPERTY"),
@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 abstract class AbstractSimpleModificationByFilterInfos<T> extends AbstractModificationByFilterInfos {
public class AssignmentInfos<T> extends AbstractAssignmentInfos {
@Schema(description = "Value")
private T value;

public abstract DataType getDataType();
public DataType getDataType() {
throw new UnsupportedOperationException("This method should not be called");
}

@JsonIgnore
public SimpleModificationEntity toEntity() {
return new SimpleModificationEntity(this);
public AssignmentEntity toEntity() {
return new AssignmentEntity(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.gridsuite.modification.server.dto.byfilter.simple;
package org.gridsuite.modification.server.dto.byfilter.assignment;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.NoArgsConstructor;
Expand All @@ -17,7 +17,7 @@
*/
@SuperBuilder
@NoArgsConstructor
public class BooleanModificationByFilterInfos extends AbstractSimpleModificationByFilterInfos<Boolean> {
public class BooleanAssignmentInfos extends AssignmentInfos<Boolean> {
@Override
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
public DataType getDataType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.gridsuite.modification.server.dto.byfilter.simple;
package org.gridsuite.modification.server.dto.byfilter.assignment;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.NoArgsConstructor;
Expand All @@ -17,7 +17,7 @@
*/
@SuperBuilder
@NoArgsConstructor
public class DoubleModificationByFilterInfos extends AbstractSimpleModificationByFilterInfos<Double> {
public class DoubleAssignmentInfos extends AssignmentInfos<Double> {
@Override
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
public DataType getDataType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.gridsuite.modification.server.dto.byfilter.simple;
package org.gridsuite.modification.server.dto.byfilter.assignment;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.NoArgsConstructor;
Expand All @@ -17,7 +17,7 @@
*/
@SuperBuilder
@NoArgsConstructor
public class EnumModificationByFilterInfos extends AbstractSimpleModificationByFilterInfos<String> {
public class EnumAssignmentInfos extends AssignmentInfos<String> {
@Override
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
public DataType getDataType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.gridsuite.modification.server.dto.byfilter.simple;
package org.gridsuite.modification.server.dto.byfilter.assignment;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.NoArgsConstructor;
Expand All @@ -17,7 +17,7 @@
*/
@SuperBuilder
@NoArgsConstructor
public class IntegerModificationByFilterInfos extends AbstractSimpleModificationByFilterInfos<Integer> {
public class IntegerAssignmentInfos extends AssignmentInfos<Integer> {
@Override
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
public DataType getDataType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

package org.gridsuite.modification.server.dto.byfilter.simple;
package org.gridsuite.modification.server.dto.byfilter.assignment;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -14,14 +14,14 @@
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.gridsuite.modification.server.dto.byfilter.DataType;
import org.gridsuite.modification.server.entities.equipment.modification.byfilter.simple.SimpleModificationEntity;
import org.gridsuite.modification.server.entities.equipment.modification.byfilter.simple.AssignmentEntity;

/**
* @author Thang PHAM <quyet-thang.pham at rte-france.com>
*/
@SuperBuilder
@NoArgsConstructor
public class PropertyModificationByFilterInfos extends AbstractSimpleModificationByFilterInfos<String> {
public class PropertyAssignmentInfos extends AssignmentInfos<String> {
@Schema(description = "Property name")
@Getter
private String propertyName;
Expand All @@ -39,9 +39,9 @@ public String getEditedFieldLabel() {
}

@Override
public SimpleModificationEntity toEntity() {
SimpleModificationEntity simpleModificationEntity = super.toEntity();
simpleModificationEntity.setPropertyName(propertyName);
return simpleModificationEntity;
public AssignmentEntity toEntity() {
AssignmentEntity assignmentEntity = super.toEntity();
assignmentEntity.setPropertyName(propertyName);
return assignmentEntity;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.gridsuite.modification.server.dto.byfilter.AbstractModificationByFilterInfos;
import org.gridsuite.modification.server.dto.byfilter.AbstractAssignmentInfos;
import org.gridsuite.modification.server.entities.equipment.modification.byfilter.formula.FormulaEntity;

/**
Expand All @@ -23,7 +23,7 @@
@NoArgsConstructor
@Getter
@Setter
public class FormulaInfos extends AbstractModificationByFilterInfos {
public class FormulaInfos extends AbstractAssignmentInfos {

@Schema(description = "First reference field or value")
private ReferenceFieldOrValue fieldOrValue1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import jakarta.persistence.*;
import lombok.NoArgsConstructor;
import org.gridsuite.modification.server.dto.byfilter.AbstractModificationByFilterInfos;
import org.gridsuite.modification.server.dto.byfilter.AbstractAssignmentInfos;

import java.util.UUID;

Expand All @@ -18,7 +18,7 @@
*/
@NoArgsConstructor
@MappedSuperclass
public class ModificationByFilterEntity {
public abstract class AbstractAssignmentEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
Expand All @@ -27,12 +27,12 @@ public class ModificationByFilterEntity {
@Column
private String editedField;

protected ModificationByFilterEntity(AbstractModificationByFilterInfos modificationByFilterInfos) {
protected AbstractAssignmentEntity(AbstractAssignmentInfos abstractAssignmentInfos) {
this.id = null;
this.editedField = modificationByFilterInfos.getEditedField();
this.editedField = abstractAssignmentInfos.getEditedField();
}

protected void assignAttributes(AbstractModificationByFilterInfos modificationByFilterInfos) {
protected void assignAttributes(AbstractAssignmentInfos modificationByFilterInfos) {
modificationByFilterInfos.setId(id);
modificationByFilterInfos.setEditedField(editedField);
}
Expand Down
Loading

0 comments on commit 715f81a

Please sign in to comment.