dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16873
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6542: finished Mergeable for now
------------------------------------------------------------
revno: 6542
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-04-11 10:45:09 +0300
message:
finished Mergeable for now
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.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/dataelement/DataElementCategory.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2012-03-27 17:38:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2012-04-11 07:45:09 +0000
@@ -35,6 +35,7 @@
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
import org.hisp.dhis.concept.Concept;
@@ -179,4 +180,27 @@
{
this.concept = concept;
}
+
+ @Override
+ public void mergeWith( IdentifiableObject other )
+ {
+ super.mergeWith( other );
+
+ if ( other.getClass().isInstance( this ) )
+ {
+ DataElementCategory dataElementCategory = (DataElementCategory) other;
+
+ concept = dataElementCategory.getConcept() == null ? concept : dataElementCategory.getConcept();
+
+ for ( DataElementCategoryOption dataElementCategoryOption : dataElementCategory.getCategoryOptions() )
+ {
+ categoryOptions.add( dataElementCategoryOption );
+
+ if ( dataElementCategoryOption.getCategory() == null )
+ {
+ dataElementCategoryOption.setCategory( this );
+ }
+ }
+ }
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2012-03-27 17:38:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java 2012-04-11 07:45:09 +0000
@@ -36,6 +36,7 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.CombinationGenerator;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
@@ -243,4 +244,27 @@
{
this.optionCombos = optionCombos;
}
+
+ @Override
+ public void mergeWith( IdentifiableObject other )
+ {
+ super.mergeWith( other );
+
+ if ( other.getClass().isInstance( this ) )
+ {
+ DataElementCategoryCombo dataElementCategoryCombo = (DataElementCategoryCombo) other;
+
+ categories.addAll( dataElementCategoryCombo.getCategories() );
+
+ for ( DataElementCategoryOptionCombo dataElementCategoryOptionCombo : dataElementCategoryCombo.getOptionCombos() )
+ {
+ optionCombos.add( dataElementCategoryOptionCombo );
+
+ if ( dataElementCategoryOptionCombo.getCategoryCombo() == null )
+ {
+ dataElementCategoryOptionCombo.setCategoryCombo( this );
+ }
+ }
+ }
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2012-03-27 17:38:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2012-04-11 07:45:09 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.concept.Concept;
@@ -125,6 +126,22 @@
}
// -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
+ public void addCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo )
+ {
+ categoryOptionCombos.add( dataElementCategoryOptionCombo );
+ dataElementCategoryOptionCombo.getCategoryOptions().add( this );
+ }
+
+ public void removeCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo )
+ {
+ categoryOptionCombos.remove( dataElementCategoryOptionCombo );
+ dataElementCategoryOptionCombo.getCategoryOptions().remove( this );
+ }
+
+ // -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
@@ -173,4 +190,23 @@
{
this.categoryOptionCombos = categoryOptionCombos;
}
+
+ @Override
+ public void mergeWith( IdentifiableObject other )
+ {
+ super.mergeWith( other );
+
+ if ( other.getClass().isInstance( this ) )
+ {
+ DataElementCategoryOption dataElementCategoryOption = (DataElementCategoryOption) other;
+
+ concept = dataElementCategoryOption.getConcept() == null ? concept : dataElementCategoryOption.getConcept();
+ category = category != null ? category : dataElementCategoryOption.getCategory();
+
+ for ( DataElementCategoryOptionCombo dataElementCategoryOptionCombo : dataElementCategoryOption.getCategoryOptionCombos() )
+ {
+ addCategoryOptionCombo( dataElementCategoryOptionCombo );
+ }
+ }
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2012-03-27 17:38:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java 2012-04-11 07:45:09 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.common.BaseIdentifiableObject;
import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
@@ -325,4 +326,18 @@
{
this.categoryOptions = categoryOptions;
}
+
+ @Override
+ public void mergeWith( IdentifiableObject other )
+ {
+ super.mergeWith( other );
+
+ if ( other.getClass().isInstance( this ) )
+ {
+ DataElementCategoryOptionCombo dataElementCategoryOptionCombo = (DataElementCategoryOptionCombo) other;
+
+ categoryCombo = categoryCombo != null ? categoryCombo : dataElementCategoryOptionCombo.getCategoryCombo();
+ categoryOptions.addAll( dataElementCategoryOptionCombo.getCategoryOptions() );
+ }
+ }
}