← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3393: Merging Code from 2.1 - work in progress

 

------------------------------------------------------------
revno: 3393
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-15 16:44:02 +0530
message:
  Merging Code from 2.1 - work in progress
modified:
  local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/DefaultEmployeeService.java
  local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/DefaultLineListService.java
  local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/hibernate/HiberateEmployeeStore.java
  local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/hibernate/HibernateLineListStore.java
  local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java
  local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/org/hisp/dhis/reports/hibernate/Reports.hbm.xml


--
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 'local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/DefaultEmployeeService.java'
--- local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/DefaultEmployeeService.java	2010-11-15 08:26:40 +0000
+++ local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/DefaultEmployeeService.java	2011-04-15 11:14:02 +0000
@@ -85,5 +85,14 @@
     {
         return employeeStore.getEmployeeByisTransferred( isTransferred );
     }
+    
+    public int getEmployeeCount()
+    {
+        return employeeStore.getEmployeeCount();
+    }
+    
+    public Collection<Employee> getEmployeesBetween( int first, int max )
+    {
+        return employeeStore.getEmployeesBetween( first, max );
+    }
 }
-

=== modified file 'local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/DefaultLineListService.java'
--- local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/DefaultLineListService.java	2010-10-20 06:14:25 +0000
+++ local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/DefaultLineListService.java	2011-04-15 11:14:02 +0000
@@ -6,6 +6,12 @@
 import java.util.List;
 import java.util.Set;
 
+import org.hibernate.Criteria;
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.i18n.I18nService;
 import org.hisp.dhis.source.Source;
 import org.springframework.transaction.annotation.Transactional;
@@ -259,4 +265,40 @@
         return lineListStore.getLinelistDataelementMappings( linelistElement, linelistOption );
     }
     
+    public LineListDataElementMap getLinelistDataelementMapping( LineListElement linelistElement, LineListOption linelistOption, DataElement dataElement, DataElementCategoryOptionCombo deCOC )
+    {
+        return lineListStore.getLinelistDataelementMapping( linelistElement, linelistOption, dataElement, deCOC );
+    }
+
+    public int getLineListGroupCount()
+    {
+        return lineListStore.getLineListGroupCount();
+    }
+    
+    public Collection<LineListGroup> getLineListGroupsBetween( int first, int max )
+    {
+        return lineListStore.getLineListGroupsBetween( first, max );
+    }
+
+    public int getLineListElementCount()
+    {
+        return lineListStore.getLineListElementCount();
+    }
+    
+    public Collection<LineListElement> getLineListElementsBetween( int first, int max )
+    {
+        return lineListStore.getLineListElementsBetween( first, max );
+    }
+
+    public int getLineListOptionCount()
+    {
+        return lineListStore.getLineListOptionCount();
+    }
+    
+    @SuppressWarnings("unchecked")
+    public Collection<LineListOption> getLineListOptionsBetween( int first, int max )
+    {
+        return lineListStore.getLineListOptionsBetween( first, max );
+    }
+
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/hibernate/HiberateEmployeeStore.java'
--- local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/hibernate/HiberateEmployeeStore.java	2010-11-15 08:26:40 +0000
+++ local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/hibernate/HiberateEmployeeStore.java	2011-04-15 11:14:02 +0000
@@ -29,11 +29,13 @@
 import java.util.Collection;
 
 import org.hibernate.Criteria;
+import org.hibernate.Query;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.linelisting.Employee;
 import org.hisp.dhis.linelisting.EmployeeStore;
+import org.hisp.dhis.user.UserCredentials;
 
 /**
  * @author Mithilesh Kumar Thakur
@@ -106,6 +108,24 @@
 
         return criteria.list();        
     }
+    
+    public int getEmployeeCount()
+    {
+        Session session = sessionFactory.getCurrentSession();
+        
+        Query query = session.createQuery( "select count(*) from Employee" );
+        
+        Number rs = (Number) query.uniqueResult();
+
+        return rs != null ? rs.intValue() : 0;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public Collection<Employee> getEmployeesBetween( int first, int max )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        return session.createQuery( "from Employee" ).setFirstResult( first ).setMaxResults( max ).list();
+    }
+
 }
-
-

=== modified file 'local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/hibernate/HibernateLineListStore.java'
--- local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/hibernate/HibernateLineListStore.java	2010-10-20 06:14:25 +0000
+++ local/in/dhis-in-services/dhis-in-service-linelisting/src/main/java/org/hisp/dhis/linelisting/hibernate/HibernateLineListStore.java	2011-04-15 11:14:02 +0000
@@ -4,9 +4,13 @@
 import java.util.List;
 
 import org.hibernate.Criteria;
+import org.hibernate.Query;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.linelisting.Employee;
 import org.hisp.dhis.linelisting.LineListDataElementMap;
 import org.hisp.dhis.linelisting.LineListElement;
 import org.hisp.dhis.linelisting.LineListGroup;
@@ -322,5 +326,75 @@
         return criteria.list();
     }
     
-    
+
+    public LineListDataElementMap getLinelistDataelementMapping( LineListElement linelistElement, LineListOption linelistOption, DataElement dataElement, DataElementCategoryOptionCombo deCOC )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        Criteria criteria = session.createCriteria( LineListDataElementMap.class );
+        criteria.add( Restrictions.eq( "linelistElement", linelistElement ) );
+        criteria.add( Restrictions.eq( "linelistOption", linelistOption ) );
+        criteria.add( Restrictions.eq( "dataElement", dataElement ) );
+        criteria.add( Restrictions.eq( "dataElementOptionCombo", deCOC ) );
+
+        return (LineListDataElementMap) criteria.uniqueResult();
+    }
+
+    public int getLineListGroupCount()
+    {
+        Session session = sessionFactory.getCurrentSession();
+        
+        Query query = session.createQuery( "select count(*) from LineListGroup" );
+        
+        Number rs = (Number) query.uniqueResult();
+
+        return rs != null ? rs.intValue() : 0;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public Collection<LineListGroup> getLineListGroupsBetween( int first, int max )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        return session.createQuery( "from LineListGroup" ).setFirstResult( first ).setMaxResults( max ).list();
+    }
+
+    public int getLineListElementCount()
+    {
+        Session session = sessionFactory.getCurrentSession();
+        
+        Query query = session.createQuery( "select count(*) from LineListElement" );
+        
+        Number rs = (Number) query.uniqueResult();
+
+        return rs != null ? rs.intValue() : 0;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public Collection<LineListElement> getLineListElementsBetween( int first, int max )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        return session.createQuery( "from LineListElement" ).setFirstResult( first ).setMaxResults( max ).list();
+    }
+
+    public int getLineListOptionCount()
+    {
+        Session session = sessionFactory.getCurrentSession();
+        
+        Query query = session.createQuery( "select count(*) from LineListOption" );
+        
+        Number rs = (Number) query.uniqueResult();
+
+        return rs != null ? rs.intValue() : 0;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public Collection<LineListOption> getLineListOptionsBetween( int first, int max )
+    {
+        Session session = sessionFactory.getCurrentSession();
+
+        return session.createQuery( "from LineListOption" ).setFirstResult( first ).setMaxResults( max ).list();
+    }
+
 }

=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2011-03-01 08:22:12 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/java/org/hisp/dhis/reports/DefaultReportService.java	2011-04-15 11:14:02 +0000
@@ -640,7 +640,7 @@
                     List<Period> periodList = new ArrayList<Period>( periodService.getPeriodsBetweenDates( dePeriodType, startDate, endDate ) );
                     Period tempPeriod = new Period();
                     if ( periodList == null || periodList.isEmpty() )
-                    {
+                    {   
                         replaceString = "";
                         matcher.appendReplacement( buffer, replaceString );
                         continue;

=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/org/hisp/dhis/reports/hibernate/Reports.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/org/hisp/dhis/reports/hibernate/Reports.hbm.xml	2010-06-04 11:50:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/src/main/resources/org/hisp/dhis/reports/hibernate/Reports.hbm.xml	2011-04-15 11:14:02 +0000
@@ -17,16 +17,20 @@
         column="periodtypeid" not-null="true" foreign-key="fk_reports_periodtypeid"/>
 
     <property name="excelTemplateName" column="excelname" not-null="true" length="100"/>
-	
-	<property name="xmlTemplateName" column="xmlname" not-null="true" length="100"/>
-	
-	<property name="reportType" column="reporttype" not-null="true" length="100"/>
+    
+    <property name="xmlTemplateName" column="xmlname" not-null="true" length="100"/>
+    
+    <property name="reportType" column="reporttype" not-null="true" length="100"/>
+
+    <many-to-one name="orgunitGroup" class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" lazy="false"
+        column="orgunitgroupid" not-null="false" foreign-key="fk_reports_orgunitgroupid"/>
+
     
     <set name="sources" table="reportsource">
       <key column="reportid"/>
       <many-to-many column="sourceid" 
-        class="org.hisp.dhis.source.Source"/>
+        class="org.hisp.dhis.source.Source"/>
     </set>
-	  	
+        
   </class>
 </hibernate-mapping>