dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26661
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13184: change to using uid only in ouwt/oust, wip
------------------------------------------------------------
revno: 13184
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-09 22:32:59 +0100
message:
change to using uid only in ouwt/oust, wip
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDataSetAssociationSet.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchy.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SearchEventsAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnit.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTreePartial.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseCollapse.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseExpand.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSelect.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/AddSelectedOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/CollapseSubtreeAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/ExpandSubtreeAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetExpandedTreeAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/RemoveSelectedOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/SetSelectedOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/hierarchyOperations.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnit.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/dataset/DataSetService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java 2013-11-19 10:57:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java 2013-12-09 21:32:59 +0000
@@ -103,6 +103,18 @@
DataSet getDataSet( int id, boolean i18nDataElements, boolean i18nIndicators, boolean i18nOrgUnits, boolean i18nSections );
/**
+ * Get a DataSet
+ *
+ * @param id The unique identifier for the DataSet to get.
+ * @param i18nDataElements whether to i18n the data elements of this data set.
+ * @param i18nIndicators whether to i18n the indicators of this data set.
+ * @param i18nOrgUnits whether to i18n the org units of this data set.
+ * @param i18nSections whether to i18n the sections of this data set.
+ * @return The DataSet with the given id or null if it does not exist.
+ */
+ DataSet getDataSet( String id, boolean i18nDataElements, boolean i18nIndicators, boolean i18nOrgUnits, boolean i18nSections );
+
+ /**
* Returns the DataSet with the given UID.
*
* @param uid the UID.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDataSetAssociationSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDataSetAssociationSet.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitDataSetAssociationSet.java 2013-12-09 21:32:59 +0000
@@ -43,48 +43,48 @@
/**
* List of data set association sets.
*/
- private List<Set<Integer>> dataSetAssociationSets = new ArrayList<Set<Integer>>();
-
+ private List<Set<String>> dataSetAssociationSets = new ArrayList<Set<String>>();
+
/**
* Mapping between organisation unit identifier and index of association set in list.
*/
- private Map<Integer, Integer> organisationUnitAssociationSetMap = new HashMap<Integer, Integer>();
+ private Map<String, Integer> organisationUnitAssociationSetMap = new HashMap<String, Integer>();
/**
* Set of distinct data sets in all association sets.
*/
- private Set<Integer> distinctDataSets = new HashSet<Integer>();
-
+ private Set<String> distinctDataSets = new HashSet<String>();
+
public OrganisationUnitDataSetAssociationSet()
{
}
- public List<Set<Integer>> getDataSetAssociationSets()
+ public List<Set<String>> getDataSetAssociationSets()
{
return dataSetAssociationSets;
}
- public void setDataSetAssociationSets( List<Set<Integer>> dataSetAssociationSets )
+ public void setDataSetAssociationSets( List<Set<String>> dataSetAssociationSets )
{
this.dataSetAssociationSets = dataSetAssociationSets;
}
- public Map<Integer, Integer> getOrganisationUnitAssociationSetMap()
+ public Map<String, Integer> getOrganisationUnitAssociationSetMap()
{
return organisationUnitAssociationSetMap;
}
- public void setOrganisationUnitAssociationSetMap( Map<Integer, Integer> organisationUnitAssociationSetMap )
+ public void setOrganisationUnitAssociationSetMap( Map<String, Integer> organisationUnitAssociationSetMap )
{
this.organisationUnitAssociationSetMap = organisationUnitAssociationSetMap;
}
- public Set<Integer> getDistinctDataSets()
+ public Set<String> getDistinctDataSets()
{
return distinctDataSets;
}
- public void setDistinctDataSets( Set<Integer> distinctDataSets )
+ public void setDistinctDataSets( Set<String> distinctDataSets )
{
this.distinctDataSets = distinctDataSets;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchy.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchy.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchy.java 2013-12-09 21:32:59 +0000
@@ -175,7 +175,7 @@
return new HashSet<Integer>( children );
}
-
+
public Set<Integer> getChildren( Collection<Integer> parentIds )
{
int capacity = parentIds.size() + 5;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java 2013-11-26 10:48:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java 2013-12-09 21:32:59 +0000
@@ -121,9 +121,9 @@
*/
Collection<OrganisationUnit> getOrganisationUnitsByNameAndGroups( String query, Collection<OrganisationUnitGroup> groups, boolean limit );
- Map<Integer, Set<Integer>> getOrganisationUnitDataSetAssocationMap();
+ Map<String, Set<String>> getOrganisationUnitDataSetAssocationMap();
- Map<Integer, Set<Integer>> getOrganisationUnitGroupDataSetAssocationMap();
+ Map<String, Set<String>> getOrganisationUnitGroupDataSetAssocationMap();
Set<Integer> getOrganisationUnitIdsWithoutData();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2013-12-03 10:29:25 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2013-12-09 21:32:59 +0000
@@ -162,7 +162,39 @@
if ( i18nSections && dataSet.hasSections() )
{
i18n( i18nService, dataSet.getSections() );
-
+
+ for ( Section section : dataSet.getSections() )
+ {
+ i18n( i18nService, section.getDataElements() );
+ }
+ }
+
+ return dataSet;
+ }
+
+ public DataSet getDataSet( String id, boolean i18nDataElements, boolean i18nIndicators, boolean i18nOrgUnits, boolean i18nSections )
+ {
+ DataSet dataSet = getDataSet( id );
+
+ if ( i18nDataElements )
+ {
+ i18n( i18nService, dataSet.getDataElements() );
+ }
+
+ if ( i18nIndicators )
+ {
+ i18n( i18nService, dataSet.getIndicators() );
+ }
+
+ if ( i18nOrgUnits )
+ {
+ i18n( i18nService, dataSet.getSources() );
+ }
+
+ if ( i18nSections && dataSet.hasSections() )
+ {
+ i18n( i18nService, dataSet.getSections() );
+
for ( Section section : dataSet.getSections() )
{
i18n( i18nService, section.getDataElements() );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2013-11-26 10:48:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2013-12-09 21:32:59 +0000
@@ -28,20 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
-
-import java.awt.geom.Point2D;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.commons.collections.CollectionUtils;
import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.dataset.DataSet;
@@ -58,6 +44,20 @@
import org.hisp.dhis.version.VersionService;
import org.springframework.transaction.annotation.Transactional;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
/**
* @author Torgeir Lorange Ostby
*/
@@ -278,39 +278,39 @@
public Collection<OrganisationUnit> getOrganisationUnits( Collection<OrganisationUnitGroup> groups, Collection<OrganisationUnit> parents )
{
Set<OrganisationUnit> members = new HashSet<OrganisationUnit>();
-
+
for ( OrganisationUnitGroup group : groups )
{
members.addAll( group.getMembers() );
}
-
+
if ( parents != null && !parents.isEmpty() )
{
Collection<OrganisationUnit> children = getOrganisationUnitsWithChildren( IdentifiableObjectUtils.getUids( parents ) );
-
+
members.retainAll( children );
}
-
+
return members;
}
-
+
public Collection<OrganisationUnit> getOrganisationUnitsWithChildren( Collection<String> parentUids )
{
Set<OrganisationUnit> units = new HashSet<OrganisationUnit>();
-
+
for ( String uid : parentUids )
{
units.addAll( getOrganisationUnitsWithChildren( uid ) );
}
-
+
return units;
}
-
+
public Collection<OrganisationUnit> getOrganisationUnitsWithChildren( String uid )
{
return getOrganisationUnitWithChildren( getOrganisationUnit( uid ).getId() );
}
-
+
public Collection<OrganisationUnit> getOrganisationUnitWithChildren( int id )
{
OrganisationUnit organisationUnit = getOrganisationUnit( id );
@@ -384,7 +384,7 @@
public Collection<OrganisationUnit> getOrganisationUnitsAtLevel( int level )
{
Collection<OrganisationUnit> roots = getRootOrganisationUnits();
-
+
if ( level == 1 )
{
return roots;
@@ -397,7 +397,7 @@
{
Set<OrganisationUnit> parents = new HashSet<OrganisationUnit>();
parents.add( parent );
-
+
return getOrganisationUnitsAtLevel( level, parent != null ? parents : null );
}
@@ -405,10 +405,10 @@
{
Set<Integer> levels = new HashSet<Integer>();
levels.add( level );
-
+
return getOrganisationUnitsAtLevels( levels, parents );
}
-
+
public Collection<OrganisationUnit> getOrganisationUnitsAtLevels( Collection<Integer> levels, Collection<OrganisationUnit> parents )
{
if ( parents == null || parents.isEmpty() )
@@ -417,24 +417,24 @@
}
Set<OrganisationUnit> result = new HashSet<OrganisationUnit>();
-
+
for ( Integer level : levels )
{
if ( level < 1 )
{
throw new IllegalArgumentException( "Level must be greater than zero" );
}
-
+
for ( OrganisationUnit parent : parents )
{
int parentLevel = parent.getOrganisationUnitLevel();
-
+
if ( level < parentLevel )
{
throw new IllegalArgumentException(
"Level must be greater than or equal to level of parent organisation unit" );
}
-
+
if ( level == parentLevel )
{
parent.setLevel( level );
@@ -446,7 +446,7 @@
}
}
}
-
+
return result;
}
@@ -553,7 +553,7 @@
public OrganisationUnitDataSetAssociationSet getOrganisationUnitDataSetAssociationSet()
{
- Map<Integer, Set<Integer>> associationSet = organisationUnitStore.getOrganisationUnitDataSetAssocationMap();
+ Map<String, Set<String>> associationSet = organisationUnitStore.getOrganisationUnitDataSetAssocationMap();
associationSet.putAll( organisationUnitStore.getOrganisationUnitGroupDataSetAssocationMap() );
filterUserDataSets( associationSet );
@@ -561,7 +561,7 @@
OrganisationUnitDataSetAssociationSet set = new OrganisationUnitDataSetAssociationSet();
- for ( Map.Entry<Integer, Set<Integer>> entry : associationSet.entrySet() )
+ for ( Map.Entry<String, Set<String>> entry : associationSet.entrySet() )
{
int index = set.getDataSetAssociationSets().indexOf( entry.getValue() );
@@ -578,7 +578,7 @@
return set;
}
- private void filterUserDataSets( Map<Integer, Set<Integer>> associationMap )
+ private void filterUserDataSets( Map<String, Set<String>> associationMap )
{
User currentUser = currentUserService.getCurrentUser();
@@ -587,25 +587,28 @@
Collection<Integer> userDataSets = ConversionUtils.getIdentifiers( DataSet.class, currentUser
.getUserCredentials().getAllDataSets() );
- for ( Set<Integer> dataSets : associationMap.values() )
+ for ( Set<String> dataSets : associationMap.values() )
{
dataSets.retainAll( userDataSets );
}
}
}
- private void filterChildOrganisationUnits( Map<Integer, Set<Integer>> associatonMap )
+ private void filterChildOrganisationUnits( Map<String, Set<String>> associationMap )
{
User currentUser = currentUserService.getCurrentUser();
if ( currentUser != null )
{
- Collection<Integer> parentIds = ConversionUtils.getIdentifiers( OrganisationUnit.class,
+ Collection<String> parentIds = ConversionUtils.getUids( OrganisationUnit.class,
currentUser.getOrganisationUnits() );
- Collection<Integer> children = getOrganisationUnitHierarchy().getChildren( parentIds );
-
- associatonMap.keySet().retainAll( children );
+ // Collection<Integer> children = getOrganisationUnitHierarchy().getChildren( parentIds );
+
+ Collection<OrganisationUnit> organisationUnitsWithChildren = getOrganisationUnitsWithChildren( parentIds );
+ Collection<String> children = ConversionUtils.getUids( OrganisationUnit.class, organisationUnitsWithChildren );
+
+ associationMap.keySet().retainAll( children );
}
}
@@ -789,7 +792,7 @@
return levelMap;
}
-
+
@Override
public int getNumberOfOrganisationUnits()
{
@@ -831,7 +834,7 @@
return objects;
}
-
+
// -------------------------------------------------------------------------
// Version
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2013-11-26 10:48:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2013-12-09 21:32:59 +0000
@@ -188,24 +188,25 @@
return q.list();
}
- public Map<Integer, Set<Integer>> getOrganisationUnitDataSetAssocationMap()
+ public Map<String, Set<String>> getOrganisationUnitDataSetAssocationMap()
{
- final String sql = "select datasetid, sourceid from datasetsource";
+ final String sql = "select ds.uid as ds_uid, ou.uid as ou_uid from datasetsource d " +
+ "left join organisationunit ou on ou.organisationunitid=d.sourceid left join dataset ds on ds.datasetid=d.datasetid";
- final Map<Integer, Set<Integer>> map = new HashMap<Integer, Set<Integer>>();
+ final Map<String, Set<String>> map = new HashMap<String, Set<String>>();
jdbcTemplate.query( sql, new RowCallbackHandler()
{
public void processRow( ResultSet rs ) throws SQLException
{
- int dataSetId = rs.getInt( 1 );
- int organisationUnitId = rs.getInt( 2 );
+ String dataSetId = rs.getString( "ds_uid" );
+ String organisationUnitId = rs.getString( "ou_uid" );
- Set<Integer> dataSets = map.get( organisationUnitId );
+ Set<String> dataSets = map.get( organisationUnitId );
if ( dataSets == null )
{
- dataSets = new HashSet<Integer>();
+ dataSets = new HashSet<String>();
map.put( organisationUnitId, dataSets );
}
@@ -217,26 +218,27 @@
}
@Override
- public Map<Integer, Set<Integer>> getOrganisationUnitGroupDataSetAssocationMap()
+ public Map<String, Set<String>> getOrganisationUnitGroupDataSetAssocationMap()
{
- final String sql = "select ougds.datasetid, ou.organisationunitid from orgunitgroupdatasets ougds " +
- "left join orgunitgroupmembers ougm on ougds.orgunitgroupid=ougm.orgunitgroupid " +
- "left join organisationunit ou on ou.organisationunitid=ougm.organisationunitid";
+ final String sql = "select ds.uid as ds_uid, ou.uid as ou_uid from orgunitgroupdatasets ougds\n" +
+ "\tleft join orgunitgroupmembers ougm on ougds.orgunitgroupid=ougm.orgunitgroupid\n" +
+ "\tleft join organisationunit ou on ou.organisationunitid=ougm.organisationunitid\n" +
+ "\tleft join dataset ds on ds.datasetid=ougds.datasetid;\n";
- final Map<Integer, Set<Integer>> map = new HashMap<Integer, Set<Integer>>();
+ final Map<String, Set<String>> map = new HashMap<String, Set<String>>();
jdbcTemplate.query( sql, new RowCallbackHandler()
{
public void processRow( ResultSet rs ) throws SQLException
{
- int dataSetId = rs.getInt( 1 );
- int organisationUnitId = rs.getInt( 2 );
+ String dataSetId = rs.getString( "ds_uid" );
+ String organisationUnitId = rs.getString( "ou_uid" );
- Set<Integer> dataSets = map.get( organisationUnitId );
+ Set<String> dataSets = map.get( organisationUnitId );
if ( dataSets == null )
{
- dataSets = new HashSet<Integer>();
+ dataSets = new HashSet<String>();
map.put( organisationUnitId, dataSets );
}
@@ -305,13 +307,13 @@
+ " where o.featureType='Point'"
+ " and o.coordinates is not null"
+ " and CAST( SUBSTRING(o.coordinates, 2, LOCATE(',', o.coordinates) - 2) AS big_decimal ) >= " + box[3]
- + " and CAST( SUBSTRING(o.coordinates, 2, LOCATE(',', o.coordinates) - 2) AS big_decimal ) <= " + box[1]
- + " and CAST( SUBSTRING(coordinates, LOCATE(',', o.coordinates) + 1, LOCATE(']', o.coordinates) - LOCATE(',', o.coordinates) - 1 ) AS big_decimal ) >= " + box[2]
- + " and CAST( SUBSTRING(coordinates, LOCATE(',', o.coordinates) + 1, LOCATE(']', o.coordinates) - LOCATE(',', o.coordinates) - 1 ) AS big_decimal ) <= " + box[0]
- ).list();
+ + " and CAST( SUBSTRING(o.coordinates, 2, LOCATE(',', o.coordinates) - 2) AS big_decimal ) <= " + box[1]
+ + " and CAST( SUBSTRING(coordinates, LOCATE(',', o.coordinates) + 1, LOCATE(']', o.coordinates) - LOCATE(',', o.coordinates) - 1 ) AS big_decimal ) >= " + box[2]
+ + " and CAST( SUBSTRING(coordinates, LOCATE(',', o.coordinates) + 1, LOCATE(']', o.coordinates) - LOCATE(',', o.coordinates) - 1 ) AS big_decimal ) <= " + box[0]
+ ).list();
}
-
-
+
+
// -------------------------------------------------------------------------
// OrganisationUnitHierarchy
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-12-06 16:26:51 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java 2013-12-09 21:32:59 +0000
@@ -28,25 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.patient.Patient.FIXED_ATTR_AGE;
-import static org.hisp.dhis.patient.Patient.FIXED_ATTR_BIRTH_DATE;
-import static org.hisp.dhis.patient.Patient.FIXED_ATTR_REGISTRATION_DATE;
-import static org.hisp.dhis.patient.Patient.PREFIX_FIXED_ATTRIBUTE;
-import static org.hisp.dhis.patient.Patient.PREFIX_IDENTIFIER_TYPE;
-import static org.hisp.dhis.patient.Patient.PREFIX_PATIENT_ATTRIBUTE;
-import static org.hisp.dhis.patient.Patient.PREFIX_PROGRAM;
-import static org.hisp.dhis.patient.Patient.PREFIX_PROGRAM_EVENT_BY_STATUS;
-import static org.hisp.dhis.patient.Patient.PREFIX_PROGRAM_INSTANCE;
-import static org.hisp.dhis.patient.Patient.PREFIX_PROGRAM_STAGE;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
@@ -80,6 +61,16 @@
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.transaction.annotation.Transactional;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+
+import static org.hisp.dhis.patient.Patient.*;
+
/**
* @author Abyot Asalefew Gizaw
*/
@@ -104,7 +95,7 @@
// -------------------------------------------------------------------------
// Implementation methods
// -------------------------------------------------------------------------
-
+
@Override
public Collection<Patient> getByNames( String fullName, Integer min, Integer max )
{
@@ -190,23 +181,23 @@
public List<Patient> query( TrackedEntityQueryParams params )
{
SqlHelper hlp = new SqlHelper();
-
+
String hql = "select pt from Patient pt left join pt.attributeValues av";
-
+
for ( QueryItem at : params.getAttributes() )
{
hql += " " + hlp.whereAnd();
hql += " (av.patientAttribute = :attr" + at.getItemId() + " and av.value = :filt" + at.getItemId() + ")";
}
-
+
Query query = getQuery( hql );
-
+
for ( QueryItem at : params.getAttributes() )
{
query.setEntity( "attr" + at.getItemId(), at.getItem() );
query.setString( "filt" + at.getItemId(), at.getFilter() );
}
-
+
return query.list();
}
@@ -435,7 +426,7 @@
criteria.add( disjunction );
Number rs = (Number) criteria.setProjection( Projections.rowCount() ).uniqueResult();
-
+
if ( rs != null && rs.intValue() > 0 )
{
return PatientService.ERROR_DUPLICATE_IDENTIFIER;
@@ -518,6 +509,19 @@
value = keys[2];
}
+ Integer orgUnitId = -1;
+
+ try
+ {
+ orgUnitId = Integer.parseInt( keys[4] );
+ }
+ catch ( NumberFormatException e )
+ {
+ // handle as uid
+ OrganisationUnit ou = organisationUnitService.getOrganisationUnit( keys[4] );
+ orgUnitId = ou.getId();
+ }
+
if ( keys[0].equals( PREFIX_FIXED_ATTRIBUTE ) )
{
patientWhere += patientOperator;
@@ -621,116 +625,116 @@
int statusEvent = Integer.parseInt( keys[index] );
switch ( statusEvent )
{
- case ProgramStageInstance.COMPLETED_STATUS:
- patientWhere += condition + operatorStatus
- + "( psi.executiondate is not null and psi.executiondate>='" + keys[2]
- + "' and psi.executiondate<='" + keys[3] + "' and psi.completed=true ";
-
- // get events by orgunit children
- if ( keys[4].equals( "-1" ) )
- {
- patientWhere += " and psi.organisationunitid in( "
- + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
- }
-
- // get events by selected orgunit
- else if ( !keys[4].equals( "0" ) )
- {
- patientWhere += " and psi.organisationunitid=" + keys[4];
- }
-
- patientWhere += ")";
- operatorStatus = " OR ";
- condition = "";
- continue;
- case ProgramStageInstance.VISITED_STATUS:
- patientWhere += condition + operatorStatus
- + "( psi.executiondate is not null and psi.executiondate>='" + keys[2]
- + "' and psi.executiondate<='" + keys[3] + "' and psi.completed=false ";
-
- // get events by orgunit children
- if ( keys[4].equals( "-1" ) )
- {
- patientWhere += " and psi.organisationunitid in( "
- + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
- }
-
- // get events by selected orgunit
- else if ( !keys[4].equals( "0" ) )
- {
- patientWhere += " and psi.organisationunitid=" + keys[4];
- }
-
- patientWhere += ")";
- operatorStatus = " OR ";
- condition = "";
- continue;
- case ProgramStageInstance.FUTURE_VISIT_STATUS:
- patientWhere += condition + operatorStatus + "( psi.executiondate is null and psi.duedate>='"
- + keys[2] + "' and psi.duedate<='" + keys[3]
- + "' and psi.status is not null and (DATE(now()) - DATE(psi.duedate) <= 0) ";
-
- // get events by orgunit children
- if ( keys[4].equals( "-1" ) )
- {
- patientWhere += " and p.organisationunitid in( "
- + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
- }
-
- // get events by selected orgunit
- else if ( !keys[4].equals( "0" ) )
- {
- patientWhere += " and p.organisationunitid=" + keys[4];
- }
-
- patientWhere += ")";
- operatorStatus = " OR ";
- condition = "";
- continue;
- case ProgramStageInstance.LATE_VISIT_STATUS:
- patientWhere += condition + operatorStatus + "( psi.executiondate is null and psi.duedate>='"
- + keys[2] + "' and psi.duedate<='" + keys[3]
- + "' and psi.status is not null and (DATE(now()) - DATE(psi.duedate) > 0) ";
-
- // get events by orgunit children
- if ( keys[4].equals( "-1" ) )
- {
- patientWhere += " and p.organisationunitid in( "
- + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
- }
-
- // get events by selected orgunit
- else if ( !keys[4].equals( "0" ) )
- {
- patientWhere += " and p.organisationunitid=" + keys[4];
- }
-
- patientWhere += ")";
- operatorStatus = " OR ";
- condition = "";
- continue;
- case ProgramStageInstance.SKIPPED_STATUS:
- patientWhere += condition + operatorStatus + "( psi.status=5 and psi.duedate>='" + keys[2]
- + "' and psi.duedate<='" + keys[3] + "' ";
-
- // get events by orgunit children
- if ( keys[4].equals( "-1" ) )
- {
- patientWhere += " and psi.organisationunitid in( "
- + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
- }
-
- // get events by selected orgunit
- else if ( !keys[4].equals( "0" ) )
- {
- patientWhere += " and p.organisationunitid=" + keys[4];
- }
- patientWhere += ")";
- operatorStatus = " OR ";
- condition = "";
- continue;
- default:
- continue;
+ case ProgramStageInstance.COMPLETED_STATUS:
+ patientWhere += condition + operatorStatus
+ + "( psi.executiondate is not null and psi.executiondate>='" + keys[2]
+ + "' and psi.executiondate<='" + keys[3] + "' and psi.completed=true ";
+
+ // get events by orgunit children
+ if ( keys[4].equals( "-1" ) )
+ {
+ patientWhere += " and psi.organisationunitid in( "
+ + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+ }
+
+ // get events by selected orgunit
+ else if ( !keys[4].equals( "0" ) )
+ {
+ patientWhere += " and psi.organisationunitid=" + keys[4];
+ }
+
+ patientWhere += ")";
+ operatorStatus = " OR ";
+ condition = "";
+ continue;
+ case ProgramStageInstance.VISITED_STATUS:
+ patientWhere += condition + operatorStatus
+ + "( psi.executiondate is not null and psi.executiondate>='" + keys[2]
+ + "' and psi.executiondate<='" + keys[3] + "' and psi.completed=false ";
+
+ // get events by orgunit children
+ if ( keys[4].equals( "-1" ) )
+ {
+ patientWhere += " and psi.organisationunitid in( "
+ + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+ }
+
+ // get events by selected orgunit
+ else if ( !keys[4].equals( "0" ) )
+ {
+ patientWhere += " and psi.organisationunitid=" + keys[4];
+ }
+
+ patientWhere += ")";
+ operatorStatus = " OR ";
+ condition = "";
+ continue;
+ case ProgramStageInstance.FUTURE_VISIT_STATUS:
+ patientWhere += condition + operatorStatus + "( psi.executiondate is null and psi.duedate>='"
+ + keys[2] + "' and psi.duedate<='" + keys[3]
+ + "' and psi.status is not null and (DATE(now()) - DATE(psi.duedate) <= 0) ";
+
+ // get events by orgunit children
+ if ( keys[4].equals( "-1" ) )
+ {
+ patientWhere += " and p.organisationunitid in( "
+ + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+ }
+
+ // get events by selected orgunit
+ else if ( !keys[4].equals( "0" ) )
+ {
+ patientWhere += " and p.organisationunitid=" + orgUnitId;
+ }
+
+ patientWhere += ")";
+ operatorStatus = " OR ";
+ condition = "";
+ continue;
+ case ProgramStageInstance.LATE_VISIT_STATUS:
+ patientWhere += condition + operatorStatus + "( psi.executiondate is null and psi.duedate>='"
+ + keys[2] + "' and psi.duedate<='" + keys[3]
+ + "' and psi.status is not null and (DATE(now()) - DATE(psi.duedate) > 0) ";
+
+ // get events by orgunit children
+ if ( keys[4].equals( "-1" ) )
+ {
+ patientWhere += " and p.organisationunitid in( "
+ + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+ }
+
+ // get events by selected orgunit
+ else if ( !keys[4].equals( "0" ) )
+ {
+ patientWhere += " and p.organisationunitid=" + orgUnitId;
+ }
+
+ patientWhere += ")";
+ operatorStatus = " OR ";
+ condition = "";
+ continue;
+ case ProgramStageInstance.SKIPPED_STATUS:
+ patientWhere += condition + operatorStatus + "( psi.status=5 and psi.duedate>='" + keys[2]
+ + "' and psi.duedate<='" + keys[3] + "' ";
+
+ // get events by orgunit children
+ if ( keys[4].equals( "-1" ) )
+ {
+ patientWhere += " and psi.organisationunitid in( "
+ + TextUtils.getCommaDelimitedString( orgunitChilrenIds ) + " )";
+ }
+
+ // get events by selected orgunit
+ else if ( !keys[4].equals( "0" ) )
+ {
+ patientWhere += " and p.organisationunitid=" + keys[4];
+ }
+ patientWhere += ")";
+ operatorStatus = " OR ";
+ condition = "";
+ continue;
+ default:
+ continue;
}
}
if ( condition.isEmpty() )
@@ -751,20 +755,20 @@
int statusEvent = Integer.parseInt( keys[2] );
switch ( statusEvent )
{
- case ProgramStageInstance.COMPLETED_STATUS:
- patientWhere += "psi.completed=true";
- break;
- case ProgramStageInstance.VISITED_STATUS:
- patientWhere += "psi.executiondate is not null and psi.completed=false";
- break;
- case ProgramStageInstance.FUTURE_VISIT_STATUS:
- patientWhere += "psi.executiondate is null and psi.duedate >= now()";
- break;
- case ProgramStageInstance.LATE_VISIT_STATUS:
- patientWhere += "psi.executiondate is null and psi.duedate < now()";
- break;
- default:
- break;
+ case ProgramStageInstance.COMPLETED_STATUS:
+ patientWhere += "psi.completed=true";
+ break;
+ case ProgramStageInstance.VISITED_STATUS:
+ patientWhere += "psi.executiondate is not null and psi.completed=false";
+ break;
+ case ProgramStageInstance.FUTURE_VISIT_STATUS:
+ patientWhere += "psi.executiondate is null and psi.duedate >= now()";
+ break;
+ case ProgramStageInstance.LATE_VISIT_STATUS:
+ patientWhere += "psi.executiondate is null and psi.duedate < now()";
+ break;
+ default:
+ break;
}
patientWhere += " and pgi.status=" + ProgramInstance.STATUS_ACTIVE + " ";
@@ -845,8 +849,7 @@
{
for ( OrganisationUnit orgunit : orgunits )
{
- orgUnitIds
- .addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( orgunit.getId() ) );
+ orgUnitIds.addAll( organisationUnitService.getOrganisationUnitHierarchy().getChildren( orgunit.getId() ) );
orgUnitIds.remove( orgunit.getId() );
}
}
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java 2013-12-09 21:32:59 +0000
@@ -48,8 +48,8 @@
/**
* Creates a collection of the identifiers of the objects passed as argument.
* The object are assumed to have a <code>int getId()</code> method.
- *
- * @param clazz the clazz of the argument objects.
+ *
+ * @param clazz the clazz of the argument objects.
* @param objects for which to get the identifiers.
*/
public static Collection<Integer> getIdentifiers( Class<?> clazz, Collection<?> objects )
@@ -57,28 +57,58 @@
try
{
Collection<Integer> identifiers = new ArrayList<Integer>();
-
- Method method = clazz.getMethod( "getId", new Class[ 0 ] );
-
- for ( Object object : objects )
- {
- Integer identifier = (Integer) method.invoke( object, new Object[ 0 ] );
-
- identifiers.add( identifier );
- }
-
- return identifiers;
- }
- catch ( Exception ex )
- {
- throw new RuntimeException( "Failed to convert objects", ex );
- }
- }
-
+
+ Method method = clazz.getMethod( "getId", new Class[0] );
+
+ for ( Object object : objects )
+ {
+ Integer identifier = (Integer) method.invoke( object, new Object[0] );
+
+ identifiers.add( identifier );
+ }
+
+ return identifiers;
+ }
+ catch ( Exception ex )
+ {
+ throw new RuntimeException( "Failed to convert objects", ex );
+ }
+ }
+
+ /**
+ * Creates a collection of the identifiers of the objects passed as argument.
+ * The object are assumed to have a <code>int getId()</code> method.
+ *
+ * @param clazz the clazz of the argument objects.
+ * @param objects for which to get the identifiers.
+ */
+ public static Collection<String> getUids( Class<?> clazz, Collection<?> objects )
+ {
+ try
+ {
+ Collection<String> identifiers = new ArrayList<String>();
+
+ Method method = clazz.getMethod( "getUid", new Class[0] );
+
+ for ( Object object : objects )
+ {
+ String identifier = (String) method.invoke( object, new Object[0] );
+
+ identifiers.add( identifier );
+ }
+
+ return identifiers;
+ }
+ catch ( Exception ex )
+ {
+ throw new RuntimeException( "Failed to convert objects", ex );
+ }
+ }
+
/**
* Returns the identifier of the argument object. The object is assumed to
* have a <code>int getId()</code> method.
- *
+ *
* @param object the object.
* @return the identifier of the argument object.
*/
@@ -86,26 +116,26 @@
{
try
{
- Method method = object.getClass().getMethod( "getId", new Class[ 0 ] );
-
- return (Integer) method.invoke( object, new Object[ 0 ] );
+ Method method = object.getClass().getMethod( "getId", new Class[0] );
+
+ return (Integer) method.invoke( object, new Object[0] );
}
catch ( Exception ex )
{
throw new RuntimeException( "Failed to convert object", ex );
}
}
-
+
/**
* Creates a collection of Integers out of a collection of Strings.
- *
+ *
* @param strings the collection of Strings.
* @return a collection of Integers.
*/
public static Collection<Integer> getIntegerCollection( Collection<String> strings )
{
Collection<Integer> integers = new ArrayList<Integer>();
-
+
if ( strings != null )
{
for ( String string : strings )
@@ -113,13 +143,13 @@
integers.add( Integer.valueOf( string ) );
}
}
-
+
return integers;
}
-
+
/**
* Creates an array of Integers out of an array of Strings.
- *
+ *
* @param strings the array of Strings.
* @return an array of Integers, an empty array if input is null.
*/
@@ -131,18 +161,18 @@
}
Integer[] integers = new Integer[strings.length];
-
+
for ( int i = 0; i < strings.length; i++ )
{
integers[i] = Integer.valueOf( strings[i] );
}
return integers;
}
-
+
/**
- * Parses the string argument as a signed decimal integer. Null is returedn
+ * Parses the string argument as a signed decimal integer. Null is returedn
* if the argument is null or has zero length.
- *
+ *
* @param string the string to parse.
* @return an integer or null.
*/
@@ -152,127 +182,127 @@
{
return null;
}
-
+
return Integer.parseInt( string );
}
-
+
/**
* Creates a Set of objects out of a Collection of objects.
- *
+ *
* @param objects the Collection of objects.
* @return a Set of objects.
*/
public static <T> Set<T> getSet( Collection<T> objects )
{
Set<T> set = new HashSet<T>();
-
+
for ( T object : objects )
{
set.add( object );
}
-
+
return set;
}
-
+
/**
* Creates a List of objects out of a Collection of objects.
- *
+ *
* @param objects the Collection of objects.
* @return a List of objects.
*/
public static <T> List<T> getList( Collection<T> objects )
{
List<T> list = new ArrayList<T>();
-
+
for ( T object : objects )
{
list.add( object );
}
-
+
return list;
}
-
+
/**
* Creates a List out of an array of objects.
- *
+ *
* @param objects the array of objects.
* @return a List of objects.
*/
public static <T> List<T> getList( T... objects )
{
List<T> list = new ArrayList<T>();
-
- for ( T object: objects )
+
+ for ( T object : objects )
{
list.add( object );
}
-
+
return list;
}
-
+
/**
* Returns a Map based on an argument Collection of objects where the key is
* the object identifier and the value if the object itself.
- *
+ *
* @param collection the Collection of objects.
* @return a Map with identifier object pairs.
*/
public static <T> Map<Integer, T> getIdentifierMap( Collection<T> collection )
{
Map<Integer, T> map = new HashMap<Integer, T>();
-
+
for ( T object : collection )
{
map.put( getIdentifier( object ), object );
}
-
+
return map;
}
-
+
/**
* Converts a List<Double> into a double[].
- *
+ *
* @param list the List.
* @return a double array.
*/
public static double[] getArray( List<Double> list )
{
- double[] array = new double[ list.size() ];
-
+ double[] array = new double[list.size()];
+
int index = 0;
-
+
for ( Double d : list )
{
- array[ index++ ] = d;
+ array[index++] = d;
}
-
+
return array;
}
-
+
/**
* Strips the number of decimals to a maximum of 4. The string must be on the
* form <number>.<decimals>,<number>.<decimals>
- *
+ *
* @param coordinates the coordinates string.
* @return the stripped coordinates string.
*/
public static String stripCoordinates( String coordinates )
{
final int decimals = 4;
-
+
if ( coordinates != null )
{
Matcher matcher = Pattern.compile( "\\d+\\.\\d{0," + decimals + "}" ).matcher( coordinates );
matcher.find();
return matcher.group() + "," + matcher.group();
}
-
+
return null;
}
-
+
/**
* Wraps an object in a set.
- *
+ *
* @param object the object to wrap.
* @return a set with the given object as element.
*/
@@ -282,11 +312,11 @@
set.add( object );
return set;
}
-
+
/**
* Casts the elements in the given collection to the desired return type. It
* is the caller's responsibility that the types legally can be casted.
- *
+ *
* @param collection the collection.
* @return a collection.
*/
@@ -294,12 +324,12 @@
public static <T> Collection<T> cast( Collection<? super T> collection )
{
Collection<T> list = new ArrayList<T>();
-
+
for ( Object o : collection )
{
list.add( (T) o );
}
-
+
return list;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java 2013-12-09 21:32:59 +0000
@@ -83,9 +83,9 @@
return programs;
}
- private Map<Integer, Set<Integer>> programAssociations = new HashMap<Integer, Set<Integer>>();
+ private Map<String, Set<String>> programAssociations = new HashMap<String, Set<String>>();
- public Map<Integer, Set<Integer>> getProgramAssociations()
+ public Map<String, Set<String>> getProgramAssociations()
{
return programAssociations;
}
@@ -116,11 +116,11 @@
for ( Program program : programs )
{
Set<OrganisationUnit> organisationUnits = program.getOrganisationUnits();
- programAssociations.put( program.getId(), new HashSet<Integer>() );
+ programAssociations.put( program.getUid(), new HashSet<String>() );
for ( OrganisationUnit organisationUnit : organisationUnits )
{
- programAssociations.get( program.getId() ).add( organisationUnit.getId() );
+ programAssociations.get( program.getUid() ).add( organisationUnit.getUid() );
}
populateOptionSets( program );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2013-10-24 08:31:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveExecutionDateAction.java 2013-12-09 21:32:59 +0000
@@ -28,8 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Date;
-
+import com.opensymphony.xwork2.Action;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.i18n.I18nFormat;
@@ -43,7 +42,7 @@
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
-import com.opensymphony.xwork2.Action;
+import java.util.Date;
/**
* @author Abyot Asalefew Gizaw
@@ -104,9 +103,9 @@
// Input/Output
// -------------------------------------------------------------------------
- private Integer organisationUnitId;
+ private String organisationUnitId;
- public void setOrganisationUnitId( Integer organisationUnitId )
+ public void setOrganisationUnitId( String organisationUnitId )
{
this.organisationUnitId = organisationUnitId;
}
@@ -157,16 +156,17 @@
if ( dateValue != null )
{
- OrganisationUnit organisationUnit = organisationUnitId == null ? selectionManager
- .getSelectedOrganisationUnit() : organisationUnitService.getOrganisationUnit( organisationUnitId );
- ProgramStageInstance programStageInstance = programStageInstanceService
- .getProgramStageInstance( programStageInstanceId );
+ OrganisationUnit organisationUnit = organisationUnitId == null ?
+ selectionManager.getSelectedOrganisationUnit() : organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+ ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( programStageInstanceId );
if ( programStageInstance == null )
{
Program program = (programId == null) ? null : programService.getProgram( programId );
Patient patient = patientService.getPatient( patientId );
- programStageInstanceService.createProgramStageInstance( patient, program, dateValue, organisationUnit );
+
+ programStageInstance = programStageInstanceService.createProgramStageInstance( patient, program, dateValue, organisationUnit );
}
else
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SearchEventsAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SearchEventsAction.java 2013-12-01 22:32:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SearchEventsAction.java 2013-12-09 21:32:59 +0000
@@ -27,19 +27,6 @@
package org.hisp.dhis.caseentry.action.caseentry;
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_DATA_ELEMENT;
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_NUMBER_DATA_ELEMENT;
-import static org.hisp.dhis.patientreport.PatientTabularReport.VALUE_TYPE_OPTION_SET;
-
-import java.util.ArrayList;
-import java.util.Collection;
-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 org.hibernate.exception.SQLGrammarException;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.dataelement.DataElement;
@@ -56,12 +43,23 @@
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.program.ProgramStageService;
import org.hisp.dhis.program.TabularEventColumn;
+import org.hisp.dhis.system.util.ConversionUtils;
import org.hisp.dhis.system.util.TextUtils;
import org.hisp.dhis.user.CurrentUserService;
+import java.util.ArrayList;
+import java.util.Collection;
+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 org.hisp.dhis.patientreport.PatientTabularReport.*;
+
/**
* @author Chau Thu Tran
- *
* @version $ SearchEventsAction.java Nov 22, 2013 1:06:04 PM $
*/
public class SearchEventsAction
@@ -124,9 +122,9 @@
return patientAttributes;
}
- private Collection<Integer> orgunitIds = new HashSet<Integer>();
+ private Collection<String> orgunitIds = new HashSet<String>();
- public void setOrgunitIds( Collection<Integer> orgunitIds )
+ public void setOrgunitIds( Collection<String> orgunitIds )
{
this.orgunitIds = orgunitIds;
}
@@ -285,16 +283,19 @@
// Get user orgunits
// ---------------------------------------------------------------------
+ Set<OrganisationUnit> ous = new HashSet<OrganisationUnit>( organisationUnitService.getOrganisationUnitsByUid( orgunitIds ) );
+ Set<Integer> orgUnitIds = new HashSet<Integer>( ConversionUtils.getIdentifiers( OrganisationUnit.class, ous ) );
+
if ( userOrganisationUnit || userOrganisationUnitChildren )
{
Collection<OrganisationUnit> userOrgunits = currentUserService.getCurrentUser().getOrganisationUnits();
- orgunitIds = new HashSet<Integer>();
+ orgUnitIds = new HashSet<Integer>();
if ( userOrganisationUnit )
{
for ( OrganisationUnit userOrgunit : userOrgunits )
{
- orgunitIds.add( userOrgunit.getId() );
+ orgUnitIds.add( userOrgunit.getId() );
}
}
@@ -306,7 +307,7 @@
{
for ( OrganisationUnit childOrgunit : userOrgunit.getSortedChildren() )
{
- orgunitIds.add( childOrgunit.getId() );
+ orgUnitIds.add( childOrgunit.getId() );
}
}
}
@@ -321,11 +322,11 @@
if ( facilityLB.equals( "selected" ) )
{
- organisationUnits.addAll( orgunitIds );
+ organisationUnits.addAll( orgUnitIds );
}
else if ( facilityLB.equals( "childrenOnly" ) )
{
- for ( Integer orgunitId : orgunitIds )
+ for ( Integer orgunitId : orgUnitIds )
{
OrganisationUnit selectedOrgunit = organisationUnitService.getOrganisationUnit( orgunitId );
organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy()
@@ -335,7 +336,7 @@
}
else
{
- for ( Integer orgunitId : orgunitIds )
+ for ( Integer orgunitId : orgUnitIds )
{
organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy()
.getChildren( orgunitId ) );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm 2013-09-16 17:07:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm 2013-12-09 21:32:59 +0000
@@ -4,10 +4,10 @@
"programs": {
#set( $psize = $programs.size() )
#foreach( $program in $programs )
-"${program.id}":{
+"$encoder.jsonEncode( $program.uid )":{
"id":"${program.id}",
+ "uid":"$encoder.jsonEncode( ${program.uid} )",
"name":"$encoder.jsonEncode( ${program.displayName} )",
- "uid":"$encoder.jsonEncode( ${program.uid} )",
"description":"$encoder.jsonEncode( ${program.description} )",
"enrollmentDescription":"$encoder.jsonEncode( ${program.dateOfEnrollmentDescription} )",
"incidentDescription":"$encoder.jsonEncode( ${program.dateOfIncidentDescription} )",
@@ -15,20 +15,24 @@
"programStages":[#set( $pssize = $program.programStages.size() )
#foreach( $ps in $program.programStages )
{
- "id": "${ps.id}",
- "uid": "$encoder.jsonEncode( ${ps.uid} )",
- "name": "$encoder.jsonEncode( ${ps.displayName} )",
- "reportDateDescription": "$encoder.jsonEncode( ${ps.reportDateDescription} )",
- "irregular": "$!{ps.irregular}",
- "displayGenerateEventBox": "$!{ps.displayGenerateEventBox}",
- "validCompleteOnly": "$!{ps.validCompleteOnly}",
- "captureCoordinates": "$!{ps.captureCoordinates}",
- "blockEntryForm": "$!ps.blockEntryForm",
- "remindCompleted": "$!ps.remindCompleted",
- "allowGenerateNextVisit": "$!ps.allowGenerateNextVisit"
+ "id": "${ps.id}",
+ "uid": "$encoder.jsonEncode( ${ps.uid} )",
+ "name": "$encoder.jsonEncode( ${ps.displayName} )",
+ "reportDateDescription": "$encoder.jsonEncode( ${ps.reportDateDescription} )",
+ "irregular": "$!{ps.irregular}",
+ "displayGenerateEventBox": "$!{ps.displayGenerateEventBox}",
+ "validCompleteOnly": "$!{ps.validCompleteOnly}",
+ "captureCoordinates": "$!{ps.captureCoordinates}",
+ "blockEntryForm": "$!ps.blockEntryForm",
+ "remindCompleted": "$!ps.remindCompleted",
+ "allowGenerateNextVisit": "$!ps.allowGenerateNextVisit"
}#if( $velocityCount < $pssize ),#end
#end],
- "programAssociations": $programAssociations.get( ${program.id} )
+ "programAssociations": [
+ #set( $asize = $programAssociations.get( ${program.uid} ).size() )
+ #foreach( $assoc in $programAssociations.get( ${program.uid} ) )
+ "$encoder.jsonEncode( $assoc )"#if( $velocityCount < $asize ),#end
+ #end]
}#if( $velocityCount < $psize ),#end
#end }
}}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnit.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnit.vm 2012-03-06 03:17:52 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnit.vm 2013-12-09 21:32:59 +0000
@@ -1,19 +1,20 @@
{ "organisationUnit":
{
- "id": $!{organisationUnit.id},
- "name": "$!encoder.jsonEncode( ${organisationUnit.name} )",
- "shortName": "$!encoder.jsonEncode( ${organisationUnit.shortName} )",
- "description": "$!encoder.jsonEncode( ${organisationUnit.description} )",
- "code": "$!encoder.jsonEncode( ${organisationUnit.code} )",
- "openingDate": "$!{organisationUnit.openingDate}",
- "closedDate": "$!{organisationUnit.closedDate}",
- "active": "$!{organisationUnit.active}",
- "comment": "$!encoder.jsonEncode( ${organisationUnit.comment} )",
- "geoCode": "$!{organisationUnit.geoCode}",
- "featureType": "$!encoder.jsonEncode( ${organisationUnit.featureType} )",
- "coordinates": "$!encoder.jsonEncode( ${organisationUnit.coordinates} )",
- "latitude": "$!{organisationUnit.latitude}",
- "longitude": "$!{organisationUnit.longitude}",
+ "id": $!{organisationUnit.id},
+ "uid": "$!encoder.jsonEncode( ${organisationUnit.uid} )",
+ "name": "$!encoder.jsonEncode( ${organisationUnit.name} )",
+ "shortName": "$!encoder.jsonEncode( ${organisationUnit.shortName} )",
+ "description": "$!encoder.jsonEncode( ${organisationUnit.description} )",
+ "code": "$!encoder.jsonEncode( ${organisationUnit.code} )",
+ "openingDate": "$!{organisationUnit.openingDate}",
+ "closedDate": "$!{organisationUnit.closedDate}",
+ "active": "$!{organisationUnit.active}",
+ "comment": "$!encoder.jsonEncode( ${organisationUnit.comment} )",
+ "geoCode": "$!{organisationUnit.geoCode}",
+ "featureType": "$!encoder.jsonEncode( ${organisationUnit.featureType} )",
+ "coordinates": "$!encoder.jsonEncode( ${organisationUnit.coordinates} )",
+ "latitude": "$!{organisationUnit.latitude}",
+ "longitude": "$!{organisationUnit.longitude}",
"hasChild": $!{organisationUnit.hasChild()}
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm 2013-11-26 12:30:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTree.vm 2013-12-09 21:32:59 +0000
@@ -2,11 +2,11 @@
"version":"$!encoder.jsonEncode( $version )"
,"username":"$!encoder.jsonEncode( $username )"
,"realRoot":$realRoot
-,"roots": [ #foreach( $root in $rootOrganisationUnits )$root.id#if( $velocityCount < $rootOrganisationUnits.size() ),#end#end ]
+,"roots": [ #foreach( $root in $rootOrganisationUnits )"$!encoder.jsonEncode($root.uid)"#if( $velocityCount < $rootOrganisationUnits.size() ),#end#end ]
#if( ! $versionOnly )
,"organisationUnits": {
#foreach( $unit in $organisationUnits )
-"${unit.id}":{"id":${unit.id},"n":"$!encoder.jsonEncode( ${unit.name} )",#if( $unit.parent )"pid":${unit.parent.id},#end"c":[#foreach( $child in $unit.sortedChildren )${child.id}#if( $velocityCount < $unit.children.size() ),#end#end]}
+"$!encoder.jsonEncode($unit.uid)":{"id":"$!encoder.jsonEncode($unit.uid)","n":"$!encoder.jsonEncode( ${unit.name} )",#if( $unit.parent )"pid":"$!encoder.jsonEncode($unit.parent.uid)",#end"c":[#foreach( $child in $unit.sortedChildren )"$!encoder.jsonEncode($child.uid)"#if( $velocityCount < $unit.children.size() ),#end#end]}
#if( $velocityCount < $organisationUnits.size() ),#end#end
}#end
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTreePartial.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTreePartial.vm 2013-11-26 12:30:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonOrganisationUnitTreePartial.vm 2013-12-09 21:32:59 +0000
@@ -3,6 +3,6 @@
,"username":"$!encoder.jsonEncode( $username )"
,"organisationUnits": {
#foreach( $unit in $organisationUnits )
-"${unit.id}":{"id":${unit.id},"n":"$!encoder.jsonEncode( ${unit.name} )",#if( $unit.parent )"pid":${unit.parent.id},#end"c":[#foreach( $child in $unit.sortedChildren )${child.id}#if( $velocityCount < $unit.children.size() ),#end#end]}
+"$!encoder.jsonEncode($unit.uid)":{"id":"$!encoder.jsonEncode($unit.uid)","n":"$!encoder.jsonEncode( ${unit.name} )",#if( $unit.parent )"pid":"$!encoder.jsonEncode($unit.parent.uid)",#end"c":[#foreach( $child in $unit.sortedChildren )"$!encoder.jsonEncode($child.uid)"#if( $velocityCount < $unit.children.size() ),#end#end]}
#if( $velocityCount < $organisationUnits.size() ),#end#end
}}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2013-12-03 09:49:28 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2013-12-09 21:32:59 +0000
@@ -35,12 +35,12 @@
dhis2.ou.store = new dhis2.storage.Store( {
name: OU_STORE_NAME,
objectStores: [ {
- name: OU_KEY,
- adapters: [ dhis2.storage.IndexedDBAdapter, dhis2.storage.DomLocalStorageAdapter, dhis2.storage.InMemoryAdapter ]
- }, {
- name: OU_PARTIAL_KEY,
- adapters: [ dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter ]
- }
+ name: OU_KEY,
+ adapters: [ dhis2.storage.IndexedDBAdapter, dhis2.storage.DomLocalStorageAdapter, dhis2.storage.InMemoryAdapter ]
+ }, {
+ name: OU_PARTIAL_KEY,
+ adapters: [ dhis2.storage.IndexedDBAdapter, dhis2.storage.DomSessionStorageAdapter, dhis2.storage.InMemoryAdapter ]
+ }
]
} );
@@ -410,7 +410,7 @@
var idx = undefined;
$.each( selected, function( i, item ) {
- if( +item === unitId ) {
+ if( item === unitId ) {
idx = i;
}
} );
@@ -479,13 +479,13 @@
if( multipleSelectionAllowed ) {
$.each( selected, function( i, item ) {
var name = organisationUnits[item].n;
- ids.push( +item );
+ ids.push( item );
names.push( name );
} );
listenerFunction( ids, names, children );
} else {
- selected = +selected[0];
+ selected = selected[0];
if( 'undefined' !== typeof organisationUnits[selected]) {
// we only support includeChildren for single selects
@@ -788,7 +788,7 @@
$toggleTag.addClass( "toggle" );
if( ou.c.length > 0 ) {
- $toggleTag.bind( "click", new Function( 'subtree.toggle( ' + ou.id + ' )' ) );
+ $toggleTag.bind( "click", new Function( 'subtree.toggle( \"' + ou.id + '\" )' ) );
$toggleTag.append( getToggleExpand() );
}
else {
@@ -796,7 +796,7 @@
}
var $linkTag = $( "<a/>" );
- $linkTag.attr( "href", "javascript:void selection.select( " + ou.id + ")" );
+ $linkTag.attr( "href", "javascript:void selection.select( \"" + ou.id + "\" )" );
$linkTag.append( ou.n );
var $childTag = $( "<li/>" );
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseCollapse.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseCollapse.vm 2011-07-18 10:46:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseCollapse.vm 2013-12-09 21:32:59 +0000
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<units>
#foreach( $unit in $collapsedUnits )
- <unit>$unit.id</unit>
+ <unit uid="$encoder.xmlEncode( $unit.uid )">$unit.id</unit>
#end
</units>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseExpand.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseExpand.vm 2011-07-18 10:46:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseExpand.vm 2013-12-09 21:32:59 +0000
@@ -3,7 +3,7 @@
#foreach( $parent in $parents )
<parent parentId="$parent.id">
#foreach( $child in $childrenMap.get( $parent ) )
- <child id="$child.id" hasChildren="$child.children.size()">$encoder.xmlEncode( $child.name )</child>
+ <child id="$child.id" uid="$encoder.xmlEncode( $child.uid )" hasChildren="$child.children.size()">$encoder.xmlEncode( $child.name )</child>
#end
</parent>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSelect.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSelect.vm 2012-04-22 21:15:54 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseSelect.vm 2013-12-09 21:32:59 +0000
@@ -2,9 +2,8 @@
{ "selectedUnits": [
#foreach( $unit in $selectedUnits )
{
- "id":"${unit.id}",
- "name":"$encoder.jsonEncode( ${unit.name} )",
- "uid":"$encoder.jsonEncode( ${unit.uid} )"
+ "id":"$encoder.jsonEncode( ${unit.uid} )",
+ "name":"$encoder.jsonEncode( ${unit.name} )"
}#if( $velocityCount < $size ),#end
#end
] }
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm 2012-04-26 15:26:28 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseTree.vm 2013-12-09 21:32:59 +0000
@@ -11,7 +11,7 @@
<parent parentId="$parent.id">
#foreach( $child in $childrenMap.get( $parent ) )
<child id="${child.id}" uid="${child.uid}" hasChildren="$child.children.size()" #if( $selected.contains( $child )) selected="true" #end>$encoder.xmlEncode( $child.name )</child>
- #end
+ #end
</parent>
#end
</children>
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitAction.java 2013-12-09 21:32:59 +0000
@@ -28,11 +28,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.opensymphony.xwork2.Action;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import com.opensymphony.xwork2.Action;
-
/**
* @author Lars Helge Overland
*/
@@ -54,9 +53,9 @@
// Input
// -------------------------------------------------------------------------
- private Integer id;
+ private String id;
- public void setId( Integer id )
+ public void setId( String id )
{
this.id = id;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java 2013-11-26 12:30:24 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java 2013-12-09 21:32:59 +0000
@@ -129,9 +129,9 @@
return versionOnly;
}
- private Integer parentId;
+ private String parentId;
- public void setParentId( Integer parentId )
+ public void setParentId( String parentId )
{
this.parentId = parentId;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/AddSelectedOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/AddSelectedOrganisationUnitAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/AddSelectedOrganisationUnitAction.java 2013-12-09 21:32:59 +0000
@@ -65,9 +65,9 @@
// Input/output
// -------------------------------------------------------------------------
- private int id;
+ private String id;
- public void setId( int organisationUnitId )
+ public void setId( String organisationUnitId )
{
this.id = organisationUnitId;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/CollapseSubtreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/CollapseSubtreeAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/CollapseSubtreeAction.java 2013-12-09 21:32:59 +0000
@@ -28,17 +28,15 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
-
+import com.opensymphony.xwork2.Action;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.ouwt.manager.TreeStateManager;
-import com.opensymphony.xwork2.Action;
+import java.util.Collection;
/**
* @author Torgeir Lorange Ostby
- * @version $Id: CollapseSubtreeAction.java 2869 2007-02-20 14:26:09Z andegje $
*/
public class CollapseSubtreeAction
implements Action
@@ -65,9 +63,9 @@
// Input
// -------------------------------------------------------------------------
- private int parentId;
+ private String parentId;
- public void setParentId( int parentId )
+ public void setParentId( String parentId )
{
this.parentId = parentId;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/ExpandSubtreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/ExpandSubtreeAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/ExpandSubtreeAction.java 2013-12-09 21:32:59 +0000
@@ -28,20 +28,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.ouwt.manager.TreeStateManager;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.ouwt.manager.TreeStateManager;
-
-import com.opensymphony.xwork2.Action;
-
/**
* @author Torgeir Lorange Ostby
- * @version $Id: ExpandSubtreeAction.java 6251 2008-11-10 14:37:05Z larshelg $
*/
public class ExpandSubtreeAction
implements Action
@@ -68,9 +66,9 @@
// Input
// -------------------------------------------------------------------------
- private int parentId;
+ private String parentId;
- public void setParentId( int organisationUnitId )
+ public void setParentId( String organisationUnitId )
{
this.parentId = organisationUnitId;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetExpandedTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetExpandedTreeAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetExpandedTreeAction.java 2013-12-09 21:32:59 +0000
@@ -28,6 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.ouwt.manager.TreeStateManager;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -35,16 +41,8 @@
import java.util.List;
import java.util.Map;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.ouwt.manager.TreeStateManager;
-
-import com.opensymphony.xwork2.Action;
-
/**
* @author Torgeir Lorange Ostby
- * @version $Id: GetExpandedTreeAction.java 5282 2008-05-28 10:41:06Z larshelg $
*/
public class GetExpandedTreeAction
implements Action
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/RemoveSelectedOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/RemoveSelectedOrganisationUnitAction.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/RemoveSelectedOrganisationUnitAction.java 2013-12-09 21:32:59 +0000
@@ -28,13 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
-
+import com.opensymphony.xwork2.Action;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import com.opensymphony.xwork2.Action;
+import java.util.Collection;
/**
* @author Torgeir Lorange Ostby
@@ -65,9 +64,9 @@
// Input/output
// -------------------------------------------------------------------------
- private int id;
+ private String id;
- public void setId( int organisationUnitId )
+ public void setId( String organisationUnitId )
{
this.id = organisationUnitId;
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/SetSelectedOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/SetSelectedOrganisationUnitAction.java 2013-08-28 12:33:54 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/SetSelectedOrganisationUnitAction.java 2013-12-09 21:32:59 +0000
@@ -38,7 +38,6 @@
/**
* @author Torgeir Lorange Ostby
- * @version $Id: SetSelectedOrganisationUnitAction.java 2869 2007-02-20 14:26:09Z andegje $
*/
public class SetSelectedOrganisationUnitAction
implements Action
@@ -65,11 +64,11 @@
// Input/output
// -------------------------------------------------------------------------
- private int id;
+ private String id;
- public void setId( int organisationUnitId )
+ public void setId( String id )
{
- this.id = organisationUnitId;
+ this.id = id;
}
private Collection<OrganisationUnit> selectedUnits;
@@ -86,7 +85,7 @@
public String execute()
throws Exception
{
- if ( id == 0 )
+ if ( id == null )
{
selectionManager.clearSelectedOrganisationUnits();
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java 2013-09-27 12:55:38 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetDataValuesForDataSetAction.java 2013-12-09 21:32:59 +0000
@@ -103,16 +103,16 @@
this.periodId = periodId;
}
- private Integer dataSetId;
+ private String dataSetId;
- public void setDataSetId( Integer dataSetId )
+ public void setDataSetId( String dataSetId )
{
this.dataSetId = dataSetId;
}
- private Integer organisationUnitId;
+ private String organisationUnitId;
- public void setOrganisationUnitId( Integer organisationUnitId )
+ public void setOrganisationUnitId( String organisationUnitId )
{
this.organisationUnitId = organisationUnitId;
}
@@ -185,17 +185,17 @@
Set<OrganisationUnit> children = organisationUnit.getChildren();
DataSet dataSet = dataSetService.getDataSet( dataSetId );
-
+
Period period = PeriodType.getPeriodFromIsoString( periodId );
// TODO null-checks
-
+
// ---------------------------------------------------------------------
// Data values & Min-max data elements
// ---------------------------------------------------------------------
dataValues.addAll( dataValueService.getDataValues( organisationUnit, period, dataSet.getDataElements() ) );
-
+
minMaxDataElements.addAll( minMaxDataElementService.getMinMaxDataElements( organisationUnit, dataSet
.getDataElements() ) );
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java 2013-11-21 11:27:47 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java 2013-12-09 21:32:59 +0000
@@ -139,16 +139,16 @@
return dataSets;
}
- private List<Set<Integer>> dataSetAssociationSets;
+ private List<Set<String>> dataSetAssociationSets;
- public List<Set<Integer>> getDataSetAssociationSets()
+ public List<Set<String>> getDataSetAssociationSets()
{
return dataSetAssociationSets;
}
- private Map<Integer, Integer> organisationUnitAssociationSetMap;
+ private Map<String, Integer> organisationUnitAssociationSetMap;
- public Map<Integer, Integer> getOrganisationUnitAssociationSetMap()
+ public Map<String, Integer> getOrganisationUnitAssociationSetMap()
{
return organisationUnitAssociationSetMap;
}
@@ -195,7 +195,7 @@
organisationUnitAssociationSetMap = organisationUnitSet.getOrganisationUnitAssociationSetMap();
- dataSets = dataSetService.getDataSets( organisationUnitSet.getDistinctDataSets() );
+ dataSets = dataSetService.getDataSetsByUid( organisationUnitSet.getDistinctDataSets() );
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2013-12-03 16:35:10 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2013-12-09 21:32:59 +0000
@@ -104,9 +104,9 @@
// Input
// -------------------------------------------------------------------------
- private Integer dataSetId;
+ private String dataSetId;
- public void setDataSetId( Integer dataSetId )
+ public void setDataSetId( String dataSetId )
{
this.dataSetId = dataSetId;
}
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java 2013-11-19 13:45:37 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java 2013-12-09 21:32:59 +0000
@@ -121,9 +121,9 @@
this.dataElementId = dataElementId;
}
- private int organisationUnitId;
+ private String organisationUnitId;
- public void setOrganisationUnitId( int organisationUnitId )
+ public void setOrganisationUnitId( String organisationUnitId )
{
this.organisationUnitId = organisationUnitId;
}
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm 2013-11-21 11:27:47 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMetaData.vm 2013-12-09 21:32:59 +0000
@@ -38,7 +38,7 @@
"dataSets": {
#set( $size = $dataSets.size() )
#foreach( $dataSet in $dataSets )
-"${dataSet.id}":{"name":"$encoder.jsonEncode( ${dataSet.displayName} )","periodType":"$encoder.jsonEncode( ${dataSet.periodType.name} )",
+"${dataSet.uid}":{"name":"$encoder.jsonEncode( ${dataSet.displayName} )","periodType":"$encoder.jsonEncode( ${dataSet.periodType.name} )",
"version":"${dataSet.version}","type":"${dataSet.getDataSetType()}","expiryDays":"${dataSet.expiryDays}",
"allowFuturePeriods":${dataSet.allowFuturePeriods},"fieldCombinationRequired":${dataSet.fieldCombinationRequired},"validCompleteOnly":${dataSet.validCompleteOnly},
"skipOffline":${dataSet.skipOffline}, "renderAsTabs":${dataSet.renderAsTabs}, "renderHorizontally":${dataSet.renderHorizontally}
@@ -53,7 +53,7 @@
#set( $index = $index + 1 )
#set( $size2 = $associationSet.size() )
#foreach( $id in $associationSet )
-${id}#if( $velocityCount < $size2 ),#end
+"$encoder.jsonEncode( $id )"#if( $velocityCount < $size2 ),#end
#end ]#if( $velocityCount < $size1 ),#end
#end },
@@ -62,4 +62,4 @@
#foreach( $orgUnit in $organisationUnitAssociationSetMap.keySet() )
"${orgUnit}":"$organisationUnitAssociationSetMap.get( ${orgUnit} )"#if( $velocityCount < $size ),#end
#end }
-} }
\ No newline at end of file
+} }
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2013-07-02 07:29:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm 2013-12-09 21:32:59 +0000
@@ -1,39 +1,40 @@
<script type="text/javascript">
- var previousName = '';
- var adding_the_org_unit_failed = '$encoder.jsEscape( $i18n.getString( "adding_the_org_unit_failed" ) , "'" )';
+ var previousName = '';
+ var adding_the_org_unit_failed = '$encoder.jsEscape( $i18n.getString( "adding_the_org_unit_failed" ) , "'" )';
jQuery(document).ready(function() {
validation2('addOrganisationUnitForm', function(form) {
- $.ajax({
- url: '../dhis-web-commons/ouwt/getselected.action',
- dataType: 'json'
- } ).done(function(data) {
- if(data.selectedUnits.length == 0) {
- if ( confirm( '$i18n.getString( "create_new_root" )' ) ) {
- selectAllById( "dataSets" );
- form.submit();
- }
- } else {
- selectAllById( "dataSets" );
- form.submit();
- }
- });
+ $.ajax({
+ url: '../dhis-web-commons/ouwt/getselected.action',
+ dataType: 'json'
+ } ).done(function(data) {
+ console.log(data);
+ if(data.selectedUnits.length == 0) {
+ if ( confirm( '$i18n.getString( "create_new_root" )' ) ) {
+ selectAllById( "dataSets" );
+ form.submit();
+ }
+ } else {
+ selectAllById( "dataSets" );
+ form.submit();
+ }
+ });
}, {
- 'beforeValidateHandler' : function()
- {
- #tblDynamicAttributesJavascript()
- },
+ 'beforeValidateHandler' : function()
+ {
+ #tblDynamicAttributesJavascript()
+ },
'rules' : getValidationRules("organisationUnit")
});
- checkValueIsExistWarning("name", "validateOrganisationUnit.action");
- checkValueIsExist("code", "validateOrganisationUnit.action");
- datePickerValid('openingDate', false);
+ checkValueIsExistWarning("name", "validateOrganisationUnit.action");
+ checkValueIsExist("code", "validateOrganisationUnit.action");
+ datePickerValid('openingDate', false);
jQuery( "div[id=dynamicAttributesContainer] table tr td:first-child" ).attr( "style", "width: 120px" );
jQuery( "div[id=dynamicAttributesContainer] table tr td:last-child *" ).attr( "style", "" );
-
- jQuery("#name").focus();
+
+ jQuery("#name").focus();
});
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/hierarchyOperations.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/hierarchyOperations.js 2012-02-22 15:04:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/hierarchyOperations.js 2013-12-09 21:32:59 +0000
@@ -9,22 +9,22 @@
{
hideHeaderMessage();
- if ( orgUnitIds.length == 1 )
+ if ( orgUnitIds.length == 1 )
+ {
+ var id = orgUnitIds[0];
+
+ $.getJSON( '../dhis-web-commons-ajax-json/getOrganisationUnit.action', { id:id }, function( json )
{
- var id = orgUnitIds[0];
-
- $.getJSON( '../dhis-web-commons-ajax-json/getOrganisationUnit.action', { id:id }, function( json )
- {
- $( '#organisationUnitToMoveId' ).val( id );
- $( '#toMoveNameField' ).html( json.organisationUnit.name );
- $( '#confirmOrganisationUnitToMoveButton' ).removeAttr( 'disabled' );
- } );
- }
+ $( '#organisationUnitToMoveId' ).val( json.organisationUnit.id );
+ $( '#toMoveNameField' ).html( json.organisationUnit.name );
+ $( '#confirmOrganisationUnitToMoveButton' ).removeAttr( 'disabled' );
+ } );
+ }
}
function organisationUnitToMoveConfirmed()
{
- var id = $( '#organisationUnitToMoveId' ).val();
+ var id = $( '#organisationUnitToMoveId' ).val();
$.getJSON( 'validateOrganisationUnitToMove.action', { organisationUnitToMoveId:id }, function( json )
{
@@ -58,7 +58,7 @@
$.getJSON( '../dhis-web-commons-ajax-json/getOrganisationUnit.action', { id:id }, function( json )
{
- $( '#newParentOrganisationUnitId' ).val( id );
+ $( '#newParentOrganisationUnitId' ).val( json.organisationUnit.id );
$( '#newParentNameField' ).html( json.organisationUnit.name );
$( '#confirmNewParentOrganisationUnitButton' ).removeAttr( 'disabled' );
} );
@@ -72,8 +72,8 @@
function newParentOrganisationUnitConfirmed()
{
- var toMoveId = $( '#organisationUnitToMoveId' ).val();
- var newParentId = $( '#newParentOrganisationUnitId' ).val();
+ var toMoveId = $( '#organisationUnitToMoveId' ).val();
+ var newParentId = $( '#newParentOrganisationUnitId' ).val();
$.getJSON( 'validateNewParentOrganisationUnit.action', {
organisationUnitToMoveId:toMoveId, newParentOrganisationUnitId:newParentId }, function( json )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnit.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnit.js 2013-12-04 13:26:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnit.js 2013-12-09 21:32:59 +0000
@@ -2,16 +2,14 @@
// Organisation unit selection listener
// -----------------------------------------------------------------------------
-$( document ).ready( function()
-{
- selection.setAutoSelectRoot( false );
- selection.setRootUnselectAllowed( true );
- selection.setListenerFunction( organisationUnitSelected, true );
-} );
+$( document ).ready( function() {
+ selection.setAutoSelectRoot( false );
+ selection.setRootUnselectAllowed( true );
+ selection.setListenerFunction( organisationUnitSelected, true );
+});
-function organisationUnitSelected( orgUnitIds )
-{
- window.location.href = 'organisationUnit.action';
+function organisationUnitSelected( orgUnitIds ) {
+ window.location.href = 'organisationUnit.action';
}
// -----------------------------------------------------------------------------