-
Notifications
You must be signed in to change notification settings - Fork 0
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
rename branch status modif by operational status modif #377
Changes from 4 commits
946fa37
48212e6
4367789
abb7c9a
fdd38ee
47513b3
93a3def
8d0cbad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
import com.powsybl.commons.PowsyblException; | ||
import com.powsybl.iidm.network.IdentifiableType; | ||
import lombok.NonNull; | ||
import org.gridsuite.modification.server.dto.BranchStatusModificationInfos; | ||
import org.gridsuite.modification.server.dto.OperationalStatusModificationInfos; | ||
import org.springframework.http.HttpStatus; | ||
|
||
import java.util.Objects; | ||
|
@@ -74,10 +74,10 @@ public enum Type { | |
TWO_WINDINGS_TRANSFORMER_CREATION_ERROR(HttpStatus.BAD_REQUEST), | ||
CONNECTION_POSITION_ERROR(HttpStatus.BAD_REQUEST), | ||
MODIFY_BATTERY_ERROR(HttpStatus.INTERNAL_SERVER_ERROR), | ||
BRANCH_ACTION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR), | ||
BRANCH_ACTION_TYPE_EMPTY(HttpStatus.BAD_REQUEST, "Empty branch action type"), | ||
BRANCH_ACTION_TYPE_UNKNOWN(HttpStatus.BAD_REQUEST), | ||
BRANCH_ACTION_TYPE_UNSUPPORTED(HttpStatus.INTERNAL_SERVER_ERROR), | ||
OPERATIONAL_EQUIPMENT_ACTION_ERROR(HttpStatus.INTERNAL_SERVER_ERROR), | ||
OPERATIONAL_EQUIPMENT_ACTION_TYPE_EMPTY(HttpStatus.BAD_REQUEST, "Empty equipment action type"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty operational status action type ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OPERATIONAL_STATUS_ACTION_TYPE_EMPTY |
||
OPERATIONAL_EQUIPMENT_ACTION_TYPE_UNKNOWN(HttpStatus.BAD_REQUEST), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OPERATIONAL_STATUS_ACTION_TYPE_UNKNOWN |
||
OPERATIONAL_EQUIPMENT_ACTION_TYPE_UNSUPPORTED(HttpStatus.INTERNAL_SERVER_ERROR), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OPERATIONAL_STATUS_ACTION_TYPE_UNSUPPORTED |
||
LINE_SPLIT_ERROR(HttpStatus.INTERNAL_SERVER_ERROR), | ||
LINE_SPLIT_NOT_FOUND(HttpStatus.NOT_FOUND), | ||
LINE_ATTACH_ERROR(HttpStatus.INTERNAL_SERVER_ERROR), | ||
|
@@ -150,8 +150,8 @@ public static NetworkModificationException createEquipmentTypeUnknown(@NonNull S | |
return new NetworkModificationException(Type.UNKNOWN_EQUIPMENT_TYPE, "The equipment type : " + type + " is unknown"); | ||
} | ||
|
||
public static NetworkModificationException createBranchActionTypeUnsupported(@NonNull BranchStatusModificationInfos.ActionType type) { | ||
return new NetworkModificationException(Type.BRANCH_ACTION_TYPE_UNSUPPORTED, "The branch action type : " + type + " is unsupported"); | ||
public static NetworkModificationException createBranchActionTypeUnsupported(@NonNull OperationalStatusModificationInfos.ActionType type) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. createOperationalStatusActionTypeUnsupported |
||
return new NetworkModificationException(Type.OPERATIONAL_EQUIPMENT_ACTION_TYPE_UNSUPPORTED, "The branch action type : " + type + " is unsupported"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The operational status action type : " + type + " is unsupported |
||
} | ||
|
||
public static NetworkModificationException createEquipementAttributeNotEditable(@NonNull IdentifiableType equipmentType, @NonNull String attributeName) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,13 @@ | |
import lombok.experimental.SuperBuilder; | ||
import org.gridsuite.modification.server.NetworkModificationException; | ||
import org.gridsuite.modification.server.dto.annotation.ModificationErrorTypeName; | ||
import org.gridsuite.modification.server.entities.equipment.modification.BranchStatusModificationEntity; | ||
import org.gridsuite.modification.server.entities.equipment.modification.OperationalStatusModificationEntity; | ||
import org.gridsuite.modification.server.modifications.AbstractModification; | ||
import org.gridsuite.modification.server.modifications.BranchStatusModification; | ||
import org.gridsuite.modification.server.modifications.OperationalStatusModification; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.gridsuite.modification.server.NetworkModificationException.Type.BRANCH_ACTION_TYPE_EMPTY; | ||
import static org.gridsuite.modification.server.NetworkModificationException.Type.OPERATIONAL_EQUIPMENT_ACTION_TYPE_EMPTY; | ||
|
||
/** | ||
* @author Slimane Amar <slimane.amar at rte-france.com> | ||
|
@@ -33,10 +33,10 @@ | |
@Getter | ||
@Setter | ||
@ToString(callSuper = true) | ||
@Schema(description = "Branch status modification") | ||
@JsonTypeName("BRANCH_STATUS_MODIFICATION") | ||
@ModificationErrorTypeName("BRANCH_ACTION_ERROR") | ||
public class BranchStatusModificationInfos extends EquipmentModificationInfos { | ||
@Schema(description = "Operational status modification") | ||
@JsonTypeName("OPERATIONAL_STATUS_MODIFICATION") | ||
@ModificationErrorTypeName("OPERATIONAL_EQUIPMENT_ACTION_ERROR") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OPERATIONAL_STATUS_ACTION_ERROR |
||
public class OperationalStatusModificationInfos extends EquipmentModificationInfos { | ||
@Schema(description = "Action type") | ||
private ActionType action; | ||
|
||
|
@@ -52,43 +52,43 @@ public enum ActionType { | |
} | ||
|
||
@Override | ||
public BranchStatusModificationEntity toEntity() { | ||
return new BranchStatusModificationEntity(this); | ||
public OperationalStatusModificationEntity toEntity() { | ||
return new OperationalStatusModificationEntity(this); | ||
} | ||
|
||
@Override | ||
public AbstractModification toModification() { | ||
return new BranchStatusModification(this); | ||
return new OperationalStatusModification(this); | ||
} | ||
|
||
@Override | ||
public Reporter createSubReporter(ReporterModel reporter) { | ||
String defaultName; | ||
switch (action) { | ||
case LOCKOUT: | ||
defaultName = "Lockout ${branchId}"; | ||
defaultName = "Lockout ${equipmentId}"; | ||
break; | ||
case TRIP: | ||
defaultName = "Trip ${branchId}"; | ||
defaultName = "Trip ${equipmentId}"; | ||
break; | ||
case ENERGISE_END_ONE: | ||
case ENERGISE_END_TWO: | ||
defaultName = "Energise ${branchId}"; | ||
defaultName = "Energise ${equipmentId}"; | ||
break; | ||
case SWITCH_ON: | ||
defaultName = "Switch on ${branchId}"; | ||
defaultName = "Switch on ${equipmentId}"; | ||
break; | ||
default: | ||
defaultName = ""; | ||
} | ||
return reporter.createSubReporter(getType().name() + "_" + action, defaultName, "branchId", this.getEquipmentId()); | ||
return reporter.createSubReporter(getType().name() + "_" + action, defaultName, "equipmentId", this.getEquipmentId()); | ||
} | ||
|
||
@Override | ||
public void check() { | ||
super.check(); | ||
if (action == null) { | ||
throw new NetworkModificationException(BRANCH_ACTION_TYPE_EMPTY); | ||
throw new NetworkModificationException(OPERATIONAL_EQUIPMENT_ACTION_TYPE_EMPTY); | ||
} | ||
} | ||
|
||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPERATIONAL_STATUS_ACTION_ERROR