=== 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 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 getLineListGroupsBetween( int first, int max ) + { + return lineListStore.getLineListGroupsBetween( first, max ); + } + + public int getLineListElementCount() + { + return lineListStore.getLineListElementCount(); + } + + public Collection getLineListElementsBetween( int first, int max ) + { + return lineListStore.getLineListElementsBetween( first, max ); + } + + public int getLineListOptionCount() + { + return lineListStore.getLineListOptionCount(); + } + + @SuppressWarnings("unchecked") + public Collection 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 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 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 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 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 periodList = new ArrayList( 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"/> - - - - + + + + + + + + class="org.hisp.dhis.source.Source"/> - +