dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34950
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17927: Set a range of properties to be not-null to be consistent with application layer: organiationunit...
------------------------------------------------------------
revno: 17927
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-01-09 14:25:59 +0100
message:
Set a range of properties to be not-null to be consistent with application layer: organiationunit openingdate, indicator indicatortype, validationrule periodtype, constant value.
modified:
dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/hibernate/HibernateMessageConversationStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java
dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
--
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-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java 2014-10-07 21:16:53 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/QueryPlannerTest.java 2015-01-09 13:25:59 +0000
@@ -68,6 +68,7 @@
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.indicator.IndicatorType;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.MonthlyPeriodType;
@@ -107,6 +108,7 @@
// Fixture
// -------------------------------------------------------------------------
+ private IndicatorType itA;
private Indicator inA;
private DataElement deA;
@@ -136,7 +138,11 @@
{
PeriodType pt = new MonthlyPeriodType();
- inA = createIndicator( 'A', null );
+ itA = createIndicatorType( 'A' );
+
+ indicatorService.addIndicatorType( itA );
+
+ inA = createIndicator( 'A', itA );
indicatorService.addIndicator( inA );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/hibernate/HibernateMessageConversationStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/hibernate/HibernateMessageConversationStore.java 2015-01-07 12:59:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/message/hibernate/HibernateMessageConversationStore.java 2015-01-09 13:25:59 +0000
@@ -28,6 +28,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.List;
+
import org.hibernate.Query;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
@@ -39,12 +44,6 @@
import org.hisp.dhis.user.User;
import org.springframework.jdbc.core.RowMapper;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
/**
* @author Lars Helge Overland
*/
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java 2014-12-22 13:52:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/AbstractPropertyIntrospectorService.java 2015-01-09 13:25:59 +0000
@@ -127,6 +127,7 @@
return (LocalSessionFactoryBean) context.getBean( "&sessionFactory" );
}
+ @SuppressWarnings("unused")
protected Map<String, Property> getPropertiesFromHibernate( Class<?> klass )
{
ClassMetadata classMetadata = sessionFactory.getClassMetadata( klass );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml 2013-02-07 10:25:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml 2015-01-09 13:25:59 +0000
@@ -17,7 +17,7 @@
<property name="name" column="name" not-null="true" unique="true" length="230" />
- <property name="value" />
+ <property name="value" not-null="true" />
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml 2014-12-13 10:38:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml 2015-01-09 13:25:59 +0000
@@ -26,7 +26,7 @@
<property name="decimals" />
<many-to-one name="indicatorType" class="org.hisp.dhis.indicator.IndicatorType" column="indicatortypeid"
- foreign-key="fk_indicator_indicatortypeid" />
+ foreign-key="fk_indicator_indicatortypeid" not-null="true" />
<property name="numerator" column="numerator" type="text" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml 2015-01-09 12:56:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml 2015-01-09 13:25:59 +0000
@@ -32,7 +32,7 @@
<property name="description" type="text" />
- <property name="openingDate" column="openingdate" type="date" />
+ <property name="openingDate" column="openingdate" type="date" not-null="true" />
<property name="closedDate" column="closeddate" type="date" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml 2014-07-17 12:43:25 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml 2015-01-09 13:25:59 +0000
@@ -41,7 +41,7 @@
<property name="organisationUnitLevel" column="organisationunitlevel" />
<many-to-one name="periodType" class="org.hisp.dhis.period.PeriodType" column="periodtypeid"
- foreign-key="fk_validationrule_periodtypeid" />
+ foreign-key="fk_validationrule_periodtypeid" not-null="true" />
<property name="sequentialSampleCount" column="sequentialsamplecount" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2015-01-09 12:56:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2015-01-09 13:25:59 +0000
@@ -67,22 +67,15 @@
public void testBasicOrganisationUnitCoarseGrained()
throws Exception
{
- // Single OrganisationUnit
- String organisationUnitName1 = "organisationUnitName1";
- OrganisationUnit organisationUnit1 = new OrganisationUnit( organisationUnitName1, "shortName1",
- "organisationUnitCode1", new Date(), new Date(), "comment" );
+ OrganisationUnit organisationUnit1 = createOrganisationUnit( 'A' );
int id1 = organisationUnitService.addOrganisationUnit( organisationUnit1 );
- // assert getOrganisationUnit
assertNotNull( organisationUnitService.getOrganisationUnit( id1 ) );
assertNull( organisationUnitService.getOrganisationUnit( -1 ) );
- // OrganisationUnit with parent
- String organisationUnitName2 = "organisationUnitName2";
- OrganisationUnit organisationUnit2 = new OrganisationUnit( organisationUnitName2, organisationUnit1,
- "shortName2", "organisationUnitCode2", new Date(), new Date(), "comment" );
+ OrganisationUnit organisationUnit2 = createOrganisationUnit( 'B', organisationUnit1 );
int id2 = organisationUnitService.addOrganisationUnit( organisationUnit2 );
@@ -98,13 +91,10 @@
public void testUpdateOrganisationUnit()
throws Exception
{
- String name = "name";
- String shortName = "shortName";
String updatedName = "updatedName";
String updatedShortName = "updatedShortName";
- OrganisationUnit organisationUnit = new OrganisationUnit( name, shortName, "organisationUnitCode", new Date(),
- new Date(), "comment" );
+ OrganisationUnit organisationUnit = createOrganisationUnit( 'A' );
int id = organisationUnitService.addOrganisationUnit( organisationUnit );
@@ -237,10 +227,10 @@
String oU2Code = "OU2Code";
String oU3Code = "OU3Code";
- OrganisationUnit organisationUnit1 = new OrganisationUnit( oU1Name, null, oU1ShortName, oU1Code, null, null, null );
- OrganisationUnit organisationUnit2 = new OrganisationUnit( oU2Name, null, oU2ShortName, oU2Code, null, null, null );
- OrganisationUnit organisationUnit3 = new OrganisationUnit( oU3Name, null, oU3ShortName, oU3Code, null, null, null );
-
+ OrganisationUnit organisationUnit1 = new OrganisationUnit( oU1Name, null, oU1ShortName, oU1Code, new Date(), null, null );
+ OrganisationUnit organisationUnit2 = new OrganisationUnit( oU2Name, null, oU2ShortName, oU2Code, new Date(), null, null );
+ OrganisationUnit organisationUnit3 = new OrganisationUnit( oU3Name, null, oU3ShortName, oU3Code, new Date(), null, null );
+
organisationUnitService.addOrganisationUnit( organisationUnit1 );
organisationUnitService.addOrganisationUnit( organisationUnit2 );
organisationUnitService.addOrganisationUnit( organisationUnit3 );
@@ -262,12 +252,9 @@
public void testGetOrganisationUnitGraph()
throws Exception
{
- OrganisationUnit organisationUnit1 = new OrganisationUnit( "Foo", "shortName1", "organisationUnitCode1",
- new Date(), new Date(), "comment" );
- OrganisationUnit organisationUnit2 = new OrganisationUnit( "Bar", organisationUnit1, "shortName2",
- "organisationUnitCode2", new Date(), new Date(), "comment" );
- OrganisationUnit organisationUnit3 = new OrganisationUnit( "Foobar", organisationUnit2, "shortName3",
- "organisationUnitCode3", new Date(), new Date(), "comment" );
+ OrganisationUnit organisationUnit1 = createOrganisationUnit( 'A' );
+ OrganisationUnit organisationUnit2 = createOrganisationUnit( 'B', organisationUnit1 );
+ OrganisationUnit organisationUnit3 = createOrganisationUnit( 'C', organisationUnit2 );
int orgId1 = organisationUnitService.addOrganisationUnit( organisationUnit1 );
int orgId2 = organisationUnitService.addOrganisationUnit( organisationUnit2 );
@@ -290,11 +277,11 @@
{
// creating a tree with two roots ( id1 and id4 )
- OrganisationUnit unit1 = new OrganisationUnit( "OU1name", "OU1sname", "OU1code", null, null, null );
- OrganisationUnit unit2 = new OrganisationUnit( "OU2name", unit1, "OU2sname", "OU2code", null, null, null );
- OrganisationUnit unit3 = new OrganisationUnit( "OU3name", unit1, "OU3sname", "OU3code", null, null, null );
- OrganisationUnit unit4 = new OrganisationUnit( "OU4name", "OU4sname", "OU4code", null, null, null );
- OrganisationUnit unit5 = new OrganisationUnit( "OU5name", unit4, "OU5sname", "OU5code", null, null, null );
+ OrganisationUnit unit1 = createOrganisationUnit( 'A' );
+ OrganisationUnit unit2 = createOrganisationUnit( 'B', unit1 );
+ OrganisationUnit unit3 = createOrganisationUnit( 'C', unit1 );
+ OrganisationUnit unit4 = createOrganisationUnit( 'D' );
+ OrganisationUnit unit5 = createOrganisationUnit( 'E', unit4 );
organisationUnitService.addOrganisationUnit( unit1 );
organisationUnitService.addOrganisationUnit( unit2 );
=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2015-01-09 12:56:12 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2015-01-09 13:25:59 +0000
@@ -148,7 +148,7 @@
static
{
- DateTime dateTime = new DateTime(1970, 1, 1, 0, 0);
+ DateTime dateTime = new DateTime( 1970, 1, 1, 0, 0 );
date = dateTime.toDate();
}