dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37175
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19019: Centralized date pattern string in web api
------------------------------------------------------------
revno: 19019
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-04-24 16:15:03 +0200
message:
Centralized date pattern string in web api
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityInstanceController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java 2015-03-04 10:13:19 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java 2015-04-24 14:15:03 +0000
@@ -64,8 +64,14 @@
};
//TODO replace with FastDateParser, SimpleDateFormat is not thead-safe
+
+ /**
+ * Used by web API and utility methods.
+ */
+ public static final String DATE_PATTERN = "yyyy-MM-dd";
+ public static final String TIMESTAMP_PATTERN = "yyyy-MM-dd'T'HH:mm:ss";
- public static final SimpleDateFormat LONG_DATE_FORMAT = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss" );
+ public static final SimpleDateFormat LONG_DATE_FORMAT = new SimpleDateFormat( TIMESTAMP_PATTERN );
public static final SimpleDateFormat ACCESS_DATE_FORMAT = new SimpleDateFormat( "yyyy/MM/dd HH:mm:ss" );
public static final SimpleDateFormat HTTP_DATE_FORMAT = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss" );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-02-25 09:51:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-04-24 14:15:03 +0000
@@ -30,7 +30,7 @@
import static org.hisp.dhis.common.DimensionalObjectUtils.getUniqueDimensions;
import static org.hisp.dhis.common.DimensionalObjectUtils.toDimension;
-import static org.hisp.dhis.webapi.utils.ContextUtils.DATE_PATTERN;
+import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
import java.io.IOException;
import java.util.Date;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java 2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java 2015-04-24 14:15:03 +0000
@@ -53,6 +53,7 @@
import java.util.Set;
import static org.hisp.dhis.webapi.utils.ContextUtils.*;
+import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
@Controller
@RequestMapping( value = DataValueSetController.RESOURCE_PATH )
@@ -73,8 +74,8 @@
public void getDataValueSetXml(
@RequestParam Set<String> dataSet,
@RequestParam( required = false ) String period,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date startDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date endDate,
@RequestParam Set<String> orgUnit,
@RequestParam( required = false ) boolean children,
IdSchemes idSchemes, HttpServletResponse response ) throws IOException
@@ -104,8 +105,8 @@
public void getDataValueSetJson(
@RequestParam Set<String> dataSet,
@RequestParam( required = false ) String period,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date startDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date endDate,
@RequestParam Set<String> orgUnit,
@RequestParam( required = false ) boolean children,
IdSchemes idSchemes, HttpServletResponse response ) throws IOException
@@ -135,8 +136,8 @@
public void getDataValueSetCsv(
@RequestParam Set<String> dataSet,
@RequestParam( required = false ) String period,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date startDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date endDate,
@RequestParam Set<String> orgUnit,
@RequestParam( required = false ) boolean children,
IdSchemes idSchemes,
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java 2015-04-24 14:15:03 +0000
@@ -59,7 +59,7 @@
import java.util.Date;
import static org.hisp.dhis.system.util.CodecUtils.filenameEncode;
-import static org.hisp.dhis.webapi.utils.ContextUtils.DATE_PATTERN;
+import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java 2015-02-25 06:32:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java 2015-04-24 14:15:03 +0000
@@ -30,7 +30,7 @@
import static org.hisp.dhis.common.DimensionalObjectUtils.getUniqueDimensions;
import static org.hisp.dhis.system.util.CodecUtils.filenameEncode;
-import static org.hisp.dhis.webapi.utils.ContextUtils.DATE_PATTERN;
+import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
import java.util.Date;
import java.util.Set;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java 2015-02-25 06:51:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java 2015-04-24 14:15:03 +0000
@@ -63,7 +63,7 @@
import java.util.Set;
import static org.hisp.dhis.common.DimensionalObjectUtils.getDimensions;
-import static org.hisp.dhis.webapi.utils.ContextUtils.DATE_PATTERN;
+import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
/**
* @author Jan Henrik Overland
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2015-04-21 20:08:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2015-04-24 14:15:03 +0000
@@ -83,6 +83,8 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -139,10 +141,10 @@
@RequestParam( required = false ) String trackedEntityInstance,
@RequestParam( required = false ) String orgUnit,
@RequestParam( required = false ) OrganisationUnitSelectionMode ouMode,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date startDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date endDate,
@RequestParam( required = false ) EventStatus status,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date lastUpdated,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date lastUpdated,
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) boolean skipMeta,
@@ -190,10 +192,10 @@
@RequestParam( required = false ) String trackedEntityInstance,
@RequestParam( required = false ) String orgUnit,
@RequestParam( required = false ) OrganisationUnitSelectionMode ouMode,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date startDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date endDate,
@RequestParam( required = false ) EventStatus status,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date lastUpdated,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date lastUpdated,
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@RequestParam( required = false ) String attachment,
@@ -234,8 +236,8 @@
@RequestParam( required = false ) OrganisationUnitSelectionMode ouMode,
@RequestParam( required = false ) ProgramStatus programStatus,
@RequestParam( required = false ) EventStatus eventStatus,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date startDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date endDate,
@RequestParam Map<String, String> parameters, Model model, HttpServletRequest request )
{
WebOptions options = new WebOptions( parameters );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityInstanceController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityInstanceController.java 2015-02-24 03:57:26 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityInstanceController.java 2015-04-24 14:15:03 +0000
@@ -75,6 +75,8 @@
import java.util.List;
import java.util.Set;
+import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -115,12 +117,12 @@
@RequestParam( required = false ) String program,
@RequestParam( required = false ) ProgramStatus programStatus,
@RequestParam( required = false ) Boolean followUp,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date programStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date programEndDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programStartDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programEndDate,
@RequestParam( required = false ) String trackedEntity,
@RequestParam( required = false ) EventStatus eventStatus,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date eventStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date eventEndDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventStartDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventEndDate,
@RequestParam( required = false ) boolean skipMeta,
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@@ -151,12 +153,12 @@
@RequestParam( required = false ) String program,
@RequestParam( required = false ) ProgramStatus programStatus,
@RequestParam( required = false ) Boolean followUp,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date programStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date programEndDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programStartDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programEndDate,
@RequestParam( required = false ) String trackedEntity,
@RequestParam( required = false ) EventStatus eventStatus,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date eventStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date eventEndDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventStartDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventEndDate,
@RequestParam( required = false ) boolean skipMeta,
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@@ -184,12 +186,12 @@
@RequestParam( required = false ) String program,
@RequestParam( required = false ) ProgramStatus programStatus,
@RequestParam( required = false ) Boolean followUp,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date programStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date programEndDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programStartDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programEndDate,
@RequestParam( required = false ) String trackedEntity,
@RequestParam( required = false ) EventStatus eventStatus,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date eventStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date eventEndDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventStartDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventEndDate,
@RequestParam( required = false ) boolean skipMeta,
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@@ -217,12 +219,12 @@
@RequestParam( required = false ) String program,
@RequestParam( required = false ) ProgramStatus programStatus,
@RequestParam( required = false ) Boolean followUp,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date programStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date programEndDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programStartDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programEndDate,
@RequestParam( required = false ) String trackedEntity,
@RequestParam( required = false ) EventStatus eventStatus,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date eventStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date eventEndDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventStartDate,
+ @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventEndDate,
@RequestParam( required = false ) boolean skipMeta,
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java 2015-02-25 06:51:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java 2015-04-24 14:15:03 +0000
@@ -64,7 +64,7 @@
import java.util.Iterator;
import java.util.Set;
-import static org.hisp.dhis.webapi.utils.ContextUtils.DATE_PATTERN;
+import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java 2015-04-03 12:51:02 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/ContextUtils.java 2015-04-24 14:15:03 +0000
@@ -84,7 +84,6 @@
public static final String HEADER_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
public static final String HEADER_LOCATION = "Location";
- public static final String DATE_PATTERN = "yyyy-MM-dd";
public static final String QUERY_PARAM_SEP = ";";
public static final String HEADER_IF_NONE_MATCH = "If-None-Match";
public static final String HEADER_ETAG = "ETag";