=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java 2009-09-15 04:00:03 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/CopyReportExcelItemAction.java 2009-10-22 05:37:47 +0000 @@ -39,81 +39,87 @@ * @author Tran Thanh Tri * @version $Id$ */ -public class CopyReportExcelItemAction implements Action -{ - // ------------------------------------------- - // Dependency - // ------------------------------------------- - - private ReportExcelService reportService; - - // ------------------------------------------- - // Input - // ------------------------------------------- - - private Integer reportId; - - private Integer sheetNo; - - private Collection reportItems; - - // ------------------------------------------- - // Getter & Setter - // ------------------------------------------- - - public void setReportService( ReportExcelService reportService ) - { - this.reportService = reportService; - } - - public Integer getReportId() - { - return reportId; - } - - public Integer getSheetNo() - { - return sheetNo; - } - - public void setReportId( Integer reportId ) - { - this.reportId = reportId; - } - - public void setReportItems( Collection reportItems ) - { - this.reportItems = reportItems; - } - - public void setSheetNo( Integer sheetNo ) - { - this.sheetNo = sheetNo; - } - - public String execute() - throws Exception - { - ReportExcel reportExcel = reportService.getReportExcel( reportId ); - - - for(String itemId:this.reportItems){ - Set reportItems = reportExcel.getReportExcelItems(); - ReportExcelItem reportItem = reportService.getReportExcelItem( Integer.parseInt( itemId ) ) ; - ReportExcelItem newReportItem = new ReportExcelItem(); - newReportItem.setName( reportItem.getName() ); - newReportItem.setItemType( reportItem.getItemType() ); - newReportItem.setPeriodType( reportItem.getPeriodType() ); - newReportItem.setExpression( reportItem.getExpression() ); - newReportItem.setRow( reportItem.getRow() ); - newReportItem.setColumn( reportItem.getColumn() ); - newReportItem.setSheetNo( sheetNo ); - reportItems.add( newReportItem ); - reportExcel.setReportExcelItems( reportItems ); - reportService.updateReportExcel( reportExcel ); - - } - - return SUCCESS; - } +public class CopyReportExcelItemAction implements Action { + + // ------------------------------------------- + // Dependency + // ------------------------------------------- + + private ReportExcelService reportService; + + // ------------------------------------------- + // Input + // ------------------------------------------- + + private Integer reportId; + + private Integer sheetNo; + + private Collection reportItems; + + // ------------------------------------------- + // Getter & Setter + // ------------------------------------------- + + public void setReportService(ReportExcelService reportService) { + this.reportService = reportService; + } + + public Integer getReportId() { + return reportId; + } + + public Integer getSheetNo() { + return sheetNo; + } + + public void setReportId(Integer reportId) { + this.reportId = reportId; + } + + public void setReportItems(Collection reportItems) { + this.reportItems = reportItems; + } + + public void setSheetNo(Integer sheetNo) { + this.sheetNo = sheetNo; + } + + public String execute() throws Exception { + + ReportExcel reportExcel = reportService.getReportExcel(reportId); + + Set reportItems = reportExcel.getReportExcelItems(); + + for (String itemId : this.reportItems) { + + ReportExcelItem reportItem = reportService + .getReportExcelItem(Integer.parseInt(itemId)); + + ReportExcelItem newReportItem = new ReportExcelItem(); + + newReportItem.setName(reportItem.getName()); + + newReportItem.setItemType(reportItem.getItemType()); + + newReportItem.setPeriodType(reportItem.getPeriodType()); + + newReportItem.setExpression(reportItem.getExpression()); + + newReportItem.setRow(reportItem.getRow()); + + newReportItem.setColumn(reportItem.getColumn()); + + newReportItem.setSheetNo(sheetNo); + + reportItems.add(newReportItem); + + reportExcel.getReportExcelItems().add(newReportItem); + + } + + reportService.updateReportExcel(reportExcel); + + return SUCCESS; + } } === modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm 2009-10-02 02:58:42 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportItems.vm 2009-10-22 05:37:47 +0000 @@ -31,7 +31,7 @@ #set( $mark = false ) #foreach($reportItem in $reportItems) - + $encoder.htmlEncode( $reportItem.name ) $i18n.getString( $reportItem.itemType ) $i18n.getString( $reportItem.periodType )