← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2482: Reverted r2480

 

------------------------------------------------------------
revno: 2482
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-01-07 12:38:55 +0100
message:
  Reverted r2480
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryComboDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.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/dataelement/hibernate/DataElementCategory.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/AddReportExcelItemAction.java
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/reportItems.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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryComboDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryComboDeletionHandler.java	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryComboDeletionHandler.java	2011-01-07 11:38:55 +0000
@@ -60,9 +60,9 @@
     @Override
     public boolean allowDeleteDataElementCategory( DataElementCategory category )
     {
-        for ( DataElementCategoryCombo categoryCombo : categoryService.getAllDataElementCategoryCombos() )
+        for ( DataElementCategoryOptionCombo categoryOptionCombo : categoryService.getAllDataElementCategoryOptionCombos() )
         {
-            if ( categoryCombo.getCategories().contains( category ) )
+            if ( categoryOptionCombo.getCategoryCombo().getCategories().contains( category ) )
             {
                 return false;
             }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryDeletionHandler.java	2011-01-07 11:38:55 +0000
@@ -27,10 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.concept.Concept.DEFAULT_CONCEPT_NAME;
-
 import org.hisp.dhis.concept.Concept;
-import org.hisp.dhis.concept.ConceptService;
 import org.hisp.dhis.dataelement.DataElementCategory;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.system.deletion.DeletionHandler;
@@ -53,13 +50,6 @@
         this.categoryService = categoryService;
     }
 
-    private ConceptService conceptService;
-
-    public void setConceptService( ConceptService conceptService )
-    {
-        this.conceptService = conceptService;
-    }
-
     // -------------------------------------------------------------------------
     // DeletionHandler implementation
     // -------------------------------------------------------------------------
@@ -92,8 +82,6 @@
     @Override
     public void deleteConcept( Concept concept )
     {
-        Concept _default = conceptService.getConceptByName( DEFAULT_CONCEPT_NAME );
-
         for ( DataElementCategory category : categoryService.getAllDataElementCategories() )
         {
             Concept categoryConcept = category.getConcept();
@@ -102,7 +90,7 @@
             {
                 if ( categoryConcept.equals( concept ) )
                 {
-                    category.setConcept( _default );
+                    category.setConcept( null );
                     categoryService.updateDataElementCategory( category );
                 }
             }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboDeletionHandler.java	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboDeletionHandler.java	2011-01-07 11:38:55 +0000
@@ -64,43 +64,39 @@
     {
         return DataElementCategoryOptionCombo.class.getSimpleName();
     }
-
+    
     @Override
     public boolean allowDeleteDataElementCategoryOption( DataElementCategoryOption categoryOption )
     {
-        for ( DataElementCategoryOptionCombo categoryOptionCombo : categoryService
-            .getAllDataElementCategoryOptionCombos() )
+        for ( DataElementCategoryOptionCombo categoryOptionCombo : 
+            categoryService.getAllDataElementCategoryOptionCombos() )
         {
             if ( categoryOptionCombo.getCategoryOptions().contains( categoryOption ) )
             {
                 return false;
             }
         }
-
+        
         return true;
     }
-
+    
     @Override
     public boolean allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
     {
-        for ( DataElementCategoryOptionCombo eachOptionCombo : categoryCombo.getOptionCombos() )
+        for(DataElementCategoryOptionCombo eachOptionCombo : categoryCombo.getOptionCombos())
         {
             String sql = "SELECT COUNT(*) FROM datavalue where categoryoptioncomboid=" + eachOptionCombo.getId();
-
-            if ( jdbcTemplate.queryForInt( sql ) > 0 )
-            {
-                return false;
-            }
+            
+            if( jdbcTemplate.queryForInt( sql ) > 0) return false;
         }
-
+        
         return true;
     }
-
+    
     @Override
     public void deleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
     {
-        for ( DataElementCategoryOptionCombo categoryOptionCombo : categoryService
-            .getAllDataElementCategoryOptionCombos() )
+        for ( DataElementCategoryOptionCombo categoryOptionCombo : categoryService.getAllDataElementCategoryOptionCombos() )
         {
             if ( categoryOptionCombo.getCategoryCombo().equals( categoryCombo ) )
             {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java	2011-01-07 11:38:55 +0000
@@ -67,20 +67,6 @@
     }
 
     @Override
-    public boolean allowDeleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
-    {
-        for ( DataElement dataElement : dataElementService.getAllDataElements() )
-        {
-            if ( dataElement.getCategoryCombo().equals( categoryCombo ) )
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    @Override
     public void deleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
     {
         DataElementCategoryCombo default_ = categoryService

=== 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	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-01-07 11:38:55 +0000
@@ -1387,8 +1387,6 @@
 		class="org.hisp.dhis.dataelement.DataElementCategoryDeletionHandler">
 		<property name="categoryService" 
 			ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
-		<property name="conceptService"
-			ref="org.hisp.dhis.concept.ConceptService" />
 	</bean>
 	
 	<bean id="org.hisp.dhis.dataelement.DataElementGroupSetDeletionHandler"

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml	2011-01-07 11:38:55 +0000
@@ -17,7 +17,7 @@
     <property name="name">
       <column name="name" not-null="true" unique="true" length="160"/>
     </property>
-
+		
 	<many-to-one name="concept" class="org.hisp.dhis.concept.Concept"
 		column="conceptid" foreign-key="fk_dataelementcategory_conceptid"/>
     

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml	2011-01-07 11:38:55 +0000
@@ -14,18 +14,18 @@
       <column name="name" not-null="true" unique="true" length="160"/>
     </property>
       
-    <list name="categories" table="categorycombos_categories">  
+    <list name="categories" table="categorycombos_categories" >  
       <key column="categorycomboid"/>
       <list-index column="sort_order" base="1"/>
       <many-to-many class="org.hisp.dhis.dataelement.DataElementCategory"
         column="categoryid" foreign-key="fk_categorycombo_categoryid"/> 
     </list>
 
-    <set name="optionCombos" table="categorycombos_optioncombos" inverse="true">
+    <set name="optionCombos" table="categorycombos_optioncombos" inverse="true" cascade="all">
       <key column="categorycomboid"/>
       <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo"
         column="categoryoptioncomboid" foreign-key="fk_categorycombo_categoryoptioncomboid" unique="true"/>
-    </set>
+    </set>    
     
     </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml	2011-01-07 11:38:55 +0000
@@ -9,23 +9,23 @@
     <id name="id" column="categoryoptionid">
       <generator class="native"/>
     </id>
-
+        	
     <property name="uuid" length="40"/>
-
+    
     <property name="name">
       <column name="name" not-null="true" unique="true" length="160"/>
     </property>
-
+    
     <set name="categoryOptionCombos" table="categoryoptioncombos_categoryoptions" inverse="true">
 	  <key column="categoryoptionid"/>
 	  <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo"
 		column="categoryoptioncomboid" foreign-key="fk_categoryoption_categoryoptioncomboid"/>
 	</set> 
-
+    
     <join table="categories_categoryoptions" inverse="true">
       <key column="categoryoptionid"/>
       <many-to-one column="categoryid" name="category"/>
     </join>
-
+    
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml	2011-01-07 11:38:55 +0000
@@ -16,11 +16,11 @@
       <many-to-many class="org.hisp.dhis.dataelement.DataElementCategoryOption"
         column="categoryoptionid" foreign-key="fk_categoryoptioncombo_categoryoptionid"/> 
     </list>
-
-	<join table="categorycombos_optioncombos">
+          
+    <join table="categorycombos_optioncombos">
       <key column="categoryoptioncomboid"/>
       <many-to-one name="categoryCombo" column="categorycomboid"/>
-    </join>
+    </join>  
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/AddReportExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/AddReportExcelItemAction.java	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/AddReportExcelItemAction.java	2011-01-07 11:38:55 +0000
@@ -118,6 +118,7 @@
     public String execute()
         throws Exception
     {
+
         ReportExcelItem reportItem = new ReportExcelItem();
         reportItem.setName( name );
         reportItem.setItemType( itemType );

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm	2011-01-07 11:38:55 +0000
@@ -4,11 +4,11 @@
 	jQuery(document).ready(function(){	
 		deExpressionValidator = validation( 'dataelement-form', function(){ 
 			updateDeExpression();
-		});
-
-		#if( !$reportExcel.isCategory() )
-			remoteValidate( jQuery( "#dataelement textarea[id=formula]"), '../dhis-web-commons-ajax-json/getExpressionText.action' );	
+		});	
+		#if(!$reportExcel.isCategory()) 
+		remoteValidate( jQuery( "#dataelement textarea[id=formula]"), '../dhis-web-commons-ajax-json/getExpressionText.action' );	
 		#end
+	
 	});	
 	
 	

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/reportItems.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/reportItems.vm	2011-01-07 11:19:45 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/reportItems.vm	2011-01-07 11:38:55 +0000
@@ -73,7 +73,7 @@
 			<td>$reportItem.sheetNo </td>
 			<td align="center">				
 				<a href="updateReportExcelItemForm.action?reportExcelItemId=$reportItem.id&reportId=$reportExcel.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
-				<a href="javascript:translate( 'ReportExcelItem', '$reportItem.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"></a>
+				<a href="javascript:translate( 'ReportExcelItem', '$reportItem.id' )" title="$i18n.getString( "translation_translate" )"><img src="../images/i18n.png" alt="$i18n.getString( "translation_translate" )"></a>
 				<a href="javascript:removeItem($reportItem.id, '$reportItem.name','$i18n.getString( 'confirm_delete' )', 'deleteReportExcelItem.action');" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
 			</td>
 		</tr>