dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02901
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 955: Implemented preview of groupsets.
------------------------------------------------------------
revno: 955
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-11-02 12:56:51 +0100
message:
Implemented preview of groupsets.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Objects.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/GroupMemberType.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportObjectManager.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupSetMemberConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/IndicatorGroupSetMemberConverter.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/importer/DefaultDXFImportService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectService.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetMatchOptionsAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetPreviewOptionsAction.java
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ClassMapUtil.java
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/import.js
dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/previewForm.vm
--
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/common/Objects.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Objects.java 2009-10-07 18:53:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Objects.java 2009-11-02 11:56:51 +0000
@@ -34,13 +34,21 @@
public enum Objects
{
DATAELEMENT,
+ CALCULATEDDATAELEMENT,
+ EXTENDEDDATAELEMENT,
DATAELEMENTGROUP,
+ DATAELEMENTGROUPSET,
INDICATORTYPE,
INDICATOR,
INDICATORGROUP,
+ INDICATORGROUPSET,
DATASET,
DATADICTIONARY,
SOURCE,
+ ORGANISATIONUNIT,
+ ORGANISATIONUNITGROUP,
+ ORGANISATIONUNITGROUPSET,
+ ORGANISATIONUNITLEVEL,
VALIDATIONRULE,
PERIOD,
DATAVALUE,
@@ -49,5 +57,6 @@
USER,
REPORTTABLE,
REPORT,
- CHART
+ CHART,
+ OLAPURL
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/GroupMemberType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/GroupMemberType.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/GroupMemberType.java 2009-11-02 11:56:51 +0000
@@ -37,7 +37,9 @@
CATEGORY_CATEGORYOPTION,
CATEGORYCOMBO_CATEGORY,
DATAELEMENTGROUP,
+ DATAELEMENTGROUPSET,
INDICATORGROUP,
+ INDICATORGROUPSET,
DATADICTIONARY_DATAELEMENT,
DATADICTIONARY_INDICATOR,
DATASET,
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportObjectManager.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportObjectManager.java 2009-06-10 22:26:49 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportObjectManager.java 2009-11-02 11:56:51 +0000
@@ -53,14 +53,22 @@
void importDataElementGroupMembers();
+ void importDataElementGroupSets();
+
+ void importDataElementGroupSetMembers();
+
void importIndicatorTypes();
void importIndicators();
void importIndicatorGroups();
-
+
void importIndicatorGroupMembers();
+ void importIndicatorGroupSets();
+
+ void importIndicatorGroupSetMembers();
+
void importDataDictionaries();
void importDataSets();
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupSetMemberConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupSetMemberConverter.java 2009-11-02 09:20:10 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementGroupSetMemberConverter.java 2009-11-02 11:56:51 +0000
@@ -145,7 +145,7 @@
association.setMemberId( dataElementGroupMapping.get( Integer.parseInt( values.get( FIELD_DATAELEMENT_GROUP ) ) ) );
association.setSortOrder( Integer.parseInt( values.get( FIELD_SORT_ORDER ) ) );
- read( association, GroupMemberType.DATAELEMENTGROUP, params );
+ read( association, GroupMemberType.DATAELEMENTGROUPSET, params );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/IndicatorGroupSetMemberConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/IndicatorGroupSetMemberConverter.java 2009-11-02 09:20:10 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/IndicatorGroupSetMemberConverter.java 2009-11-02 11:56:51 +0000
@@ -145,7 +145,7 @@
association.setMemberId( indicatorGroupMapping.get( Integer.parseInt( values.get( FIELD_INDICATOR_GROUP ) ) ) );
association.setSortOrder( Integer.parseInt( values.get( FIELD_SORT_ORDER ) ) );
- read( association, GroupMemberType.INDICATORGROUP, params );
+ read( association, GroupMemberType.INDICATORGROUPSET, params );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/importer/DefaultDXFImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/importer/DefaultDXFImportService.java 2009-11-02 09:20:10 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/importer/DefaultDXFImportService.java 2009-11-02 11:56:51 +0000
@@ -367,7 +367,7 @@
if ( reader.getXmlStreamReader().getNamespaceURI() == DXF2_NAMESPACE_URI )
{
dxfVersion = 2;
- log.info( "parsing dxf version " + dxfVersion );
+ log.info( "Parsing DXF version " + dxfVersion );
try
{
@@ -377,14 +377,14 @@
}
catch ( javax.xml.bind.JAXBException ex )
{
- log.info( "Parsing error: " + ex );
+ log.warn( "Parsing error: " + ex );
// report something to GUI ....
}
}
else
{
dxfVersion = 1;
- log.info( "parsing dxf version " + dxfVersion );
+ log.info( "Parsing DXF version " + dxfVersion );
parseDXFv1( params, reader );
}
@@ -1216,7 +1216,7 @@
log.warn( "Skipped DataValues because import file contained DataValues for locked Period, Organisation Unit and DataSet combinations" );
}
- else */
+ else */ //TODO too slow
{
BatchHandler<DataValue> batchHandler = batchHandlerFactory
.createBatchHandler( DataValueBatchHandler.class );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java 2009-10-18 22:44:41 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java 2009-11-02 11:56:51 +0000
@@ -46,6 +46,7 @@
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.CompleteDataSetRegistration;
import org.hisp.dhis.dataset.DataSet;
@@ -65,6 +66,7 @@
import org.hisp.dhis.importexport.mapping.ObjectMappingGenerator;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
import org.hisp.dhis.indicator.IndicatorType;
import org.hisp.dhis.jdbc.batchhandler.CategoryCategoryOptionAssociationBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.CategoryComboCategoryAssociationBatchHandler;
@@ -78,6 +80,8 @@
import org.hisp.dhis.jdbc.batchhandler.DataElementCategoryOptionBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.DataElementGroupBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.DataElementGroupMemberBatchHandler;
+import org.hisp.dhis.jdbc.batchhandler.DataElementGroupSetBatchHandler;
+import org.hisp.dhis.jdbc.batchhandler.DataElementGroupSetMemberBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.DataSetBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.DataSetMemberBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.DataSetSourceAssociationBatchHandler;
@@ -88,6 +92,8 @@
import org.hisp.dhis.jdbc.batchhandler.IndicatorBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.IndicatorGroupBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.IndicatorGroupMemberBatchHandler;
+import org.hisp.dhis.jdbc.batchhandler.IndicatorGroupSetBatchHandler;
+import org.hisp.dhis.jdbc.batchhandler.IndicatorGroupSetMemberBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.IndicatorTypeBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.OrganisationUnitBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.OrganisationUnitGroupBatchHandler;
@@ -532,7 +538,7 @@
log.info( "Imported DataElementGroups" );
}
-
+
@Transactional
public void importDataElementGroupMembers()
{
@@ -544,6 +550,52 @@
log.info( "Imported DataElementGroup members" );
}
+
+ @Transactional
+ public void importDataElementGroupSets()
+ {
+ BatchHandler<DataElementGroupSet> batchHandler = batchHandlerFactory.createBatchHandler( DataElementGroupSetBatchHandler.class );
+
+ batchHandler.init();
+
+ Collection<ImportObject> importObjects = importObjectStore.getImportObjects( DataElementGroupSet.class );
+
+ for ( ImportObject importObject : importObjects )
+ {
+ DataElementGroupSet object = (DataElementGroupSet) importObject.getObject();
+
+ NameMappingUtil.addDataElementGroupSetMapping( object.getId(), object.getName() );
+
+ if ( importObject.getStatus() == ImportObjectStatus.UPDATE )
+ {
+ DataElementGroupSet compareObject = (DataElementGroupSet) importObject.getCompareObject();
+
+ object.setId( compareObject.getId() );
+ }
+
+ importObject.setObject( object );
+
+ addOrUpdateObject( batchHandler, importObject );
+ }
+
+ batchHandler.flush();
+
+ importObjectStore.deleteImportObjects( DataElementGroupSet.class );
+
+ log.info( "Imported DataElementGroupSets" );
+ }
+
+ @Transactional
+ public void importDataElementGroupSetMembers()
+ {
+ BatchHandler<GroupMemberAssociation> batchHandler = batchHandlerFactory.createBatchHandler( DataElementGroupSetMemberBatchHandler.class );
+
+ importGroupMemberAssociation( batchHandler, GroupMemberType.DATAELEMENTGROUPSET,
+ objectMappingGenerator.getDataElementGroupSetMapping( false ),
+ objectMappingGenerator.getDataElementGroupMapping( false ) );
+
+ log.info( "Imported DataElementGroupSet members" );
+ }
@Transactional
public void importIndicatorTypes()
@@ -684,7 +736,7 @@
log.info( "Imported IndicatorGroups" );
}
-
+
@Transactional
public void importIndicatorGroupMembers()
{
@@ -696,6 +748,52 @@
log.info( "Imported IndicatorGroup members" );
}
+
+ @Transactional
+ public void importIndicatorGroupSets()
+ {
+ BatchHandler<IndicatorGroupSet> batchHandler = batchHandlerFactory.createBatchHandler( IndicatorGroupSetBatchHandler.class );
+
+ batchHandler.init();
+
+ Collection<ImportObject> importObjects = importObjectStore.getImportObjects( IndicatorGroupSet.class );
+
+ for ( ImportObject importObject : importObjects )
+ {
+ IndicatorGroupSet object = (IndicatorGroupSet) importObject.getObject();
+
+ NameMappingUtil.addIndicatorGroupSetMapping( object.getId(), object.getName() );
+
+ if ( importObject.getStatus() == ImportObjectStatus.UPDATE )
+ {
+ IndicatorGroupSet compareObject = (IndicatorGroupSet) importObject.getCompareObject();
+
+ object.setId( compareObject.getId() );
+ }
+
+ importObject.setObject( object );
+
+ addOrUpdateObject( batchHandler, importObject );
+ }
+
+ batchHandler.flush();
+
+ importObjectStore.deleteImportObjects( IndicatorGroupSet.class );
+
+ log.info( "Imported IndicatorGroupSets" );
+ }
+
+ @Transactional
+ public void importIndicatorGroupSetMembers()
+ {
+ BatchHandler<GroupMemberAssociation> batchHandler = batchHandlerFactory.createBatchHandler( IndicatorGroupSetMemberBatchHandler.class );
+
+ importGroupMemberAssociation( batchHandler, GroupMemberType.INDICATORGROUPSET,
+ objectMappingGenerator.getIndicatorGroupSetMapping( false ),
+ objectMappingGenerator.getIndicatorGroupMapping( false ) );
+
+ log.info( "Imported IndicatorGroupSet members" );
+ }
@Transactional
public void importDataDictionaries()
@@ -1244,11 +1342,12 @@
@Transactional
public void importDataValues()
{
+ /*
if ( lockingManager.currentImportContainsLockedData() )
{
log.warn( "Import file contained DataValues for locked periods" );
}
- else
+ else*/ //TODO too slow
{
BatchHandler<DataValue> batchHandler = batchHandlerFactory.createBatchHandler( DataValueBatchHandler.class );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectService.java 2009-07-08 22:52:31 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectService.java 2009-11-02 11:56:51 +0000
@@ -43,6 +43,7 @@
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.CompleteDataSetRegistration;
import org.hisp.dhis.dataset.DataSet;
@@ -60,6 +61,7 @@
import org.hisp.dhis.importexport.mapping.NameMappingUtil;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.indicator.IndicatorType;
import org.hisp.dhis.olap.OlapURL;
@@ -293,6 +295,13 @@
DataElementGroup group = (DataElementGroup) importObject.getObject();
deleteGroupAssociations( GroupMemberType.DATAELEMENTGROUP, group.getId() );
+ deleteMemberAssociations( GroupMemberType.DATAELEMENTGROUPSET, group.getId() );
+ }
+ else if ( importObject.getClassName().equals( DataElementGroupSet.class.getName() ) )
+ {
+ DataElementGroupSet groupSet = (DataElementGroupSet) importObject.getObject();
+
+ deleteGroupAssociations( GroupMemberType.DATAELEMENTGROUPSET, groupSet.getId() );
}
else if ( importObject.getClassName().equals( IndicatorType.class.getName() ) )
{
@@ -313,6 +322,13 @@
IndicatorGroup group = (IndicatorGroup) importObject.getObject();
deleteGroupAssociations( GroupMemberType.INDICATORGROUP, group.getId() );
+ deleteMemberAssociations( GroupMemberType.INDICATORGROUPSET, group.getId() );
+ }
+ else if ( importObject.getClassName().equals( IndicatorGroupSet.class.getName() ) )
+ {
+ IndicatorGroupSet groupSet = (IndicatorGroupSet) importObject.getObject();
+
+ deleteGroupAssociations( GroupMemberType.INDICATORGROUPSET, groupSet.getId() );
}
else if ( importObject.getClassName().equals( DataDictionary.class.getName() ) )
{
@@ -409,6 +425,11 @@
else if ( clazz.equals( DataElementGroup.class ) )
{
importObjectStore.deleteImportObjects( GroupMemberType.DATAELEMENTGROUP );
+ importObjectStore.deleteImportObjects( GroupMemberType.DATAELEMENTGROUPSET );
+ }
+ else if ( clazz.equals( DataElementGroupSet.class ) )
+ {
+ importObjectStore.deleteImportObjects( GroupMemberType.DATAELEMENTGROUPSET );
}
else if ( clazz.equals( IndicatorType.class ) )
{
@@ -426,6 +447,11 @@
else if ( clazz.equals( IndicatorGroup.class ) )
{
importObjectStore.deleteImportObjects( GroupMemberType.INDICATORGROUP );
+ importObjectStore.deleteImportObjects( GroupMemberType.INDICATORGROUPSET );
+ }
+ else if ( clazz.equals( IndicatorGroupSet.class ) )
+ {
+ importObjectStore.deleteImportObjects( GroupMemberType.INDICATORGROUPSET );
}
else if ( clazz.equals( DataDictionary.class ) )
{
@@ -498,6 +524,12 @@
group.setName( dataElementService.getDataElementGroup( existingObjectId ).getName() );
}
+ else if ( object.getClass().equals( DataElementGroupSet.class ) )
+ {
+ DataElementGroupSet groupSet = (DataElementGroupSet) object;
+
+ groupSet.setName( dataElementService.getDataElementGroupSet( existingObjectId ).getName() );
+ }
else if ( object.getClass().equals( IndicatorType.class ) )
{
IndicatorType type = (IndicatorType) object;
@@ -516,6 +548,12 @@
group.setName( indicatorService.getIndicatorGroup( existingObjectId ).getName() );
}
+ else if ( object.getClass().equals( IndicatorGroupSet.class ) )
+ {
+ IndicatorGroupSet groupSet = (IndicatorGroupSet) object;
+
+ groupSet.setName( indicatorService.getIndicatorGroupSet( existingObjectId ).getName() );
+ }
else if ( object.getClass().equals( DataDictionary.class ) )
{
DataDictionary dictionary = (DataDictionary) object;
@@ -604,10 +642,14 @@
importObjectManager.importCalculatedDataElements();
importObjectManager.importDataElementGroups();
importObjectManager.importDataElementGroupMembers();
+ importObjectManager.importDataElementGroupSets();
+ importObjectManager.importDataElementGroupSetMembers();
importObjectManager.importIndicatorTypes();
importObjectManager.importIndicators();
importObjectManager.importIndicatorGroups();
importObjectManager.importIndicatorGroupMembers();
+ importObjectManager.importIndicatorGroupSets();
+ importObjectManager.importIndicatorGroupSetMembers();
importObjectManager.importDataDictionaries();
importObjectManager.importDataDictionaryDataElements();
importObjectManager.importDataDictionaryIndicators();
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetMatchOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetMatchOptionsAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetMatchOptionsAction.java 2009-11-02 11:56:51 +0000
@@ -27,13 +27,30 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.common.Objects.CALCULATEDDATAELEMENT;
+import static org.hisp.dhis.common.Objects.DATADICTIONARY;
+import static org.hisp.dhis.common.Objects.DATAELEMENT;
+import static org.hisp.dhis.common.Objects.DATAELEMENTGROUP;
+import static org.hisp.dhis.common.Objects.DATAELEMENTGROUPSET;
+import static org.hisp.dhis.common.Objects.DATASET;
+import static org.hisp.dhis.common.Objects.INDICATOR;
+import static org.hisp.dhis.common.Objects.INDICATORGROUP;
+import static org.hisp.dhis.common.Objects.INDICATORGROUPSET;
+import static org.hisp.dhis.common.Objects.INDICATORTYPE;
+import static org.hisp.dhis.common.Objects.OLAPURL;
+import static org.hisp.dhis.common.Objects.ORGANISATIONUNIT;
+import static org.hisp.dhis.common.Objects.ORGANISATIONUNITGROUP;
+import static org.hisp.dhis.common.Objects.ORGANISATIONUNITGROUPSET;
+import static org.hisp.dhis.common.Objects.ORGANISATIONUNITLEVEL;
+import static org.hisp.dhis.common.Objects.REPORTTABLE;
+import static org.hisp.dhis.common.Objects.VALIDATIONRULE;
+
import java.util.Collection;
import org.hisp.dhis.datadictionary.DataDictionaryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.importexport.ImportObjectService;
-import org.hisp.dhis.importexport.action.util.ClassMapUtil;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.olap.OlapURLService;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -179,63 +196,71 @@
{
importObject = importObjectService.getImportObject( Integer.valueOf( objectId ) );
- if ( objectType.equals( ClassMapUtil.ObjectType.DATAELEMENT.name() ) )
+ if ( objectType.equals( DATAELEMENT.name() ) )
{
objects = dataElementService.getNonCalculatedDataElements();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.CALCULATEDDATAELEMENT.name() ) )
+ else if ( objectType.equals( CALCULATEDDATAELEMENT.name() ) )
{
objects = dataElementService.getCalculatedDataElements();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.DATAELEMENTGROUP.name() ) )
+ else if ( objectType.equals( DATAELEMENTGROUP.name() ) )
{
objects = dataElementService.getAllDataElementGroups();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.INDICATORTYPE.name() ) )
+ else if ( objectType.equals( DATAELEMENTGROUPSET.name() ) )
+ {
+ objects = dataElementService.getAllDataElementGroupSets();
+ }
+ else if ( objectType.equals( INDICATORTYPE.name() ) )
{
objects = indicatorService.getAllIndicatorTypes();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.INDICATOR.name() ) )
+ else if ( objectType.equals( INDICATOR.name() ) )
{
objects = indicatorService.getAllIndicators();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.INDICATORGROUP.name() ) )
+ else if ( objectType.equals( INDICATORGROUP.name() ) )
{
objects = indicatorService.getAllIndicatorGroups();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.DATADICTIONARY.name() ) )
+ else if ( objectType.equals( INDICATORGROUPSET.name() ) )
+ {
+ objects = indicatorService.getAllIndicatorGroupSets();
+ }
+ else if ( objectType.equals( DATADICTIONARY.name() ) )
{
objects = dataDictionaryService.getAllDataDictionaries();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.DATASET.name() ) )
+ else if ( objectType.equals( DATASET.name() ) )
{
objects = dataSetService.getAllDataSets();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.ORGANISATIONUNIT.name() ) )
+ else if ( objectType.equals( ORGANISATIONUNIT.name() ) )
{
objects = organisationUnitService.getAllOrganisationUnits();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.ORGANISATIONUNITGROUP.name() ) )
+ else if ( objectType.equals( ORGANISATIONUNITGROUP.name() ) )
{
objects = organisationUnitGroupService.getAllOrganisationUnitGroups();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.ORGANISATIONUNITGROUPSET.name() ) )
+ else if ( objectType.equals( ORGANISATIONUNITGROUPSET.name() ) )
{
objects = organisationUnitGroupService.getAllOrganisationUnitGroupSets();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.ORGANISATIONUNITLEVEL.name() ) )
+ else if ( objectType.equals( ORGANISATIONUNITLEVEL.name() ) )
{
objects = organisationUnitService.getOrganisationUnitLevels();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.VALIDATIONRULE.name() ) )
+ else if ( objectType.equals( VALIDATIONRULE.name() ) )
{
objects = validationRuleService.getAllValidationRules();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.REPORTTABLE.name() ) )
+ else if ( objectType.equals( REPORTTABLE.name() ) )
{
objects = reportTableService.getAllReportTables();
}
- else if ( objectType.equals( ClassMapUtil.ObjectType.OLAPURL.name() ) )
+ else if ( objectType.equals( OLAPURL.name() ) )
{
objects = olapURLService.getAllOlapURLs();
}
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetPreviewOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetPreviewOptionsAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetPreviewOptionsAction.java 2009-11-02 11:56:51 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.dataelement.CalculatedDataElement;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.importexport.ImportDataValueService;
import org.hisp.dhis.importexport.ImportObjectService;
@@ -43,6 +44,7 @@
import org.hisp.dhis.importexport.action.util.ClassMapUtil;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
import org.hisp.dhis.indicator.IndicatorType;
import org.hisp.dhis.olap.OlapURL;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -139,6 +141,13 @@
return newDataElementGroups;
}
+ private Integer newDataElementGroupSets;
+
+ public Integer getNewDataElementGroupSets()
+ {
+ return newDataElementGroupSets;
+ }
+
private Integer newIndicatorTypes;
public Integer getNewIndicatorTypes()
@@ -160,6 +169,13 @@
return newIndicatorGroups;
}
+ private Integer newIndicatorGroupSets;
+
+ public Integer getNewIndicatorGroupSets()
+ {
+ return newIndicatorGroupSets;
+ }
+
private Integer newDataDictionaries;
public Integer getNewDataDictionaries()
@@ -258,6 +274,13 @@
return updateDataElementGroups;
}
+ private Integer updateDataElementGroupSets;
+
+ public Integer getUpdateDataElementGroupSets()
+ {
+ return updateDataElementGroupSets;
+ }
+
private Integer updateIndicatorTypes;
public Integer getUpdateIndicatorTypes()
@@ -279,6 +302,13 @@
return updateIndicatorGroups;
}
+ private Integer updateIndicatorGroupSets;
+
+ public Integer getUpdateIndicatorGroupSets()
+ {
+ return updateIndicatorGroupSets;
+ }
+
private Integer updateDataDictionaries;
public Integer getUpdateDataDictionaries()
@@ -374,9 +404,11 @@
newCalculatedDataElements = importObjectService.getImportObjects( ImportObjectStatus.NEW, CalculatedDataElement.class ).size();
newExtendedDataElements = importObjectService.getImportObjects( ImportObjectStatus.NEW, ExtendedDataElement.class ).size();
newDataElementGroups = importObjectService.getImportObjects( ImportObjectStatus.NEW, DataElementGroup.class ).size();
+ newDataElementGroupSets = importObjectService.getImportObjects( ImportObjectStatus.NEW, DataElementGroupSet.class ).size();
newIndicatorTypes = importObjectService.getImportObjects( ImportObjectStatus.NEW, IndicatorType.class ).size();
newIndicators = importObjectService.getImportObjects( ImportObjectStatus.NEW, Indicator.class ).size();
newIndicatorGroups = importObjectService.getImportObjects( ImportObjectStatus.NEW, IndicatorGroup.class ).size();
+ newIndicatorGroupSets = importObjectService.getImportObjects( ImportObjectStatus.NEW, IndicatorGroupSet.class ).size();
newDataDictionaries = importObjectService.getImportObjects( ImportObjectStatus.NEW, DataDictionary.class ).size();
newDataSets = importObjectService.getImportObjects( ImportObjectStatus.NEW, DataSet.class ).size();
newOrganisationUnits = importObjectService.getImportObjects( ImportObjectStatus.NEW, OrganisationUnit.class ).size();
@@ -392,9 +424,11 @@
updateCalculatedDataElements = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, CalculatedDataElement.class ).size();
updateExtendedDataElements = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, ExtendedDataElement.class ).size();
updateDataElementGroups = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, DataElementGroup.class ).size();
+ updateDataElementGroupSets = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, DataElementGroupSet.class ).size();
updateIndicatorTypes = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, IndicatorType.class ).size();
updateIndicators = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, Indicator.class ).size();
updateIndicatorGroups = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, IndicatorGroup.class ).size();
+ updateIndicatorGroupSets = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, IndicatorGroupSet.class ).size();
updateDataDictionaries = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, DataDictionary.class ).size();
updateDataSets = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, DataSet.class ).size();
updateOrganisationUnits = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, OrganisationUnit.class ).size();
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ClassMapUtil.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ClassMapUtil.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/util/ClassMapUtil.java 2009-11-02 11:56:51 +0000
@@ -30,15 +30,18 @@
import java.util.HashMap;
import java.util.Map;
+import org.hisp.dhis.common.Objects;
import org.hisp.dhis.datadictionary.DataDictionary;
import org.hisp.dhis.datadictionary.ExtendedDataElement;
import org.hisp.dhis.dataelement.CalculatedDataElement;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
import org.hisp.dhis.indicator.IndicatorType;
import org.hisp.dhis.olap.OlapURL;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -48,65 +51,48 @@
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.validation.ValidationRule;
+import static org.hisp.dhis.common.Objects.*;
+
/**
* @author Lars Helge Overland
* @version $Id$
*/
public class ClassMapUtil
{
- //TODO move to API?
-
- public static enum ObjectType
- {
- DATAELEMENT,
- CALCULATEDDATAELEMENT,
- EXTENDEDDATAELEMENT,
- DATAELEMENTGROUP,
- INDICATORTYPE,
- INDICATOR,
- INDICATORGROUP,
- DATADICTIONARY,
- DATASET,
- ORGANISATIONUNIT,
- ORGANISATIONUNITGROUP,
- ORGANISATIONUNITGROUPSET,
- ORGANISATIONUNITLEVEL,
- VALIDATIONRULE,
- REPORTTABLE,
- OLAPURL,
- DATAVALUE
- }
-
- private static Map<ObjectType, Class<?>> classMap;
+
+
+ private static Map<Objects, Class<?>> classMap;
static
{
- classMap = new HashMap<ObjectType, Class<?>>();
+ classMap = new HashMap<Objects, Class<?>>();
- classMap.put( ObjectType.DATAELEMENT, DataElement.class );
- classMap.put( ObjectType.CALCULATEDDATAELEMENT, CalculatedDataElement.class );
- classMap.put( ObjectType.EXTENDEDDATAELEMENT, ExtendedDataElement.class );
- classMap.put( ObjectType.DATAELEMENTGROUP, DataElementGroup.class );
- classMap.put( ObjectType.INDICATORTYPE, IndicatorType.class );
- classMap.put( ObjectType.INDICATOR, Indicator.class );
- classMap.put( ObjectType.INDICATORGROUP, IndicatorGroup.class );
- classMap.put( ObjectType.DATADICTIONARY, DataDictionary.class );
- classMap.put( ObjectType.DATASET, DataSet.class );
- classMap.put( ObjectType.ORGANISATIONUNIT, OrganisationUnit.class );
- classMap.put( ObjectType.ORGANISATIONUNITGROUP, OrganisationUnitGroup.class );
- classMap.put( ObjectType.ORGANISATIONUNITGROUPSET, OrganisationUnitGroupSet.class );
- classMap.put( ObjectType.ORGANISATIONUNITLEVEL, OrganisationUnitLevel.class );
- classMap.put( ObjectType.VALIDATIONRULE, ValidationRule.class );
- classMap.put( ObjectType.REPORTTABLE, ReportTable.class );
- classMap.put( ObjectType.OLAPURL, OlapURL.class );
- classMap.put( ObjectType.DATAVALUE, DataValue.class );
+ classMap.put( DATAELEMENT, DataElement.class );
+ classMap.put( CALCULATEDDATAELEMENT, CalculatedDataElement.class );
+ classMap.put( EXTENDEDDATAELEMENT, ExtendedDataElement.class );
+ classMap.put( DATAELEMENTGROUP, DataElementGroup.class );
+ classMap.put( DATAELEMENTGROUPSET, DataElementGroupSet.class );
+ classMap.put( INDICATORTYPE, IndicatorType.class );
+ classMap.put( INDICATOR, Indicator.class );
+ classMap.put( INDICATORGROUP, IndicatorGroup.class );
+ classMap.put( INDICATORGROUPSET, IndicatorGroupSet.class );
+ classMap.put( DATADICTIONARY, DataDictionary.class );
+ classMap.put( DATASET, DataSet.class );
+ classMap.put( ORGANISATIONUNIT, OrganisationUnit.class );
+ classMap.put( ORGANISATIONUNITGROUP, OrganisationUnitGroup.class );
+ classMap.put( ORGANISATIONUNITGROUPSET, OrganisationUnitGroupSet.class );
+ classMap.put( ORGANISATIONUNITLEVEL, OrganisationUnitLevel.class );
+ classMap.put( VALIDATIONRULE, ValidationRule.class );
+ classMap.put( REPORTTABLE, ReportTable.class );
+ classMap.put( OLAPURL, OlapURL.class );
+ classMap.put( DATAVALUE, DataValue.class );
}
public static Class<?> getClass( String type )
{
try
{
- return classMap.get( ObjectType.valueOf( type ) );
+ return classMap.get( valueOf( type ) );
}
catch ( IllegalArgumentException ex )
{
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2009-11-01 21:32:55 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties 2009-11-02 11:56:51 +0000
@@ -429,4 +429,6 @@
error_data_elements_with_different_period_types = There are data elements registered for data sets with different period types, please go to data integrity checks for more information and then correct this before exporting
data_element_group_sets = Data element group sets
indicator_group_sets = Indicator group sets
+data_element_group_set = Data element group set
+indicator_group_set = Indicator group set
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/import.js'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/import.js 2009-03-18 16:58:55 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/javascript/import.js 2009-11-02 11:56:51 +0000
@@ -94,6 +94,14 @@
{
handleField( discardedElements, "updateDataElementGroupSpan", "updateDataElementGroupTd" );
}
+ else if ( elementType == "DATAELEMENTGROUPSET" && elementStatus == "NEW" )
+ {
+ handleField( discardedElements, "newDataElementGroupSetSpan", "newDataElementGroupSetTd" );
+ }
+ else if ( elementType == "DATAELEMENTGROUPSET" && elementStatus == "UPDATE" )
+ {
+ handleField( discardedElements, "updateDataElementGroupSetSpan", "updateDataElementGroupSetTd" );
+ }
else if ( elementType == "INDICATORTYPE" && elementStatus == "NEW" )
{
handleField( discardedElements, "newIndicatorTypeSpan", "newIndicatorTypeTd" );
@@ -118,6 +126,14 @@
{
handleField( discardedElements, "updateIndicatorGroupSpan", "updateIndicatorGroupTd" );
}
+ else if ( elementType == "INDICATORGROUPSET" && elementStatus == "NEW" )
+ {
+ handleField( discardedElements, "newIndicatorGroupSetSpan", "newIndicatorGroupSetTd" );
+ }
+ else if ( elementType == "INDICATORGROUPSET" && elementStatus == "UPDATE" )
+ {
+ handleField( discardedElements, "updateIndicatorGroupSetSpan", "updateIndicatorGroupSetTd" );
+ }
else if ( elementType == "DATASET" && elementStatus == "NEW" )
{
handleField( discardedElements, "newDataSetSpan", "newDataSetTd" );
@@ -239,6 +255,11 @@
clearField( "newDataElementGroupTd" );
clearField( "updateDataElementGroupTd" );
}
+ else if ( elementType == "DATAELEMENTGROUPSET" )
+ {
+ clearField( "newDataElementGroupSetTd" );
+ clearField( "updateDataElementGroupSetTd" );
+ }
else if ( elementType == "INDICATORTYPE")
{
clearField( "newIndicatorTypeTd" );
@@ -256,6 +277,11 @@
clearField( "newIndicatorGroupTd" );
clearField( "updateIndicatorGroupTd" );
}
+ else if ( elementType == "INDICATORGROUPSET" )
+ {
+ clearField( "newIndicatorGroupSetTd" );
+ clearField( "updateIndicatorGroupSetTd" );
+ }
else if ( elementType == "DATASET" )
{
clearField( "newDataSetTd" );
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/previewForm.vm'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/previewForm.vm 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/webapp/dhis-web-importexport/previewForm.vm 2009-11-02 11:56:51 +0000
@@ -91,7 +91,32 @@
<td>$i18n.getString( "none" )</td>
#end
<td></td>
- </tr>
+ </tr><tr>
+ <td>$i18n.getString( "data_element_group_set" )</td>
+ #if ( $newDataElementGroupSets > 0 )
+ <td id="newDataElementGroupSetTd" style="background-color:#CEEACC">
+ <a href="displayPreviewForm.action?type=DATAELEMENTGROUPSET&status=NEW" style="width:100%; display:block; text-align:center">
+ <span id="newDataElementGroupSetSpan">
+ $newDataElementGroupSets
+ </span>
+ </a>
+ </td>
+ #else
+ <td>$i18n.getString( "none" )</td>
+ #end
+ #if ( $updateDataElementGroupSets > 0 )
+ <td id="updateDataElementGroupSetTd" style="background-color:#D1D9E5">
+ <a href="displayPreviewForm.action?type=DATAELEMENTGROUPSET&status=UPDATE" style="width:100%; display:block; text-align:center">
+ <span id="updateDataElementGroupSetSpan">
+ $updateDataElementGroupSets
+ </span>
+ </a>
+ </td>
+ #else
+ <td>$i18n.getString( "none" )</td>
+ #end
+ <td></td>
+ </tr>
<tr>
<td>$i18n.getString( "indicator_type" )</td>
#if ( $newIndicatorTypes > 0 )
@@ -171,6 +196,32 @@
<td></td>
</tr>
<tr>
+ <td>$i18n.getString( "indicator_group_set" )</td>
+ #if ( $newIndicatorGroupSets > 0 )
+ <td id="newIndicatorGroupSetTd" style="background-color:#CEEACC">
+ <a href="displayPreviewForm.action?type=INDICATORGROUPSET&status=NEW" style="width:100%; display:block; text-align:center">
+ <span id="newIndicatorGroupSetSpan">
+ $newIndicatorGroupSets
+ </span>
+ </a>
+ </td>
+ #else
+ <td>$i18n.getString( "none" )</td>
+ #end
+ #if ( $updateIndicatorGroupSets > 0 )
+ <td id="updateIndicatorGroupSetTd" style="background-color:#D1D9E5">
+ <a href="displayPreviewForm.action?type=INDICATORGROUPSET&status=UPDATE" style="width:100%; display:block; text-align:center">
+ <span id="updateIndicatorGroupSetSpan">
+ $updateIndicatorGroupSets
+ </span>
+ </a>
+ </td>
+ #else
+ <td>$i18n.getString( "none" )</td>
+ #end
+ <td></td>
+ </tr>
+ <tr>
<td>$i18n.getString( "data_dictionary" )</td>
#if ( $newDataDictionaries > 0 )
<td id="newDataDictionaryTd" style="background-color:#CEEACC">