dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15879
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5861: (wip) automatic dataset locking
------------------------------------------------------------
revno: 5861
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-02-05 20:27:40 +0700
message:
(wip) automatic dataset locking
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/LockException.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/LockExceptionStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/LockException.hbm.xml
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
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/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSet.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSets.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js
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/UpdateDataSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.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/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2012-01-28 17:42:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2012-02-05 13:27:40 +0000
@@ -1,7 +1,7 @@
package org.hisp.dhis.dataset;
/*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,7 +55,8 @@
*/
@XmlRootElement( name = "dataSet", namespace = Dxf2Namespace.NAMESPACE )
@XmlAccessorType( value = XmlAccessType.NONE )
-public class DataSet extends BaseNameableObject
+public class DataSet
+ extends BaseNameableObject
{
public static final String TYPE_DEFAULT = "default";
public static final String TYPE_SECTION = "section";
@@ -118,6 +119,16 @@
*/
private Integer version;
+ /**
+ * How many days after period is over will this dataSet auto-lock
+ */
+ private Integer expiryDays;
+
+ /**
+ * Locking exceptions
+ */
+ private Set<LockException> lockExceptions = new HashSet<LockException>();
+
// -------------------------------------------------------------------------
// Contructors
// -------------------------------------------------------------------------
@@ -236,16 +247,16 @@
return TYPE_DEFAULT;
}
-
+
public Set<DataElement> getDataElementsInSections()
{
Set<DataElement> dataElements = new HashSet<DataElement>();
-
+
for ( Section section : sections )
{
dataElements.addAll( section.getDataElements() );
}
-
+
return dataElements;
}
@@ -423,4 +434,29 @@
{
this.version = version;
}
+
+ @XmlElement
+ @JsonProperty
+ public Integer getExpiryDays()
+ {
+ return expiryDays;
+ }
+
+ public void setExpiryDays( Integer expiryDays )
+ {
+ this.expiryDays = expiryDays;
+ }
+
+ @XmlElementWrapper( name = "lockExceptions" )
+ @XmlElement( name = "lockException" )
+ @JsonProperty
+ public Set<LockException> getLockExceptions()
+ {
+ return lockExceptions;
+ }
+
+ public void setLockExceptions( Set<LockException> lockExceptions )
+ {
+ this.lockExceptions = lockExceptions;
+ }
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/LockException.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/LockException.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/LockException.java 2012-02-05 13:27:40 +0000
@@ -0,0 +1,90 @@
+package org.hisp.dhis.dataset;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class LockException
+{
+ private int id;
+
+ private Period period;
+
+ private OrganisationUnit organisationUnit;
+
+ private DataSet dataSet;
+
+ public LockException()
+ {
+
+ }
+
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ public Period getPeriod()
+ {
+ return period;
+ }
+
+ public void setPeriod( Period period )
+ {
+ this.period = period;
+ }
+
+ public OrganisationUnit getOrganisationUnit()
+ {
+ return organisationUnit;
+ }
+
+ public void setOrganisationUnit( OrganisationUnit organisationUnit )
+ {
+ this.organisationUnit = organisationUnit;
+ }
+
+ public DataSet getDataSet()
+ {
+ return dataSet;
+ }
+
+ public void setDataSet( DataSet dataSet )
+ {
+ this.dataSet = dataSet;
+ }
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/LockExceptionStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/LockExceptionStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/LockExceptionStore.java 2012-02-05 13:27:40 +0000
@@ -0,0 +1,39 @@
+package org.hisp.dhis.dataset;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.common.GenericStore;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public interface LockExceptionStore
+ extends GenericStore<LockException>
+{
+ String ID = LockExceptionStore.class.getName();
+}
=== 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 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java 2012-02-05 13:27:40 +0000
@@ -27,8 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
-
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
@@ -41,6 +39,8 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.system.util.ConversionUtils;
+import java.util.Collection;
+
/**
* @author Kristian Nordal
* @version $Id: HibernateDataSetStore.java 3303 2007-05-14 13:39:34Z larshelg $
@@ -52,7 +52,7 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
+
private PeriodStore periodStore;
public void setPeriodStore( PeriodStore periodStore )
@@ -115,7 +115,7 @@
return query.list();
}
-
+
@SuppressWarnings( "unchecked" )
public Collection<DataSet> getDataSetsForMobile()
{
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java 2012-02-05 13:27:40 +0000
@@ -0,0 +1,41 @@
+package org.hisp.dhis.dataset.hibernate;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.dataset.LockException;
+import org.hisp.dhis.dataset.LockExceptionStore;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class HibernateLockExceptionStore
+ extends HibernateGenericStore<LockException>
+ implements LockExceptionStore
+{
+}
=== 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 2012-02-03 08:17:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2012-02-05 13:27:40 +0000
@@ -85,6 +85,12 @@
<property name="cacheable" value="true" />
</bean>
+ <bean id="org.hisp.dhis.dataset.LockExceptionStore" class="org.hisp.dhis.dataset.hibernate.HibernateLockExceptionStore">
+ <property name="clazz" value="org.hisp.dhis.dataset.LockException" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ <property name="cacheable" value="true" />
+ </bean>
+
<bean id="org.hisp.dhis.dataset.CompleteDataSetRegistrationStore" class="org.hisp.dhis.dataset.hibernate.HibernateCompleteDataSetRegistrationStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
=== 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 2011-11-23 18:07:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2012-02-05 13:27:40 +0000
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
- [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
->
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+ >
<hibernate-mapping>
<class name="org.hisp.dhis.dataset.DataSet" table="dataset">
@@ -14,33 +14,36 @@
<generator class="native" />
</id>
&identifiableProperties;
-
+
<property name="shortName" unique="true" length="50" />
<many-to-one name="periodType" lazy="false" class="org.hisp.dhis.period.PeriodType" column="periodtypeid"
- not-null="true" foreign-key="fk_dataset_periodtypeid" />
+ not-null="true" foreign-key="fk_dataset_periodtypeid" />
<set name="dataElements" table="datasetmembers">
<cache usage="read-write" />
<key column="datasetid" foreign-key="fk_datasetmembers_datasetid" />
- <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_dataset_dataelementid" />
- </set>
-
- <set name="indicators" table="datasetindicators">
- <key column="datasetid" foreign-key="fk_datasetindicators_datasetid" />
- <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" foreign-key="fk_dataset_indicatorid" />
- </set>
+ <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
+ foreign-key="fk_dataset_dataelementid" />
+ </set>
+
+ <set name="indicators" table="datasetindicators">
+ <key column="datasetid" foreign-key="fk_datasetindicators_datasetid" />
+ <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid"
+ foreign-key="fk_dataset_indicatorid" />
+ </set>
<set name="compulsoryDataElementOperands" table="datasetoperands" cascade="all-delete-orphan">
<key column="datasetid" foreign-key="fk_datasetoperands_datasetid" />
<many-to-many class="org.hisp.dhis.dataelement.DataElementOperand" column="dataelementoperandid"
- foreign-key="fk_dataset_dataelementoperandid" />
+ foreign-key="fk_dataset_dataelementoperandid" />
</set>
<set name="sources" table="datasetsource">
<cache usage="read-write" />
<key column="datasetid" foreign-key="fk_datasetsource_datasetid" />
- <many-to-many column="sourceid" class="org.hisp.dhis.organisationunit.OrganisationUnit" foreign-key="fk_dataset_organisationunit"/>
+ <many-to-many column="sourceid" class="org.hisp.dhis.organisationunit.OrganisationUnit"
+ foreign-key="fk_dataset_organisationunit" />
</set>
<set name="sections" order-by="sortorder" inverse="true">
@@ -51,11 +54,20 @@
<property name="sortOrder" />
- <many-to-one name="dataEntryForm" class="org.hisp.dhis.dataentryform.DataEntryForm" foreign-key="fk_dataset_dataentryform" cascade="all" />
+ <many-to-one name="dataEntryForm" class="org.hisp.dhis.dataentryform.DataEntryForm"
+ foreign-key="fk_dataset_dataentryform" cascade="all" />
<property name="mobile" not-null="true" />
<property name="version" />
+ <property name="expiryDays" not-null="false" />
+
+ <set name="lockExceptions" table="datasetlockexceptions">
+ <cache usage="read-write" />
+ <key column="datasetid" />
+ <many-to-many class="org.hisp.dhis.dataset.LockException" column="lockexceptionid" unique="true" />
+ </set>
+
</class>
</hibernate-mapping>
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/LockException.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/LockException.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/LockException.hbm.xml 2012-02-05 13:27:40 +0000
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.dataset.LockException" table="lockexception">
+
+ <cache usage="read-write" />
+
+ <id name="id" column="lockexceptionid">
+ <generator class="native" />
+ </id>
+
+ <many-to-one name="organisationUnit" class="org.hisp.dhis.organisationunit.OrganisationUnit"
+ foreign-key="fk_lockexception_organisationunitid" column="organisationunitid" />
+
+ <many-to-one name="period" class="org.hisp.dhis.period.Period"
+ foreign-key="fk_lockexception_periodid" column="periodid" />
+
+ <many-to-one name="dataSet" class="org.hisp.dhis.dataset.DataSet"
+ foreign-key="fk_lockexception_datasetid" column="datasetid" />
+
+ </class>
+</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSet.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSet.vm 2012-01-22 11:28:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSet.vm 2012-02-05 13:27:40 +0000
@@ -6,6 +6,7 @@
"periodTypeId": "$!{dataSet.periodTypeId}",
"frequency": "$i18n.getString( $!{dataSet.periodType.name} )",
"dataElementCount": "$!{dataSet.dataElements.size()}"
+ #if( $dataSet.expiryDays ),"expiryDays": "$!encoder.jsonEncode( ${dataSet.expiryDays} ) #end
#if( $!{dataSet.dataEntryForm} ),"dataentryform": "$!encoder.jsonEncode( ${dataSet.dataEntryForm.name} )"#end
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSets.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSets.vm 2012-01-22 11:28:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonDataSets.vm 2012-02-05 13:27:40 +0000
@@ -7,6 +7,7 @@
"shortName": "$!encoder.jsonEncode( ${dataSet.displayShortName} )",
"periodTypeId": "$!{dataSet.periodTypeId}",
"version": "$!{dataSet.version}"
+ #if( $dataSet.expiryDays ),"expiryDays": "$!encoder.jsonEncode( ${dataSet.expiryDays} ) #end
}#if( $velocityCount < $size ),#end
#end
]
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2011-12-01 12:29:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2012-02-05 13:27:40 +0000
@@ -152,6 +152,9 @@
"notOnlyDigits" : false,
"rangelength" : [ 0, 25 ]
},
+ "expiryDays": {
+ "digits" : true
+ },
"frequencySelect" : {
"required" : true
}
=== 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 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java 2012-02-05 13:27:40 +0000
@@ -105,6 +105,13 @@
this.code = code;
}
+ private Integer expiryDays;
+
+ public void setExpiryDays( Integer expiryDays )
+ {
+ this.expiryDays = expiryDays;
+ }
+
private String frequencySelect;
public void setFrequencySelect( String frequencySelect )
@@ -153,11 +160,13 @@
{
code = null;
}
-
+
PeriodType periodType = PeriodType.getPeriodTypeByName( frequencySelect );
DataSet dataSet = new DataSet( name, shortName, code, periodType );
+ dataSet.setExpiryDays( expiryDays );
+
for ( String id : dataElementsSelectedList )
{
dataSet.addDataElement( 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 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2012-02-05 13:27:40 +0000
@@ -108,6 +108,13 @@
this.code = code;
}
+ private Integer expiryDays;
+
+ public void setExpiryDays( Integer expiryDays )
+ {
+ this.expiryDays = expiryDays;
+ }
+
private String frequencySelect;
public void setFrequencySelect( String frequencySelect )
@@ -175,6 +182,8 @@
DataSet dataSet = dataSetService.getDataSet( dataSetId );
+ dataSet.setExpiryDays( expiryDays );
+
if ( !( equalsNullSafe( name, dataSet.getName() ) && periodType.equals( dataSet.getPeriodType() ) &&
dataElements.equals( dataSet.getDataElements() ) && indicators.equals( dataSet.getIndicators() ) ) )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2012-01-18 06:11:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/org/hisp/dhis/dataset/i18n_module.properties 2012-02-05 13:27:40 +0000
@@ -139,4 +139,5 @@
unassigned=Unassigned
show_selection_box=Show selection box
grey_field=Grey field
-totals=Totals
\ No newline at end of file
+totals=Totals
+expiry_days=Expiry Days
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2011-11-22 18:46:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2012-02-05 13:27:40 +0000
@@ -72,6 +72,10 @@
<td><input type="text" id="code" name="code" style="width:20em"></td>
</tr>
<tr>
+ <td><label>$i18n.getString( "expiry_days" )</label></td>
+ <td><input type="text" id="expiryDays" name="expiryDays" style="width:20em"></td>
+ </tr>
+ <tr>
<td><label>$i18n.getString( "frequency" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
<select id="frequencySelect" name="frequencySelect" style="min-width:20em">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2012-02-01 09:54:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2012-02-05 13:27:40 +0000
@@ -62,7 +62,7 @@
<tr>
<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td><input type="text" id="name" name="name" style="width:20em" value="$!encoder.htmlEncode( $dataSet.name )"></td>
- </tr>
+ </tr>
<tr>
<td><label>$i18n.getString( "short_name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td><input type="text" id="shortName" name="shortName" style="width:20em" value="$!encoder.htmlEncode( $dataSet.shortName )"></td>
@@ -72,6 +72,10 @@
<td><input type="text" id="code" name="code" style="width:20em" value="$!encoder.htmlEncode( $dataSet.code )"></td>
</tr>
<tr>
+ <td><label>$i18n.getString( "expiry_days" )</label></td>
+ <td><input type="text" id="expiryDays" name="expiryDays" style="width:20em" value="$!encoder.htmlEncode( $dataSet.expiryDays )"></td>
+ </tr>
+ <tr>
<td><label>$i18n.getString( "frequency" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
<select id="frequencySelect" name="frequencySelect" style="min-width:20em">