=== 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-09-17 15:02:10 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcelStore.java 2009-10-29 05:21:01 +0000 @@ -82,7 +82,7 @@ public Collection getSheets( Integer reportId ); // -------------------------------------- - // Report DataElement Order + // DataElement Order // -------------------------------------- public DataElementGroupOrder getDataElementGroupOrder( Integer id ); @@ -110,4 +110,6 @@ Collection getDataEntryStatusDefaultByDataSets( Collection dataSets ); public int countDataValueOfDataSet( DataSet dataSet, OrganisationUnit organisationUnit, Period period ); + + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemGroup.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemGroup.java 2009-10-27 06:36:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemGroup.java 2009-10-29 05:21:01 +0000 @@ -27,90 +27,99 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.util.List; import java.util.Set; import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitGroup; +import org.hisp.dhis.reportexcel.DataElementGroupOrder; /** * @author Chau Thu Tran * @version $Id$ */ -public class ExcelItemGroup -{ - private int id; - - private String name; - - private Set excelItems; - - private String excelTemplateFile; - - private String type; - - private Set organisationAssocitions; - - // ---------------------------------------------------------------------- - // Constructors - // ---------------------------------------------------------------------- - - public ExcelItemGroup() - { - - } - - // ------------------------------------------------------------------------- - // Internal classes - // ------------------------------------------------------------------------- - - public static class TYPE - { - public static final String NORMAL = "NORMAL"; - - public static final String CATEGORY = "CATEGORY"; - - public static final String PERIOD_COLUMN_LISTING = "PERIOD_COLUMN_LISTING"; - - public static final String ORGANIZATION_GROUP_LISTING = "ORGANIZATION_GROUP_LISTING"; - } - - // ------------------------------------------------------------------------- - // hashCode and equals - // ------------------------------------------------------------------------- - - @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + name.hashCode(); - return result; - } - - @Override - public boolean equals( Object obj ) - { - if ( this == obj ) - return true; - if ( obj == null ) - return false; - if ( getClass() != obj.getClass() ) - return false; - ExcelItemGroup other = (ExcelItemGroup) obj; - if ( name != other.name ) - return false; - return true; - } - - // ---------------------------------------------------------------------- - // Getters and setters - // ---------------------------------------------------------------------- - - public int getId() - { - return id; - } - - public String getType() { +public class ExcelItemGroup { + private int id; + + private String name; + + private Set excelItems; + + private String excelTemplateFile; + + private String type; + + private Set organisationAssocitions; + + private List organisationUnitGroups; + + private List dataElementOrders; + + // ---------------------------------------------------------------------- + // Constructors + // ---------------------------------------------------------------------- + + public ExcelItemGroup() { + + } + + // ------------------------------------------------------------------------- + // Internal classes + // ------------------------------------------------------------------------- + + public static class TYPE { + public static final String NORMAL = "NORMAL"; + + public static final String CATEGORY = "CATEGORY"; + + public static final String PERIOD_COLUMN_LISTING = "PERIOD_COLUMN_LISTING"; + + public static final String ORGANIZATION_GROUP_LISTING = "ORGANIZATION_GROUP_LISTING"; + } + + // ------------------------------------------------------------------------- + // hashCode and equals + // ------------------------------------------------------------------------- + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + name.hashCode(); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ExcelItemGroup other = (ExcelItemGroup) obj; + if (name != other.name) + return false; + return true; + } + + // ---------------------------------------------------------------------- + // Getters and setters + // ---------------------------------------------------------------------- + + public int getId() { + return id; + } + + public List getDataElementOrders() { + return dataElementOrders; + } + + public void setDataElementOrders(List dataElementOrders) { + this.dataElementOrders = dataElementOrders; + } + + public String getType() { return type; } @@ -118,30 +127,34 @@ this.type = type; } - public void setId( int id ) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName( String name ) - { - this.name = name; - } - - public String getExcelTemplateFile() - { - return excelTemplateFile; - } - - public void setExcelTemplateFile( String excelTemplateFile ) - { - this.excelTemplateFile = excelTemplateFile; - } + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public List getOrganisationUnitGroups() { + return organisationUnitGroups; + } + + public void setOrganisationUnitGroups( + List organisationUnitGroups) { + this.organisationUnitGroups = organisationUnitGroups; + } + + public void setName(String name) { + this.name = name; + } + + public String getExcelTemplateFile() { + return excelTemplateFile; + } + + public void setExcelTemplateFile(String excelTemplateFile) { + this.excelTemplateFile = excelTemplateFile; + } public Set getExcelItems() { return excelItems; @@ -160,4 +173,28 @@ this.organisationAssocitions = organisationAssocitions; } + // ---------------------------------------------------------------------- + // getType + // ---------------------------------------------------------------------- + + public boolean isCategory() + { + return this.getType().equalsIgnoreCase( TYPE.CATEGORY ); + } + + public boolean isOrganisationUnitGroupListing() + { + return this.getType().equalsIgnoreCase( TYPE.ORGANIZATION_GROUP_LISTING ); + } + + public boolean isPeriodColumnListing() + { + return this.getType().equalsIgnoreCase( TYPE.PERIOD_COLUMN_LISTING ); + } + + public boolean isNormal() + { + return this.getType().equalsIgnoreCase( TYPE.NORMAL ); + } + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemService.java 2009-10-27 06:36:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemService.java 2009-10-29 05:21:01 +0000 @@ -3,40 +3,52 @@ import java.util.Collection; import org.hisp.dhis.organisationunit.OrganisationUnit; - +import org.hisp.dhis.reportexcel.DataElementGroupOrder; public interface ExcelItemService { String ID = ExcelItemService.class.getName(); - + // ---------------------------------------------------------------------------- // Excelitem group services // ---------------------------------------------------------------------------- - + public void addExcelItemGroup(ExcelItemGroup excelItemGroup); - + public void updateExcelItemGroup(ExcelItemGroup excelItemGroup); - + public void deleteExcelItemGroup(int id); - + public Collection getAllExcelItemGroup(); - + public ExcelItemGroup getExcelItemGroup(int id); - public Collection getExcelItemGroupsByOrganisationUnit( OrganisationUnit organisationUnit ); - + public Collection getExcelItemGroupsByOrganisationUnit( + OrganisationUnit organisationUnit); + // ---------------------------------------------------------------------------- // Excelitem services // ---------------------------------------------------------------------------- - + public void addExcelItem(ExcelItem excelItem); - + public void updateExcelItem(ExcelItem excelItem); - + public void deleteExcelItem(int id); - + public Collection getAllExcelItem(); - + public ExcelItem getExcelItem(int id); - + + // -------------------------------------- + // DataElement Order + // -------------------------------------- + + public DataElementGroupOrder getDataElementGroupOrder(Integer id); + + public void updateDataElementGroupOrder( + DataElementGroupOrder dataElementGroupOrder); + + public void deleteDataElementGroupOrder(Integer id); + } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemStore.java 2009-10-27 06:36:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/excelitem/ExcelItemStore.java 2009-10-29 05:21:01 +0000 @@ -3,39 +3,51 @@ import java.util.Collection; import org.hisp.dhis.organisationunit.OrganisationUnit; - +import org.hisp.dhis.reportexcel.DataElementGroupOrder; public interface ExcelItemStore { String ID = ExcelItemStore.class.getName(); - + // ---------------------------------------------------------------------------- // Excelitem group services // ---------------------------------------------------------------------------- - + public void addExcelItemGroup(ExcelItemGroup excelItemGroup); - + public void updateExcelItemGroup(ExcelItemGroup excelItemGroup); - + public void deleteExcelItemGroup(int id); - + public Collection getAllExcelItemGroup(); - + public ExcelItemGroup getExcelItemGroup(int id); - public Collection getExcelItemGroupsByOrganisationUnit( OrganisationUnit organisationUnit ); - + public Collection getExcelItemGroupsByOrganisationUnit( + OrganisationUnit organisationUnit); + // ---------------------------------------------------------------------------- // Excelitem services // ---------------------------------------------------------------------------- - + public void addExcelItem(ExcelItem excelItem); - + public void updateExcelItem(ExcelItem excelItem); - + public void deleteExcelItem(int id); - + public Collection getAllExcelItem(); - + public ExcelItem getExcelItem(int id); + + // -------------------------------------- + // DataElement Order + // -------------------------------------- + + public DataElementGroupOrder getDataElementGroupOrder(Integer id); + + public void updateDataElementGroupOrder( + DataElementGroupOrder dataElementGroupOrder); + + public void deleteDataElementGroupOrder(Integer id); } === modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/DefaultExcelItemService.java' --- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/DefaultExcelItemService.java 2009-10-27 06:36:41 +0000 +++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/DefaultExcelItemService.java 2009-10-29 05:21:01 +0000 @@ -30,6 +30,7 @@ import java.util.Collection; import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.reportexcel.DataElementGroupOrder; import org.springframework.transaction.annotation.Transactional; /** @@ -81,8 +82,9 @@ public Collection getExcelItemGroupsByOrganisationUnit( OrganisationUnit organisationUnit) { - - return excelItemStore.getExcelItemGroupsByOrganisationUnit(organisationUnit); + + return excelItemStore + .getExcelItemGroupsByOrganisationUnit(organisationUnit); } // -------------------------------------- @@ -114,4 +116,21 @@ return excelItemStore.getExcelItem(id); } + // -------------------------------------- + // DataElement Order + // -------------------------------------- + + public DataElementGroupOrder getDataElementGroupOrder(Integer id) { + return excelItemStore.getDataElementGroupOrder(id); + } + + public void updateDataElementGroupOrder( + DataElementGroupOrder dataElementGroupOrder) { + excelItemStore.updateDataElementGroupOrder(dataElementGroupOrder); + } + + public void deleteDataElementGroupOrder(Integer id) { + excelItemStore.deleteDataElementGroupOrder(id); + } + } === modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/hibernate/HibernateExcelItemStore.java' --- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/hibernate/HibernateExcelItemStore.java 2009-10-27 06:36:41 +0000 +++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/hibernate/HibernateExcelItemStore.java 2009-10-29 05:21:01 +0000 @@ -7,7 +7,7 @@ import org.hibernate.SessionFactory; import org.hibernate.criterion.Restrictions; import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.reportexcel.ReportExcel; +import org.hisp.dhis.reportexcel.DataElementGroupOrder; import org.hisp.dhis.reportexcel.excelitem.ExcelItem; import org.hisp.dhis.reportexcel.excelitem.ExcelItemGroup; import org.hisp.dhis.reportexcel.excelitem.ExcelItemStore; @@ -69,7 +69,7 @@ Session session = sessionFactory.getCurrentSession(); - session.delete( getExcelItem(id)); + session.delete(getExcelItem(id)); } @SuppressWarnings("unchecked") @@ -88,20 +88,20 @@ session.saveOrUpdate(excelItem); } - - public ExcelItem getExcelItem(int id){ - + + public ExcelItem getExcelItem(int id) { + Session session = sessionFactory.getCurrentSession(); Criteria criteria = session.createCriteria(ExcelItem.class); criteria.add(Restrictions.eq("id", id)); - return (ExcelItem)criteria.uniqueResult(); + return (ExcelItem) criteria.uniqueResult(); } public void addExcelItemGroup(ExcelItemGroup excelItemGroup) { - + sessionFactory.getCurrentSession().save(excelItemGroup); } @@ -109,12 +109,12 @@ Session session = sessionFactory.getCurrentSession(); - session.delete( getExcelItemGroup(id)); + session.delete(getExcelItemGroup(id)); } @SuppressWarnings("unchecked") public Collection getAllExcelItemGroup() { - + Session session = sessionFactory.getCurrentSession(); Criteria criteria = session.createCriteria(ExcelItemGroup.class); @@ -130,29 +130,46 @@ criteria.add(Restrictions.eq("id", id)); - return (ExcelItemGroup)criteria.uniqueResult(); + return (ExcelItemGroup) criteria.uniqueResult(); } public void updateExcelItemGroup(ExcelItemGroup excelItemGroup) { - + Session session = sessionFactory.getCurrentSession(); session.saveOrUpdate(excelItemGroup); } - - @SuppressWarnings( "unchecked" ) + + @SuppressWarnings("unchecked") public Collection getExcelItemGroupsByOrganisationUnit( OrganisationUnit organisationUnit) { - - Session session = sessionFactory.getCurrentSession(); - - Criteria criteria = session.createCriteria( ReportExcel.class ); - - criteria.createAlias( "organisationAssocitions", "o" ); - - criteria.add( Restrictions.eq( "o.id", organisationUnit.getId() ) ); - - return criteria.list(); + + Session session = sessionFactory.getCurrentSession(); + + Criteria criteria = session.createCriteria(ExcelItemGroup.class); + + criteria.createAlias("organisationAssocitions", "o"); + + criteria.add(Restrictions.eq("o.id", organisationUnit.getId())); + + return criteria.list(); + } + + public DataElementGroupOrder getDataElementGroupOrder(Integer id) { + Session session = sessionFactory.getCurrentSession(); + return (DataElementGroupOrder) session.get(DataElementGroupOrder.class, + id); + } + + public void updateDataElementGroupOrder( + DataElementGroupOrder dataElementGroupOrder) { + Session session = sessionFactory.getCurrentSession(); + session.update(dataElementGroupOrder); + } + + public void deleteDataElementGroupOrder(Integer id) { + Session session = sessionFactory.getCurrentSession(); + session.delete(this.getDataElementGroupOrder(id)); } } === modified file 'dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/excelitem/hibernate/ExcelItemGroup.hbm.xml' --- dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/excelitem/hibernate/ExcelItemGroup.hbm.xml 2009-10-27 06:36:41 +0000 +++ dhis-2/dhis-services/dhis-service-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/excelitem/hibernate/ExcelItemGroup.hbm.xml 2009-10-29 05:21:01 +0000 @@ -3,28 +3,44 @@ "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> - - + + - + - + - + - + - - + + - + column="organisationid" foreign-key="fk_excelitemgroup_organisation" /> + + + + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2009-10-29 03:02:42 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2009-10-29 05:21:01 +0000 @@ -967,7 +967,7 @@ - + + + + + + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2009-10-29 03:02:42 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2009-10-29 05:21:01 +0000 @@ -820,6 +820,20 @@ style/ui.theme.css,style/basic.css + + /main.vm + /dhis-web-excel-reporting/organisationUnitGroupListingReport.vm + /dhis-web-excel-reporting/menu.vm + javascript/commons.js + + + + listReportExcel.action + + +