dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41586
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21195: document attributes, wip
------------------------------------------------------------
revno: 21195
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-11-26 11:04:27 +0700
message:
document attributes, wip
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java
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/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/document/hibernate/Document.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.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/attribute/Attribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2015-11-23 06:05:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/Attribute.java 2015-11-26 04:04:27 +0000
@@ -45,6 +45,7 @@
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.document.Document;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.option.OptionSet;
@@ -103,6 +104,8 @@
private boolean categoryOptionGroupAttribute;
+ private boolean documentAttribute;
+
private boolean mandatory;
private boolean unique;
@@ -419,6 +422,19 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isDocumentAttribute()
+ {
+ return documentAttribute;
+ }
+
+ public void setDocumentAttribute( boolean documentAttribute )
+ {
+ this.documentAttribute = documentAttribute;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public OptionSet getOptionSet()
{
return optionSet;
@@ -462,6 +478,7 @@
if ( programStageAttribute ) klasses.add( ProgramStage.class );
if ( trackedEntityAttribute ) klasses.add( TrackedEntity.class );
if ( trackedEntityAttributeAttribute ) klasses.add( TrackedEntityAttribute.class );
+ if ( documentAttribute ) klasses.add( Document.class );
return klasses;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java 2015-11-24 04:18:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java 2015-11-26 04:04:27 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.document.Document;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -74,6 +75,7 @@
.put( TrackedEntityAttribute.class, "trackedEntityAttributeAttribute" )
.put( DataElementCategoryOption.class, "categoryOptionAttribute" )
.put( CategoryOptionGroup.class, "categoryOptionGroupAttribute" )
+ .put( Document.class, "documentAttribute" )
.build();
/**
=== 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 2015-11-17 06:46:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-11-26 04:04:27 +0000
@@ -761,6 +761,7 @@
executeSql( "UPDATE attribute SET trackedentityattributeattribute=false WHERE trackedentityattributeattribute IS NULL" );
executeSql( "UPDATE attribute SET categoryoptionattribute=false WHERE categoryoptionattribute IS NULL" );
executeSql( "UPDATE attribute SET categoryoptiongroupattribute=false WHERE categoryoptiongroupattribute IS NULL" );
+ executeSql( "UPDATE attribute SET documentattribute=false WHERE documentattribute IS NULL" );
executeSql( "ALTER TABLE trackedentityattributedimension DROP COLUMN operator" );
executeSql( "ALTER TABLE trackedentitydataelementdimension DROP COLUMN operator" );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml 2015-11-18 11:50:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml 2015-11-26 04:04:27 +0000
@@ -61,6 +61,8 @@
<property name="categoryOptionGroupAttribute" not-null="false" />
+ <property name="documentAttribute" not-null="false" />
+
<property name="sortOrder" />
<set name="attributeValues" inverse="true" lazy="true">
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2015-11-23 06:05:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2015-11-26 04:04:27 +0000
@@ -75,7 +75,6 @@
foreign-key="fk_dataelement_legendset" />
<!-- Dynamic attribute values -->
-
<set name="attributeValues" table="dataelementattributevalues" cascade="delete-orphan">
<cache usage="read-write" />
<key column="dataelementid" />
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/document/hibernate/Document.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/document/hibernate/Document.hbm.xml 2013-11-21 10:14:59 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/document/hibernate/Document.hbm.xml 2015-11-26 04:04:27 +0000
@@ -25,6 +25,13 @@
<property name="attachment" />
+ <!-- Dynamic attribute values -->
+ <set name="attributeValues" table="documentattributevalues" cascade="delete-orphan">
+ <cache usage="read-write" />
+ <key column="documentid" />
+ <many-to-many class="org.hisp.dhis.attribute.AttributeValue" column="attributevalueid" unique="true" />
+ </set>
+
<!-- Access properties -->
<property name="externalAccess" />
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java 2015-11-18 04:39:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/AddAttributeAction.java 2015-11-26 04:04:27 +0000
@@ -204,6 +204,13 @@
this.categoryOptionGroupAttribute = categoryOptionGroupAttribute;
}
+ private boolean documentAttribute;
+
+ public void setDocumentAttribute( boolean documentAttribute )
+ {
+ this.documentAttribute = documentAttribute;
+ }
+
private String optionSetUid;
public void setOptionSetUid( String optionSetUid )
@@ -225,6 +232,7 @@
attribute.setCode( StringUtils.trimToNull( code ) );
attribute.setMandatory( mandatory );
attribute.setUnique( unique );
+ attribute.setOptionSet( optionSet );
attribute.setDataElementAttribute( dataElementAttribute );
attribute.setDataElementGroupAttribute( dataElementGroupAttribute );
attribute.setIndicatorAttribute( indicatorAttribute );
@@ -241,7 +249,7 @@
attribute.setTrackedEntityAttributeAttribute( trackedEntityAttributeAttribute );
attribute.setCategoryOptionAttribute( categoryOptionAttribute );
attribute.setCategoryOptionGroupAttribute( categoryOptionGroupAttribute );
- attribute.setOptionSet( optionSet );
+ attribute.setDocumentAttribute( documentAttribute );
attributeService.addAttribute( attribute );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java 2015-11-18 04:39:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/attribute/UpdateAttributeAction.java 2015-11-26 04:04:27 +0000
@@ -211,6 +211,13 @@
this.categoryOptionGroupAttribute = categoryOptionGroupAttribute;
}
+ private boolean documentAttribute;
+
+ public void setDocumentAttribute( boolean documentAttribute )
+ {
+ this.documentAttribute = documentAttribute;
+ }
+
private String optionSetUid;
public void setOptionSetUid( String optionSetUid )
@@ -254,6 +261,7 @@
attribute.setTrackedEntityAttributeAttribute( trackedEntityAttributeAttribute );
attribute.setCategoryOptionAttribute( categoryOptionAttribute );
attribute.setCategoryOptionGroupAttribute( categoryOptionGroupAttribute );
+ attribute.setDocumentAttribute( documentAttribute );
attributeService.updateAttribute( attribute );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2015-11-18 04:39:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2015-11-26 04:04:27 +0000
@@ -379,4 +379,5 @@
pending_invitations=Pending invitations
expired_invitations=Expired invitations
category_option=Category Option
-category_option_group=Category Option Group
\ No newline at end of file
+category_option_group=Category Option Group
+document=Document
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm 2015-11-18 04:39:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addAttributeForm.vm 2015-11-26 04:04:27 +0000
@@ -70,6 +70,7 @@
<input type="checkbox" id="trackedEntityAttributeAttribute" name="trackedEntityAttributeAttribute" value="true" /><label for="trackedEntityAttributeAttribute">$i18n.getString( 'tracked_entity_attribute' )</label> <br />
<input type="checkbox" id="categoryOptionAttribute" name="categoryOptionAttribute" value="true" /><label for="categoryOptionAttribute">$i18n.getString( 'category_option' )</label> <br />
<input type="checkbox" id="categoryOptionGroupAttribute" name="categoryOptionGroupAttribute" value="true" /><label for="categoryOptionGroupAttribute">$i18n.getString( 'category_option_group' )</label> <br />
+ <input type="checkbox" id="documentAttribute" name="documentAttribute" value="true" /><label for="documentAttribute">$i18n.getString( 'document' )</label> <br />
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm 2015-11-18 04:39:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateAttributeForm.vm 2015-11-26 04:04:27 +0000
@@ -71,6 +71,7 @@
<input type="checkbox" id="trackedEntityAttributeAttribute" name="trackedEntityAttributeAttribute" value="true" #if( $attribute.trackedEntityAttributeAttribute ) checked="checked" #end /><label for="trackedEntityAttributeAttribute">$i18n.getString( 'tracked_entity_attribute' )</label> <br />
<input type="checkbox" id="categoryOptionAttribute" name="categoryOptionAttribute" value="true" #if( $attribute.categoryOptionAttribute ) checked="checked" #end /><label for="categoryOptionAttribute">$i18n.getString( 'category_option' ) <br />
<input type="checkbox" id="categoryOptionGroupAttribute" name="categoryOptionGroupAttribute" value="true" #if( $attribute.categoryOptionGroupAttribute ) checked="checked" #end /><label for="categoryOptionGroupAttribute">$i18n.getString( 'category_option_group' ) <br />
+ <input type="checkbox" id="documentAttribute" name="documentAttribute" value="true" #if( $attribute.documentAttribute ) checked="checked" #end /><label for="documentAttribute">$i18n.getString( 'document' ) <br />
</label> <br />
</td>
</tr>