Skip to content

Commit 42ecf0a

Browse files
authored
Merge pull request steve-community#1474 from steve-community/1473-connector-zero-causes-exception
insert connector conditionally for SetChargingProfile tasks (steve-community#1473)
2 parents 347744d + 52794d1 commit 42ecf0a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ public class ChargingProfileRepositoryImpl implements ChargingProfileRepository
6868

6969
@Override
7070
public void setProfile(int chargingProfilePk, String chargeBoxId, int connectorId) {
71+
OcppServerRepositoryImpl.insertIgnoreConnector(ctx, chargeBoxId, connectorId);
72+
7173
SelectConditionStep<Record1<Integer>> connectorPkSelect = ctx.select(CONNECTOR.CONNECTOR_PK)
7274
.from(CONNECTOR)
7375
.where(CONNECTOR.CHARGE_BOX_ID.eq(chargeBoxId))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private void insertConnectorStatus(DSLContext ctx,
379379
/**
380380
* If the connector information was not received before, insert it. Otherwise, ignore.
381381
*/
382-
private void insertIgnoreConnector(DSLContext ctx, String chargeBoxIdentity, int connectorId) {
382+
public static void insertIgnoreConnector(DSLContext ctx, String chargeBoxIdentity, int connectorId) {
383383
int count = ctx.insertInto(CONNECTOR,
384384
CONNECTOR.CHARGE_BOX_ID, CONNECTOR.CONNECTOR_ID)
385385
.values(chargeBoxIdentity, connectorId)

0 commit comments

Comments
 (0)