← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13792: minor updates to attribute, change from objects to primitives, updated table-alteror to set all d...

 

------------------------------------------------------------
revno: 13792
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-01-21 13:32:43 +0700
message:
  minor updates to attribute, change from objects to primitives, updated table-alteror to set all defaults to false
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.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-api/src/main/java/org/hisp/dhis/attribute/Attribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java	2014-01-20 12:02:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java	2014-01-21 06:32:43 +0000
@@ -44,7 +44,7 @@
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
-@JacksonXmlRootElement( localName = "attributeType", namespace = DxfNamespaces.DXF_2_0 )
+@JacksonXmlRootElement(localName = "attributeType", namespace = DxfNamespaces.DXF_2_0)
 public class Attribute
     extends BaseIdentifiableObject
 {
@@ -57,23 +57,23 @@
 
     private boolean dataElementAttribute;
 
-    private Boolean dataElementGroupAttribute = false;
+    private boolean dataElementGroupAttribute;
 
     private boolean indicatorAttribute;
 
-    private Boolean indicatorGroupAttribute = false;
+    private boolean indicatorGroupAttribute;
 
-    private Boolean dataSetAttribute = false;
+    private boolean dataSetAttribute;
 
     private boolean organisationUnitAttribute;
 
-    private Boolean organisationUnitGroupAttribute = false;
+    private boolean organisationUnitGroupAttribute;
 
-    private Boolean organisationUnitGroupSetAttribute = false;
+    private boolean organisationUnitGroupSetAttribute;
 
     private boolean userAttribute;
 
-    private Boolean userGroupAttribute = false;
+    private boolean userGroupAttribute;
 
     private boolean mandatory;
 
@@ -93,8 +93,8 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public String getValueType()
     {
         return valueType;
@@ -106,8 +106,8 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isMandatory()
     {
         return mandatory;
@@ -119,8 +119,8 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isDataElementAttribute()
     {
         return dataElementAttribute;
@@ -132,11 +132,11 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isDataElementGroupAttribute()
     {
-        return dataElementGroupAttribute == null ? false : dataElementGroupAttribute;
+        return dataElementGroupAttribute;
     }
 
     public void setDataElementGroupAttribute( Boolean dataElementGroupAttribute )
@@ -145,8 +145,8 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isIndicatorAttribute()
     {
         return indicatorAttribute;
@@ -158,11 +158,11 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isIndicatorGroupAttribute()
     {
-        return indicatorGroupAttribute == null ? false : indicatorGroupAttribute;
+        return indicatorGroupAttribute;
     }
 
     public void setIndicatorGroupAttribute( Boolean indicatorGroupAttribute )
@@ -171,11 +171,11 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isDataSetAttribute()
     {
-        return dataSetAttribute == null ? false : dataSetAttribute;
+        return dataSetAttribute;
     }
 
     public void setDataSetAttribute( Boolean dataSetAttribute )
@@ -184,8 +184,8 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isOrganisationUnitAttribute()
     {
         return organisationUnitAttribute;
@@ -197,11 +197,11 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isOrganisationUnitGroupAttribute()
     {
-        return organisationUnitGroupAttribute == null ? false : organisationUnitGroupAttribute;
+        return organisationUnitGroupAttribute;
     }
 
     public void setOrganisationUnitGroupAttribute( Boolean organisationUnitGroupAttribute )
@@ -210,11 +210,11 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isOrganisationUnitGroupSetAttribute()
     {
-        return organisationUnitGroupSetAttribute == null ? false : organisationUnitGroupSetAttribute;
+        return organisationUnitGroupSetAttribute;
     }
 
     public void setOrganisationUnitGroupSetAttribute( Boolean organisationUnitGroupSetAttribute )
@@ -223,8 +223,8 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isUserAttribute()
     {
         return userAttribute;
@@ -236,11 +236,11 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isUserGroupAttribute()
     {
-        return userGroupAttribute == null ? false : userGroupAttribute;
+        return userGroupAttribute;
     }
 
     public void setUserGroupAttribute( Boolean userGroupAttribute )
@@ -259,8 +259,8 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public Integer getSortOrder()
     {
         return sortOrder;
@@ -282,9 +282,15 @@
 
             valueType = attribute.getValueType() == null ? valueType : attribute.getValueType();
             dataElementAttribute = attribute.isDataElementAttribute();
+            dataElementGroupAttribute = attribute.isDataElementGroupAttribute();
             indicatorAttribute = attribute.isIndicatorAttribute();
+            indicatorGroupAttribute = attribute.isIndicatorGroupAttribute();
+            dataSetAttribute = attribute.isDataSetAttribute();
             organisationUnitAttribute = attribute.isOrganisationUnitAttribute();
+            organisationUnitGroupAttribute = attribute.isOrganisationUnitGroupAttribute();
+            organisationUnitGroupSetAttribute = attribute.isOrganisationUnitGroupSetAttribute();
             userAttribute = attribute.isUserAttribute();
+            userGroupAttribute = attribute.isUserGroupAttribute();
             mandatory = attribute.isMandatory();
             sortOrder = attribute.getSortOrder() == null ? sortOrder : attribute.getSortOrder();
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-01-14 13:07:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2014-01-21 06:32:43 +0000
@@ -668,6 +668,18 @@
         executeSql( "UPDATE orgunitgroupset SET datadimension=true WHERE datadimension IS NULL" );
         executeSql( "ALTER TABLE orgunitgroupset ALTER COLUMN datadimension SET NOT NULL" );
 
+        // set attribute defaults
+        executeSql( "UPDATE attribute SET dataelementattribute=false WHERE dataelementattribute IS NULL" );
+        executeSql( "UPDATE attribute SET dataelementgroupattribute=false WHERE dataelementgroupattribute IS NULL" );
+        executeSql( "UPDATE attribute SET indicatorattribute=false WHERE indicatorattribute IS NULL" );
+        executeSql( "UPDATE attribute SET indicatorgroupattribute=false WHERE indicatorgroupattribute IS NULL" );
+        executeSql( "UPDATE attribute SET organisationunitattribute=false WHERE organisationunitattribute IS NULL" );
+        executeSql( "UPDATE attribute SET organisationunitgroupattribute=false WHERE organisationunitgroupattribute IS NULL" );
+        executeSql( "UPDATE attribute SET organisationunitgroupsetattribute=false WHERE organisationunitgroupsetattribute IS NULL" );
+        executeSql( "UPDATE attribute SET userattribute=false WHERE userattribute IS NULL" );
+        executeSql( "UPDATE attribute SET usergroupattribute=false WHERE usergroupattribute IS NULL" );
+        executeSql( "UPDATE attribute SET datasetattribute=false WHERE datasetattribute IS NULL" );
+
         upgradeDataValuesWithAttributeOptionCombo();
         upgradeMapViewsToAnalyticalObject();