Skip to content

Commit

Permalink
Version 1.0.1. See changelog for details.
Browse files Browse the repository at this point in the history
  • Loading branch information
goekay committed Jul 9, 2014
1 parent 17cf5cd commit 23086c0
Show file tree
Hide file tree
Showing 26 changed files with 115 additions and 211 deletions.
27 changes: 0 additions & 27 deletions .classpath

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/target
/.idea
*.iml
.DS_Store
42 changes: 0 additions & 42 deletions .project

This file was deleted.

13 changes: 0 additions & 13 deletions .settings/.jsdtscope

This file was deleted.

5 changes: 0 additions & 5 deletions .settings/org.eclipse.core.resources.prefs

This file was deleted.

8 changes: 0 additions & 8 deletions .settings/org.eclipse.jdt.core.prefs

This file was deleted.

2 changes: 0 additions & 2 deletions .settings/org.eclipse.jst.ws.cxf.core.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions .settings/org.eclipse.m2e.core.prefs

This file was deleted.

10 changes: 0 additions & 10 deletions .settings/org.eclipse.wst.common.component

This file was deleted.

8 changes: 0 additions & 8 deletions .settings/org.eclipse.wst.common.project.facet.core.xml

This file was deleted.

1 change: 0 additions & 1 deletion .settings/org.eclipse.wst.jsdt.ui.superType.container

This file was deleted.

1 change: 0 additions & 1 deletion .settings/org.eclipse.wst.jsdt.ui.superType.name

This file was deleted.

2 changes: 0 additions & 2 deletions .settings/org.eclipse.wst.validation.prefs

This file was deleted.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.1
- Fix: Start and stop date/time values for Get Diagnostics must be in the past. Frontend allows to do that now.
- New: Backend validates input date/time variables for Get Diagnostics.

## 1.0.0
- DB updated to 0.6.7.
- Home page displays various statistics now (See the screenshot). Data is returned by a stored procedure in DB.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>idsg</groupId>
<artifactId>steve</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>war</packaging>
<build>
<plugins>
Expand Down
63 changes: 37 additions & 26 deletions src/main/java/de/rwth/idsg/steve/ChargePointService12_Client.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
package de.rwth.idsg.steve;

import ocpp.cp._2010._08.AvailabilityType;
import ocpp.cp._2010._08.ChangeAvailabilityRequest;
import ocpp.cp._2010._08.ChangeAvailabilityResponse;
import ocpp.cp._2010._08.ChangeConfigurationRequest;
import ocpp.cp._2010._08.ChangeConfigurationResponse;
import ocpp.cp._2010._08.ChargePointService;
import ocpp.cp._2010._08.ClearCacheRequest;
import ocpp.cp._2010._08.ClearCacheResponse;
import ocpp.cp._2010._08.GetDiagnosticsRequest;
import ocpp.cp._2010._08.GetDiagnosticsResponse;
import ocpp.cp._2010._08.RemoteStartTransactionRequest;
import ocpp.cp._2010._08.RemoteStartTransactionResponse;
import ocpp.cp._2010._08.RemoteStopTransactionRequest;
import ocpp.cp._2010._08.RemoteStopTransactionResponse;
import ocpp.cp._2010._08.ResetRequest;
import ocpp.cp._2010._08.ResetResponse;
import ocpp.cp._2010._08.ResetType;
import ocpp.cp._2010._08.UnlockConnectorRequest;
import ocpp.cp._2010._08.UnlockConnectorResponse;
import ocpp.cp._2010._08.UpdateFirmwareRequest;
import ocpp.cp._2010._08.UpdateFirmwareResponse;

import de.rwth.idsg.steve.common.utils.DateTimeUtils;
import de.rwth.idsg.steve.html.InputException;
import ocpp.cp._2010._08.*;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.rwth.idsg.steve.common.utils.DateTimeUtils;

/**
* Client implementation of OCPP V1.2.
*
Expand Down Expand Up @@ -73,8 +53,39 @@ public GetDiagnosticsRequest prepareGetDiagnostics(String location, int retries,
req.setLocation(location);
if (retries != -1) req.setRetries(retries);
if (retryInterval != -1) req.setRetryInterval(retryInterval);
if (startTime != null) req.setStartTime( DateTimeUtils.convertToXMLGregCal(startTime) );
if (stopTime != null) req.setStopTime( DateTimeUtils.convertToXMLGregCal(stopTime) );

//// Act according to four boolean combinations of the two variables ////

if (startTime == null && stopTime == null) {
// Do not set the fields

} else if (startTime == null && stopTime != null) {
DateTime stop = DateTimeUtils.convertToDateTime(stopTime);
if (stop.isBeforeNow()) {
req.setStopTime(DateTimeUtils.convertToXMLGregCal(stop));
} else {
throw new InputException("Stop date/time must be in the past.");
}

} else if (startTime != null && stopTime == null) {
DateTime start = DateTimeUtils.convertToDateTime(startTime);
if (start.isBeforeNow()) {
req.setStartTime( DateTimeUtils.convertToXMLGregCal(start) );
} else {
throw new InputException("Start date/time must be in the past.");
}

} else {
DateTime start = DateTimeUtils.convertToDateTime(startTime);
DateTime stop = DateTimeUtils.convertToDateTime(stopTime);
if (stop.isBeforeNow() && start.isBefore(stop)) {
req.setStartTime( DateTimeUtils.convertToXMLGregCal(start) );
req.setStopTime( DateTimeUtils.convertToXMLGregCal(stop) );
} else {
throw new InputException("Start date/time must be before the stop date/time, and both must be in the past.");
}
}

return req;
}

Expand Down
90 changes: 41 additions & 49 deletions src/main/java/de/rwth/idsg/steve/ChargePointService15_Client.java
Original file line number Diff line number Diff line change
@@ -1,57 +1,18 @@
package de.rwth.idsg.steve;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import ocpp.cp._2012._06.AuthorisationData;
import ocpp.cp._2012._06.AvailabilityType;
import ocpp.cp._2012._06.CancelReservationRequest;
import ocpp.cp._2012._06.CancelReservationResponse;
import ocpp.cp._2012._06.CancelReservationStatus;
import ocpp.cp._2012._06.ChangeAvailabilityRequest;
import ocpp.cp._2012._06.ChangeAvailabilityResponse;
import ocpp.cp._2012._06.ChangeConfigurationRequest;
import ocpp.cp._2012._06.ChangeConfigurationResponse;
import ocpp.cp._2012._06.ChargePointService;
import ocpp.cp._2012._06.ClearCacheRequest;
import ocpp.cp._2012._06.ClearCacheResponse;
import ocpp.cp._2012._06.DataTransferRequest;
import ocpp.cp._2012._06.DataTransferResponse;
import ocpp.cp._2012._06.GetConfigurationRequest;
import ocpp.cp._2012._06.GetConfigurationResponse;
import ocpp.cp._2012._06.GetDiagnosticsRequest;
import ocpp.cp._2012._06.GetDiagnosticsResponse;
import ocpp.cp._2012._06.GetLocalListVersionRequest;
import ocpp.cp._2012._06.GetLocalListVersionResponse;
import ocpp.cp._2012._06.KeyValue;
import ocpp.cp._2012._06.RemoteStartTransactionRequest;
import ocpp.cp._2012._06.RemoteStartTransactionResponse;
import ocpp.cp._2012._06.RemoteStopTransactionRequest;
import ocpp.cp._2012._06.RemoteStopTransactionResponse;
import ocpp.cp._2012._06.ReservationStatus;
import ocpp.cp._2012._06.ReserveNowRequest;
import ocpp.cp._2012._06.ReserveNowResponse;
import ocpp.cp._2012._06.ResetRequest;
import ocpp.cp._2012._06.ResetResponse;
import ocpp.cp._2012._06.ResetType;
import ocpp.cp._2012._06.SendLocalListRequest;
import ocpp.cp._2012._06.SendLocalListResponse;
import ocpp.cp._2012._06.UnlockConnectorRequest;
import ocpp.cp._2012._06.UnlockConnectorResponse;
import ocpp.cp._2012._06.UpdateFirmwareRequest;
import ocpp.cp._2012._06.UpdateFirmwareResponse;
import ocpp.cp._2012._06.UpdateStatus;
import ocpp.cp._2012._06.UpdateType;

import de.rwth.idsg.steve.common.ClientDBAccess;
import de.rwth.idsg.steve.common.utils.DateTimeUtils;
import de.rwth.idsg.steve.common.utils.InputUtils;
import de.rwth.idsg.steve.html.InputException;
import ocpp.cp._2012._06.*;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.rwth.idsg.steve.common.ClientDBAccess;
import de.rwth.idsg.steve.common.utils.DateTimeUtils;
import de.rwth.idsg.steve.common.utils.InputUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
* Client implementation of OCPP V1.5.
Expand Down Expand Up @@ -98,8 +59,39 @@ public GetDiagnosticsRequest prepareGetDiagnostics(String location, int retries,
req.setLocation(location);
if (retries != -1) req.setRetries(retries);
if (retryInterval != -1) req.setRetryInterval(retryInterval);
if (startTime != null) req.setStartTime( DateTimeUtils.convertToXMLGregCal(startTime) );
if (stopTime != null) req.setStopTime( DateTimeUtils.convertToXMLGregCal(stopTime) );

//// Act according to four boolean combinations of the two variables ////

if (startTime == null && stopTime == null) {
// Do not set the fields

} else if (startTime == null && stopTime != null) {
DateTime stop = DateTimeUtils.convertToDateTime(stopTime);
if (stop.isBeforeNow()) {
req.setStopTime(DateTimeUtils.convertToXMLGregCal(stop));
} else {
throw new InputException("Stop date/time must be in the past.");
}

} else if (startTime != null && stopTime == null) {
DateTime start = DateTimeUtils.convertToDateTime(startTime);
if (start.isBeforeNow()) {
req.setStartTime( DateTimeUtils.convertToXMLGregCal(start) );
} else {
throw new InputException("Start date/time must be in the past.");
}

} else {
DateTime start = DateTimeUtils.convertToDateTime(startTime);
DateTime stop = DateTimeUtils.convertToDateTime(stopTime);
if (stop.isBeforeNow() && start.isBefore(stop)) {
req.setStartTime( DateTimeUtils.convertToXMLGregCal(start) );
req.setStopTime( DateTimeUtils.convertToXMLGregCal(stop) );
} else {
throw new InputException("Start date/time must be before the stop date/time, and both must be in the past.");
}
}

return req;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/rwth/idsg/steve/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
public class Constants {
// Current version of the application
public static final String STEVE_VERSION = "1.0.0";
public static final String STEVE_VERSION = "1.0.1";
// Heartbeat interval in seconds
public static int HEARTBEAT_INTERVAL = 14400;
// Determines how many hours the idtag should be stored in the local whitelist of a chargebox
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
$(".datepicker").datepicker({ firstDay:1, dateFormat:'yy-mm-dd', minDate:0 });
$(".datepicker").datepicker({ firstDay:1, dateFormat:'yy-mm-dd', minDate:0 , maxDate:null});
17 changes: 17 additions & 0 deletions src/main/webapp/WEB-INF/jsp/00-js-snippets/datepicker-past.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var startDate = $("#startDate").datepicker({
firstDay: 1,
dateFormat: 'yy-mm-dd',
maxDate: 0,
onSelect: function(selectedDate) {
stopDate.datepicker("option", "minDate", selectedDate);
}
});

var stopDate = $("#stopDate").datepicker({
firstDay: 1,
dateFormat: 'yy-mm-dd',
maxDate: 0,
onSelect: function(selectedDate) {
startDate.datepicker("option", "maxDate", selectedDate);
}
});
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/jsp/data-man/users.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%@ include file="/WEB-INF/jsp/00-header.jsp" %>
<script type="text/javascript">
$(document).ready(function() {
<%@ include file="/WEB-INF/jsp/00-js-snippets/datepicker.js" %>
<%@ include file="/WEB-INF/jsp/00-js-snippets/datepicker-future.js" %>
<%@ include file="/WEB-INF/jsp/00-js-snippets/populateUpdate.js" %>
});
</script>
Expand Down
Loading

0 comments on commit 23086c0

Please sign in to comment.