dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42473
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21371: Merged trunk changes
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
Morten Olav Hansen (mortenoh)
------------------------------------------------------------
revno: 21371 [merge]
committer: Ken Haase <kh@xxxxxxxxxxxxx>
branch nick: bzr.trunk
timestamp: Wed 2016-01-13 06:54:04 -0500
message:
Merged trunk changes
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValue.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValue.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportDataValueForm.vm
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/filteredMetaDataExport.js
--
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-api/src/main/java/org/hisp/dhis/schema/Schema.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java 2016-01-13 08:24:11 +0000
@@ -443,8 +443,8 @@
{
this.propertyMap = propertyMap;
}
-
- @SuppressWarnings("rawtypes")
+
+ @SuppressWarnings( "rawtypes" )
private Set<Class> references;
@JsonProperty
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValue.java 2016-01-07 12:15:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValue.java 2016-01-13 11:05:50 +0000
@@ -77,6 +77,16 @@
private String value;
// -------------------------------------------------------------------------
+ // Transient properties
+ // -------------------------------------------------------------------------
+
+ private transient boolean auditValueIsSet = false;
+
+ private transient boolean valueIsSet = false;
+
+ private transient String auditValue;
+
+ // -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -278,6 +288,14 @@
*/
public void setValue( String value )
{
+ if ( !auditValueIsSet )
+ {
+ this.auditValue = valueIsSet ? this.value : value;
+ auditValueIsSet = true;
+ }
+
+ valueIsSet = true;
+
this.value = value;
}
@@ -308,4 +326,9 @@
{
this.entityInstance = entityInstance;
}
-}
+
+ public String getAuditValue()
+ {
+ return auditValue;
+ }
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValue.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValue.java 2016-01-13 11:05:50 +0000
@@ -63,6 +63,16 @@
private String storedBy;
// -------------------------------------------------------------------------
+ // Transient properties
+ // -------------------------------------------------------------------------
+
+ private transient boolean auditValueIsSet = false;
+
+ private transient boolean valueIsSet = false;
+
+ private transient String auditValue;
+
+ // -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -75,7 +85,7 @@
{
this.dataElement = dataElement;
this.programStageInstance = programStageInstance;
- this.value = value;
+ setValue( value );
}
public void setAutoFields()
@@ -215,6 +225,14 @@
public void setValue( String value )
{
+ if ( !auditValueIsSet )
+ {
+ this.auditValue = valueIsSet ? this.value : value;
+ auditValueIsSet = true;
+ }
+
+ valueIsSet = true;
+
this.value = value;
}
@@ -232,4 +250,9 @@
{
this.storedBy = storedBy;
}
+
+ public String getAuditValue()
+ {
+ return auditValue;
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java 2016-01-07 10:06:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java 2016-01-13 11:05:50 +0000
@@ -76,7 +76,7 @@
public void deleteTrackedEntityAttributeValue( TrackedEntityAttributeValue attributeValue )
{
TrackedEntityAttributeValueAudit trackedEntityAttributeValueAudit = new TrackedEntityAttributeValueAudit( attributeValue,
- attributeValue.getValue(), currentUserService.getCurrentUsername(), AuditType.DELETE );
+ attributeValue.getAuditValue(), currentUserService.getCurrentUsername(), AuditType.DELETE );
trackedEntityAttributeValueAuditService.addTrackedEntityAttributeValueAudit( trackedEntityAttributeValueAudit );
attributeValueStore.delete( attributeValue );
@@ -140,7 +140,7 @@
else
{
TrackedEntityAttributeValueAudit trackedEntityAttributeValueAudit = new TrackedEntityAttributeValueAudit( attributeValue,
- attributeValue.getValue(), currentUserService.getCurrentUsername(), AuditType.UPDATE );
+ attributeValue.getAuditValue(), currentUserService.getCurrentUsername(), AuditType.UPDATE );
trackedEntityAttributeValueAuditService.addTrackedEntityAttributeValueAudit( trackedEntityAttributeValueAudit );
attributeValueStore.update( attributeValue );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentitydatavalue/DefaultTrackedEntityDataValueService.java 2016-01-13 11:05:50 +0000
@@ -97,7 +97,8 @@
trackedEntityDataValue.setStoredBy( currentUserService.getCurrentUsername() );
}
- TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( trackedEntityDataValue, trackedEntityDataValue.getValue(), trackedEntityDataValue.getStoredBy(), AuditType.UPDATE );
+ TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( trackedEntityDataValue, trackedEntityDataValue.getAuditValue(),
+ trackedEntityDataValue.getStoredBy(), AuditType.UPDATE );
dataValueAuditService.addTrackedEntityDataValueAudit( dataValueAudit );
dataValueStore.update( trackedEntityDataValue );
@@ -107,7 +108,7 @@
@Override
public void deleteTrackedEntityDataValue( TrackedEntityDataValue dataValue )
{
- TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getValue(),
+ TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getAuditValue(),
currentUserService.getCurrentUsername(), AuditType.DELETE );
dataValueAuditService.addTrackedEntityDataValueAudit( dataValueAudit );
@@ -122,7 +123,7 @@
for ( TrackedEntityDataValue dataValue : dataValues )
{
- TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getValue(), username, AuditType.DELETE );
+ TrackedEntityDataValueAudit dataValueAudit = new TrackedEntityDataValueAudit( dataValue, dataValue.getAuditValue(), username, AuditType.DELETE );
dataValueAuditService.addTrackedEntityDataValueAudit( dataValueAudit );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2015-09-27 17:36:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml 2016-01-13 10:01:42 +0000
@@ -20,13 +20,13 @@
<property name="layer" not-null="true" />
- <list name="dataDimensionItems" table="mapview_datadimensionitems" cascade="all, delete-orphan">
- <cache usage="read-write" />
- <key column="mapviewid" foreign-key="fk_mapview_datadimensionitems_mapviewid" />
- <list-index column="sort_order" base="0" />
- <many-to-many column="datadimensionitemid" class="org.hisp.dhis.common.DataDimensionItem"
+ <list name="dataDimensionItems" table="mapview_datadimensionitems" cascade="all, delete-orphan">
+ <cache usage="read-write" />
+ <key column="mapviewid" foreign-key="fk_mapview_datadimensionitems_mapviewid" />
+ <list-index column="sort_order" base="0" />
+ <many-to-many column="datadimensionitemid" class="org.hisp.dhis.common.DataDimensionItem"
foreign-key="fk_mapview_datadimensionitems_datadimensionitemid" />
- </list>
+ </list>
<list name="organisationUnits" table="mapview_organisationunits">
<cache usage="read-write" />
@@ -61,10 +61,10 @@
<many-to-many column="orgunitgroupid" class="org.hisp.dhis.organisationunit.OrganisationUnitGroup"
foreign-key="fk_mapview_itemorgunitgroups_orgunitgroupid" />
</list>
-
+
<many-to-one name="program" class="org.hisp.dhis.program.Program" column="programid"
foreign-key="fk_reporttable_programid" />
-
+
<property name="userOrganisationUnit" />
<property name="userOrganisationUnitChildren" />
@@ -92,18 +92,18 @@
column="orgunitgroupsetid" foreign-key="fk_mapview_orgunitgroupsetid" />
<property name="areaRadius" />
-
- <property name="hidden" />
-
- <property name="labels" />
-
- <property name="labelFontSize" />
-
- <property name="labelFontWeight" />
-
- <property name="labelFontStyle" />
-
- <property name="labelFontColor" />
+
+ <property name="hidden" />
+
+ <property name="labels" />
+
+ <property name="labelFontSize" />
+
+ <property name="labelFontWeight" />
+
+ <property name="labelFontStyle" />
+
+ <property name="labelFontColor" />
</class>
</hibernate-mapping>
=== 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 2016-01-08 14:23:25 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/EventController.java 2016-01-13 09:18:47 +0000
@@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.google.common.collect.Lists;
import com.google.common.io.ByteSource;
import org.apache.commons.io.IOUtils;
import org.hisp.dhis.common.IdSchemes;
@@ -56,11 +57,15 @@
import org.hisp.dhis.dxf2.webmessage.WebMessageException;
import org.hisp.dhis.dxf2.webmessage.responses.FileResourceWebMessageResponse;
import org.hisp.dhis.event.EventStatus;
+import org.hisp.dhis.fieldfilter.FieldFilterService;
import org.hisp.dhis.fileresource.FileResource;
import org.hisp.dhis.fileresource.FileResourceDomain;
import org.hisp.dhis.fileresource.FileResourceService;
import org.hisp.dhis.fileresource.FileResourceStorageStatus;
import org.hisp.dhis.importexport.ImportStrategy;
+import org.hisp.dhis.node.NodeUtils;
+import org.hisp.dhis.node.Preset;
+import org.hisp.dhis.node.types.RootNode;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.program.ProgramStatus;
@@ -68,6 +73,7 @@
import org.hisp.dhis.scheduling.TaskId;
import org.hisp.dhis.system.scheduling.Scheduler;
import org.hisp.dhis.user.CurrentUserService;
+import org.hisp.dhis.webapi.service.ContextService;
import org.hisp.dhis.webapi.service.WebMessageService;
import org.hisp.dhis.webapi.utils.ContextUtils;
import org.hisp.dhis.webapi.utils.WebMessageUtils;
@@ -82,6 +88,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -144,13 +151,19 @@
@Autowired
private FileResourceService fileResourceService;
+ @Autowired
+ protected FieldFilterService fieldFilterService;
+
+ @Autowired
+ protected ContextService contextService;
+
// -------------------------------------------------------------------------
// READ
// -------------------------------------------------------------------------
@RequestMapping( value = "", method = RequestMethod.GET )
@PreAuthorize( "hasRole('ALL') or hasRole('F_TRACKED_ENTITY_DATAVALUE_ADD')" )
- public String getEvents(
+ public @ResponseBody RootNode getEvents(
@RequestParam( required = false ) String program,
@RequestParam( required = false ) String programStage,
@RequestParam( required = false ) ProgramStatus programStatus,
@@ -174,6 +187,12 @@
throws WebMessageException
{
WebOptions options = new WebOptions( parameters );
+ List<String> fields = Lists.newArrayList( contextService.getParameterValues( "fields" ) );
+
+ if ( fields.isEmpty() )
+ {
+ fields.addAll( Preset.ALL.getFields() );
+ }
DataElementCategoryOptionCombo attributeOptionCombo = inputUtils.getAttributeOptionCombo( attributeCc, attributeCos );
@@ -205,7 +224,16 @@
response.addHeader( "Content-Disposition", "attachment; filename=" + attachment );
}
- return "events";
+ RootNode rootNode = NodeUtils.createMetadata();
+
+ if ( events.getPager() != null )
+ {
+ rootNode.addChild( NodeUtils.createPager( events.getPager() ) );
+ }
+
+ rootNode.addChild( fieldFilterService.filter( Event.class, events.getEvents(), fields ) );
+
+ return rootNode;
}
@RequestMapping( value = "", method = RequestMethod.GET, produces = { "application/csv", "application/csv+gzip", "text/csv" } )
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js 2016-01-12 11:24:22 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js 2016-01-13 10:04:35 +0000
@@ -2972,11 +2972,13 @@
// remove
delete view.periodType;
+ delete view.dataDimensionItems;
views.push(view);
}
map = {
+ name: record.data.name,
longitude: lonlat.lon,
latitude: lonlat.lat,
zoom: gis.olmap.getZoom(),
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js 2015-04-14 08:25:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.selected.js 2016-01-13 08:24:11 +0000
@@ -228,7 +228,7 @@
};
if( context.like !== undefined && context.like.length > 0 ) {
- request.data.filter = 'name:like:' + context.like;
+ request.data.filter = 'displayName:like:' + context.like;
}
context.searchButton.find('i').removeClass('fa-search');
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportDataValueForm.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportDataValueForm.vm 2015-08-03 22:22:21 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/exportDataValueForm.vm 2016-01-13 08:24:11 +0000
@@ -1,28 +1,28 @@
<script type="text/javascript">
- jQuery(document).ready(function() {
- datePickerInRange( 'startDate' , 'endDate' );
-
- selectionTreeSelection.setMultipleSelectionAllowed( true );
- selectionTree.clearSelectedOrganisationUnitsAndBuildTree();
-
- jQuery("#availableDataSets").dhisAjaxSelect({
- source: "../api/dataSets.json?links=false&paging=false",
- iterator: "dataSets",
- connectedTo: 'selectedDataSets',
- handler: function(item) {
- var option = jQuery("<option />");
- option.text( item.name );
- option.attr( "value", item.id );
-
- return option;
- }
- });
- });
-
- var i18n_select_organisation_unit = '$encoder.jsEscape( $i18n.getString( "select_organisation_unit" ), "'")';
- var i18n_select_startdate = '$encoder.jsEscape( $i18n.getString( "select_startdate" ), "'")';
- var i18n_select_enddate = '$encoder.jsEscape( $i18n.getString( "select_enddate" ), "'")';
- var i18n_select_datasets = '$encoder.jsEscape( $i18n.getString( "select_datasets" ), "'")';
+ jQuery(document).ready(function() {
+ datePickerInRange('startDate', 'endDate');
+
+ selectionTreeSelection.setMultipleSelectionAllowed(true);
+ selectionTree.clearSelectedOrganisationUnitsAndBuildTree();
+
+ jQuery("#availableDataSets").dhisAjaxSelect({
+ source: "../api/dataSets.json?links=false&paging=false",
+ iterator: "dataSets",
+ connectedTo: 'selectedDataSets',
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text(item.displayName);
+ option.attr("value", item.id);
+
+ return option;
+ }
+ });
+ });
+
+ var i18n_select_organisation_unit = '$encoder.jsEscape( $i18n.getString( "select_organisation_unit" ), "'")';
+ var i18n_select_startdate = '$encoder.jsEscape( $i18n.getString( "select_startdate" ), "'")';
+ var i18n_select_enddate = '$encoder.jsEscape( $i18n.getString( "select_enddate" ), "'")';
+ var i18n_select_datasets = '$encoder.jsEscape( $i18n.getString( "select_datasets" ), "'")';
</script>
<h3>$i18n.getString( "data_export" ) #openHelp( "export" )</h3>
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/filteredMetaDataExport.js'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/filteredMetaDataExport.js 2015-06-30 21:58:15 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/filteredMetaDataExport.js 2016-01-13 08:25:17 +0000
@@ -190,14 +190,14 @@
function loadMetaData( metaDataCategoryName )
{
$( "#available" + metaDataCategoryName ).dhisAjaxSelect( {
- source: "../api/" + lowercaseFirstLetter( metaDataCategoryName ) + ".json?links=false&paging=false",
+ source: "../api/" + lowercaseFirstLetter( metaDataCategoryName ) + ".json?paging=false",
iterator: lowercaseFirstLetter( metaDataCategoryName ),
connectedTo: "selected" + metaDataCategoryName,
handler: function ( item )
{
var option = jQuery( "<option/>" );
- option.text( item.name );
- option.attr( "name", item.name );
+ option.text( item.displayName );
+ option.attr( "name", item.displayName );
option.attr( "value", item.id );
return option;