dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03003
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1001: fixed delete report excel item
------------------------------------------------------------
revno: 1001
committer: Tran Thanh Tri <Tran Thanh Tri@TranThanhTri-PC>
branch nick: trunk
timestamp: Mon 2009-11-09 12:52:46 +0700
message:
fixed delete report excel item
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelStore.java
dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java
dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java
dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/hibernate/ReportExcel.hbm.xml
dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/hibernate/ReportExcelItem.hbm.xml
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/ValidateAddReportExcelAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/DeleteReportExcelItemAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ValidateAddReportExcelItemAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ValidateUpdateReportExcelItemAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reports.js
--
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/reportexcel/ReportExcelService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelService.java 2009-09-17 15:02:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelService.java 2009-11-09 05:52:46 +0000
@@ -81,6 +81,8 @@
public Collection<ReportExcelItem> getALLReportExcelItem();
public Collection<ReportExcelItem> getReportExcelItem( int sheetNo, Integer reportId );
+
+ public ReportExcelItem getReportExcelItem(ReportExcel reportExcel, int sheetNo, String name);
public Collection<Integer> getSheets( Integer reportId );
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelStore.java 2009-10-29 05:21:01 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelStore.java 2009-11-09 05:52:46 +0000
@@ -73,12 +73,14 @@
public void deleteReportExcelItem( int id );
- public ReportExcelItem getReportExcelItem( int id );
+ public ReportExcelItem getReportExcelItem( int id );
public Collection<ReportExcelItem> getALLReportExcelItem();
public Collection<ReportExcelItem> getReportExcelItem( int sheetNo, Integer reportId );
+ public ReportExcelItem getReportExcelItem( ReportExcel reportExcel, int sheetNo, String name );
+
public Collection<Integer> getSheets( Integer reportId );
// --------------------------------------
@@ -88,7 +90,7 @@
public DataElementGroupOrder getDataElementGroupOrder( Integer id );
public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder );
-
+
public void deleteDataElementGroupOrder( Integer id );
// --------------------------------------
@@ -96,20 +98,19 @@
// --------------------------------------
public int saveDataEntryStatus( DataEntryStatus dataStatus );
-
+
public void updateDataEntryStatus( DataEntryStatus dataStatus );
public DataEntryStatus getDataEntryStatus( int id );
- public void deleteDataEntryStatus( int id );
+ public void deleteDataEntryStatus( int id );
public Collection<DataEntryStatus> getALLDataEntryStatus();
- public Collection<DataEntryStatus> getDataEntryStatusDefault();
+ public Collection<DataEntryStatus> getDataEntryStatusDefault();
Collection<DataEntryStatus> getDataEntryStatusDefaultByDataSets( Collection<DataSet> dataSets );
public int countDataValueOfDataSet( DataSet dataSet, OrganisationUnit organisationUnit, Period period );
-
}
=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java 2009-09-26 09:41:54 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportExcelService.java 2009-11-09 05:52:46 +0000
@@ -44,202 +44,179 @@
* @version $Id$
*/
@Transactional
-public class DefaultReportExcelService
- implements ReportExcelService
-{
- // -------------------------------------------------
- // Dependency
- // -------------------------------------------------
-
- private ReportExcelStore reportStore;
-
- public void setReportStore( ReportExcelStore reportStore )
- {
- this.reportStore = reportStore;
- }
-
- private UserStore userStore;
-
- public void setUserStore( UserStore userStore )
- {
- this.userStore = userStore;
- }
-
- // --------------------------------------
- // Service of Report
- // --------------------------------------
-
- public int addReportExcel( ReportExcel report )
- {
- return reportStore.addReportExcel( report );
- }
-
- public void updateReportExcel( ReportExcel report )
- {
- reportStore.updateReportExcel( report );
- }
-
- public void deleteReportExcel( int id )
- {
- reportStore.deleteReportExcel( id );
- }
-
- public ReportExcel getReportExcel( int id )
- {
- return reportStore.getReportExcel( id );
- }
-
- public ReportExcel getReportExcel( String name )
- {
- return reportStore.getReportExcel( name );
- }
-
- public Collection<ReportExcel> getReportExcelsByOrganisationUnit( OrganisationUnit organisationUnit )
- {
- return reportStore.getReportExcelsByOrganisationUnit( organisationUnit );
- }
-
- public Collection<ReportExcel> getALLReportExcel()
- {
- return reportStore.getALLReportExcel();
- }
-
- public Collection<ReportExcel> getReportExcels( User user, boolean superUser, String group )
- {
- if ( user == null || (user != null && superUser) )
- {
- return this.getReportsByGroup( group );
- }
-
- else
- {
- Collection<ReportExcel> reports = new ArrayList<ReportExcel>();
-
- UserCredentials credentials = userStore.getUserCredentials( user );
-
- for ( UserAuthorityGroup ugroup : credentials.getUserAuthorityGroups() )
- {
- reports.addAll( ugroup.getReportExcels() );
- }
-
- reports.retainAll( this.getReportsByGroup( group ) );
-
- return reports;
- }
- }
-
- public Collection<String> getReportExcelGroups()
- {
- return reportStore.getReportExcelGroups();
- }
-
- public Collection<ReportExcel> getReportsByGroup( String group )
- {
- return reportStore.getReportsByGroup( group );
- }
-
- // --------------------------------------
- // Service of Report Item
- // --------------------------------------
-
- public void addReportExcelItem( ReportExcelItem reportItem )
- {
- reportStore.addReportExcelItem( reportItem );
- }
-
- public void updateReportExcelItem( ReportExcelItem reportItem )
- {
- reportStore.updateReportExcelItem( reportItem );
- }
-
- public void deleteReportExcelItem( int id )
- {
- reportStore.deleteReportExcelItem( id );
- }
-
- public ReportExcelItem getReportExcelItem( int id )
- {
- return reportStore.getReportExcelItem( id );
- }
-
- public Collection<ReportExcelItem> getALLReportExcelItem()
- {
- return reportStore.getALLReportExcelItem();
- }
-
- public Collection<ReportExcelItem> getReportExcelItem( int sheetNo, Integer reportId )
- {
- return reportStore.getReportExcelItem( sheetNo, reportId );
- }
-
- public Collection<Integer> getSheets( Integer reportId )
- {
- return reportStore.getSheets( reportId );
- }
-
- // --------------------------------------
- // Report DataElement Order
- // --------------------------------------
-
- public DataElementGroupOrder getDataElementGroupOrder( Integer id )
- {
- return reportStore.getDataElementGroupOrder( id );
- }
-
- public void updateDataElementGroupOrder( DataElementGroupOrder dataElementGroupOrder )
- {
- reportStore.updateDataElementGroupOrder( dataElementGroupOrder );
- }
-
- public void deleteDataElementGroupOrder( Integer id )
- {
- reportStore.deleteDataElementGroupOrder( id );
- }
-
- // -------------------------------------------------
- // Data Entry Status
- // -------------------------------------------------
-
- public int countDataValueOfDataSet( DataSet arg0, OrganisationUnit arg1, Period arg2 )
- {
- return reportStore.countDataValueOfDataSet( arg0, arg1, arg2 );
- }
-
- public void deleteDataEntryStatus( int arg0 )
- {
- reportStore.deleteDataEntryStatus( arg0 );
- }
-
- public Collection<DataEntryStatus> getALLDataEntryStatus()
- {
- return reportStore.getALLDataEntryStatus();
- }
-
- public DataEntryStatus getDataEntryStatus( int arg0 )
- {
- return reportStore.getDataEntryStatus( arg0 );
- }
-
- public Collection<DataEntryStatus> getDataEntryStatusDefault()
- {
- return reportStore.getDataEntryStatusDefault();
- }
-
- public int saveDataEntryStatus( DataEntryStatus arg0 )
- {
- return reportStore.saveDataEntryStatus( arg0 );
- }
-
- public Collection<DataEntryStatus> getDataEntryStatusDefaultByDataSets( Collection<DataSet> arg0 )
- {
- return reportStore.getDataEntryStatusDefaultByDataSets( arg0 );
-
- }
-
- public void updateDataEntryStatus( DataEntryStatus arg0 )
- {
-
- reportStore.updateDataEntryStatus( arg0 );
- }
+public class DefaultReportExcelService implements ReportExcelService {
+ // -------------------------------------------------
+ // Dependency
+ // -------------------------------------------------
+
+ private ReportExcelStore reportStore;
+
+ public void setReportStore(ReportExcelStore reportStore) {
+ this.reportStore = reportStore;
+ }
+
+ private UserStore userStore;
+
+ public void setUserStore(UserStore userStore) {
+ this.userStore = userStore;
+ }
+
+ // --------------------------------------
+ // Service of Report
+ // --------------------------------------
+
+ public int addReportExcel(ReportExcel report) {
+ return reportStore.addReportExcel(report);
+ }
+
+ public void updateReportExcel(ReportExcel report) {
+ reportStore.updateReportExcel(report);
+ }
+
+ public void deleteReportExcel(int id) {
+ reportStore.deleteReportExcel(id);
+ }
+
+ public ReportExcel getReportExcel(int id) {
+ return reportStore.getReportExcel(id);
+ }
+
+ public ReportExcel getReportExcel(String name) {
+ return reportStore.getReportExcel(name);
+ }
+
+ public Collection<ReportExcel> getReportExcelsByOrganisationUnit(
+ OrganisationUnit organisationUnit) {
+ return reportStore.getReportExcelsByOrganisationUnit(organisationUnit);
+ }
+
+ public Collection<ReportExcel> getALLReportExcel() {
+ return reportStore.getALLReportExcel();
+ }
+
+ public Collection<ReportExcel> getReportExcels(User user,
+ boolean superUser, String group) {
+ if (user == null || (user != null && superUser)) {
+ return this.getReportsByGroup(group);
+ }
+
+ else {
+ Collection<ReportExcel> reports = new ArrayList<ReportExcel>();
+
+ UserCredentials credentials = userStore.getUserCredentials(user);
+
+ for (UserAuthorityGroup ugroup : credentials
+ .getUserAuthorityGroups()) {
+ reports.addAll(ugroup.getReportExcels());
+ }
+
+ reports.retainAll(this.getReportsByGroup(group));
+
+ return reports;
+ }
+ }
+
+ public Collection<String> getReportExcelGroups() {
+ return reportStore.getReportExcelGroups();
+ }
+
+ public Collection<ReportExcel> getReportsByGroup(String group) {
+ return reportStore.getReportsByGroup(group);
+ }
+
+ // --------------------------------------
+ // Service of Report Item
+ // --------------------------------------
+
+ public void addReportExcelItem(ReportExcelItem reportItem) {
+ reportStore.addReportExcelItem(reportItem);
+ }
+
+ public void updateReportExcelItem(ReportExcelItem reportItem) {
+ reportStore.updateReportExcelItem(reportItem);
+ }
+
+ public void deleteReportExcelItem(int id) {
+ reportStore.deleteReportExcelItem(id);
+ }
+
+ public ReportExcelItem getReportExcelItem(int id) {
+ return reportStore.getReportExcelItem(id);
+ }
+
+ public Collection<ReportExcelItem> getALLReportExcelItem() {
+ return reportStore.getALLReportExcelItem();
+ }
+
+ public Collection<ReportExcelItem> getReportExcelItem(int sheetNo,
+ Integer reportId) {
+ return reportStore.getReportExcelItem(sheetNo, reportId);
+ }
+
+ public ReportExcelItem getReportExcelItem(
+ ReportExcel reportExcel, int sheetNo, String name) {
+ return reportStore.getReportExcelItem( reportExcel, sheetNo, name );
+ }
+
+ public Collection<Integer> getSheets(Integer reportId) {
+ return reportStore.getSheets(reportId);
+ }
+
+ // --------------------------------------
+ // Report DataElement Order
+ // --------------------------------------
+
+ public DataElementGroupOrder getDataElementGroupOrder(Integer id) {
+ return reportStore.getDataElementGroupOrder(id);
+ }
+
+ public void updateDataElementGroupOrder(
+ DataElementGroupOrder dataElementGroupOrder) {
+ reportStore.updateDataElementGroupOrder(dataElementGroupOrder);
+ }
+
+ public void deleteDataElementGroupOrder(Integer id) {
+ reportStore.deleteDataElementGroupOrder(id);
+ }
+
+ // -------------------------------------------------
+ // Data Entry Status
+ // -------------------------------------------------
+
+ public int countDataValueOfDataSet(DataSet arg0, OrganisationUnit arg1,
+ Period arg2) {
+ return reportStore.countDataValueOfDataSet(arg0, arg1, arg2);
+ }
+
+ public void deleteDataEntryStatus(int arg0) {
+ reportStore.deleteDataEntryStatus(arg0);
+ }
+
+ public Collection<DataEntryStatus> getALLDataEntryStatus() {
+ return reportStore.getALLDataEntryStatus();
+ }
+
+ public DataEntryStatus getDataEntryStatus(int arg0) {
+ return reportStore.getDataEntryStatus(arg0);
+ }
+
+ public Collection<DataEntryStatus> getDataEntryStatusDefault() {
+ return reportStore.getDataEntryStatusDefault();
+ }
+
+ public int saveDataEntryStatus(DataEntryStatus arg0) {
+ return reportStore.saveDataEntryStatus(arg0);
+ }
+
+ public Collection<DataEntryStatus> getDataEntryStatusDefaultByDataSets(
+ Collection<DataSet> arg0) {
+ return reportStore.getDataEntryStatusDefaultByDataSets(arg0);
+
+ }
+
+ public void updateDataEntryStatus(DataEntryStatus arg0) {
+
+ reportStore.updateDataEntryStatus(arg0);
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java 2009-09-17 15:02:10 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/hibernate/HibernateReportExcelStore.java 2009-11-09 05:52:46 +0000
@@ -203,6 +203,19 @@
sqlQuery.addEntity( ReportExcelItem.class );
return sqlQuery.list();
}
+
+ @Override
+ public ReportExcelItem getReportExcelItem( ReportExcel reportExcel, int sheetNo, String name )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( ReportExcelItem.class );
+ criteria.add( Restrictions.eq( "reportExcel", reportExcel ) );
+ criteria.add( Restrictions.eq( "sheetNo", sheetNo ) );
+ criteria.add( Restrictions.eq( "name", name ) );
+
+ return (ReportExcelItem) criteria.uniqueResult();
+ }
@SuppressWarnings( "unchecked" )
public Collection<Integer> getSheets( Integer reportId )
@@ -214,6 +227,8 @@
return sqlQuery.list();
}
+
+
// --------------------------------------
// Report DataElement Order
@@ -332,4 +347,6 @@
Session session = sessionFactory.getCurrentSession();
session.update( arg0 );
}
+
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/hibernate/ReportExcel.hbm.xml'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/hibernate/ReportExcel.hbm.xml 2009-10-26 15:39:29 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/hibernate/ReportExcel.hbm.xml 2009-11-09 05:52:46 +0000
@@ -7,15 +7,15 @@
<id name="id" column="reportexcelid">
<generator class="native" />
</id>
- <property name="name" />
- <property name="excelTemplateFile" column="exceltemplate" />
+ <property name="name" not-null="true" unique="true"/>
+ <property name="excelTemplateFile" column="exceltemplate" not-null="true" />
<property name="periodRow" column="periodrow" />
<property name="periodColumn" column="periodcolumn" />
<property name="organisationRow" column="organisationrow" />
<property name="organisationColumn" column="organisationcolumn" />
- <property name="group" column="reportgroup" />
+ <property name="group" column="reportgroup" not-null="true"/>
- <set name="reportExcelItems" lazy="false" cascade="all">
+ <set name="reportExcelItems" lazy="false" cascade="all-delete-orphan" inverse="true">
<key column="reportexcelid" />
<one-to-many class="org.hisp.dhis.reportexcel.ReportExcelItem" />
</set>
=== modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/hibernate/ReportExcelItem.hbm.xml'
--- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/hibernate/ReportExcelItem.hbm.xml 2009-10-22 17:22:15 +0000
+++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/hibernate/ReportExcelItem.hbm.xml 2009-11-09 05:52:46 +0000
@@ -7,15 +7,21 @@
<id name="id" column="reportexcelitemid">
<generator class="native" />
</id>
- <property name="name" />
- <property name="itemType" column="itemtype" />
- <property name="row" column="excelrow" />
- <property name="column" column="excelcolumn" />
- <property name="expression" column="itemexpression" />
- <property name="periodType" column="periodtype" />
- <property name="sheetNo" column="sheetno" />
- <many-to-one name="reportExcel" column="reportexcelid"
+
+ <properties name="name" unique="true">
+ <property name="name" not-null="true"/>
+ <property name="sheetNo" column="sheetno" not-null="true"/>
+ <many-to-one name="reportExcel" column="reportexcelid"
class="org.hisp.dhis.reportexcel.ReportExcel" foreign-key="pk_reportitem_report"
- lazy="false" insert="true"/>
+ lazy="false"/>
+ </properties>
+
+ <property name="itemType" column="itemtype" not-null="true"/>
+ <property name="row" column="excelrow" not-null="true"/>
+ <property name="column" column="excelcolumn" not-null="true"/>
+ <property name="expression" column="itemexpression" not-null="true"/>
+ <property name="periodType" column="periodtype" not-null="true"/>
+
+
</class>
</hibernate-mapping>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/ValidateAddReportExcelAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/ValidateAddReportExcelAction.java 2009-09-14 03:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/ValidateAddReportExcelAction.java 2009-11-09 05:52:46 +0000
@@ -45,12 +45,14 @@
// -------------------------------------------
// Input & Output
- // -------------------------------------------
+ // -------------------------------------------
private String name;
private String excel;
+ private String groupName;
+
// -------------------------------------------
// Getter & Setter
// -------------------------------------------
@@ -60,6 +62,11 @@
this.reportService = reportService;
}
+ public void setGroupName( String groupName )
+ {
+ this.groupName = groupName;
+ }
+
public void setName( String name )
{
this.name = name;
@@ -68,13 +75,12 @@
public void setExcel( String excel )
{
this.excel = excel;
- }
+ }
public String getReportType( String reportType )
{
return reportType;
}
-
public String execute()
throws Exception
@@ -89,7 +95,7 @@
{
message = i18n.getString( "name_is_null" );
return ERROR;
- }
+ }
ReportExcel reportExcel = reportService.getReportExcel( name );
@@ -97,8 +103,7 @@
{
message = i18n.getString( "name_ready_exist" );
return ERROR;
- }
-
+ }
if ( excel == null )
{
@@ -110,6 +115,17 @@
message = i18n.getString( "excel_is_null" );
return ERROR;
}
+
+ if ( groupName == null )
+ {
+ message = i18n.getString( "please_enter_group_name" );
+ return ERROR;
+ }
+ if ( groupName.trim().length() == 0 )
+ {
+ message = i18n.getString( "please_enter_group_name" );
+ return ERROR;
+ }
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/DeleteReportExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/DeleteReportExcelItemAction.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/DeleteReportExcelItemAction.java 2009-11-09 05:52:46 +0000
@@ -26,6 +26,8 @@
*/
package org.hisp.dhis.reportexcel.item.action;
+import org.hisp.dhis.reportexcel.ReportExcel;
+import org.hisp.dhis.reportexcel.ReportExcelItem;
import org.hisp.dhis.reportexcel.ReportExcelService;
import com.opensymphony.xwork2.Action;
@@ -47,7 +49,7 @@
// Input & Output
// -------------------------------------------
- private Integer id;
+ private Integer id;
// -------------------------------------------
// Getter & Setter
@@ -61,13 +63,20 @@
public void setId( Integer id )
{
this.id = id;
- }
+ }
public String execute()
throws Exception
- {
- reportService.deleteReportExcelItem( id );
-
+ {
+
+ ReportExcelItem reportExcelItem = reportService.getReportExcelItem( id );
+
+ ReportExcel reportExcel = reportExcelItem.getReportExcel();
+
+ reportExcel.getReportExcelItems().remove( reportExcelItem );
+
+ reportService.updateReportExcel( reportExcel );
+
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ValidateAddReportExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ValidateAddReportExcelItemAction.java 2009-09-17 07:12:56 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ValidateAddReportExcelItemAction.java 2009-11-09 05:52:46 +0000
@@ -59,6 +59,8 @@
private Integer column;
+ private Integer sheetNo;
+
// -------------------------------------------
// Getter & Getter
// -------------------------------------------
@@ -68,6 +70,11 @@
this.reportId = reportId;
}
+ public void setSheetNo( Integer sheetNo )
+ {
+ this.sheetNo = sheetNo;
+ }
+
public void setReportService( ReportExcelService reportService )
{
this.reportService = reportService;
@@ -105,27 +112,34 @@
{
message = i18n.getString( "name_is_null" );
return ERROR;
- }
-
+ }
+
+ if ( expression == null )
+ {
+ message = i18n.getString( "expression_is_null" );
+ return ERROR;
+ }
+ if ( expression.trim().length() == 0 )
+ {
+ message = i18n.getString( "expression_is_null" );
+ return ERROR;
+ }
+ if ( sheetNo == null )
+ {
+ message = i18n.getString( "please_enter_sheet_no" );
+
+ return ERROR;
+ }
+
ReportExcel reportExcel = reportService.getReportExcel( reportId );
- ReportExcelItem reportItem = reportExcel.getReportExcelItem( name );
+ ReportExcelItem reportItem = reportService.getReportExcelItem( reportExcel, sheetNo, name );
- if ( reportItem != null && reportExcel.getReportExcelItems().contains( reportItem ) )
+ if ( reportItem != null )
{
message = i18n.getString( "name_ready_exist" );
return ERROR;
}
-
- if ( expression == null )
- {
- message = i18n.getString( "name_is_null" );
- return ERROR;
- }
- if ( expression.trim().length() == 0 )
- {
- message = i18n.getString( "expression_is_null" );
- return ERROR;
- }
+
if ( row == null )
{
message = i18n.getString( "row_is_null" );
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ValidateUpdateReportExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ValidateUpdateReportExcelItemAction.java 2009-09-17 07:12:56 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/ValidateUpdateReportExcelItemAction.java 2009-11-09 05:52:46 +0000
@@ -51,6 +51,8 @@
private Integer reportItemId;
+ private Integer sheetNo;
+
private String name;
private String expression;
@@ -59,6 +61,11 @@
private Integer column;
+ public void setSheetNo( Integer sheetNo )
+ {
+ this.sheetNo = sheetNo;
+ }
+
public void setReportItemId( Integer reportItemId )
{
this.reportItemId = reportItemId;
@@ -107,33 +114,43 @@
message = i18n.getString( "name_is_null" );
return ERROR;
}
+
+ if ( expression == null )
+ {
+ message = i18n.getString( "expression_is_null" );
+ return ERROR;
+ }
+
+ if ( expression.trim().length() == 0 )
+ {
+ message = i18n.getString( "expression_is_null" );
+ return ERROR;
+ }
+
+ if ( sheetNo == null )
+ {
+ message = i18n.getString( "please_enter_sheet_no" );
+ return ERROR;
+ }
+
ReportExcel reportExcel = reportService.getReportExcel( reportId );
-
- ReportExcelItem reportItem = reportExcel.getReportExcelItem( name );
+
+ ReportExcelItem reportItem = reportService.getReportExcelItem( reportExcel, sheetNo, name );
ReportExcelItem temp = reportService.getReportExcelItem( reportItemId );
- if ( (!temp.equals( reportItem )) && reportExcel.getReportExcelItems().contains( reportItem ) )
+ if ( (!temp.equals( reportItem )) )
{
message = i18n.getString( "name_ready_exist" );
return ERROR;
- }
+ }
- if ( expression == null )
- {
- message = i18n.getString( "name_is_null" );
- return ERROR;
- }
- if ( expression.trim().length() == 0 )
- {
- message = i18n.getString( "expression_is_null" );
- return ERROR;
- }
if ( row == null )
{
message = i18n.getString( "row_is_null" );
return ERROR;
}
+
if ( column == null )
{
message = i18n.getString( "column_is_null" );
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2009-11-09 04:18:02 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2009-11-09 05:52:46 +0000
@@ -147,8 +147,10 @@
generate_advanced_report = Generate advanced report
report_ready_exist = Report ready exist
upload_file_first = Upload file first !
+please_enter_sheet_no = Please enter sheet no
+please_enter_group_name = Please enter group name
excel_item = Excel item and group
type = Type
associations = Associations
sheetNo = Sheet
-choose_excelItem = Please choose excel items
\ No newline at end of file
+choose_excelItem = Please choose excel items
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2009-11-09 04:18:02 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2009-11-09 05:52:46 +0000
@@ -163,4 +163,7 @@
generate_advanced_report = B\u00e1o c\u00e1o theo nh\u00f3m \u0111\u01a1n v\u1ecb
report_ready_exist = B\u00e1o c\u00e1o n\u00e0y \u0111\u00e3 t\u1ed3n t\u1ea1i
upload_file_first = Upload t\u1eadp tin tr\u01b0\u1edbc !
-choose_excelItem = Xin ch\u1ecdn c\u00e1c gi\u00e1 tr\u1ecb c\u1ea7n import
\ No newline at end of file
+please_enter_sheet_no = Vui l\u00f2ng nh\u1eadp sheet no
+please_enter_group_name = Vui l\u00f2ng nh\u1eadp t\u00ean nh\u00f3m
+upload_file_first = Upload t\u1eadp tin tr\u01b0\u1edbc !
+choose_excelItem = Xin ch\u1ecdn c\u00e1c gi\u00e1 tr\u1ecb c\u1ea7n import
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js 2009-09-15 04:10:48 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js 2009-11-09 05:52:46 +0000
@@ -59,6 +59,7 @@
expression:$("#expression").val(),
row:$("#row").val(),
column:$("#column").val(),
+ sheetNo:$("#sheetNo").val(),
reportId:reportId
}, function (data){
var xmlObject = data.getElementsByTagName('message')[0];
@@ -101,7 +102,8 @@
reportItemId:$("#id").val(),
expression:$("#expression").val(),
row:$("#row").val(),
- column:$("#column").val(),
+ column:$("#column").val(),
+ sheetNo:$("#sheetNo").val(),
reportId:reportId
}, function (data){
var xmlObject = data.getElementsByTagName('message')[0];
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reports.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reports.js 2009-10-26 15:39:29 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reports.js 2009-11-09 05:52:46 +0000
@@ -28,7 +28,7 @@
periodCol:$("#periodColumn").val(),
organisationRow:$("#organisationRow").val(),
organisationCol:$("#organisationColumn").val(),
- group:$("#group").val()
+ groupName:$("#group").val()
},function(xmlObject){
var xmlObject = xmlObject.getElementsByTagName('message')[0];
var type = xmlObject.getAttribute( 'type' );