dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25895
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12859: Tracker, removed old tabular report code
------------------------------------------------------------
revno: 12859
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-11-04 00:45:52 +0100
message:
Tracker, removed old tabular report code
removed:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.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 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2013-10-24 08:31:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java 2013-11-03 23:45:52 +0000
@@ -39,7 +39,6 @@
import org.hisp.dhis.message.MessageConversation;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patientreport.TabularReportColumn;
import org.hisp.dhis.sms.outbound.OutboundSms;
/**
@@ -105,14 +104,6 @@
List<ProgramStageInstance> getProgramStageInstances( Patient patient, Boolean completed );
- Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage, List<TabularReportColumn> columns,
- Collection<Integer> organisationUnits, int level, Date startDate, Date endDate, boolean descOrder,
- Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n );
-
- int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage,
- List<TabularReportColumn> columns, Collection<Integer> organisationUnits, int level, Boolean completed,
- Date startDate, Date endDate );
-
List<Grid> getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n );
void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java 2013-10-08 03:23:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceStore.java 2013-11-03 23:45:52 +0000
@@ -31,15 +31,12 @@
import java.util.Collection;
import java.util.Date;
import java.util.List;
-import java.util.Map;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patientreport.TabularReportColumn;
import org.hisp.dhis.sms.outbound.OutboundSms;
/**
@@ -88,15 +85,6 @@
List<ProgramStageInstance> get( ProgramStage programStage, OrganisationUnit orgunit, Date startDate, Date endDate,
int min, int max );
- Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage,
- Map<Integer, OrganisationUnitLevel> orgUnitLevelMap, Collection<Integer> orgUnits,
- List<TabularReportColumn> columns, int level, int maxLevel, Date startDate, Date endDate, boolean descOrder,
- Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n );
-
- int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage,
- List<TabularReportColumn> columns, Collection<Integer> organisationUnits, int level, int maxLevel,
- Date startDate, Date endDate, Boolean completed );
-
void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit );
void update( Collection<Integer> programStageInstanceIds, OutboundSms outboundSms );
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2013-10-24 08:31:35 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2013-11-03 23:45:52 +0000
@@ -46,14 +46,12 @@
import org.hisp.dhis.message.MessageConversation;
import org.hisp.dhis.message.MessageService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.patient.Patient;
import org.hisp.dhis.patient.PatientReminder;
import org.hisp.dhis.patient.PatientReminderService;
import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
-import org.hisp.dhis.patientreport.TabularReportColumn;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.sms.SmsSender;
import org.hisp.dhis.sms.SmsServiceException;
@@ -250,32 +248,6 @@
return programStageInstanceStore.get( patient, completed );
}
- @Override
- public Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage,
- List<TabularReportColumn> columns, Collection<Integer> organisationUnits, int level, Date startDate,
- Date endDate, boolean descOrder, Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode,
- Integer min, Integer max, I18n i18n )
- {
- int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels();
-
- Map<Integer, OrganisationUnitLevel> orgUnitLevelMap = organisationUnitService.getOrganisationUnitLevelMap();
-
- return programStageInstanceStore.getTabularReport( anonynousEntryForm, programStage, orgUnitLevelMap,
- organisationUnits, columns, level, maxLevel, startDate, endDate, descOrder, completed, accessPrivateInfo,
- displayOrgunitCode, min, max, i18n );
- }
-
- @Override
- public int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage,
- List<TabularReportColumn> columns, Collection<Integer> organisationUnits, int level, Boolean completed,
- Date startDate, Date endDate )
- {
- int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels();
-
- return programStageInstanceStore.getTabularReportCount( anonynousEntryForm, programStage, columns,
- organisationUnits, level, maxLevel, startDate, endDate, completed );
- }
-
public List<Grid> getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n )
{
List<Grid> grids = new ArrayList<Grid>();
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-10-14 11:20:58 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java 2013-11-03 23:45:52 +0000
@@ -249,109 +249,6 @@
.setFirstResult( min ).setMaxResults( max ).list();
}
- @Override
- public Grid getTabularReport( Boolean anonynousEntryForm, ProgramStage programStage,
- Map<Integer, OrganisationUnitLevel> orgUnitLevelMap, Collection<Integer> orgUnits,
- List<TabularReportColumn> columns, int level, int maxLevel, Date startDate, Date endDate, boolean descOrder,
- Boolean completed, Boolean accessPrivateInfo, Boolean displayOrgunitCode, Integer min, Integer max, I18n i18n )
- {
- // ---------------------------------------------------------------------
- // Headers cols
- // ---------------------------------------------------------------------
-
- Grid grid = new ListGrid();
- grid.setTitle( programStage.getDisplayName() );
- grid.setSubtitle( i18n.getString( "from" ) + " " + DateUtils.getMediumDateString( startDate ) + " "
- + i18n.getString( "to" ) + " " + DateUtils.getMediumDateString( endDate ) );
-
- grid.addHeader( new GridHeader( "id", true, true ) );
- grid.addHeader( new GridHeader( programStage.getReportDateDescription(), false, true ) );
-
- if ( anonynousEntryForm == null || !anonynousEntryForm )
- {
- for ( int i = level; i <= maxLevel; i++ )
- {
- String name = orgUnitLevelMap.containsKey( i ) ? orgUnitLevelMap.get( i ).getName() : "Level " + i;
- grid.addHeader( new GridHeader( name, false, true ) );
- }
- }
-
- if ( displayOrgunitCode != null && displayOrgunitCode )
- {
- grid.addHeader( new GridHeader( i18n.getString( "orgunit_code" ), false, true ) );
- }
-
- Collection<String> deKeys = new HashSet<String>();
- for ( TabularReportColumn column : columns )
- {
- if ( !column.isMeta() )
- {
- String deKey = "element_" + column.getIdentifier();
- if ( !deKeys.contains( deKey ) )
- {
- grid.addHeader( new GridHeader( column.getName(), column.isHidden(), true ) );
- deKeys.add( deKey );
- }
- }
- }
-
- grid.addHeader( new GridHeader( "Complete", true, true ) );
- grid.addHeader( new GridHeader( "PatientId", true, true ) );
-
- // ---------------------------------------------------------------------
- // Get SQL and build grid
- // ---------------------------------------------------------------------
-
- String sql = getTabularReportSql( anonynousEntryForm, false, programStage, columns, orgUnits, level, maxLevel,
- startDate, endDate, descOrder, completed, accessPrivateInfo, displayOrgunitCode, min, max );
-
- SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-
- GridUtils.addRows( grid, rowSet );
-
- // Save PatientAudit
-
- if ( accessPrivateInfo != null && accessPrivateInfo )
- {
- long millisInDay = 60 * 60 * 24 * 1000;
- long currentTime = new Date().getTime();
- long dateOnly = (currentTime / millisInDay) * millisInDay;
- Date date = new Date( dateOnly );
- String visitor = currentUserService.getCurrentUsername();
-
- List<Map<String, Object>> rows = jdbcTemplate.queryForList( sql );
-
- if ( rows != null && !rows.isEmpty() )
- {
- for ( Map<String, Object> row : rows )
- {
- Integer patientId = (Integer) row.get( "patientid" );
-
- PatientAudit patientAudit = patientAuditService.getPatientAudit( patientId, visitor, date,
- PatientAudit.MODULE_TABULAR_REPORT );
- if ( patientAudit == null )
- {
- Patient patient = patientService.getPatient( patientId );
- patientAudit = new PatientAudit( patient, visitor, date, PatientAudit.MODULE_TABULAR_REPORT );
- patientAuditService.savePatientAudit( patientAudit );
- }
- }
- }
- }
-
- return grid;
- }
-
- public int getTabularReportCount( Boolean anonynousEntryForm, ProgramStage programStage,
- List<TabularReportColumn> columns, Collection<Integer> organisationUnits, int level, int maxLevel,
- Date startDate, Date endDate, Boolean completed )
- {
- String sql = getTabularReportSql( anonynousEntryForm, true, programStage, columns, organisationUnits, level,
- maxLevel, startDate, endDate, false, completed, null, null, null, null );
-
- return jdbcTemplate.queryForObject( sql, Integer.class );
- }
-
public void removeEmptyEvents( ProgramStage programStage, OrganisationUnit organisationUnit )
{
String sql = "delete from programstageinstance where programstageid=" + programStage.getId()
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2013-10-09 11:26:54 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 1970-01-01 00:00:00 +0000
@@ -1,539 +0,0 @@
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.caseentry.action.report;
-
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_DATA_ELEMENT;
-import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_NUMBER_DATA_ELEMENT;
-import static org.hisp.dhis.patientreport.PatientTabularReport.VALUE_TYPE_OPTION_SET;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.hibernate.exception.SQLGrammarException;
-import org.hisp.dhis.common.Grid;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.paging.ActionPagingSupport;
-import org.hisp.dhis.patient.PatientAttribute;
-import org.hisp.dhis.patient.PatientIdentifierType;
-import org.hisp.dhis.patientreport.TabularReportColumn;
-import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramStageInstance;
-import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.program.ProgramStageService;
-import org.hisp.dhis.system.util.TextUtils;
-import org.hisp.dhis.user.CurrentUserService;
-
-/**
- * @author Chau Thu Tran
- * @version $GenerateTabularReportAction.java Feb 29, 2012 10:15:05 AM$
- */
-public class GenerateTabularReportAction
- extends ActionPagingSupport<ProgramStageInstance>
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- private ProgramStageService programStageService;
-
- public void setProgramStageService( ProgramStageService programStageService )
- {
- this.programStageService = programStageService;
- }
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private ProgramStageInstanceService programStageInstanceService;
-
- public void setProgramStageInstanceService( ProgramStageInstanceService programStageInstanceService )
- {
- this.programStageInstanceService = programStageInstanceService;
- }
-
- private CurrentUserService currentUserService;
-
- public void setCurrentUserService( CurrentUserService currentUserService )
- {
- this.currentUserService = currentUserService;
- }
-
- // -------------------------------------------------------------------------
- // Input/Output
- // -------------------------------------------------------------------------
-
- private List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
-
- public List<PatientIdentifierType> getIdentifierTypes()
- {
- return identifierTypes;
- }
-
- private Boolean anonynousEntryForm;
-
- public void setAnonynousEntryForm( Boolean anonynousEntryForm )
- {
- this.anonynousEntryForm = anonynousEntryForm;
- }
-
- private List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
-
- public List<PatientAttribute> getPatientAttributes()
- {
- return patientAttributes;
- }
-
- private Collection<Integer> orgunitIds = new HashSet<Integer>();
-
- public void setOrgunitIds( Collection<Integer> orgunitIds )
- {
- this.orgunitIds = orgunitIds;
- }
-
- private Integer programStageId;
-
- public void setProgramStageId( Integer programStageId )
- {
- this.programStageId = programStageId;
- }
-
- private String startDate;
-
- public void setStartDate( String startDate )
- {
- this.startDate = startDate;
- }
-
- private String endDate;
-
- public void setEndDate( String endDate )
- {
- this.endDate = endDate;
- }
-
- private List<String> values = new ArrayList<String>();
-
- public List<String> getValues()
- {
- return values;
- }
-
- private List<String> filterValues = new ArrayList<String>();
-
- public void setFilterValues( List<String> filterValues )
- {
- this.filterValues = filterValues;
- }
-
- private boolean orderByOrgunitAsc;
-
- public void setOrderByOrgunitAsc( boolean orderByOrgunitAsc )
- {
- this.orderByOrgunitAsc = orderByOrgunitAsc;
- }
-
- private Integer level;
-
- public void setLevel( Integer level )
- {
- this.level = level;
- }
-
- private Boolean userOrganisationUnit;
-
- public void setUserOrganisationUnit( Boolean userOrganisationUnit )
- {
- this.userOrganisationUnit = userOrganisationUnit;
- }
-
- private Boolean userOrganisationUnitChildren;
-
- public void setUserOrganisationUnitChildren( Boolean userOrganisationUnitChildren )
- {
- this.userOrganisationUnitChildren = userOrganisationUnitChildren;
- }
-
- private Integer pageSize;
-
- public void setPageSize( Integer pageSize )
- {
- this.pageSize = pageSize;
- }
-
- private Grid grid;
-
- public Grid getGrid()
- {
- return grid;
- }
-
- private int totalRecords;
-
- public int getTotalRecords()
- {
- return totalRecords;
- }
-
- private Integer total;
-
- public void setTotal( Integer total )
- {
- this.total = total;
- }
-
- public Integer getTotal()
- {
- return total;
- }
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- private Boolean useCompletedEvents;
-
- public void setUseCompletedEvents( Boolean useCompletedEvents )
- {
- this.useCompletedEvents = useCompletedEvents;
- }
-
- private List<DataElement> dataElements = new ArrayList<DataElement>();
-
- public List<DataElement> getDataElements()
- {
- return dataElements;
- }
-
- private String type;
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- private String facilityLB; // All, children, current
-
- public void setFacilityLB( String facilityLB )
- {
- this.facilityLB = facilityLB;
- }
-
- private List<String> valueTypes = new ArrayList<String>();
-
- public List<String> getValueTypes()
- {
- return valueTypes;
- }
-
- private Map<Integer, List<String>> mapSuggestedValues = new HashMap<Integer, List<String>>();
-
- public Map<Integer, List<String>> getMapSuggestedValues()
- {
- return mapSuggestedValues;
- }
-
- private String message;
-
- public String getMessage()
- {
- return message;
- }
-
- private Boolean displayOrgunitCode;
-
- public void setDisplayOrgunitCode( Boolean displayOrgunitCode )
- {
- this.displayOrgunitCode = displayOrgunitCode;
- }
-
- private Boolean useFormNameDataElement;
-
- public void setUseFormNameDataElement( Boolean useFormNameDataElement )
- {
- this.useFormNameDataElement = useFormNameDataElement;
- }
-
- private boolean accessPrivateInfo = false;
-
- // -------------------------------------------------------------------------
- // Implementation Action
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- if ( programStageId == null )
- {
- return INPUT;
- }
-
- // ---------------------------------------------------------------------
- // Get user orgunits
- // ---------------------------------------------------------------------
-
- if ( userOrganisationUnit || userOrganisationUnitChildren )
- {
- Collection<OrganisationUnit> userOrgunits = currentUserService.getCurrentUser().getOrganisationUnits();
- orgunitIds = new HashSet<Integer>();
-
- if ( userOrganisationUnit )
- {
- for ( OrganisationUnit userOrgunit : userOrgunits )
- {
- orgunitIds.add( userOrgunit.getId() );
- }
- }
-
- if ( userOrganisationUnitChildren )
- {
- for ( OrganisationUnit userOrgunit : userOrgunits )
- {
- if ( userOrgunit.hasChild() )
- {
- for ( OrganisationUnit childOrgunit : userOrgunit.getSortedChildren() )
- {
- orgunitIds.add( childOrgunit.getId() );
- }
- }
- }
- }
- }
-
- // ---------------------------------------------------------------------
- // Get orgunitIds
- // ---------------------------------------------------------------------
-
- Set<Integer> organisationUnits = new HashSet<Integer>();
-
- if ( facilityLB.equals( "selected" ) )
- {
- organisationUnits.addAll( orgunitIds );
- }
- else if ( facilityLB.equals( "childrenOnly" ) )
- {
- for ( Integer orgunitId : orgunitIds )
- {
- OrganisationUnit selectedOrgunit = organisationUnitService.getOrganisationUnit( orgunitId );
- organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy()
- .getChildren( orgunitId ) );
- organisationUnits.remove( selectedOrgunit );
- }
- }
- else
- {
- for ( Integer orgunitId : orgunitIds )
- {
- organisationUnits.addAll( organisationUnitService.getOrganisationUnitHierarchy()
- .getChildren( orgunitId ) );
- }
- }
-
- // ---------------------------------------------------------------------
- // Get program-stage, start-date, end-date
- // ---------------------------------------------------------------------
-
- if ( level == 0 )
- {
- level = organisationUnitService.getMaxOfOrganisationUnitLevels();
- }
-
- // ---------------------------------------------------------------------
- // Get program-stage, start-date, end-date
- // ---------------------------------------------------------------------
-
- ProgramStage programStage = programStageService.getProgramStage( programStageId );
- Date startValue = format.parseDate( startDate );
- Date endValue = format.parseDate( endDate );
- List<TabularReportColumn> columns = getTableColumns();
-
- // ---------------------------------------------------------------------
- // Generate tabular report
- // ---------------------------------------------------------------------
- try
- {
- if ( type == null ) // Tabular report
- {
- totalRecords = programStageInstanceService.getTabularReportCount( anonynousEntryForm, programStage,
- columns, organisationUnits, level, useCompletedEvents, startValue, endValue );
-
- total = getNumberOfPages( totalRecords );
-
- this.paging = createPaging( totalRecords );
-
- grid = programStageInstanceService.getTabularReport( anonynousEntryForm, programStage, columns,
- organisationUnits, level, startValue, endValue, !orderByOrgunitAsc, useCompletedEvents,
- accessPrivateInfo, displayOrgunitCode, paging.getStartPos(), paging.getPageSize(), i18n );
- }
- // Download as Excel
- else
- {
- grid = programStageInstanceService.getTabularReport( anonynousEntryForm, programStage, columns,
- organisationUnits, level, startValue, endValue, !orderByOrgunitAsc, useCompletedEvents,
- accessPrivateInfo, displayOrgunitCode, null, null, i18n );
- }
- }
- catch ( SQLGrammarException ex )
- {
- message = i18n.getString( "failed_to_get_events" );
- }
-
- return type == null ? SUCCESS : type;
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- private int getNumberOfPages( int totalRecord )
- {
- int size = ( pageSize != null ) ? pageSize : this.getDefaultPageSize();
- return (totalRecord % size == 0) ? (totalRecord / size) : (totalRecord / size + 1);
- }
-
- public int getStartPos()
- {
- if ( currentPage == null )
- {
- return paging.getStartPos();
- }
- int startPos = currentPage <= 0 ? 0 : (currentPage - 1) * paging.getPageSize();
- startPos = (startPos > total) ? total : startPos;
- return startPos;
- }
-
- private List<TabularReportColumn> getTableColumns()
- {
- List<TabularReportColumn> columns = new ArrayList<TabularReportColumn>();
-
- int index = 0;
-
- for ( String filterValue : filterValues )
- {
- String[] values = filterValue.split( "_" );
-
- if ( values != null && values.length >= 3 )
- {
- String prefix = values[0];
-
- TabularReportColumn column = new TabularReportColumn();
- column.setPrefix( prefix );
- column.setIdentifier( values[1] );
- column.setHidden( Boolean.parseBoolean( values[2] ) );
-
- column.setOperator( values.length > 3 ? TextUtils.lower( values[3] ) : TextUtils.EMPTY);
- column.setQuery( values.length > 4 ? TextUtils.lower( values[4] ) : TextUtils.EMPTY );
-
- if ( PREFIX_DATA_ELEMENT.equals( prefix ) )
- {
- int objectId = Integer.parseInt( values[1] );
- DataElement dataElement = dataElementService.getDataElement( objectId );
- if ( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
- {
- column.setPrefix( PREFIX_NUMBER_DATA_ELEMENT );
- }
- dataElements.add( dataElement );
-
- String valueType = dataElement.getOptionSet() != null ? VALUE_TYPE_OPTION_SET : dataElement
- .getType();
- valueTypes.add( valueType );
- mapSuggestedValues.put( index, getSuggestedDataElementValues( dataElement ) );
- if ( dataElement.getType().equals( DataElement.VALUE_TYPE_DATE ) )
- {
- column.setDateType( true );
- }
-
- if ( useFormNameDataElement != null && useFormNameDataElement )
- {
- column.setName( dataElement.getFormNameFallback() );
- }
- else
- {
- column.setName( dataElement.getDisplayName() );
- }
- }
-
- columns.add( column );
-
- index++;
- }
- }
-
- return columns;
- }
-
- private List<String> getSuggestedDataElementValues( DataElement dataElement )
- {
- List<String> values = new ArrayList<String>();
- String valueType = dataElement.getType();
-
- if ( valueType.equals( DataElement.VALUE_TYPE_BOOL ) )
- {
- values.add( i18n.getString( "yes" ) );
- values.add( i18n.getString( "no" ) );
- }
- if ( valueType.equals( DataElement.VALUE_TYPE_TRUE_ONLY ) )
- {
- values.add( i18n.getString( "" ) );
- values.add( i18n.getString( "yes" ) );
- }
-
- return values;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-10-25 05:00:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2013-11-03 23:45:52 +0000
@@ -782,19 +782,6 @@
<!-- Tabular report -->
- <bean
- id="org.hisp.dhis.caseentry.action.report.GenerateTabularReportAction"
- class="org.hisp.dhis.caseentry.action.report.GenerateTabularReportAction"
- scope="prototype">
- <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
- <property name="programStageInstanceService"
- ref="org.hisp.dhis.program.ProgramStageInstanceService" />
- <property name="organisationUnitService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
- </bean>
-
<bean id="org.hisp.dhis.caseentry.action.report.TabularInitializeAction"
class="org.hisp.dhis.caseentry.action.report.TabularInitializeAction"
scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2013-10-25 05:00:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2013-11-03 23:45:52 +0000
@@ -838,12 +838,6 @@
<!-- Tabular report -->
- <action name="searchProgramStageInstances"
- class="org.hisp.dhis.caseentry.action.report.GenerateTabularReportAction">
- <result name="success" type="velocity">/content.vm</result>
- <param name="page">/dhis-web-caseentry/programStageInstancesList.vm</param>
- </action>
-
<action name="generateTabularReport" class="org.hisp.dhis.caseentry.action.NoAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm
</result>