=== 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-06-15 13:44:20 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-07-08 05:42:56 +0000 @@ -31,12 +31,14 @@ import org.hisp.dhis.chart.Chart; import org.hisp.dhis.chart.ChartService; import org.hisp.dhis.common.DimensionService; +import org.hisp.dhis.commons.util.CodecUtils; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.dxf2.common.ImportOptions; import org.hisp.dhis.dxf2.common.JacksonUtils; +import org.hisp.dhis.dxf2.webmessage.WebMessage; import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.i18n.I18nManager; import org.hisp.dhis.indicator.Indicator; @@ -46,10 +48,10 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.schema.descriptors.ChartSchemaDescriptor; -import org.hisp.dhis.commons.util.CodecUtils; import org.hisp.dhis.user.CurrentUserService; import org.hisp.dhis.webapi.utils.ContextUtils; import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy; +import org.hisp.dhis.webapi.utils.WebMessageUtils; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; import org.springframework.beans.factory.annotation.Autowired; @@ -93,7 +95,7 @@ @Autowired private DimensionService dimensionService; - + @Autowired private CurrentUserService currentUserService; @@ -278,7 +280,7 @@ chart.populateAnalyticalProperties(); Set roots = currentUserService.getCurrentUser().getDataViewOrganisationUnitsWithFallback(); - + for ( OrganisationUnit organisationUnit : chart.getOrganisationUnits() ) { chart.getParentGraphMap().put( organisationUnit.getUid(), organisationUnit.getParentGraph( roots ) ); === 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-05-11 08:40:14 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataApprovalController.java 2015-07-08 05:42:56 +0000 @@ -124,9 +124,6 @@ @Autowired private DataElementCategoryService categoryService; - @Autowired - private InputUtils inputUtils; - // ------------------------------------------------------------------------- // Get // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java 2015-06-10 20:22:17 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueController.java 2015-07-08 05:42:56 +0000 @@ -121,7 +121,7 @@ return; } - DataElementCategoryOptionCombo categoryOptionCombo = null; + DataElementCategoryOptionCombo categoryOptionCombo; if ( co != null ) { @@ -285,7 +285,7 @@ return; } - DataElementCategoryOptionCombo categoryOptionCombo = null; + DataElementCategoryOptionCombo categoryOptionCombo; if ( co != null ) { === 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-06-09 08:37:13 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java 2015-07-08 05:42:56 +0000 @@ -28,17 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_CSV; -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.io.InputStream; -import java.util.Date; -import java.util.Set; - -import javax.servlet.http.HttpServletResponse; - import org.hisp.dhis.dxf2.common.IdSchemes; import org.hisp.dhis.dxf2.common.ImportOptions; import org.hisp.dhis.dxf2.common.JacksonUtils; @@ -55,6 +44,14 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.util.Date; +import java.util.Set; + +import static org.hisp.dhis.webapi.utils.ContextUtils.*; + /** * @author Lars Helge Overland */ @@ -85,9 +82,9 @@ { response.setContentType( CONTENT_TYPE_XML ); - DataExportParams params = dataValueSetService.getFromUrl( dataSet, period, + DataExportParams params = dataValueSetService.getFromUrl( dataSet, period, startDate, endDate, orgUnit, children, lastUpdated, limit, idSchemes ); - + dataValueSetService.writeDataValueSetXml( params, response.getOutputStream() ); } @@ -105,9 +102,9 @@ { response.setContentType( CONTENT_TYPE_JSON ); - DataExportParams params = dataValueSetService.getFromUrl( dataSet, period, + DataExportParams params = dataValueSetService.getFromUrl( dataSet, period, startDate, endDate, orgUnit, children, lastUpdated, limit, idSchemes ); - + dataValueSetService.writeDataValueSetJson( params, response.getOutputStream() ); } @@ -126,9 +123,9 @@ { response.setContentType( CONTENT_TYPE_CSV ); - DataExportParams params = dataValueSetService.getFromUrl( dataSet, period, + DataExportParams params = dataValueSetService.getFromUrl( dataSet, period, startDate, endDate, orgUnit, children, lastUpdated, limit, idSchemes ); - + dataValueSetService.writeDataValueSetCsv( params, response.getWriter() ); } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java 2015-07-04 16:43:29 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/EventAnalyticsController.java 2015-07-08 05:42:56 +0000 @@ -28,13 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import static org.hisp.dhis.analytics.AnalyticsService.NAMES_META_KEY; - -import java.util.Map; -import java.util.Set; - -import javax.servlet.http.HttpServletResponse; - import org.hisp.dhis.analytics.AggregationType; import org.hisp.dhis.analytics.EventOutputType; import org.hisp.dhis.analytics.SortOrder; @@ -56,6 +49,12 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; +import javax.servlet.http.HttpServletResponse; +import java.util.Map; +import java.util.Set; + +import static org.hisp.dhis.analytics.AnalyticsService.NAMES_META_KEY; + /** * @author Lars Helge Overland */ @@ -101,7 +100,7 @@ HttpServletResponse response ) throws Exception { EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, - value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, + value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING ); @@ -135,7 +134,7 @@ HttpServletResponse response ) throws Exception { EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, - value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, + value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xml", false ); @@ -167,7 +166,7 @@ HttpServletResponse response ) throws Exception { EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, - value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, + value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.xls", true ); @@ -199,7 +198,7 @@ HttpServletResponse response ) throws Exception { EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, - value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, + value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.csv", true ); @@ -231,7 +230,7 @@ HttpServletResponse response ) throws Exception { EventQueryParams params = analyticsService.getFromUrl( program, stage, startDate, endDate, dimension, filter, - value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, + value, aggregationType, skipMeta, skipRounding, hierarchyMeta, showHierarchy, sortOrder, limit, outputType, collapseDataDimensions, aggregateData, displayProperty, i18nManager.getI18nFormat() ); contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING, "events.html", false ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IndexController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IndexController.java 2015-04-29 07:11:23 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/IndexController.java 2015-07-08 05:42:56 +0000 @@ -28,11 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.lang3.StringUtils; import org.hisp.dhis.node.NodeUtils; import org.hisp.dhis.node.types.CollectionNode; @@ -49,6 +44,10 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + /** * @author Morten Olav Hansen */ === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java 2015-03-03 16:18:51 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MaintenanceController.java 2015-07-08 05:42:56 +0000 @@ -28,15 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - import org.hisp.dhis.analytics.partition.PartitionManager; import org.hisp.dhis.cache.HibernateCacheManager; import org.hisp.dhis.common.IdentifiableObject; @@ -48,6 +39,7 @@ import org.hisp.dhis.dxf2.schema.SchemaValidator; import org.hisp.dhis.dxf2.schema.ValidationViolation; import org.hisp.dhis.maintenance.MaintenanceService; +import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.resourcetable.ResourceTableService; import org.hisp.dhis.schema.Property; import org.hisp.dhis.schema.Schema; @@ -59,6 +51,14 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * @author Lars Helge Overland */ @@ -91,10 +91,20 @@ @Autowired private RenderService renderService; - + @Autowired private ResourceTableService resourceTableService; + @Autowired + private OrganisationUnitService organisationUnitService; + + @RequestMapping( value = "/ouPathUpdate", method = { RequestMethod.PUT, RequestMethod.POST } ) + @PreAuthorize( "hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')" ) + public void forceUpdatePaths() + { + organisationUnitService.forceUpdatePaths(); + } + @RequestMapping( value = "/periodPruning", method = { RequestMethod.PUT, RequestMethod.POST } ) @PreAuthorize( "hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')" ) public void prunePeriods() @@ -115,14 +125,14 @@ { resourceTableService.dropAllSqlViews(); } - + @RequestMapping( value = "/createSqlViews", method = { RequestMethod.PUT, RequestMethod.POST } ) @PreAuthorize( "hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')" ) public void createSqlViews() { resourceTableService.createAllSqlViews(); } - + @RequestMapping( value = "/categoryOptionComboUpdate", method = { RequestMethod.PUT, RequestMethod.POST } ) @PreAuthorize( "hasRole('ALL') or hasRole('F_PERFORM_MAINTENANCE')" ) public void updateCategoryOptionCombos() === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java 2015-03-16 13:12:20 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MessageConversationController.java 2015-07-08 05:42:56 +0000 @@ -28,14 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import com.google.common.collect.Lists; import org.hisp.dhis.common.Pager; import org.hisp.dhis.dxf2.common.ImportOptions; import org.hisp.dhis.dxf2.common.JacksonUtils; @@ -71,7 +64,12 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; -import com.google.common.collect.Lists; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; /** * @author Morten Olav Hansen @@ -277,7 +275,7 @@ @RequestMapping( value = "/{uid}/read", method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE } ) public @ResponseBody RootNode markMessageConversationRead( - @PathVariable String uid, @RequestParam ( required = false ) String userUid, HttpServletResponse response ) + @PathVariable String uid, @RequestParam( required = false ) String userUid, HttpServletResponse response ) { return modifyMessageConversationRead( userUid, new String[]{ uid }, response, true ); } @@ -295,7 +293,7 @@ @RequestMapping( value = "/{uid}/unread", method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE } ) public @ResponseBody RootNode markMessageConversationUnread( - @PathVariable String uid, @RequestParam ( required = false ) String userUid, HttpServletResponse response ) + @PathVariable String uid, @RequestParam( required = false ) String userUid, HttpServletResponse response ) { return modifyMessageConversationRead( userUid, new String[]{ uid }, response, false ); } @@ -566,6 +564,7 @@ /** * Internal handler for setting the read property of MessageConversation. + * * @param readValue true when setting as read, false when setting unread. */ private RootNode modifyMessageConversationRead( String userUid, String[] uids, HttpServletResponse response, boolean readValue ) @@ -603,7 +602,7 @@ for ( org.hisp.dhis.message.MessageConversation conversation : messageConversations ) { - boolean success = ( readValue ? conversation.markRead( user ) : conversation.markUnread( user ) ); + boolean success = (readValue ? conversation.markRead( user ) : conversation.markUnread( user )); if ( success ) { messageService.updateMessageConversation( conversation ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java 2015-02-17 06:00:52 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/MetaDataController.java 2015-07-08 05:42:56 +0000 @@ -28,13 +28,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.dxf2.common.ImportOptions; +import org.hisp.dhis.dxf2.common.JacksonUtils; import org.hisp.dhis.dxf2.metadata.ExportService; -import org.hisp.dhis.dxf2.common.ImportOptions; import org.hisp.dhis.dxf2.metadata.ImportService; import org.hisp.dhis.dxf2.metadata.ImportSummary; import org.hisp.dhis.dxf2.metadata.MetaData; import org.hisp.dhis.dxf2.metadata.tasks.ImportMetaDataTask; -import org.hisp.dhis.dxf2.common.JacksonUtils; import org.hisp.dhis.importexport.ImportStrategy; import org.hisp.dhis.scheduling.TaskCategory; import org.hisp.dhis.scheduling.TaskId; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java 2015-06-15 13:44:20 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/PdfFormController.java 2015-07-08 05:42:56 +0000 @@ -33,9 +33,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hisp.dhis.common.IdentifiableProperty; +import org.hisp.dhis.commons.util.StreamUtils; import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.dxf2.common.ImportOptions; import org.hisp.dhis.dxf2.datavalueset.DataValueSetService; -import org.hisp.dhis.dxf2.common.ImportOptions; import org.hisp.dhis.dxf2.pdfform.PdfDataEntryFormService; import org.hisp.dhis.dxf2.pdfform.PdfDataEntryFormUtil; import org.hisp.dhis.dxf2.pdfform.PdfFormFontSettings; @@ -46,7 +47,6 @@ import org.hisp.dhis.scheduling.TaskCategory; import org.hisp.dhis.scheduling.TaskId; import org.hisp.dhis.system.notification.Notifier; -import org.hisp.dhis.commons.util.StreamUtils; import org.hisp.dhis.user.CurrentUserService; import org.hisp.dhis.webapi.utils.ContextUtils; import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy; === 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-06-15 13:44:20 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ReportController.java 2015-07-08 05:42:56 +0000 @@ -31,6 +31,7 @@ import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.j2ee.servlets.BaseHttpServlet; import net.sf.jasperreports.j2ee.servlets.ImageServlet; +import org.hisp.dhis.commons.util.CodecUtils; import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.i18n.I18nManager; import org.hisp.dhis.organisationunit.OrganisationUnitService; @@ -40,7 +41,6 @@ import org.hisp.dhis.report.Report; import org.hisp.dhis.report.ReportService; import org.hisp.dhis.schema.descriptors.ReportSchemaDescriptor; -import org.hisp.dhis.commons.util.CodecUtils; import org.hisp.dhis.webapi.utils.ContextUtils; import org.hisp.dhis.webapi.utils.ContextUtils.CacheStrategy; import org.joda.time.DateTime; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchedulingController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchedulingController.java 2015-02-19 08:48:07 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SchedulingController.java 2015-07-08 05:42:56 +0000 @@ -28,22 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import static org.hisp.dhis.scheduling.SchedulingManager.TASK_ANALYTICS_ALL; -import static org.hisp.dhis.scheduling.SchedulingManager.TASK_ANALYTICS_LAST_3_YEARS; -import static org.hisp.dhis.scheduling.SchedulingManager.TASK_DATAMART_LAST_YEAR; -import static org.hisp.dhis.scheduling.SchedulingManager.TASK_DATA_SYNCH; -import static org.hisp.dhis.scheduling.SchedulingManager.TASK_MONITORING_LAST_DAY; -import static org.hisp.dhis.scheduling.SchedulingManager.TASK_RESOURCE_TABLE; -import static org.hisp.dhis.scheduling.SchedulingManager.TASK_RESOURCE_TABLE_15_MINS; -import static org.hisp.dhis.system.scheduling.Scheduler.CRON_DAILY_0AM; -import static org.hisp.dhis.system.scheduling.Scheduler.CRON_EVERY_15MIN; -import static org.hisp.dhis.system.scheduling.Scheduler.CRON_EVERY_MIN; - -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.hisp.dhis.common.ListMap; import org.hisp.dhis.dxf2.common.JacksonUtils; import org.hisp.dhis.scheduling.SchedulingManager; @@ -57,6 +41,13 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +import static org.hisp.dhis.scheduling.SchedulingManager.*; +import static org.hisp.dhis.system.scheduling.Scheduler.*; + /** * @author Lars Helge Overland */ @@ -71,7 +62,7 @@ @Autowired private SchedulingManager schedulingManager; - + @PreAuthorize( "hasRole('ALL') or hasRole('F_SCHEDULING_ADMIN')" ) @ResponseStatus( value = HttpStatus.OK ) @RequestMapping( method = { RequestMethod.POST, RequestMethod.PUT }, consumes = { ContextUtils.CONTENT_TYPE_JSON } ) @@ -79,7 +70,7 @@ throws IOException { SchedulingStrategy strategy = JacksonUtils.fromJson( request.getInputStream(), SchedulingStrategy.class ); - + ListMap cronKeyMap = new ListMap<>(); // ------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SharingController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SharingController.java 2015-02-17 06:00:52 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SharingController.java 2015-07-08 05:42:56 +0000 @@ -28,14 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.io.IOException; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -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.acl.AccessStringHelper; @@ -61,6 +53,13 @@ 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.Collections; +import java.util.Iterator; +import java.util.List; + /** * @author Morten Olav Hansen */ @@ -156,7 +155,7 @@ } Collections.sort( sharing.getObject().getUserGroupAccesses(), SharingUserGroupAccessNameComparator.INSTANCE ); - + JacksonUtils.toJson( response.getOutputStream(), sharing ); } @@ -265,13 +264,13 @@ ContextUtils.conflictResponse( response, "Search key not specified" ); return; } - + int max = pageSize != null ? pageSize : Integer.MAX_VALUE; - + SharingUserGroups sharingUserGroups = new SharingUserGroups(); List userGroups = userGroupService.getUserGroupsBetweenByName( key, 0, max ); - + for ( UserGroup userGroup : userGroups ) { SharingUserGroupAccess sharingUserGroupAccess = new SharingUserGroupAccess(); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SmsConfigurationController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SmsConfigurationController.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SmsConfigurationController.java 2015-07-08 05:42:56 +0000 @@ -28,19 +28,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; - -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.webapi.utils.ContextUtils; import org.hisp.dhis.sms.config.GenericHttpGatewayConfig; import org.hisp.dhis.sms.config.SmsConfiguration; import org.hisp.dhis.sms.config.SmsConfigurationManager; import org.hisp.dhis.sms.config.SmsGatewayConfig; +import org.hisp.dhis.webapi.utils.ContextUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -49,6 +43,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; + @Controller @RequestMapping( value = SmsConfigurationController.RESOURCE_PATH ) public class SmsConfigurationController @@ -59,7 +58,7 @@ @Autowired private SmsConfigurationManager smsConfigurationManager; - + @RequestMapping( method = RequestMethod.GET ) public String getSmsConfiguration( Model model ) { @@ -75,32 +74,32 @@ return "smsConfiguration"; } - @RequestMapping( value="test", method = RequestMethod.GET ) + @RequestMapping( value = "test", method = RequestMethod.GET ) public String getTest( Model model ) { SmsConfiguration smsConfiguration = new SmsConfiguration(); - SmsGatewayConfig gatewayConfig = new GenericHttpGatewayConfig("http://storset.org/", new HashMap()); + SmsGatewayConfig gatewayConfig = new GenericHttpGatewayConfig( "http://storset.org/", new HashMap() ); smsConfiguration.setGateways( Collections.singletonList( gatewayConfig ) ); - + model.addAttribute( "model", smsConfiguration ); model.addAttribute( "viewClass", "detailed" ); return "smsConfiguration"; } - + //-------------------------------------------------------------------------- // POST //-------------------------------------------------------------------------- @RequestMapping( method = RequestMethod.PUT ) - public String putSmsConfig( @RequestBody SmsConfiguration smsConfiguration, Model model ) throws Exception + public String putSmsConfig( @RequestBody SmsConfiguration smsConfiguration, Model model ) throws Exception { if ( smsConfiguration == null ) { - throw new IllegalArgumentException(); + throw new IllegalArgumentException(); } smsConfigurationManager.updateSmsConfiguration( smsConfiguration ); @@ -109,7 +108,7 @@ @ExceptionHandler - public void mapException(IllegalArgumentException exception, HttpServletResponse response ) throws IOException + public void mapException( IllegalArgumentException exception, HttpServletResponse response ) throws IOException { log.info( "Exception", exception ); response.setStatus( HttpServletResponse.SC_CONFLICT ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java 2015-06-15 13:44:20 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SvgConversionController.java 2015-07-08 05:42:56 +0000 @@ -28,12 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.awt.Color; -import java.io.OutputStream; -import java.io.StringReader; - -import javax.servlet.http.HttpServletResponse; - import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderOutput; @@ -49,23 +43,28 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; +import javax.servlet.http.HttpServletResponse; +import java.awt.*; +import java.io.OutputStream; +import java.io.StringReader; + import static org.hisp.dhis.system.util.GeoUtils.replaceUnsafeSvgText; @Controller @RequestMapping public class SvgConversionController -{ +{ @Autowired private ContextUtils contextUtils; - + @RequestMapping( value = "/svg.png", method = RequestMethod.POST, consumes = ContextUtils.CONTENT_TYPE_FORM_ENCODED ) public void toPng( @RequestParam String svg, @RequestParam( required = false ) String filename, HttpServletResponse response ) throws Exception { - String name = filename != null ? ( CodecUtils.filenameEncode( filename ) + ".png" ) : "file.png"; - - contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PNG, CacheStrategy.NO_CACHE, name, true ); - + String name = filename != null ? (CodecUtils.filenameEncode( filename ) + ".png") : "file.png"; + + contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PNG, CacheStrategy.NO_CACHE, name, true ); + convertToPng( svg, response.getOutputStream() ); } @@ -73,22 +72,22 @@ public void toPdf( @RequestParam String svg, @RequestParam( required = false ) String filename, HttpServletResponse response ) throws Exception { - String name = filename != null ? ( CodecUtils.filenameEncode( filename ) + ".pdf" ) : "file.pdf"; - - contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, CacheStrategy.NO_CACHE, name, true ); - + String name = filename != null ? (CodecUtils.filenameEncode( filename ) + ".pdf") : "file.pdf"; + + contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_PDF, CacheStrategy.NO_CACHE, name, true ); + convertToPdf( svg, response.getOutputStream() ); } // ------------------------------------------------------------------------- // Supportive methods // ------------------------------------------------------------------------- - + private void convertToPng( String svg, OutputStream out ) throws TranscoderException { svg = replaceUnsafeSvgText( svg ); - + PNGTranscoder t = new PNGTranscoder(); t.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, Color.WHITE ); @@ -104,7 +103,7 @@ throws TranscoderException { svg = replaceUnsafeSvgText( svg ); - + PDFTranscoder t = new PDFTranscoder(); TranscoderInput input = new TranscoderInput( new StringReader( svg ) ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SynchronizationController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SynchronizationController.java 2015-02-17 06:00:52 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/SynchronizationController.java 2015-07-08 05:42:56 +0000 @@ -28,10 +28,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.dxf2.common.JacksonUtils; import org.hisp.dhis.dxf2.importsummary.ImportSummary; import org.hisp.dhis.dxf2.synch.AvailabilityStatus; import org.hisp.dhis.dxf2.synch.SynchronizationManager; -import org.hisp.dhis.dxf2.common.JacksonUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping;