dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #37356
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19125: update to support more flexible date formats, remove usage of @DateTimeFormat, and is replaced wi...
------------------------------------------------------------
revno: 19125
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-05-11 13:02:29 +0700
message:
update to support more flexible date formats, remove usage of @DateTimeFormat, and is replaced with using @InitBinder/DateUtils.parse()
modified:
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/CompleteDataSetRegistrationController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.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/EnrollmentController.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/TrackedEntityInstanceController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.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-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-04-24 14:15:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-05-11 06:02:29 +0000
@@ -28,17 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.common.DimensionalObjectUtils.getUniqueDimensions;
-import static org.hisp.dhis.common.DimensionalObjectUtils.toDimension;
-import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.chart.ChartService;
import org.hisp.dhis.common.DimensionService;
@@ -64,13 +53,21 @@
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Set;
+
+import static org.hisp.dhis.common.DimensionalObjectUtils.getUniqueDimensions;
+import static org.hisp.dhis.common.DimensionalObjectUtils.toDimension;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -166,7 +163,7 @@
@RequestMapping( value = { "/{uid}/data", "/{uid}/data.png" }, method = RequestMethod.GET )
public void getChart(
@PathVariable( "uid" ) String uid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
@RequestParam( value = "ou", required = false ) String ou,
@RequestParam( value = "width", defaultValue = "800", required = false ) int width,
@RequestParam( value = "height", defaultValue = "500", required = false ) int height,
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CompleteDataSetRegistrationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CompleteDataSetRegistrationController.java 2015-04-07 10:35:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CompleteDataSetRegistrationController.java 2015-05-11 06:02:29 +0000
@@ -28,19 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_JSON;
-import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_XML;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.IdentifiableObjectManager;
@@ -53,8 +40,8 @@
import org.hisp.dhis.dataset.CompleteDataSetRegistrations;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.dxf2.render.RenderService;
-import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.i18n.I18nManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -66,7 +53,6 @@
import org.hisp.dhis.webapi.utils.ContextUtils;
import org.hisp.dhis.webapi.utils.InputUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@@ -76,6 +62,18 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.HttpClientErrorException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_JSON;
+import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_XML;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -118,8 +116,8 @@
public void getCompleteDataSetRegistrationsXml(
@RequestParam Set<String> dataSet,
@RequestParam( required = false ) String period,
- @RequestParam @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam Date startDate,
+ @RequestParam Date endDate,
@RequestParam Set<String> orgUnit,
@RequestParam( required = false ) boolean children,
HttpServletResponse response ) throws IOException
@@ -135,8 +133,8 @@
public void getCompleteDataSetRegistrationsJson(
@RequestParam Set<String> dataSet,
@RequestParam( required = false ) String period,
- @RequestParam @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam Date startDate,
+ @RequestParam Date endDate,
@RequestParam Set<String> orgUnit,
@RequestParam( required = false ) boolean children,
HttpServletResponse response ) throws IOException
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java 2015-04-30 15:14:27 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java 2015-05-11 06:02:29 +0000
@@ -28,20 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static com.google.common.collect.Lists.newArrayList;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.common.IdentifiableObjectManager;
@@ -74,7 +60,6 @@
import org.hisp.dhis.webapi.webdomain.approval.Approval;
import org.hisp.dhis.webapi.webdomain.approval.Approvals;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
@@ -82,9 +67,22 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static com.google.common.collect.Lists.newArrayList;
+
/**
* This controller uses both /dataApprovals and /dataAcceptances.
- *
+ *
* @author Lars Helge Overland
*/
@Controller
@@ -171,7 +169,7 @@
DataApprovalStatus status = dataApprovalService
.getDataApprovalStatusAndPermissions( dataSet, period, organisationUnit, combo );
-
+
DataApprovalPermissions permissions = status.getPermissions();
permissions.setState( status.getState().toString() );
@@ -182,8 +180,8 @@
public void getApproval(
@RequestParam Set<String> ds,
@RequestParam( required = false ) String pe,
- @RequestParam @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam Date startDate,
+ @RequestParam Date endDate,
@RequestParam Set<String> ou,
@RequestParam( required = false ) boolean children,
HttpServletResponse response )
@@ -234,7 +232,7 @@
JacksonUtils.toJsonWithView( response.getOutputStream(), dataApprovalStateResponses, BasicView.class );
}
- private DataApprovalStateResponse getDataApprovalStateResponse( DataSet dataSet,
+ private DataApprovalStateResponse getDataApprovalStateResponse( DataSet dataSet,
OrganisationUnit organisationUnit, Period period )
{
DataElementCategoryOptionCombo combo = categoryService.getDefaultDataElementCategoryOptionCombo();
@@ -248,19 +246,19 @@
String state = status.getState().toString();
- return new DataApprovalStateResponse( dataSet, period, organisationUnit, state,
+ return new DataApprovalStateResponse( dataSet, period, organisationUnit, state,
createdDate, createdByUsername, status.getPermissions() );
}
@RequestMapping( value = APPROVALS_PATH + "/categoryOptionCombos", method = RequestMethod.GET, produces = ContextUtils.CONTENT_TYPE_JSON )
- public void getApprovalByCategoryOptionCombos(
- @RequestParam Set<String> ds,
+ public void getApprovalByCategoryOptionCombos(
+ @RequestParam Set<String> ds,
@RequestParam String pe,
- @RequestParam(required = false) String ou,
+ @RequestParam( required = false ) String ou,
HttpServletResponse response ) throws IOException
{
Set<DataSet> dataSets = new HashSet<>( objectManager.getByUid( DataSet.class, ds ) );
-
+
Period period = PeriodType.getPeriodFromIsoString( pe );
if ( period == null )
@@ -268,7 +266,7 @@
ContextUtils.conflictResponse( response, "Illegal period identifier: " + pe );
return;
}
-
+
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ou );
List<DataApprovalStatus> statusList = dataApprovalService.getUserDataApprovalsAndPermissions( dataSets, period, orgUnit );
@@ -278,32 +276,32 @@
for ( DataApprovalStatus status : statusList )
{
Map<String, Object> item = new HashMap<String, Object>();
-
+
DataApproval approval = status.getDataApproval();
-
+
Map<String, String> approvalLevel = new HashMap<>();
-
+
if ( status.getDataApprovalLevel() != null )
{
approvalLevel.put( "id", status.getDataApprovalLevel().getUid() );
approvalLevel.put( "level", String.valueOf( status.getDataApprovalLevel().getLevel() ) );
}
-
+
if ( approval != null )
{
item.put( "id", approval.getAttributeOptionCombo().getUid() );
item.put( "level", approvalLevel );
- item.put( "ou", approval.getOrganisationUnit().getUid() );
+ item.put( "ou", approval.getOrganisationUnit().getUid() );
item.put( "accepted", approval.isAccepted() );
item.put( "permissions", status.getPermissions() );
-
+
list.add( item );
}
}
-
+
JacksonUtils.toJson( response.getOutputStream(), list );
}
-
+
// -------------------------------------------------------------------------
// Post, approval
// -------------------------------------------------------------------------
@@ -497,7 +495,7 @@
{
ContextUtils.conflictResponse( response, "Approval must have data sets and periods" );
}
-
+
dataApprovalService.acceptData( getDataApprovalList( approvals ) );
}
@@ -509,13 +507,13 @@
{
ContextUtils.conflictResponse( response, "Approval must have data sets and periods" );
}
-
+
dataApprovalService.unacceptData( getDataApprovalList( approvals ) );
}
@PreAuthorize( "hasRole('ALL') or hasRole('F_ACCEPT_DATA_LOWER_LEVELS')" )
@RequestMapping( value = MULTIPLE_ACCEPTANCES_RESOURCE_PATH, method = RequestMethod.POST )
- public void acceptApprovalMultiple( @RequestBody DataApprovalStateRequests dataApprovalStateRequests,
+ public void acceptApprovalMultiple( @RequestBody DataApprovalStateRequests dataApprovalStateRequests,
HttpServletResponse response )
{
List<DataApproval> dataApprovalList = new ArrayList<>();
@@ -555,7 +553,7 @@
return;
}
- User user = dataApprovalStateRequest.getAb() == null ?
+ User user = dataApprovalStateRequest.getAb() == null ?
currentUserService.getCurrentUser() : userService.getUserCredentialsByUsername( dataApprovalStateRequest.getAb() ).getUser();
Date approvalDate = (dataApprovalStateRequest.getAd() == null) ? new Date() : dataApprovalStateRequest.getAd();
@@ -563,7 +561,7 @@
dataApprovalList.addAll( getApprovalsAsList( dataApprovalLevel, dataSet,
period, organisationUnit, false, approvalDate, user ) );
}
-
+
dataApprovalService.acceptData( dataApprovalList );
}
@@ -710,7 +708,7 @@
{
OrganisationUnit unit = organisationUnitService.getOrganisationUnit( approval.getOu() );
DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( approval.getAoc() );
-
+
for ( Period period : periods )
{
if ( dataSetOptionCombos != null && dataSetOptionCombos.contains( optionCombo ) )
@@ -721,7 +719,7 @@
}
}
}
-
+
return list;
}
}
=== 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-04-24 14:15:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java 2015-05-11 06:02:29 +0000
@@ -30,14 +30,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dxf2.common.IdSchemes;
+import org.hisp.dhis.dxf2.common.ImportOptions;
+import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
-import org.hisp.dhis.dxf2.common.ImportOptions;
-import org.hisp.dhis.dxf2.common.IdSchemes;
-import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.webapi.utils.ContextUtils;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -53,7 +52,6 @@
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 )
@@ -74,8 +72,8 @@
public void getDataValueSetXml(
@RequestParam Set<String> dataSet,
@RequestParam( required = false ) String period,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date endDate,
+ @RequestParam( required = false ) Date startDate,
+ @RequestParam( required = false ) Date endDate,
@RequestParam Set<String> orgUnit,
@RequestParam( required = false ) boolean children,
IdSchemes idSchemes, HttpServletResponse response ) throws IOException
@@ -105,8 +103,8 @@
public void getDataValueSetJson(
@RequestParam Set<String> dataSet,
@RequestParam( required = false ) String period,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date endDate,
+ @RequestParam( required = false ) Date startDate,
+ @RequestParam( required = false ) Date endDate,
@RequestParam Set<String> orgUnit,
@RequestParam( required = false ) boolean children,
IdSchemes idSchemes, HttpServletResponse response ) throws IOException
@@ -136,8 +134,8 @@
public void getDataValueSetCsv(
@RequestParam Set<String> dataSet,
@RequestParam( required = false ) String period,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date endDate,
+ @RequestParam( required = false ) Date startDate,
+ @RequestParam( required = false ) 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-04-24 14:15:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java 2015-05-11 06:02:29 +0000
@@ -45,7 +45,6 @@
import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
@@ -59,7 +58,6 @@
import java.util.Date;
import static org.hisp.dhis.system.util.CodecUtils.filenameEncode;
-import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -141,7 +139,7 @@
public void getReportAsPdf( @PathVariable( "uid" ) String uid,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
@RequestParam( value = "pe", required = false ) String period,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletRequest request, HttpServletResponse response ) throws Exception
{
getReport( request, response, uid, organisationUnitUid, period, date, "pdf", ContextUtils.CONTENT_TYPE_PDF, false );
@@ -151,7 +149,7 @@
public void getReportAsXls( @PathVariable( "uid" ) String uid,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
@RequestParam( value = "pe", required = false ) String period,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletRequest request, HttpServletResponse response ) throws Exception
{
getReport( request, response, uid, organisationUnitUid, period, date, "xls", ContextUtils.CONTENT_TYPE_EXCEL, true );
@@ -161,7 +159,7 @@
public void getReportAsHtml( @PathVariable( "uid" ) String uid,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
@RequestParam( value = "pe", required = false ) String period,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletRequest request, HttpServletResponse response ) throws Exception
{
getReport( request, response, uid, organisationUnitUid, period, date, "html", ContextUtils.CONTENT_TYPE_HTML, false );
=== 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-04-24 14:15:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportTableController.java 2015-05-11 06:02:29 +0000
@@ -28,16 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.common.DimensionalObjectUtils.getUniqueDimensions;
-import static org.hisp.dhis.system.util.CodecUtils.filenameEncode;
-import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
-
-import java.util.Date;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.hisp.dhis.common.DimensionService;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.MergeStrategy;
@@ -58,7 +48,6 @@
import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
@@ -66,6 +55,14 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+import java.util.Set;
+
+import static org.hisp.dhis.common.DimensionalObjectUtils.getUniqueDimensions;
+import static org.hisp.dhis.system.util.CodecUtils.filenameEncode;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
* @author Lars Helge Overland
@@ -86,7 +83,7 @@
@Autowired
private MappingService mappingService;
-
+
@Autowired
private LegendService legendService;
@@ -156,7 +153,7 @@
@RequestMapping( value = "/{uid}/data", method = RequestMethod.GET ) // For json, jsonp
public String getReportTableData( @PathVariable( "uid" ) String uid, Model model,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletResponse response ) throws Exception
{
model.addAttribute( "model", getReportTableGrid( uid, organisationUnitUid, date ) );
@@ -168,7 +165,7 @@
@RequestMapping( value = "/{uid}/data.html", method = RequestMethod.GET )
public void getReportTableHtml( @PathVariable( "uid" ) String uid,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletResponse response ) throws Exception
{
Grid grid = getReportTableGrid( uid, organisationUnitUid, date );
@@ -182,7 +179,7 @@
@RequestMapping( value = "/{uid}/data.html+css", method = RequestMethod.GET )
public void getReportTableHtmlCss( @PathVariable( "uid" ) String uid,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletResponse response ) throws Exception
{
Grid grid = getReportTableGrid( uid, organisationUnitUid, date );
@@ -196,7 +193,7 @@
@RequestMapping( value = "/{uid}/data.xml", method = RequestMethod.GET )
public void getReportTableXml( @PathVariable( "uid" ) String uid,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletResponse response ) throws Exception
{
Grid grid = getReportTableGrid( uid, organisationUnitUid, date );
@@ -210,7 +207,7 @@
@RequestMapping( value = "/{uid}/data.pdf", method = RequestMethod.GET )
public void getReportTablePdf( @PathVariable( "uid" ) String uid,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletResponse response ) throws Exception
{
Grid grid = getReportTableGrid( uid, organisationUnitUid, date );
@@ -224,7 +221,7 @@
@RequestMapping( value = "/{uid}/data.xls", method = RequestMethod.GET )
public void getReportTableXls( @PathVariable( "uid" ) String uid,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletResponse response ) throws Exception
{
Grid grid = getReportTableGrid( uid, organisationUnitUid, date );
@@ -238,7 +235,7 @@
@RequestMapping( value = "/{uid}/data.csv", method = RequestMethod.GET )
public void getReportTableCsv( @PathVariable( "uid" ) String uid,
@RequestParam( value = "ou", required = false ) String organisationUnitUid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
HttpServletResponse response ) throws Exception
{
Grid grid = getReportTableGrid( uid, organisationUnitUid, date );
@@ -274,7 +271,7 @@
reportTable.populateAnalyticalProperties();
Set<OrganisationUnit> roots = currentUserService.getCurrentUser().getDataViewOrganisationUnitsWithFallback();
-
+
for ( OrganisationUnit organisationUnit : reportTable.getOrganisationUnits() )
{
reportTable.getParentGraphMap().put( organisationUnit.getUid(), organisationUnit.getParentGraph( roots ) );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java 2015-02-17 06:00:52 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EnrollmentController.java 2015-05-11 06:02:29 +0000
@@ -30,6 +30,7 @@
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.OrganisationUnitSelectionMode;
+import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.dxf2.events.enrollment.Enrollment;
import org.hisp.dhis.dxf2.events.enrollment.EnrollmentService;
import org.hisp.dhis.dxf2.events.enrollment.EnrollmentStatus;
@@ -39,7 +40,6 @@
import org.hisp.dhis.dxf2.importsummary.ImportStatus;
import org.hisp.dhis.dxf2.importsummary.ImportSummaries;
import org.hisp.dhis.dxf2.importsummary.ImportSummary;
-import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.importexport.ImportStrategy;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -48,7 +48,6 @@
import org.hisp.dhis.webapi.utils.ContextUtils;
import org.hisp.dhis.webapi.webdomain.WebOptions;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -62,7 +61,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
@@ -86,7 +84,7 @@
@Autowired
private IdentifiableObjectManager manager;
-
+
@Autowired
private OrganisationUnitService organisationUnitService;
@@ -99,8 +97,8 @@
@RequestParam( value = "orgUnit", required = false ) String orgUnitUid,
@RequestParam( value = "program", required = false ) String programUid,
@RequestParam( value = "trackedEntityInstance", required = false ) String trackedEntityInstanceUid,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date startDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = "yyyy-MM-dd" ) Date endDate,
+ @RequestParam( required = false ) Date startDate,
+ @RequestParam( required = false ) Date endDate,
@RequestParam( required = false ) OrganisationUnitSelectionMode ouMode,
@RequestParam( value = "status", required = false ) EnrollmentStatus status,
@RequestParam Map<String, String> parameters, Model model ) throws NotFoundException
@@ -112,7 +110,7 @@
{
OrganisationUnit organisationUnit = getOrganisationUnit( orgUnitUid );
List<OrganisationUnit> organisationUnits = getOrganisationUnits( organisationUnit, ouMode );
-
+
Program program = getProgram( programUid );
enrollments = status != null ?
@@ -327,11 +325,11 @@
return organisationUnit;
}
-
+
private List<OrganisationUnit> getOrganisationUnits( OrganisationUnit rootOrganisationUnit, OrganisationUnitSelectionMode ouMode )
{
List<OrganisationUnit> organisationUnits = new ArrayList<>();
-
+
if ( OrganisationUnitSelectionMode.DESCENDANTS.equals( ouMode ) )
{
organisationUnits.addAll( organisationUnitService.getOrganisationUnitWithChildren( rootOrganisationUnit.getUid() ) );
@@ -345,8 +343,8 @@
{
organisationUnits.add( rootOrganisationUnit );
}
-
- return organisationUnits;
+
+ return organisationUnits;
}
private Program getProgram( String id ) throws NotFoundException
=== 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-04-24 14:15:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventChartController.java 2015-05-11 06:02:29 +0000
@@ -49,7 +49,6 @@
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -63,7 +62,6 @@
import java.util.Set;
import static org.hisp.dhis.common.DimensionalObjectUtils.getDimensions;
-import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
/**
* @author Jan Henrik Overland
@@ -157,7 +155,7 @@
@RequestMapping( value = { "/{uid}/data", "/{uid}/data.png" }, method = RequestMethod.GET )
public void getChart(
@PathVariable( "uid" ) String uid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
@RequestParam( value = "ou", required = false ) String ou,
@RequestParam( value = "width", defaultValue = "800", required = false ) int width,
@RequestParam( value = "height", defaultValue = "500", required = false ) int height,
=== 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-05-01 14:30:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityInstanceController.java 2015-05-11 06:02:29 +0000
@@ -28,16 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import com.google.common.collect.Lists;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.IllegalQueryException;
@@ -62,7 +53,6 @@
import org.hisp.dhis.webapi.utils.ContextUtils;
import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -76,7 +66,12 @@
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
-import com.google.common.collect.Lists;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -115,12 +110,12 @@
@RequestParam( required = false ) String program,
@RequestParam( required = false ) ProgramStatus programStatus,
@RequestParam( required = false ) Boolean followUp,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programEndDate,
+ @RequestParam( required = false ) Date programStartDate,
+ @RequestParam( required = false ) Date programEndDate,
@RequestParam( required = false ) String trackedEntity,
@RequestParam( required = false ) EventStatus eventStatus,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventEndDate,
+ @RequestParam( required = false ) Date eventStartDate,
+ @RequestParam( required = false ) Date eventEndDate,
@RequestParam( required = false ) boolean skipMeta,
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@@ -152,12 +147,12 @@
@RequestParam( required = false ) String program,
@RequestParam( required = false ) ProgramStatus programStatus,
@RequestParam( required = false ) Boolean followUp,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programEndDate,
+ @RequestParam( required = false ) Date programStartDate,
+ @RequestParam( required = false ) Date programEndDate,
@RequestParam( required = false ) String trackedEntity,
@RequestParam( required = false ) EventStatus eventStatus,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventEndDate,
+ @RequestParam( required = false ) Date eventStartDate,
+ @RequestParam( required = false ) Date eventEndDate,
@RequestParam( required = false ) boolean skipMeta,
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@@ -186,12 +181,12 @@
@RequestParam( required = false ) String program,
@RequestParam( required = false ) ProgramStatus programStatus,
@RequestParam( required = false ) Boolean followUp,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programEndDate,
+ @RequestParam( required = false ) Date programStartDate,
+ @RequestParam( required = false ) Date programEndDate,
@RequestParam( required = false ) String trackedEntity,
@RequestParam( required = false ) EventStatus eventStatus,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventEndDate,
+ @RequestParam( required = false ) Date eventStartDate,
+ @RequestParam( required = false ) Date eventEndDate,
@RequestParam( required = false ) boolean skipMeta,
@RequestParam( required = false ) Integer page,
@RequestParam( required = false ) Integer pageSize,
@@ -220,12 +215,12 @@
@RequestParam( required = false ) String program,
@RequestParam( required = false ) ProgramStatus programStatus,
@RequestParam( required = false ) Boolean followUp,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date programEndDate,
+ @RequestParam( required = false ) Date programStartDate,
+ @RequestParam( required = false ) Date programEndDate,
@RequestParam( required = false ) String trackedEntity,
@RequestParam( required = false ) EventStatus eventStatus,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventStartDate,
- @RequestParam( required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date eventEndDate,
+ @RequestParam( required = false ) Date eventStartDate,
+ @RequestParam( required = false ) 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-04-24 14:15:03 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/MapController.java 2015-05-11 06:02:29 +0000
@@ -49,7 +49,6 @@
import org.hisp.dhis.webapi.utils.ContextUtils;
import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -64,8 +63,6 @@
import java.util.Iterator;
import java.util.Set;
-import static org.hisp.dhis.system.util.DateUtils.DATE_PATTERN;
-
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
* @author Lars Helge Overland
@@ -195,7 +192,7 @@
@RequestMapping( value = { "/{uid}/data", "/{uid}/data.png" }, method = RequestMethod.GET )
public void getMapData( @PathVariable String uid,
- @RequestParam( value = "date", required = false ) @DateTimeFormat( pattern = DATE_PATTERN ) Date date,
+ @RequestParam( value = "date", required = false ) Date date,
@RequestParam( value = "ou", required = false ) String ou,
@RequestParam( required = false ) Integer width,
@RequestParam( required = false ) Integer height,