=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2010-11-20 10:53:59 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2010-12-22 04:05:46 +0000 @@ -95,6 +95,11 @@ */ private DataEntryForm dataEntryForm; + /** + * Indicating custom data entry form. + */ + private Integer version; + // ------------------------------------------------------------------------- // Contructors // ------------------------------------------------------------------------- @@ -287,4 +292,18 @@ return result; } + + public Integer getVersion() + { + return version; + } + + public void setVersion( Integer version ) + { + this.version = version; + } + + + + } === 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 2010-11-27 09:37:29 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java 2010-12-22 04:05:46 +0000 @@ -199,6 +199,20 @@ */ Collection getDataSetsForMobile(Source source); + /** + * Get list of realted datasets from categoryOption + * + * @return A List containing related DataSets. + */ + Collection getMobileDataSetsFromCategoryOption(int categoryOptionId); + + /** + * Get list of realted datasets from category + * + * @return A List containing related DataSets. + */ + Collection getMobileDataSetsFromCategory(int categoryOptionId); + // ------------------------------------------------------------------------- // FrequencyOverrideAssociation // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java 2010-11-27 09:37:29 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java 2010-12-22 04:05:46 +0000 @@ -122,6 +122,9 @@ Collection getDataSetsBySources( Collection sources ); + Collection getMobileDataSetsFromCategoryOption(int categoryOptionId); + + Collection getMobileDataSetsFromCategory(int categoryId); // ------------------------------------------------------------------------- // FrequencyOverrideAssociation // ------------------------------------------------------------------------- === 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 2010-11-27 09:37:29 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2010-12-22 04:05:46 +0000 @@ -275,11 +275,18 @@ return i18n( i18nService, dataSet.getDataElements() ); } - public Collection getDataSetsForMobile(Source source) - { - return i18n( i18nService, dataSetStore.getDataSetsForMobile(source) ); - } - + public Collection getDataSetsForMobile(Source source) + { + return i18n( i18nService, dataSetStore.getDataSetsForMobile(source) ); + } + + public Collection getMobileDataSetsFromCategoryOption(int categoryOptionId){ + return dataSetStore.getMobileDataSetsFromCategoryOption(categoryOptionId); + } + + public Collection getMobileDataSetsFromCategory(int categoryId){ + return dataSetStore.getMobileDataSetsFromCategory(categoryId); + } // ------------------------------------------------------------------------- // FrequencyOverrideAssociation // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java 2010-12-12 07:34:08 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java 2010-12-22 04:05:46 +0000 @@ -27,8 +27,16 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; +import org.amplecode.quick.StatementHolder; +import org.amplecode.quick.StatementManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.Session; @@ -47,11 +55,20 @@ * @version $Id: HibernateDataSetStore.java 3303 2007-05-14 13:39:34Z larshelg $ */ public class HibernateDataSetStore - extends HibernateGenericStore implements DataSetStore + extends HibernateGenericStore + implements DataSetStore { + private static final Log log = LogFactory.getLog( HibernateDataSetStore.class ); + // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- + private StatementManager statementManager; + + public void setStatementManager( StatementManager statementManager ) + { + this.statementManager = statementManager; + } private PeriodStore periodStore; @@ -142,12 +159,12 @@ public Collection getDataSetsByPeriodType( PeriodType periodType ) { periodType = periodStore.getPeriodType( periodType.getClass() ); - + Session session = sessionFactory.getCurrentSession(); - + Criteria criteria = session.createCriteria( DataSet.class ); criteria.add( Restrictions.eq( "periodType", periodType ) ); - + return criteria.list(); } @@ -155,10 +172,10 @@ public Collection getDataSetsBySource( Source source ) { String hql = "from DataSet d where :source in elements(d.sources)"; - + Query query = sessionFactory.getCurrentSession().createQuery( hql ); query.setEntity( "source", source ); - + return query.list(); } @@ -166,8 +183,9 @@ public Collection getDataSetsBySources( Collection sources ) { String hql = "select distinct d from DataSet d join d.sources s where s.id in (:ids)"; - - return sessionFactory.getCurrentSession().createQuery( hql ).setParameterList( "ids", ConversionUtils.getIdentifiers( Source.class, sources ) ).list(); + + return sessionFactory.getCurrentSession().createQuery( hql ) + .setParameterList( "ids", ConversionUtils.getIdentifiers( Source.class, sources ) ).list(); } @SuppressWarnings( "unchecked" ) @@ -178,8 +196,72 @@ query.setEntity( "source", source ); return query.list(); - } - + + } + + @SuppressWarnings( "unchecked" ) + public Collection getMobileDataSetsFromCategoryOption( int categoryOptionId ) + { + StatementHolder holder = statementManager.getHolder(); + + List mobileDataSets = new ArrayList(); + + try + { + Statement statement = holder.getStatement(); + + ResultSet resultSet = statement + .executeQuery( "select * from dataset where datasetid in (select DISTINCT datasetid from datasetmembers where dataelementid in (select dataelementid from dataelement where categorycomboid in (select categorycomboid from categorycombos_categories where categoryid in (select categoryid from categories_categoryoptions where categoryoptionid = '" + + categoryOptionId + "')))) and (mobile = true and mobile is not null)" ); + + while ( resultSet.next() ) + { + DataSet dataSet = getDataSet( resultSet.getInt( 1 ) ); + mobileDataSets.add( dataSet ); + } + } + catch ( Exception ex ) + { + log.error( ex ); + } + finally + { + holder.close(); + } + + return mobileDataSets; + } + + @SuppressWarnings( "unchecked" ) + public Collection getMobileDataSetsFromCategory( int categoryId ) + { + StatementHolder holder = statementManager.getHolder(); + + List mobileDataSets = new ArrayList(); + + try + { + Statement statement = holder.getStatement(); + + ResultSet resultSet = statement + .executeQuery( "select * from dataset where datasetid in (select DISTINCT datasetid from datasetmembers where dataelementid in (select dataelementid from dataelement where categorycomboid in (select categorycomboid from categorycombos_categories where categoryid ='" + + categoryId + "'))) and (mobile = true and mobile is not null)" ); + while ( resultSet.next() ) + { + DataSet dataSet = getDataSet( resultSet.getInt( 1 ) ); + mobileDataSets.add( dataSet ); + } + } + catch ( Exception ex ) + { + log.error( ex ); + } + finally + { + holder.close(); + } + return mobileDataSets; + } // ------------------------------------------------------------------------- // FrequencyOverrideAssociation // ------------------------------------------------------------------------- @@ -272,5 +354,5 @@ public Collection getDataSetsBetweenByName( String name, int first, int max ) { return getBetweenByName( name, first, max ); - } + } } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-12-16 17:38:32 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-12-22 04:05:46 +0000 @@ -1,167 +1,195 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -173,1231 +201,1395 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - stddevoutlier - - - - - - minmaxoutlier - - - - - - gap - - - - - - followup - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - shortName - description - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - shortName - description - numeratorDescription - denominatorDescription - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - description - region - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - shortName - comment - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - description - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - shortName - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - name - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + stddevoutlier + + + + + + minmaxoutlier + + + + + + gap + + + + + + followup + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name + shortName + description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + shortName + description + numeratorDescription + denominatorDescription + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + description + region + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name + shortName + comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name + shortName + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + name + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2010-10-22 06:52:16 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2010-12-22 04:05:46 +0000 @@ -49,5 +49,7 @@ + + === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2010-11-09 06:45:07 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2010-12-22 04:05:46 +0000 @@ -69,6 +69,10 @@ updateDOBType(); + updateDataSetMobileAttribute(); + + updateDataSetVersionAttribute(); + executeSql("UPDATE patientidentifiertype SET type='" + PatientIdentifierType.VALUE_TYPE_TEXT +"' WHERE type IS NULL"); executeSql("UPDATE program SET minDaysAllowedInputData=0 WHERE minDaysAllowedInputData IS NULL"); @@ -131,6 +135,40 @@ holder.close(); } } + + private void updateDataSetMobileAttribute(){ + StatementHolder holder = statementManager.getHolder(); + + try + { + executeSql( "UPDATE dataset SET mobile = false WHERE mobile is null"); + } + catch ( Exception ex ) + { + log.error( ex ); + } + finally + { + holder.close(); + } + } + + private void updateDataSetVersionAttribute(){ + StatementHolder holder = statementManager.getHolder(); + + try + { + executeSql( "UPDATE dataset SET version = 1 WHERE version is null"); + } + catch ( Exception ex ) + { + log.error( ex ); + } + finally + { + holder.close(); + } + } private int executeSql( String sql ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/DataSet.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/DataSet.java 2010-11-30 19:36:40 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/DataSet.java 2010-12-22 04:05:46 +0000 @@ -37,12 +37,28 @@ public class DataSet extends Model + implements DataStreamSerializable, Comparable { private String periodType; private List
sections; + private int version; + + public DataSet() + { + } + + public DataSet( DataSet dataSet ) + { + this.setId( dataSet.getId() ); + this.setName( dataSet.getName() ); + this.periodType = dataSet.getPeriodType(); + this.sections = dataSet.getSections(); + this.version = dataSet.getVersion(); + } + public String getPeriodType() { return periodType; @@ -53,8 +69,18 @@ this.periodType = periodType; } - @XmlElementWrapper(name="sections") - @XmlElement(name="section") + public int getVersion() + { + return version; + } + + public void setVersion( int version ) + { + this.version = version; + } + + @XmlElementWrapper( name = "sections" ) + @XmlElement( name = "section" ) public List
getSections() { return sections; @@ -71,6 +97,7 @@ { dout.writeInt( this.getId() ); dout.writeUTF( this.getName() ); + dout.writeInt( this.getVersion() ); dout.writeUTF( this.getPeriodType() ); if ( this.sections == null ) @@ -92,7 +119,45 @@ throws IOException { // FIXME: Get implementation from client - + this.setId( dataInputStream.readInt() ); + this.setName( dataInputStream.readUTF() ); + this.setVersion( dataInputStream.readInt() ); + this.setPeriodType( dataInputStream.readUTF() ); + + int sectionSize = dataInputStream.readInt(); + + for ( int i = 0; i < sectionSize; i++ ) + { + Section section = new Section(); + section.deSerialize( dataInputStream ); + sections.add( section ); + } + + } + + @Override + public boolean equals( Object obj ) + { + if ( ((DataSet) obj).getId() == this.getId() ) + return true; + return false; + } + + @Override + public int compareTo( DataSet ds ) + { + if ( this.getId() > ds.getId() ) + { + return 1; + } + else if ( this.getId() < ds.getId() ) + { + return -1; + } + else + { + return 0; + } } } === added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/DataSetList.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/DataSetList.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/DataSetList.java 2010-12-22 04:05:46 +0000 @@ -0,0 +1,153 @@ +package org.hisp.dhis.web.api.model; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class DataSetList + extends Model implements DataStreamSerializable +{ + private List addedDataSets; + + private List deletedDataSets; + + private List modifiedDataSets; + + private List currentDataSets; + + public DataSetList() + { + } + + public List getAddedDataSets() + { + return addedDataSets; + } + + public void setAddedDataSets( List addedDataSets ) + { + this.addedDataSets = addedDataSets; + } + + public List getDeletedDataSets() + { + return deletedDataSets; + } + + public void setDeletedDataSets( List deletedDataSets ) + { + this.deletedDataSets = deletedDataSets; + } + + public List getModifiedDataSets() + { + return modifiedDataSets; + } + + public void setModifiedDataSets( List modifiedDataSets ) + { + this.modifiedDataSets = modifiedDataSets; + } + + public List getCurrentDataSets() + { + return currentDataSets; + } + + public void setCurrentDataSets( List currentDataSets ) + { + this.currentDataSets = currentDataSets; + } + + @Override + public void serialize( DataOutputStream dout ) + throws IOException + { + if ( addedDataSets != null ) + { + dout.writeInt( addedDataSets.size() ); + for ( DataSet dataSet : addedDataSets ) + { + dataSet.serialize( dout ); + } + }else{ + dout.writeInt( 0 ); + } + if ( deletedDataSets != null ) + { + dout.writeInt( deletedDataSets.size() ); + for ( DataSet dataSet : deletedDataSets ) + { + dataSet.serialize( dout ); + } + }else{ + dout.writeInt( 0 ); + } + if ( modifiedDataSets != null ) + { + dout.writeInt( modifiedDataSets.size() ); + for ( DataSet dataSet : modifiedDataSets ) + { + dataSet.serialize( dout ); + } + }else{ + dout.writeInt( 0 ); + } + if ( currentDataSets != null ) + { + dout.writeInt( currentDataSets.size() ); + for ( DataSet dataSet : currentDataSets ) + { + dataSet.serialize( dout ); + } + }else{ + dout.writeInt( 0 ); + } + } + + @Override + public void deSerialize( DataInputStream dataInputStream ) + throws IOException + { + int temp = 0; + temp = dataInputStream.readInt(); + if(temp > 0){ + addedDataSets = new ArrayList(); + for(int i = 0; i < temp; i++){ + DataSet dataSet = new DataSet(); + dataSet.deSerialize( dataInputStream ); + addedDataSets.add( dataSet ); + } + } + temp = dataInputStream.readInt(); + if(temp > 0){ + deletedDataSets = new ArrayList(); + for(int i = 0; i < temp; i++){ + DataSet dataSet = new DataSet(); + dataSet.deSerialize( dataInputStream ); + deletedDataSets.add( dataSet ); + } + } + temp = dataInputStream.readInt(); + if(temp > 0){ + modifiedDataSets = new ArrayList(); + for(int i = 0; i < temp; i++){ + DataSet dataSet = new DataSet(); + dataSet.deSerialize( dataInputStream ); + modifiedDataSets.add( dataSet ); + } + } + temp = dataInputStream.readInt(); + if(temp > 0){ + currentDataSets = new ArrayList(); + for(int i = 0; i < temp; i++){ + DataSet dataSet = new DataSet(); + dataSet.deSerialize( dataInputStream ); + currentDataSets.add( dataSet ); + } + } + } + +} === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/OrgUnit.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/OrgUnit.java 2010-12-04 00:17:59 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/OrgUnit.java 2010-12-22 04:05:46 +0000 @@ -47,6 +47,8 @@ private String uploadFacilityReportUrl; private String uploadActivityReportUrl; + + private String updateDataSetUrl; @XmlAttribute public int getId() @@ -108,6 +110,16 @@ public void setUploadActivityReportUrl( String uploadActivityReportUrl ) { this.uploadActivityReportUrl = uploadActivityReportUrl; + } + + public String getUpdateDataSetUrl() + { + return updateDataSetUrl; + } + + public void setUpdateDataSetUrl( String updateDataSetUrl ) + { + this.updateDataSetUrl = updateDataSetUrl; } public void serialize( DataOutputStream dataOutputStream ) @@ -119,6 +131,7 @@ dataOutputStream.writeUTF( this.downloadActivityPlanUrl ); dataOutputStream.writeUTF( this.uploadFacilityReportUrl ); dataOutputStream.writeUTF( this.uploadActivityReportUrl ); + dataOutputStream.writeUTF( this.updateDataSetUrl ); } public void deSerialize( DataInputStream dataInputStream ) @@ -130,5 +143,6 @@ this.downloadActivityPlanUrl = dataInputStream.readUTF(); this.uploadFacilityReportUrl = dataInputStream.readUTF(); this.uploadActivityReportUrl = dataInputStream.readUTF(); + this.updateDataSetUrl = dataInputStream.readUTF(); } } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResource.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResource.java 2010-12-08 05:45:56 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResource.java 2010-12-22 04:05:46 +0000 @@ -118,7 +118,8 @@ .build( unit.getId() ).toString() ); orgUnit.setUploadActivityReportUrl( uriInfo.getBaseUriBuilder().path( "/orgUnits/{id}" ).path( "activities" ) .build( unit.getId() ).toString() ); - + orgUnit.setUpdateDataSetUrl( uriInfo.getBaseUriBuilder().path( "/orgUnits/{id}" ).path( "updateDataSets" ) + .build( unit.getId() ).toString() ); return orgUnit; } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java 2010-12-08 05:45:56 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java 2010-12-22 04:05:46 +0000 @@ -1,5 +1,9 @@ package org.hisp.dhis.web.api.resources; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; @@ -13,6 +17,8 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.web.api.model.ActivityPlan; import org.hisp.dhis.web.api.model.ActivityValue; +import org.hisp.dhis.web.api.model.DataSet; +import org.hisp.dhis.web.api.model.DataSetList; import org.hisp.dhis.web.api.model.DataSetValue; import org.hisp.dhis.web.api.model.MobileModel; import org.hisp.dhis.web.api.service.ActivityReportingService; @@ -45,7 +51,10 @@ this.unit = unit; } - /** Get activity plan, program forms and facility forms wrapped in a {@link MobileModel} + /** + * Get activity plan, program forms and facility forms wrapped in a + * {@link MobileModel} + * * @param locale - localize for the given locale */ @GET @@ -64,8 +73,71 @@ return mobileModel; } + @POST + @Path( "updateDataSets" ) + public DataSetList checkUpdatedDataSet( DataSetList dataSetList, @HeaderParam( "accept-language" ) String locale ) + { + if ( DEBUG ) + log.debug( "Checking updated datasets for org unit " + unit.getName() ); + DataSetList updatedDataSetList = new DataSetList(); + List dataSets = facilityReportingService.getMobileDataSetsForUnit( unit, locale ); + List currentDataSets = dataSetList.getCurrentDataSets(); +// List copyCurrentDataSets = new ArrayList(currentDataSets.size()); +// Collections.copy( copyCurrentDataSets, currentDataSets ); + // check added dataset + for ( DataSet dataSet : dataSets ) + { + if ( !currentDataSets.contains( dataSet ) ) + { + if(updatedDataSetList.getAddedDataSets() == null) + updatedDataSetList.setAddedDataSets( new ArrayList() ); + updatedDataSetList.getAddedDataSets().add( dataSet ); + currentDataSets.add( dataSet ); + } + } + + // check deleted dataset + for ( DataSet dataSet : currentDataSets ) + { + if ( !dataSets.contains( dataSet ) ) + { + if(updatedDataSetList.getDeletedDataSets() == null) + updatedDataSetList.setDeletedDataSets( new ArrayList() ); + updatedDataSetList.getDeletedDataSets().add( new DataSet( dataSet ) ); + } + } + if(updatedDataSetList.getDeletedDataSets() != null){ + for (DataSet dataSet : updatedDataSetList.getDeletedDataSets()){ + currentDataSets.remove( dataSet ); + } + } + + // check modified dataset + Collections.sort( dataSets ); + Collections.sort( currentDataSets ); + + for ( int i = 0; i < dataSets.size(); i++ ) + { + if ( dataSets.get( i ).getVersion() != currentDataSets.get( i ).getVersion() ) + { + if(updatedDataSetList.getModifiedDataSets() == null) + updatedDataSetList.setModifiedDataSets( new ArrayList() ); + updatedDataSetList.getModifiedDataSets().add( dataSets.get( i ) ); + } + } + return getUpdatedDataSet( updatedDataSetList ); + } + + @GET + public DataSetList getUpdatedDataSet( DataSetList dataSetList ) + { + if ( DEBUG ) + log.debug( "Returning updated datasets for org unit " + unit.getName() ); + return dataSetList; + } + /** - * Get a localized representation of the current activity plan + * Get a localized representation of the current activity plan */ @GET @Path( "activitiyplan" ) @@ -75,25 +147,30 @@ } /** - * Save a facility report for unit + * Save a facility report for unit + * * @param dataSetValue - the report to save * @throws NotAllowedException if the {@link DataSetValue} is invalid */ @POST @Path( "dataSets" ) - public void saveDataSetValues( DataSetValue dataSetValue ) throws NotAllowedException + public void saveDataSetValues( DataSetValue dataSetValue ) + throws NotAllowedException { facilityReportingService.saveDataSetValues( unit, dataSetValue ); } /** * Save activity report for unit + * * @param activityValue - the report to save - * @throws NotAllowedException if the {@link ActivityValue activity value} is invalid + * @throws NotAllowedException if the {@link ActivityValue activity value} + * is invalid */ @POST @Path( "activities" ) - public void saveActivityReport( ActivityValue activityValue ) throws NotAllowedException + public void saveActivityReport( ActivityValue activityValue ) + throws NotAllowedException { activityReportingService.saveActivityReport( unit, activityValue ); } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java 2010-12-06 06:19:53 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java 2010-12-22 04:05:46 +0000 @@ -133,7 +133,6 @@ DataSet ds = new DataSet(); ds.setId( dataSet.getId() ); - // Name defaults to short name with fallback to name if empty String name = dataSet.getShortName(); if (name == null || name.trim().isEmpty()) { @@ -141,7 +140,7 @@ } ds.setName( name ); -// ds.setVersionDataSet( dataSet.getVersionDataSet() ); + ds.setVersion( dataSet.getVersion() ); ds.setPeriodType( dataSet.getPeriodType().getName() ); List
sectionList = new ArrayList
(); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java 2010-09-04 07:26:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java 2010-12-22 04:05:46 +0000 @@ -28,11 +28,14 @@ */ import java.util.ArrayList; +import java.util.Collection; import java.util.List; import org.hisp.dhis.concept.ConceptService; import org.hisp.dhis.dataelement.DataElementCategory; import org.hisp.dhis.dataelement.DataElementCategoryService; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; import com.opensymphony.xwork2.Action; @@ -61,6 +64,12 @@ this.conceptService = conceptService; } + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- @@ -117,6 +126,11 @@ dataElementCategoryService.updateDataElementCategory( dataElementCategory ); + Collection dataSets = dataSetService.getMobileDataSetsFromCategory(dataElementCategory.getId()); + for(DataSet dataSet : dataSets){ + dataSet.setVersion( dataSet.getVersion() + 1 ); + dataSetService.updateDataSet( dataSet ); + } return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java 2010-12-22 04:05:46 +0000 @@ -27,8 +27,12 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.Collection; + import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryService; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; import com.opensymphony.xwork2.Action; @@ -48,11 +52,18 @@ public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService ) { this.dataElementCategoryService = dataElementCategoryService; - } + } + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } // ------------------------------------------------------------------------- // Input - // ------------------------------------------------------------------------- + // ------------------------------------------------------------------------- private Integer id; @@ -77,9 +88,13 @@ DataElementCategoryOption categoryOption = dataElementCategoryService .getDataElementCategoryOption( id ); categoryOption.setName( name ); - dataElementCategoryService.updateDataElementCategoryOption( categoryOption ); + Collection dataSets = dataSetService.getMobileDataSetsFromCategoryOption(id); + for(DataSet dataSet : dataSets){ + dataSet.setVersion( dataSet.getVersion() + 1 ); + dataSetService.updateDataSet( dataSet ); + } return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/RemoveDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/RemoveDataElementAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/RemoveDataElementAction.java 2010-12-22 04:05:46 +0000 @@ -27,8 +27,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.Set; + import org.hisp.dhis.common.DeleteNotAllowedException; +import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.i18n.I18n; import com.opensymphony.xwork2.Action; @@ -57,7 +62,14 @@ { this.i18n = i18n; } - + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- @@ -79,7 +91,7 @@ { return message; } - + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -89,6 +101,15 @@ { try { + DataElement dataElement = dataElementService.getDataElement( id ); + Set dataSets = dataElement.getDataSets(); + for(DataSet dataSet : dataSets){ + if(dataSet.getMobile() != null && dataSet.getMobile()){ + dataSet.setVersion( dataSet.getVersion() + 1 ); + dataSetService.updateDataSet( dataSet ); + } + } + dataElementService.deleteDataElement( dataElementService.getDataElement( id ) ); } catch ( DeleteNotAllowedException ex ) @@ -101,6 +122,7 @@ } } + return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2010-10-28 09:17:13 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2010-12-22 04:05:46 +0000 @@ -38,6 +38,8 @@ import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.expression.Expression; import org.hisp.dhis.system.util.ConversionUtils; @@ -70,6 +72,13 @@ this.dataElementCategoryService = dataElementCategoryService; } + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + // ------------------------------------------------------------------------- // Input // ------------------------------------------------------------------------- @@ -230,7 +239,7 @@ // --------------------------------------------------------------------- DataElement dataElement = dataElementService.getDataElement( id ); - + DataElementCategoryCombo categoryCombo = dataElementCategoryService .getDataElementCategoryCombo( selectedCategoryComboId ); @@ -303,6 +312,16 @@ dataElement.getGroupSets().add( dataElementService.getDataElementGroupSet( Integer.parseInt( id ) ) ); } + Set dataSets = dataElement.getDataSets(); + for ( DataSet dataSet : dataSets ) + { + if ( dataSet.getMobile() != null && dataSet.getMobile()) + { + dataSet.setVersion( dataSet.getVersion() + 1 ); + dataSetService.updateDataSet( dataSet ); + } + } + dataElementService.updateDataElement( dataElement ); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2010-12-09 05:53:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2010-12-22 04:05:46 +0000 @@ -75,6 +75,9 @@ + + + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2010-12-16 04:49:14 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2010-12-22 04:05:46 +0000 @@ -163,6 +163,7 @@ dataSet.setMobile( mobile ); + dataSet.setVersion( 1 ); for ( String id : selectedList ) { DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( id ) ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2010-09-24 11:12:49 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2010-12-22 04:05:46 +0000 @@ -52,21 +52,21 @@ { this.name = name; } - + private String shortName; public void setShortName( String shortName ) { this.shortName = shortName; } - + private String code; public void setCode( String code ) { this.code = code; - } - + } + private String frequencySelect; public void setFrequencySelect( String frequencySelect ) @@ -87,13 +87,13 @@ { this.selectedList = selectedList; } - + private boolean mobile; - - public void setMobile(boolean mobile) + + public void setMobile( boolean mobile ) { - this.mobile = mobile; - } + this.mobile = mobile; + } // ------------------------------------------------------------------------- // Dependencies @@ -127,7 +127,7 @@ public String execute() throws Exception { - // --------------------------------------------------------------------- + // --------------------------------------------------------------------- // Prepare values // --------------------------------------------------------------------- @@ -140,7 +140,7 @@ { code = null; } - + Collection dataElements = new HashSet(); for ( String id : selectedList ) @@ -149,7 +149,7 @@ } PeriodType periodType = periodService.getPeriodTypeByName( frequencySelect ); - + DataSet dataSet = dataSetService.getDataSet( dataSetId ); dataSet.setName( name ); @@ -158,7 +158,10 @@ dataSet.setPeriodType( periodService.getPeriodTypeByClass( periodType.getClass() ) ); dataSet.setDataElements( dataElements ); dataSet.setMobile( mobile ); - + if ( dataSet.getMobile() != null && dataSet.getMobile() ) + { + dataSet.setVersion( dataSet.getVersion() + 1 ); + } dataSetService.updateDataSet( dataSet ); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java 2010-11-29 16:21:11 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/AddSectionAction.java 2010-12-22 04:05:46 +0000 @@ -122,6 +122,11 @@ section.setDataElements( selectedDataElements ); sectionService.addSection( section ); + if ( dataSet.getMobile() != null && dataSet.getMobile() ) + { + dataSet.setVersion( dataSet.getVersion() + 1 ); + dataSetService.updateDataSet( dataSet ); + } return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java 2010-11-29 16:21:11 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/EditSectionAction.java 2010-12-22 04:05:46 +0000 @@ -40,6 +40,7 @@ import org.hisp.dhis.dataelement.DataElementService; import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator; import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.dataset.Section; import org.hisp.dhis.dataset.SectionService; import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler; @@ -204,7 +205,7 @@ Collections.sort( dataElementGroups, new DataElementGroupNameComparator() ); displayPropertyHandler.handle( dataElementOfDataSet ); - + return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/RemoveSectionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/RemoveSectionAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/RemoveSectionAction.java 2010-12-22 04:05:46 +0000 @@ -27,6 +27,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.dataset.Section; import org.hisp.dhis.dataset.SectionService; @@ -45,6 +47,13 @@ { this.sectionService = sectionService; } + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } // ------------------------------------------------------------------------- // Input & output @@ -66,6 +75,13 @@ { Section section = sectionService.getSection( id ); + DataSet dataSet = section.getDataSet(); + + if(dataSet.getMobile() != null && dataSet.getMobile()){ + dataSet.setVersion( dataSet.getVersion() + 1 ); + dataSetService.updateDataSet( dataSet ); + } + sectionService.deleteSection( section ); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java 2010-11-29 16:43:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java 2010-12-22 04:05:46 +0000 @@ -29,6 +29,8 @@ import java.util.List; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.dataset.Section; import org.hisp.dhis.dataset.SectionService; @@ -54,6 +56,13 @@ { this.sections = sections; } + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } @Override public String execute() @@ -61,6 +70,8 @@ { int sortOrder = 1; + DataSet dataSet = null; + for ( String id : sections ) { Section section = sectionService.getSection( Integer.parseInt( id ) ); @@ -68,7 +79,15 @@ section.setSortOrder( sortOrder++ ); sectionService.updateSection( section ); - } + + if(dataSet == null) + dataSet = section.getDataSet(); + } + if(dataSet.getMobile() != null && dataSet.getMobile()){ + dataSet.setVersion( dataSet.getVersion() + 1 ); + dataSetService.updateDataSet( dataSet ); + } + dataSet = null; return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java 2010-08-25 09:31:57 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/UpdateSectionAction.java 2010-12-22 04:05:46 +0000 @@ -32,6 +32,8 @@ import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.dataset.Section; import org.hisp.dhis.dataset.SectionService; @@ -58,6 +60,12 @@ this.dataElementService = dataElementService; } + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } // ------------------------------------------------------------------------- // Input & output // ------------------------------------------------------------------------- @@ -110,6 +118,12 @@ sectionService.updateSection( section ); + DataSet dataSet = section.getDataSet(); + if(dataSet.getMobile() != null && dataSet.getMobile()){ + dataSet.setVersion( dataSet.getVersion() + 1 ); + dataSetService.updateDataSet( dataSet ); + } + return SUCCESS; } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2010-11-30 06:49:21 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2010-12-22 04:05:46 +0000 @@ -85,6 +85,9 @@ + + + + + + + + +