dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35934
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18403: minor fixes to controllers, use selected MergeStrategy
------------------------------------------------------------
revno: 18403
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-02-25 13:51:55 +0700
message:
minor fixes to controllers, use selected MergeStrategy
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/event/EventChartController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventReportController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.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/controller/user/UserController.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-02-25 06:32:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ChartController.java 2015-02-25 06:51:55 +0000
@@ -140,7 +140,7 @@
mergeChart( newChart );
- chart.mergeWith( newChart, MergeStrategy.MERGE_IF_NOT_NULL );
+ chart.mergeWith( newChart, importOptions.getMergeStrategy() );
chartService.updateChart( chart );
}
=== 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:32:18 +0000
+++ 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
@@ -28,19 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.common.DimensionalObjectUtils.getDimensions;
-import static org.hisp.dhis.webapi.utils.ContextUtils.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.ChartService;
import org.hisp.dhis.common.DimensionService;
-import org.hisp.dhis.common.MergeStrategy;
import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.eventchart.EventChart;
@@ -67,6 +56,15 @@
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.getDimensions;
+import static org.hisp.dhis.webapi.utils.ContextUtils.DATE_PATTERN;
+
/**
* @author Jan Henrik Overland
*/
@@ -77,7 +75,7 @@
{
@Autowired
private EventChartService eventChartService;
-
+
@Autowired
private ChartService chartService;
@@ -89,7 +87,7 @@
@Autowired
private ProgramStageService programStageService;
-
+
@Autowired
private OrganisationUnitService organisationUnitService;
@@ -98,7 +96,7 @@
@Autowired
private ContextUtils contextUtils;
-
+
//--------------------------------------------------------------------------
// CRUD
//--------------------------------------------------------------------------
@@ -132,7 +130,7 @@
mergeEventChart( newEventChart );
- eventChart.mergeWith( newEventChart, MergeStrategy.MERGE_IF_NOT_NULL );
+ eventChart.mergeWith( newEventChart, importOptions.getMergeStrategy() );
eventChartService.updateEventChart( eventChart );
}
@@ -184,7 +182,7 @@
ChartUtilities.writeChartAsPNG( response.getOutputStream(), jFreeChart, width, height );
}
-
+
//--------------------------------------------------------------------------
// Hooks
//--------------------------------------------------------------------------
@@ -196,7 +194,7 @@
eventChart.populateAnalyticalProperties();
Set<OrganisationUnit> roots = currentUserService.getCurrentUser().getDataViewOrganisationUnitsWithFallback();
-
+
for ( OrganisationUnit organisationUnit : eventChart.getOrganisationUnits() )
{
eventChart.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/EventReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventReportController.java 2015-02-25 06:32:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventReportController.java 2015-02-25 06:51:55 +0000
@@ -28,15 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.common.DimensionalObjectUtils.getDimensions;
-
-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.MergeStrategy;
import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.eventreport.EventReport;
@@ -56,6 +48,12 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Set;
+
+import static org.hisp.dhis.common.DimensionalObjectUtils.getDimensions;
+
/**
* @author Lars Helge Overland
*/
@@ -112,7 +110,7 @@
mergeEventReport( newReport );
- report.mergeWith( newReport, MergeStrategy.MERGE_IF_NOT_NULL );
+ report.mergeWith( newReport, importOptions.getMergeStrategy() );
eventReportService.updateEventReport( report );
}
@@ -143,7 +141,7 @@
report.populateAnalyticalProperties();
Set<OrganisationUnit> roots = currentUserService.getCurrentUser().getDataViewOrganisationUnitsWithFallback();
-
+
for ( OrganisationUnit organisationUnit : report.getOrganisationUnits() )
{
report.getParentGraphMap().put( organisationUnit.getUid(), organisationUnit.getParentGraph( roots ) );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.java 2015-02-25 06:32:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/legend/LegendSetController.java 2015-02-25 06:51:55 +0000
@@ -28,7 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.hisp.dhis.common.MergeStrategy;
import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.legend.Legend;
@@ -105,7 +104,7 @@
legendService.addLegend( legend );
}
- legendSet.mergeWith( newLegendSet, MergeStrategy.MERGE_IF_NOT_NULL );
+ legendSet.mergeWith( newLegendSet, importOptions.getMergeStrategy() );
legendService.updateLegendSet( legendSet );
}
=== 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:32:18 +0000
+++ 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
@@ -28,19 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.webapi.utils.ContextUtils.DATE_PATTERN;
-
-import java.awt.image.BufferedImage;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.imageio.ImageIO;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.hisp.dhis.common.DimensionService;
-import org.hisp.dhis.common.MergeStrategy;
import org.hisp.dhis.dxf2.common.ImportOptions;
import org.hisp.dhis.dxf2.common.JacksonUtils;
import org.hisp.dhis.i18n.I18nFormat;
@@ -68,6 +56,16 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Set;
+
+import static org.hisp.dhis.webapi.utils.ContextUtils.DATE_PATTERN;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
* @author Lars Helge Overland
@@ -82,7 +80,7 @@
@Autowired
private MappingService mappingService;
-
+
@Autowired
private LegendService legendService;
@@ -166,7 +164,7 @@
mappingService.addMapView( view );
}
- map.mergeWith( newMap, MergeStrategy.MERGE_IF_NOT_NULL );
+ map.mergeWith( newMap, importOptions.getMergeStrategy() );
if ( newMap.getUser() == null )
{
@@ -239,7 +237,7 @@
I18nFormat format = i18nManager.getI18nFormat();
Set<OrganisationUnit> roots = currentUserService.getCurrentUser().getDataViewOrganisationUnitsWithFallback();
-
+
for ( MapView view : map.getMapViews() )
{
view.populateAnalyticalProperties();
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java 2015-02-25 06:32:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java 2015-02-25 06:51:55 +0000
@@ -363,7 +363,7 @@
}
ImportTypeSummary summary = importService.importObject( currentUserService.getCurrentUser().getUid(), parsed,
- ImportStrategy.UPDATE, MergeStrategy.MERGE_IF_NOT_NULL );
+ ImportStrategy.UPDATE, importOptions.getMergeStrategy() );
if ( summary.isStatus( ImportStatus.SUCCESS ) && summary.getImportCount().getUpdated() == 1 )
{
@@ -403,7 +403,7 @@
}
ImportTypeSummary summary = importService.importObject( currentUserService.getCurrentUser().getUid(), parsed,
- ImportStrategy.UPDATE, MergeStrategy.MERGE_IF_NOT_NULL );
+ ImportStrategy.UPDATE, importOptions.getMergeStrategy() );
if ( summary.isStatus( ImportStatus.SUCCESS ) && summary.getImportCount().getUpdated() == 1 )
{