Skip to content

Commit 02a3e21

Browse files
committed
Closes steve-community#21: disallow connector id 0 reservation
1 parent ad17187 commit 02a3e21

5 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/main/java/de/rwth/idsg/steve/repository/ChargePointRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface ChargePointRepository {
2424
ChargePoint.Details getDetails(int chargeBoxPk);
2525

2626
List<ConnectorStatus> getChargePointConnectorStatus();
27-
List<Integer> getConnectorIds(String chargeBoxId);
27+
List<Integer> getNonZeroConnectorIds(String chargeBoxId);
2828

2929
void addChargePoint(List<String> chargeBoxIdList);
3030
int addChargePoint(ChargePointForm form);

src/main/java/de/rwth/idsg/steve/repository/impl/ChargePointRepositoryImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,11 @@ public List<ConnectorStatus> getChargePointConnectorStatus() {
209209
}
210210

211211
@Override
212-
public List<Integer> getConnectorIds(String chargeBoxId) {
212+
public List<Integer> getNonZeroConnectorIds(String chargeBoxId) {
213213
return ctx.select(CONNECTOR.CONNECTOR_ID)
214214
.from(CONNECTOR)
215215
.where(CONNECTOR.CHARGE_BOX_ID.equal(chargeBoxId))
216+
.and(CONNECTOR.CONNECTOR_ID.notEqual(0))
216217
.fetch(CONNECTOR.CONNECTOR_ID);
217218
}
218219

src/main/java/de/rwth/idsg/steve/web/controller/AjaxCallController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private void init() {
5757

5858
@RequestMapping(value = CONNECTOR_IDS_PATH)
5959
public String getConnectorIds(@PathVariable("chargeBoxId") String chargeBoxId) {
60-
return serializeArray(chargePointRepository.getConnectorIds(chargeBoxId));
60+
return serializeArray(chargePointRepository.getNonZeroConnectorIds(chargeBoxId));
6161
}
6262

6363
@RequestMapping(value = TRANSACTION_IDS_PATH)

src/main/java/de/rwth/idsg/steve/web/dto/ocpp15/ReserveNowParams.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
public class ReserveNowParams extends SingleChargePointSelect {
2121

2222
@NotNull(message = "Connector ID is required")
23-
@Min(value = 0, message = "Connector ID must be at least {value}")
23+
@Min(value = 1, message = "Connector ID must be at least {value}")
2424
private Integer connectorId;
2525

2626
@NotNull(message = "Expiry Date/Time is required")

src/main/resources/webapp/WEB-INF/views/op15/ReserveNow.jsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<%@ include file="../00-op-bind-errors.jsp" %>
33
<script type="text/javascript">
44
$(document).ready(function() {
5-
<%@ include file="../snippets/getConnectorIdsZeroAllowed.js" %>
5+
<%@ include file="../snippets/getConnectorIds.js" %>
66
<%@ include file="../snippets/dateTimePicker-future.js" %>
77
});
88
</script>

0 commit comments

Comments
 (0)