Skip to content

Commit 85f2000

Browse files
committed
refactor
1 parent 0adf340 commit 85f2000

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/main/java/de/rwth/idsg/steve/ocpp/converter/Server12to15Impl.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ public StatusNotificationRequest convertRequest(ocpp.cs._2010._08.StatusNotifica
7373

7474
@Override
7575
public MeterValuesRequest convertRequest(ocpp.cs._2010._08.MeterValuesRequest request) {
76-
List<MeterValue> values15 = request.getValues()
77-
.stream()
78-
.map(e -> new MeterValue().withTimestamp(e.getTimestamp())
79-
.withValue(new MeterValue.Value().withValue(Integer.toString(e.getValue()))))
80-
.collect(Collectors.toList());
76+
List<MeterValue> values15 =
77+
request.getValues()
78+
.stream()
79+
.map(e -> new MeterValue().withTimestamp(e.getTimestamp())
80+
.withValue(new MeterValue.Value().withValue(Integer.toString(e.getValue()))))
81+
.collect(Collectors.toList());
8182

8283
return new MeterValuesRequest()
8384
.withConnectorId(request.getConnectorId())
@@ -100,7 +101,6 @@ public StartTransactionRequest convertRequest(ocpp.cs._2010._08.StartTransaction
100101
.withTimestamp(request.getTimestamp());
101102
}
102103

103-
104104
@Override
105105
public StopTransactionRequest convertRequest(ocpp.cs._2010._08.StopTransactionRequest request) {
106106
return new StopTransactionRequest()
@@ -156,14 +156,14 @@ public DiagnosticsStatusNotificationResponse convertResponse(ocpp.cs._2012._06.D
156156
@Override
157157
public StartTransactionResponse convertResponse(ocpp.cs._2012._06.StartTransactionResponse response) {
158158
return new StartTransactionResponse()
159-
.withIdTagInfo(convertIdTagInfo15to12(response.getIdTagInfo()))
159+
.withIdTagInfo(toOcpp12TagInfo(response.getIdTagInfo()))
160160
.withTransactionId(response.getTransactionId());
161161
}
162162

163163
@Override
164164
public StopTransactionResponse convertResponse(ocpp.cs._2012._06.StopTransactionResponse response) {
165165
return new StopTransactionResponse()
166-
.withIdTagInfo(convertIdTagInfo15to12(response.getIdTagInfo()));
166+
.withIdTagInfo(toOcpp12TagInfo(response.getIdTagInfo()));
167167
}
168168

169169
@Override
@@ -175,14 +175,14 @@ public HeartbeatResponse convertResponse(ocpp.cs._2012._06.HeartbeatResponse res
175175
@Override
176176
public AuthorizeResponse convertResponse(ocpp.cs._2012._06.AuthorizeResponse response) {
177177
return new AuthorizeResponse()
178-
.withIdTagInfo(convertIdTagInfo15to12(response.getIdTagInfo()));
178+
.withIdTagInfo(toOcpp12TagInfo(response.getIdTagInfo()));
179179
}
180180

181181
// -------------------------------------------------------------------------
182182
// Helpers
183183
// -------------------------------------------------------------------------
184184

185-
private static IdTagInfo convertIdTagInfo15to12(ocpp.cs._2012._06.IdTagInfo info15) {
185+
private static IdTagInfo toOcpp12TagInfo(ocpp.cs._2012._06.IdTagInfo info15) {
186186
return new IdTagInfo()
187187
.withExpiryDate(info15.getExpiryDate())
188188
.withParentIdTag(info15.getParentIdTag())

src/main/java/de/rwth/idsg/steve/ocpp/converter/Server15to16Impl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public StopTransactionRequest convertRequest(ocpp.cs._2012._06.StopTransactionRe
132132
.withMeterStop(request.getMeterStop())
133133
.withTimestamp(request.getTimestamp())
134134
.withTransactionId(request.getTransactionId())
135-
.withTransactionData(toOcpp15TransactionData(request.getTransactionData()));
135+
.withTransactionData(toOcpp16TransactionData(request.getTransactionData()));
136136
}
137137

138138
@Override
@@ -191,14 +191,14 @@ public DiagnosticsStatusNotificationResponse convertResponse(
191191
@Override
192192
public StartTransactionResponse convertResponse(ocpp.cs._2015._10.StartTransactionResponse response) {
193193
return new StartTransactionResponse()
194-
.withIdTagInfo(convertIdTagInfo16to15(response.getIdTagInfo()))
194+
.withIdTagInfo(toOcpp15IdTagInfo(response.getIdTagInfo()))
195195
.withTransactionId(response.getTransactionId());
196196
}
197197

198198
@Override
199199
public StopTransactionResponse convertResponse(ocpp.cs._2015._10.StopTransactionResponse response) {
200200
return new StopTransactionResponse()
201-
.withIdTagInfo(convertIdTagInfo16to15(response.getIdTagInfo()));
201+
.withIdTagInfo(toOcpp15IdTagInfo(response.getIdTagInfo()));
202202
}
203203

204204
@Override
@@ -210,7 +210,7 @@ public HeartbeatResponse convertResponse(ocpp.cs._2015._10.HeartbeatResponse res
210210
@Override
211211
public AuthorizeResponse convertResponse(ocpp.cs._2015._10.AuthorizeResponse response) {
212212
return new AuthorizeResponse()
213-
.withIdTagInfo(convertIdTagInfo16to15(response.getIdTagInfo()));
213+
.withIdTagInfo(toOcpp15IdTagInfo(response.getIdTagInfo()));
214214
}
215215

216216
@Override
@@ -252,7 +252,7 @@ private static ChargePointErrorCode customMapErrorCode(ocpp.cs._2012._06.ChargeP
252252
// Helpers
253253
// -------------------------------------------------------------------------
254254

255-
private static IdTagInfo convertIdTagInfo16to15(ocpp.cs._2015._10.IdTagInfo info16) {
255+
private static IdTagInfo toOcpp15IdTagInfo(ocpp.cs._2015._10.IdTagInfo info16) {
256256
return new IdTagInfo()
257257
.withExpiryDate(info16.getExpiryDate())
258258
.withParentIdTag(info16.getParentIdTag())
@@ -280,7 +280,7 @@ private static MeterValue toOcpp16MeterValue(ocpp.cs._2012._06.MeterValue e) {
280280
.withSampledValue(toOcpp16SampledValueList(e.getValue()));
281281
}
282282

283-
private static List<MeterValue> toOcpp15TransactionData(List<TransactionData> transactionData) {
283+
private static List<MeterValue> toOcpp16TransactionData(List<TransactionData> transactionData) {
284284
List<ocpp.cs._2012._06.MeterValue> combinedList = transactionData.stream()
285285
.flatMap(data -> data.getValues().stream())
286286
.collect(Collectors.toList());

src/main/java/de/rwth/idsg/steve/utils/ConnectorStatusCountFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
public final class ConnectorStatusCountFilter {
1717

18-
private static final Set<String> allStatusValues = allStatusValues();
18+
private static final Set<String> ALL_STATUS_VALUES = allStatusValues();
1919

2020
private ConnectorStatusCountFilter() { }
2121

@@ -39,7 +39,7 @@ public static Map<String, Integer> getStatusCountMap(List<ConnectorStatus> lates
3939
}
4040

4141
if (printZero) {
42-
allStatusValues.forEach(s -> map.putIfAbsent(s, 0));
42+
ALL_STATUS_VALUES.forEach(s -> map.putIfAbsent(s, 0));
4343
}
4444

4545
return map;

0 commit comments

Comments
 (0)