=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport' === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAttributeAssociation.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAttributeAssociation.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientAttributeAssociation.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,111 @@ +/* + * 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.patientreport; + +import org.hisp.dhis.patient.PatientAttribute; + +/** + * @author Chau Thu Tran + * + * @version $PatientAttribueAssociation.java May 7, 2012 1:47:15 PM$ + */ +public class PatientAttributeAssociation +{ + private Integer id; + + private PatientTabularReport patientTabularReport; + + private PatientAttribute patientAttribute; + + private String key; + + private boolean hidden; + + // ------------------------------------------------------------------------- + // Constructor + // ------------------------------------------------------------------------- + + public PatientAttributeAssociation() + { + } + + // ------------------------------------------------------------------------- + // Getters && Setters + // ------------------------------------------------------------------------- + + public Integer getId() + { + return id; + } + + public void setId( Integer id ) + { + this.id = id; + } + + public PatientTabularReport getPatientTabularReport() + { + return patientTabularReport; + } + + public void setPatientTabularReport( PatientTabularReport patientTabularReport ) + { + this.patientTabularReport = patientTabularReport; + } + + public PatientAttribute getPatientAttribute() + { + return patientAttribute; + } + + public void setPatientAttribute( PatientAttribute patientAttribute ) + { + this.patientAttribute = patientAttribute; + } + + public String getKey() + { + return key; + } + + public void setKey( String key ) + { + this.key = key; + } + + public boolean isHidden() + { + return hidden; + } + + public void setHidden( boolean hidden ) + { + this.hidden = hidden; + } + +} === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientDataElementAssociation.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientDataElementAssociation.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientDataElementAssociation.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,111 @@ +/* + * 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.patientreport; + +import org.hisp.dhis.dataelement.DataElement; + +/** + * @author Chau Thu Tran + * + * @version $PatientDataElementAssociation.java May 7, 2012 1:47:16 PM$ + */ +public class PatientDataElementAssociation +{ + private Integer id; + + private PatientTabularReport patientTabularReport; + + private DataElement dataElement; + + private String key; + + private boolean hidden; + + // ------------------------------------------------------------------------- + // Constructor + // ------------------------------------------------------------------------- + + public PatientDataElementAssociation() + { + } + + // ------------------------------------------------------------------------- + // Getters && Setters + // ------------------------------------------------------------------------- + + public Integer getId() + { + return id; + } + + public void setId( Integer id ) + { + this.id = id; + } + + public PatientTabularReport getPatientTabularReport() + { + return patientTabularReport; + } + + public void setPatientTabularReport( PatientTabularReport patientTabularReport ) + { + this.patientTabularReport = patientTabularReport; + } + + public DataElement getDataElement() + { + return dataElement; + } + + public void setDataElement( DataElement dataElement ) + { + this.dataElement = dataElement; + } + + public String getKey() + { + return key; + } + + public void setKey( String key ) + { + this.key = key; + } + + public boolean isHidden() + { + return hidden; + } + + public void setHidden( boolean hidden ) + { + this.hidden = hidden; + } + +} === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientFixedAttribueAssociation.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientFixedAttribueAssociation.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientFixedAttribueAssociation.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,110 @@ +/* + * 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.patientreport; + + +/** + * @author Chau Thu Tran + * + * @version $PatientFixedAttribueAssociation.java May 7, 2012 1:47:15 PM$ + */ +public class PatientFixedAttribueAssociation +{ + private Integer id; + + private PatientTabularReport patientTabularReport; + + private String attributeName; + + private String key; + + private boolean hidden; + + // ------------------------------------------------------------------------- + // Constructor + // ------------------------------------------------------------------------- + + public PatientFixedAttribueAssociation() + { + } + + // ------------------------------------------------------------------------- + // Getters && Setters + // ------------------------------------------------------------------------- + + public Integer getId() + { + return id; + } + + public void setId( Integer id ) + { + this.id = id; + } + + public PatientTabularReport getPatientTabularReport() + { + return patientTabularReport; + } + + public void setPatientTabularReport( PatientTabularReport patientTabularReport ) + { + this.patientTabularReport = patientTabularReport; + } + + public String getAttributeName() + { + return attributeName; + } + + public void setAttributeName( String attributeName ) + { + this.attributeName = attributeName; + } + + public String getKey() + { + return key; + } + + public void setKey( String key ) + { + this.key = key; + } + + public boolean isHidden() + { + return hidden; + } + + public void setHidden( boolean hidden ) + { + this.hidden = hidden; + } + +} === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientIdentifierTypeAssociation.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientIdentifierTypeAssociation.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientIdentifierTypeAssociation.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,111 @@ +/* + * 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.patientreport; + +import org.hisp.dhis.patient.PatientIdentifierType; + +/** + * @author Chau Thu Tran + * + * @version $PatientIdentifierTypeAssociation.java May 7, 2012 1:47:17 PM$ + */ +public class PatientIdentifierTypeAssociation +{ + private Integer id; + + private PatientTabularReport patientTabularReport; + + private PatientIdentifierType patientIdentifierType; + + private String key; + + private boolean hidden; + + // ------------------------------------------------------------------------- + // Constructor + // ------------------------------------------------------------------------- + + public PatientIdentifierTypeAssociation() + { + } + + // ------------------------------------------------------------------------- + // Getters && Setters + // ------------------------------------------------------------------------- + + public Integer getId() + { + return id; + } + + public void setId( Integer id ) + { + this.id = id; + } + + public PatientTabularReport getPatientTabularReport() + { + return patientTabularReport; + } + + public void setPatientTabularReport( PatientTabularReport patientTabularReport ) + { + this.patientTabularReport = patientTabularReport; + } + + public PatientIdentifierType getPatientIdentifierType() + { + return patientIdentifierType; + } + + public void setPatientIdentifierType( PatientIdentifierType patientIdentifierType ) + { + this.patientIdentifierType = patientIdentifierType; + } + + public String getKey() + { + return key; + } + + public void setKey( String key ) + { + this.key = key; + } + + public boolean isHidden() + { + return hidden; + } + + public void setHidden( boolean hidden ) + { + this.hidden = hidden; + } + +} === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReport.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,221 @@ +/* + * 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.patientreport; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.hisp.dhis.common.BaseIdentifiableObject; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.program.ProgramStage; +import org.hisp.dhis.user.User; + +/** + * @author Chau Thu Tran + * + * @version $PatientTabularReport.java May 7, 2012 12:41:41 PM$ + */ +public class PatientTabularReport + extends BaseIdentifiableObject +{ + private static final long serialVersionUID = -2880334669266185058L; + + public static String PREFIX_META_DATA = "meta"; + + public static String PREFIX_IDENTIFIER_TYPE = "iden"; + + public static String PREFIX_PATIENT_ATTRIBUTE = "attr"; + + public static String PREFIX_DATA_ELEMENT = "de"; + + public static String VALUE_TYPE_OPTION_SET = "optionSet"; + + + private Date startDate; + + private Date endDate; + + private ProgramStage programStage; + + private List identifiers = new ArrayList(); + + private List attributes = new ArrayList(); + + private List fixedAttributes = new ArrayList(); + + private List dataElements = new ArrayList(); + + private OrganisationUnit organisationUnit; + + private int level; + + private boolean sortedOrgunitAsc; + + private String facilityLB; + + private User user; + + // ------------------------------------------------------------------------- + // Constructors + // ------------------------------------------------------------------------- + + public PatientTabularReport() + { + } + + public PatientTabularReport( String name ) + { + this.name = name; + } + + // ------------------------------------------------------------------------- + // Getters && Setters + // ------------------------------------------------------------------------- + + public Date getStartDate() + { + return startDate; + } + + public void setStartDate( Date startDate ) + { + this.startDate = startDate; + } + + public Date getEndDate() + { + return endDate; + } + + public void setEndDate( Date endDate ) + { + this.endDate = endDate; + } + + public ProgramStage getProgramStage() + { + return programStage; + } + + public void setProgramStage( ProgramStage programStage ) + { + this.programStage = programStage; + } + + public List getIdentifiers() + { + return identifiers; + } + + public void setIdentifiers( List identifiers ) + { + this.identifiers = identifiers; + } + + public List getAttributes() + { + return attributes; + } + + public void setAttributes( List attributes ) + { + this.attributes = attributes; + } + + public List getFixedAttributes() + { + return fixedAttributes; + } + + public void setFixedAttributes( List fixedAttributes ) + { + this.fixedAttributes = fixedAttributes; + } + + public List getDataElements() + { + return dataElements; + } + + public void setDataElements( List dataElements ) + { + this.dataElements = dataElements; + } + + public OrganisationUnit getOrganisationUnit() + { + return organisationUnit; + } + + public void setOrganisationUnit( OrganisationUnit organisationUnit ) + { + this.organisationUnit = organisationUnit; + } + + public int getLevel() + { + return level; + } + + public void setLevel( int level ) + { + this.level = level; + } + + public boolean isSortedOrgunitAsc() + { + return sortedOrgunitAsc; + } + + public void setSortedOrgunitAsc( boolean sortedOrgunitAsc ) + { + this.sortedOrgunitAsc = sortedOrgunitAsc; + } + + public String getFacilityLB() + { + return facilityLB; + } + + public void setFacilityLB( String facilityLB ) + { + this.facilityLB = facilityLB; + } + + public User getUser() + { + return user; + } + + public void setUser( User user ) + { + this.user = user; + } + +} === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportService.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportService.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,50 @@ +/* + * 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.patientreport; + +import java.util.Collection; + +import org.hisp.dhis.user.User; + +/** + * @author Chau Thu Tran + * + * @version $PatientTabularReportService.java May 7, 2012 1:01:39 PM$ + */ +public interface PatientTabularReportService +{ + void saveOrUpdate( PatientTabularReport patientTabularReport ); + + PatientTabularReport getPatientTabularReport( int id ); + + void deletePatientTabularReport( PatientTabularReport patientTabularReport ); + + Collection getAllCharts(); + + Collection getPatientTabularReports( User user ); +} === added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportStore.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientreport/PatientTabularReportStore.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,43 @@ +/* + * 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.patientreport; + +import java.util.Collection; + +import org.hisp.dhis.common.GenericIdentifiableObjectStore; +import org.hisp.dhis.user.User; + +/** + * @author Chau Thu Tran + * + * @version $PatientTabularReportStore.java May 7, 2012 1:01:55 PM$ + */ +public interface PatientTabularReportStore extends GenericIdentifiableObjectStore +{ + Collection get( User user ); +} === added directory 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport' === added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/DefaultPatientTabularReportService.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/DefaultPatientTabularReportService.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/DefaultPatientTabularReportService.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,89 @@ +/* + * 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.patientreport; + +import java.util.Collection; + +import org.hisp.dhis.user.User; +import org.springframework.transaction.annotation.Transactional; + +/** + * @author Chau Thu Tran + * + * @version $DefaultPatientTabularReportService.java May 7, 2012 1:12:31 PM$ + */ +@Transactional +public class DefaultPatientTabularReportService + implements PatientTabularReportService +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private PatientTabularReportStore tabularReportStore; + + public void setTabularReportStore( PatientTabularReportStore tabularReportStore ) + { + this.tabularReportStore = tabularReportStore; + } + + // ------------------------------------------------------------------------- + // Implementation methods + // ------------------------------------------------------------------------- + + @Override + public void deletePatientTabularReport( PatientTabularReport patientTabularReport ) + { + tabularReportStore.delete( patientTabularReport ); + } + + @Override + public Collection getAllCharts() + { + return tabularReportStore.getAll(); + } + + @Override + public PatientTabularReport getPatientTabularReport( int id ) + { + return tabularReportStore.get( id ); + } + + @Override + public Collection getPatientTabularReports( User user ) + { + return tabularReportStore.get( user ); + } + + @Override + public void saveOrUpdate( PatientTabularReport patientTabularReport ) + { + tabularReportStore.save( patientTabularReport ); + } + +} === added directory 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/hibernate' === added file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/hibernate/HibernatePatientTabularReportStore.java' --- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/hibernate/HibernatePatientTabularReportStore.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patientreport/hibernate/HibernatePatientTabularReportStore.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,55 @@ +/* + * 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.patientreport.hibernate; + +import java.util.Collection; + +import org.hibernate.criterion.Restrictions; +import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore; +import org.hisp.dhis.patientreport.PatientTabularReport; +import org.hisp.dhis.patientreport.PatientTabularReportStore; +import org.hisp.dhis.user.User; + +/** + * @author Chau Thu Tran + * + * @version $HibernatePatientTabularReportStore.java May 7, 2012 1:10:37 PM$ + */ +public class HibernatePatientTabularReportStore + extends HibernateIdentifiableObjectStore + implements PatientTabularReportStore +{ + + @SuppressWarnings( "unchecked" ) + @Override + public Collection get( User user ) + { + return getCriteria( Restrictions.eq( "user", user ) ).list(); + } + +} === modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-04-11 06:25:02 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/META-INF/dhis/beans.xml 2012-05-09 08:30:28 +0000 @@ -95,11 +95,11 @@ - - - - + + + + @@ -137,6 +137,12 @@ + + + + + - - + class="org.hisp.dhis.program.DefaultProgramAttributeOptionService"> + + + + + + + + + + + + + + + + + + + + + + + + + === added file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientDataElementAssociation.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientDataElementAssociation.hbm.xml 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientDataElementAssociation.hbm.xml 2012-05-09 08:30:28 +0000 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + === added file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientFixedAttribueAssociation.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientFixedAttribueAssociation.hbm.xml 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientFixedAttribueAssociation.hbm.xml 2012-05-09 08:30:28 +0000 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + === added file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientIdentifierTypeAssociation.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientIdentifierTypeAssociation.hbm.xml 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientIdentifierTypeAssociation.hbm.xml 2012-05-09 08:30:28 +0000 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + === added file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml' --- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/patientreport/hibernate/PatientTabularReport.hbm.xml 2012-05-09 08:30:28 +0000 @@ -0,0 +1,63 @@ + +] + > + + + + + + + + + &identifiableProperties; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/DeleteTabularReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/DeleteTabularReportAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/DeleteTabularReportAction.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,80 @@ +/* + * 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 org.hisp.dhis.patientreport.PatientTabularReport; +import org.hisp.dhis.patientreport.PatientTabularReportService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * + * @version $DeleteTabularReportAction.java May 7, 2012 4:11:43 PM$ + */ +public class DeleteTabularReportAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private PatientTabularReportService tabularReportService; + + public void setTabularReportService( PatientTabularReportService tabularReportService ) + { + this.tabularReportService = tabularReportService; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + PatientTabularReport tabularReport = tabularReportService.getPatientTabularReport( id ); + + tabularReportService.deletePatientTabularReport( tabularReport ); + + return SUCCESS; + } + +} === modified 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 2012-05-02 08:15:45 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java 2012-05-09 08:30:28 +0000 @@ -27,6 +27,12 @@ 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_IDENTIFIER_TYPE; +import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_META_DATA; +import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_PATIENT_ATTRIBUTE; +import static org.hisp.dhis.patientreport.PatientTabularReport.VALUE_TYPE_OPTION_SET; + import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -63,16 +69,6 @@ public class GenerateTabularReportAction extends ActionPagingSupport { - private String PREFIX_META_DATA = "meta"; - - private String PREFIX_IDENTIFIER_TYPE = "iden"; - - private String PREFIX_PATIENT_ATTRIBUTE = "attr"; - - private String PREFIX_DATA_ELEMENT = "de"; - - private String VALUE_TYPE_OPTION_SET = "optionSet"; - // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportAction.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,85 @@ +/* + * 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 org.hisp.dhis.patientreport.PatientTabularReport; +import org.hisp.dhis.patientreport.PatientTabularReportService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * + * @version $DeleteTabularReportAction.java May 7, 2012 4:11:43 PM$ + */ +public class GetTabularReportAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private PatientTabularReportService tabularReportService; + + public void setTabularReportService( PatientTabularReportService tabularReportService ) + { + this.tabularReportService = tabularReportService; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + private PatientTabularReport tabularReport; + + public PatientTabularReport getTabularReport() + { + return tabularReport; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + tabularReport = tabularReportService.getPatientTabularReport( id ); + + return SUCCESS; + } + +} === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportsAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GetTabularReportsAction.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,88 @@ +/* + * 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 java.util.Collection; +import java.util.HashSet; + +import org.hisp.dhis.patientreport.PatientTabularReport; +import org.hisp.dhis.patientreport.PatientTabularReportService; +import org.hisp.dhis.user.CurrentUserService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * + * @version $GetTabularReportsAction.java May 7, 2012 4:08:13 PM$ + */ +public class GetTabularReportsAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private PatientTabularReportService tabularReportService; + + public void setTabularReportService( PatientTabularReportService tabularReportService ) + { + this.tabularReportService = tabularReportService; + } + + private CurrentUserService currentUserService; + + public void setCurrentUserService( CurrentUserService currentUserService ) + { + this.currentUserService = currentUserService; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private Collection tabularReports = new HashSet(); + + public Collection getTabularReports() + { + return tabularReports; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + tabularReports = tabularReportService.getPatientTabularReports( currentUserService.getCurrentUser() ); + + return SUCCESS; + } +} === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/SaveTabularReportAction.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,340 @@ +/* + * 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_IDENTIFIER_TYPE; +import static org.hisp.dhis.patientreport.PatientTabularReport.PREFIX_PATIENT_ATTRIBUTE; + +import java.util.ArrayList; +import java.util.List; + +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.patient.PatientAttribute; +import org.hisp.dhis.patient.PatientAttributeService; +import org.hisp.dhis.patient.PatientIdentifierType; +import org.hisp.dhis.patient.PatientIdentifierTypeService; +import org.hisp.dhis.patientreport.PatientAttributeAssociation; +import org.hisp.dhis.patientreport.PatientDataElementAssociation; +import org.hisp.dhis.patientreport.PatientFixedAttribueAssociation; +import org.hisp.dhis.patientreport.PatientIdentifierTypeAssociation; +import org.hisp.dhis.patientreport.PatientTabularReport; +import org.hisp.dhis.patientreport.PatientTabularReportService; +import org.hisp.dhis.program.ProgramStage; +import org.hisp.dhis.program.ProgramStageService; +import org.hisp.dhis.user.CurrentUserService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * + * @version $SaveTabularReportAction.java May 7, 2012 3:13:11 PM$ + */ +public class SaveTabularReportAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private PatientTabularReportService tabularReportService; + + public void setTabularReportService( PatientTabularReportService tabularReportService ) + { + this.tabularReportService = tabularReportService; + } + + 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 PatientIdentifierTypeService identifierTypeService; + + public void setIdentifierTypeService( PatientIdentifierTypeService identifierTypeService ) + { + this.identifierTypeService = identifierTypeService; + } + + private PatientAttributeService patientAttributeService; + + public void setPatientAttributeService( PatientAttributeService patientAttributeService ) + { + this.patientAttributeService = patientAttributeService; + } + + private CurrentUserService currentUserService; + + public void setCurrentUserService( CurrentUserService currentUserService ) + { + this.currentUserService = currentUserService; + } + + private I18nFormat format; + + public void setFormat( I18nFormat format ) + { + this.format = format; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private String name; + + private String startDate; + + private String endDate; + + private Integer programStageId; + + private List fixedAttributes = new ArrayList(); + + private List searchingValues = new ArrayList(); + + private Integer orgunitId; + + private boolean orderByOrgunitAsc; + + private Integer level; + + private String facilityLB; + + // ------------------------------------------------------------------------- + // Setters + // ------------------------------------------------------------------------- + + public void setName( String name ) + { + this.name = name; + } + + public void setLevel( Integer level ) + { + this.level = level; + } + + public void setSearchingValues( List searchingValues ) + { + this.searchingValues = searchingValues; + } + + public void setFacilityLB( String facilityLB ) + { + this.facilityLB = facilityLB; + } + + public void setOrderByOrgunitAsc( boolean orderByOrgunitAsc ) + { + this.orderByOrgunitAsc = orderByOrgunitAsc; + } + + public void setFixedAttributes( List fixedAttributes ) + { + this.fixedAttributes = fixedAttributes; + } + + public void setEndDate( String endDate ) + { + this.endDate = endDate; + } + + public void setStartDate( String startDate ) + { + this.startDate = startDate; + } + + public void setOrgunitId( Integer orgunitId ) + { + this.orgunitId = orgunitId; + } + + public void setProgramStageId( Integer programStageId ) + { + this.programStageId = programStageId; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + OrganisationUnit orgunit = organisationUnitService.getOrganisationUnit( orgunitId ); + ProgramStage programStage = programStageService.getProgramStage( programStageId ); + + // --------------------------------------------------------------------- + // Get fixed-attributes + // --------------------------------------------------------------------- + + PatientTabularReport tabularReport = new PatientTabularReport( name ); + tabularReport.setStartDate( format.parseDate( startDate ) ); + tabularReport.setEndDate( format.parseDate( endDate ) ); + tabularReport.setProgramStage( programStage ); + tabularReport.setOrganisationUnit( orgunit ); + tabularReport.setLevel( level ); + tabularReport.setFacilityLB( facilityLB ); + tabularReport.setSortedOrgunitAsc( orderByOrgunitAsc ); + tabularReport.setUser( currentUserService.getCurrentUser() ); + + // --------------------------------------------------------------------- + // Get fixed-attributes + // --------------------------------------------------------------------- + + List fixedAttrAssociations = new ArrayList(); + + for ( String fixedAttribute : fixedAttributes ) + { + PatientFixedAttribueAssociation association = new PatientFixedAttribueAssociation(); + association.setAttributeName( fixedAttribute ); + association.setPatientTabularReport( tabularReport ); + fixedAttrAssociations.add( association ); + } + + // --------------------------------------------------------------------- + // Get searching-keys + // --------------------------------------------------------------------- + + List identifiers = new ArrayList(); + + List attributes = new ArrayList(); + + List dataElements = new ArrayList(); + + int index = 0; + for ( String searchingValue : searchingValues ) + { + String[] infor = searchingValue.split( "_" ); + String objectType = infor[0]; + int objectId = Integer.parseInt( infor[1] ); + + if ( objectType.equals( PREFIX_IDENTIFIER_TYPE ) ) + { + PatientIdentifierTypeAssociation association = new PatientIdentifierTypeAssociation(); + PatientIdentifierType identifierType = identifierTypeService.getPatientIdentifierType( objectId ); + + association.setPatientIdentifierType( identifierType ); + association.setPatientTabularReport( tabularReport ); + association.setHidden( Boolean.parseBoolean( infor[2] ) ); + + if ( infor.length == 4 ) + { + association.setKey( infor[3].trim() ); + } + + identifiers.add( association ); + + index++; + } + else if ( objectType.equals( PREFIX_PATIENT_ATTRIBUTE ) ) + { + PatientAttributeAssociation association = new PatientAttributeAssociation(); + PatientAttribute attribute = patientAttributeService.getPatientAttribute( objectId ); + + association.setPatientAttribute( attribute ); + association.setPatientTabularReport( tabularReport ); + association.setHidden( Boolean.parseBoolean( infor[2] ) ); + + if ( infor.length == 4 ) + { + association.setKey( infor[3].trim() ); + } + + attributes.add( association ); + + index++; + } + else if ( objectType.equals( PREFIX_DATA_ELEMENT ) ) + { + PatientDataElementAssociation association = new PatientDataElementAssociation(); + DataElement dataElement = dataElementService.getDataElement( objectId ); + + association.setDataElement( dataElement ); + association.setPatientTabularReport( tabularReport ); + association.setHidden( Boolean.parseBoolean( infor[2] ) ); + + if ( infor.length == 4 ) + { + association.setKey( infor[3].trim() ); + } + + dataElements.add( association ); + + index++; + } + + } + + if ( fixedAttrAssociations.size() > 0 ) + { + tabularReport.setFixedAttributes( fixedAttrAssociations ); + } + else if ( identifiers.size() > 0 ) + { + tabularReport.setIdentifiers( identifiers ); + } + else if ( attributes.size() > 0 ) + { + tabularReport.setAttributes( attributes ); + } + + tabularReport.setFixedAttributes( fixedAttrAssociations ); + tabularReport.setIdentifiers( identifiers ); + tabularReport.setAttributes( attributes ); + tabularReport.setDataElements( dataElements ); + + tabularReportService.saveOrUpdate( tabularReport ); + + return SUCCESS; + } + +} === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/UpdateTabularReportNameAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/UpdateTabularReportNameAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/UpdateTabularReportNameAction.java 2012-05-09 08:30:28 +0000 @@ -0,0 +1,89 @@ +/* + * 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 org.hisp.dhis.patientreport.PatientTabularReport; +import org.hisp.dhis.patientreport.PatientTabularReportService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * + * @version $DeleteTabularReportAction.java May 7, 2012 4:11:43 PM$ + */ +public class UpdateTabularReportNameAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private PatientTabularReportService tabularReportService; + + public void setTabularReportService( PatientTabularReportService tabularReportService ) + { + this.tabularReportService = tabularReportService; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + private String name; + + public void setName( String name ) + { + this.name = name; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + PatientTabularReport tabularReport = tabularReportService.getPatientTabularReport( id ); + + tabularReport.setName( name ); + + tabularReportService.saveOrUpdate( tabularReport ); + + return SUCCESS; + } + +} === 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 2012-04-20 06:58:46 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-05-09 08:30:28 +0000 @@ -249,89 +249,6 @@ ref="org.hisp.dhis.dataelement.DataElementCategoryService" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-04-28 11:26:03 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-05-09 08:30:28 +0000 @@ -334,4 +334,5 @@ favorites = Favorites manage_favorites = Manage favorites update = Update -et_no_programs = Please select an program. \ No newline at end of file +et_no_programs = Please select an program. +last_updated = Last updated \ No newline at end of file === 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 2012-04-20 06:51:37 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2012-05-09 08:30:28 +0000 @@ -265,77 +265,6 @@ /dhis-web-caseentry/records.vm - - - /main.vm - /dhis-web-caseentry/tabularReportSelect.vm - /dhis-web-caseentry/reportsMenu.vm - ../dhis-web-commons/ouwt/ouwt.js,javascript/tabularReport.js,javascript/commons.js - style/report.css - F_GENERATE_BENEFICIARY_TABULAR_REPORT - - - - - /dhis-web-caseentry/jsonminOrganisationUnitChildren.vm - - - - - /dhis-web-caseentry/jsonTabularInitialize.vm - - - - - /dhis-web-commons/ajax/jsonPrograms.vm - - - - - /dhis-web-caseentry/jsonIdentifierTypes.vm - - - - /dhis-web-caseentry/responseProgramStages.vm - - - - /dhis-web-commons/ajax/jsonPatientAttributes.vm - - - - /dhis-web-caseentry/responseDataElements.vm - - - - /dhis-web-caseentry/responseTabularParams.vm - - - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - /dhis-web-commons/ajax/jsonResponseInput.vm - - - - /dhis-web-caseentry/jsonTabularReport.vm - - - F_GENERATE_BENEFICIARY_TABULAR_REPORT - - @@ -716,5 +645,108 @@ F_RELATIONSHIP_ADD + + + + + /main.vm + /dhis-web-caseentry/tabularReportSelect.vm + /dhis-web-caseentry/reportsMenu.vm + ../dhis-web-commons/ouwt/ouwt.js,javascript/tabularReport.js,javascript/commons.js + style/report.css + F_GENERATE_BENEFICIARY_TABULAR_REPORT + + + + + /dhis-web-caseentry/jsonminOrganisationUnitChildren.vm + + + + + /dhis-web-caseentry/jsonTabularInitialize.vm + + + + + /dhis-web-commons/ajax/jsonPrograms.vm + + + + + /dhis-web-caseentry/jsonIdentifierTypes.vm + + + + /dhis-web-caseentry/responseProgramStages.vm + + + + /dhis-web-commons/ajax/jsonPatientAttributes.vm + + + + /dhis-web-caseentry/responseDataElements.vm + + + + /dhis-web-caseentry/responseTabularParams.vm + + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + /dhis-web-commons/ajax/jsonResponseInput.vm + + + + /dhis-web-caseentry/jsonTabularReportResult.vm + + + F_GENERATE_BENEFICIARY_TABULAR_REPORT + + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + + + + /dhis-web-caseentry/jsonTabularReportList.vm + + + + + /dhis-web-caseentry/jsonTabularReport.vm + + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-05-07 04:34:16 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-05-09 08:30:28 +0000 @@ -37,6 +37,11 @@ dataelements_get: 'loadDataElements.action', organisationunitchildren_get: 'getOrganisationUnitChildren.action', generatetabularreport_get: 'generateTabularReport.action', + favorite_getall: 'getTabularReports.action', + favorite_get: 'getTabularReport.action', + favorite_rename: 'updateTabularReportName.action', + favorite_save: 'saveTabularReport.action', + favorite_delete: 'deleteTabularReport.action', redirect: 'index.action' }, params: { @@ -104,7 +109,9 @@ west_maxheight_accordion_organisationunit: 225, center_tbar_height: 31, east_gridcolumn_height: 30, - form_label_width: 90 + form_label_width: 90, + grid_favorite_width: 420, + grid_favorite_height: 250 } }; @@ -144,7 +151,10 @@ toolbar: { menuitem: {} }, - statusbar: {} + statusbar: {}, + favorite: { + rename: {} + } }; TR.util = { @@ -412,11 +422,169 @@ Ext.Array.each(fixedAttributes, function(item) { if( item.value ) { - p.fixedAttributes.push( item.paramName ); + p.push( item.paramName ); } }); return p; }, + crud: { + favorite: { + create: function(fn, isupdate) { + TR.util.mask.showMask(TR.cmp.favorite.window, TR.i18n.saving + '...'); + + var p = TR.state.getParams(); + p.name = TR.cmp.favorite.name.getValue(); + + if (isupdate) { + p.uid = TR.store.favorite.getAt(TR.store.favorite.findExact('name', p.name)).data.id; + } + + Ext.Ajax.request({ + url: TR.conf.finals.ajax.path_root + TR.conf.finals.ajax.favorite_save, + method: 'POST', + params: p, + success: function() { + TR.store.favorite.load({callback: function() { + TR.util.mask.hideMask(); + if (fn) { + fn(); + } + }}); + } + }); + }, + update: function(fn) { + TR.util.crud.favorite.create(fn, true); + }, + del: function(fn) { + TR.util.mask.showMask(TR.cmp.favorite.window, TR.i18n.deleting + '...'); + var baseurl = TR.conf.finals.ajax.path_root + TR.conf.finals.ajax.favorite_delete, + selection = TR.cmp.favorite.grid.getSelectionModel().getSelection(); + Ext.Array.each(selection, function(item) { + baseurl = Ext.String.urlAppend(baseurl, 'uids=' + item.data.id); + }); + Ext.Ajax.request({ + url: baseurl, + method: 'POST', + success: function() { + TR.store.favorite.load({callback: function() { + TR.util.mask.hideMask(); + if (fn) { + fn(); + } + }}); + } + }); + }, + run: function(id) { + Ext.Ajax.request({ + url: TR.conf.finals.ajax.path_root + TR.conf.finals.ajax.favorite_get + '?id=' + id, + scope: this, + success: function(r) { + var f = Ext.JSON.decode(r.responseText); + + Ext.getCmp('programCombobox').setValue( f.programId ); + Ext.getCmp('programStageCombobox').setValue( f.programStageId ); + Ext.getCmp('startDate').setValue( f.startDate ); + Ext.getCmp('endDate').setValue( f.endDate ); + Ext.getCmp('facilityLBCombobox').setValue( f.facilityLB ); + Ext.getCmp('levelCombobox').setValue( f.level ); + TR.state.orgunitId = f.organisationUnitId; + + TR.cmp.params.identifierType.objects = []; + TR.cmp.params.patientAttribute.objects = []; + TR.cmp.params.fixedAttributes.objects = []; + TR.cmp.params.dataelement.objects = []; + + // IDENTIFIER TYPE + TR.store.identifierType.selected.removeAll(); + if (f.identifiers && f.anonymous == "false" ) { + for (var i = 0; i < f.identifiers.length; i++) { + TR.cmp.params.identifierType.objects.push({id: f.identifiers[i].id, name: TR.util.string.getEncodedString(f.identifiers[i].name)}); + } + TR.store.identifierType.selected.add(TR.cmp.params.identifierType.objects); + + var storeIdentifierType = TR.store.identifierType.available; + storeIdentifierType.parent = f.programId; + if (TR.util.store.containsParent(storeIdentifierType)) { + TR.util.store.loadFromStorage(storeIdentifierType); + TR.util.multiselect.filterAvailable(TR.cmp.params.identifierType.available, TR.cmp.params.identifierType.selected); + } + else { + storeIdentifierType.load({params: {programId: f.programId}}); + } + } + + // PATIENT ATTRIBUTE + TR.store.patientAttribute.selected.removeAll(); + if (f.attributes && f.anonymous == "false") { + for (var i = 0; i < f.attributes.length; i++) { + TR.cmp.params.patientAttribute.objects.push({id: f.attributes[i].id, name: TR.util.string.getEncodedString(f.attributes[i].name)}); + } + TR.store.patientAttribute.selected.add(TR.cmp.params.patientAttribute.objects); + + var storePatientAttribute = TR.store.patientAttribute.available; + storePatientAttribute.parent = f.programId; + if (TR.util.store.containsParent(storePatientAttribute)) { + TR.util.store.loadFromStorage(storePatientAttribute); + TR.util.multiselect.filterAvailable(TR.cmp.params.patientAttribute.available, TR.cmp.params.patientAttribute.selected); + } + else { + storePatientAttribute.load({params: {programId: f.programId}}); + } + } + + // FIXED ATTRIBUTES + TR.util.setEnabledFixedAttr(); + if (f.fixedAttributes && f.anonymous == "false") { + var fixedAttributes = TR.cmp.params.fixedAttributes.checkbox; + Ext.Array.each(fixedAttributes, function(item) { + for (var i = 0; i < f.fixedAttributes.length; i++) { + var flag = false; + if( item.paramName == f.fixedAttributes[i].name ) + { + item.setValue( true ); + flag = true; + break; + } + } + if( !flag ){ + item.setValue( false ); + } + }); + } + + // PROGRAM-STAGE + var storeProgramStage = TR.store.programStage; + storeProgramStage.parent = f.programStageId; + storeProgramStage.load({params: {programId: f.programId}}); + Ext.getCmp('programStageCombobox').setValue( f.programStageId ); + + // DATAELEMENT + TR.store.dataelement.selected.removeAll(); + if (f.dataelements) { + for (var i = 0; i < f.dataelements.length; i++) { + TR.cmp.params.dataelement.objects.push({id: f.dataelements[i].id, name: TR.util.string.getEncodedString(f.dataelements[i].name)}); + } + TR.store.dataelement.selected.add(TR.cmp.params.dataelement.objects); + + var store = TR.store.dataelement.available; + store.parent = f.programStageId; + if (TR.util.store.containsParent(store)) { + TR.util.store.loadFromStorage(store); + TR.util.multiselect.filterAvailable(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected); + } + else { + store.load({params: {programStageId: f.programStageId}}); + } + } + + TR.exe.execute(); + } + }); + } + } + } }; TR.store = { @@ -467,7 +635,7 @@ load: function(s) { this.isloaded = true; TR.util.store.addToStorage(s); - TR.util.multiselect.filterAvailable(TR.cmp.params.identifierType.available, TR.cmp.params.identifierType.selected); + TR.util.multiselect.filterAvailable(TR.cmp.params.patientAttribute.available, TR.cmp.params.patientAttribute.selected); } } }), @@ -510,12 +678,12 @@ isloaded: false, storage: {}, listeners: { - load: function(s) { + load: function(s) { this.isloaded = true; TR.util.store.addToStorage(s); TR.util.multiselect.filterAvailable(TR.cmp.params.dataelement.available, TR.cmp.params.dataelement.selected); } - } + } }), selected: Ext.create('Ext.data.Store', { fields: ['id', 'name'], @@ -539,7 +707,38 @@ }, storage: {} }); - } + }, + favorite: Ext.create('Ext.data.Store', { + fields: ['id', 'name', 'lastUpdated'], + proxy: { + type: 'ajax', + url: TR.conf.finals.ajax.path_root + TR.conf.finals.ajax.favorite_getall, + reader: { + type: 'json', + root: 'tabularReports' + } + }, + isloaded: false, + sorting: { + field: 'name', + direction: 'ASC' + }, + sortStore: function() { + this.sort(this.sorting.field, this.sorting.direction); + }, + listeners: { + load: function(s) { + s.isloaded = !s.isloaded ? true : false; + + s.sortStore(); + s.each(function(r) { + r.data.lastUpdated = r.data.lastUpdated.substr(0,16); + r.data.icon = ''; + r.commit(); + }); + } + } + }) } TR.state = { @@ -547,6 +746,7 @@ total: 1, orderByOrgunitAsc: true, orderByExecutionDateByAsc: true, + orgunitId: 0, generateReport: function( type ) { // Validation if( !this.validation.objects() ) @@ -608,8 +808,9 @@ p.endDate = TR.cmp.settings.endDate.rawValue; p.facilityLB = TR.cmp.settings.facilityLB.getValue(); p.level = TR.cmp.settings.level.getValue(); + // organisation unit - p.orgunitId = TR.cmp.params.organisationunit.treepanel.getSelectionModel().getSelection()[0].data.id + p.orgunitId = TR.state.orgunitId; p.orderByOrgunitAsc = this.orderByOrgunitAsc; p.orderByExecutionDateByAsc= this.orderByExecutionDateByAsc; @@ -618,11 +819,6 @@ // Get fixed attributes p.fixedAttributes = TR.util.getSelectedFixedAttr(); - /*var fixedAttributes = TR.cmp.params.fixedAttributes.checkbox; - Ext.Array.each(fixedAttributes, function(item) { - if( item.value ) - p.fixedAttributes.push( item.paramName ); - });*/ // Get searching values p.searchingValues = []; @@ -676,7 +872,7 @@ p += "&endDate=" + TR.cmp.settings.endDate.rawValue; p += "&facilityLB=" + TR.cmp.settings.facilityLB.getValue(); p += "&level=" + TR.cmp.settings.level.getValue(); - p += "&orgunitId=" + TR.cmp.params.organisationunit.treepanel.getSelectionModel().getSelection()[0].data.id + p += "&orgunitId=" + TR.state.orgunitId; p += "&orderByOrgunitAsc=" + 'true'; p += "&orderByExecutionDateByAsc=" +'true'; p += "&programStageId=" + TR.cmp.params.programStage.getValue(); @@ -754,13 +950,6 @@ return true; }, - - render: function() { - if (!TR.c.isrendered) { - TR.cmp.toolbar.datatable.enable(); - TR.c.isrendered = true; - } - }, response: function(r) { if (!r.responseText) { TR.util.mask.hideMask(); @@ -851,7 +1040,7 @@ name:"meta_" + index + "_", sortable: false, draggable: false, - hidden: eval(TR.value.hidden[index]) + hidden: eval(TR.value.hidden['col' + index]) } } @@ -862,7 +1051,7 @@ dataIndex: dataIndex, height: TR.conf.layout.east_gridcolumn_height, name: "iden_"+ r.data.id + "_", - hidden: eval(TR.value.hidden[index]), + hidden: eval(TR.value.hidden['col' + index]), sortable: false, draggable: true, editor: { @@ -880,7 +1069,7 @@ dataIndex: dataIndex, height: TR.conf.layout.east_gridcolumn_height, name: "attr_"+ r.data.id + "_", - hidden: eval(TR.value.hidden[index]), + hidden: eval(TR.value.hidden['col' + index]), flex:1, sortable: false, draggable: true, @@ -908,7 +1097,7 @@ dataIndex: dataIndex, height: TR.conf.layout.east_gridcolumn_height, name: "de_"+ r.data.id + "_", - hidden: eval(TR.value.hidden[index]), + hidden: eval(TR.value.hidden['col' + index]), flex:1, sortable: false, draggable: true, @@ -921,7 +1110,7 @@ allowBlank: true, store: new Ext.data.ArrayStore({ fields: ['name'], - data: TR.value.getSuggestedValues(index), + data: TR.value.getSuggestedValues('col' + index), }) } }; @@ -1159,6 +1348,7 @@ xtype: 'combobox', cls: 'tr-combo', name: TR.init.system.programs, + id: 'programCombobox', emptyText: TR.i18n.please_select, queryMode: 'local', editable: false, @@ -1171,25 +1361,25 @@ TR.cmp.settings.program = this; }, select: function(cb) { - var anonymous = cb.displayTplData[0].anonymous; - if( anonymous=='false' ) + var pId = cb.getValue(); + if( cb.displayTplData[0].anonymous=='false' ) { // IDENTIFIER TYPE var storeIdentifierType = TR.store.identifierType.available; TR.store.identifierType.selected.loadData([],false); - storeIdentifierType.parent = cb.getValue(); + storeIdentifierType.parent = pId; if (TR.util.store.containsParent(storeIdentifierType)) { TR.util.store.loadFromStorage(storeIdentifierType); TR.util.multiselect.filterAvailable(TR.cmp.params.identifierType.available, TR.cmp.params.identifierType.selected); } else { - storeIdentifierType.load({params: {programId: cb.getValue()}}); + storeIdentifierType.load({params: {programId: pId}}); } // PATIENT ATTRIBUTE var storePatientAttribute = TR.store.patientAttribute.available; - storePatientAttribute.parent = cb.getValue(); + storePatientAttribute.parent = pId; TR.store.patientAttribute.selected.loadData([],false); if (TR.util.store.containsParent(storePatientAttribute)) { @@ -1197,7 +1387,7 @@ TR.util.multiselect.filterAvailable(TR.cmp.params.patientAttribute.available, TR.cmp.params.patientAttribute.selected); } else { - storePatientAttribute.load({params: {programId: cb.getValue()}}); + storePatientAttribute.load({params: {programId: pId}}); } TR.util.setEnabledFixedAttr(); } @@ -1215,8 +1405,8 @@ // PROGRAM-STAGE var storeProgramStage = TR.store.programStage; TR.store.dataelement.selected.loadData([],false); - storeProgramStage.parent = cb.getValue(); - storeProgramStage.load({params: {programId: cb.getValue()}}); + storeProgramStage.parent = pId; + storeProgramStage.load({params: {programId: pId}}); } } }, @@ -1290,6 +1480,7 @@ { xtype: 'treepanel', cls: 'tr-tree', + id: 'treeOrg', width: TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor, height: 273, autoScroll: true, @@ -1337,6 +1528,10 @@ afterrender: function( treePanel, eOpts ) { treePanel.getSelectionModel().select( treePanel.getRootNode() ); + TR.state.orgunitId = treePanel.getSelectionModel().getSelection()[0].data.id; + }, + itemclick : function(view,rec,item,index,eventObj){ + TR.state.orgunitId = TR.cmp.params.organisationunit.treepanel.getSelectionModel().getSelection()[0].data.id; } } } @@ -1844,7 +2039,9 @@ }, { xtype: 'image', - src: 'images/grid-split.gif' + src: 'images/grid-split.gif', + width: 3, + height: 10 }, { xtype: 'button', @@ -1906,7 +2103,9 @@ }, { xtype: 'image', - src: 'images/grid-split.gif' + src: 'images/grid-split.gif', + width: 3, + height: 10 }, { xtype: 'button', @@ -2155,6 +2354,501 @@ }, { xtype: 'button', + cls: 'tr-toolbar-btn-2', + text: TR.i18n.favorites + '..', + listeners: { + afterrender: function(b) { + this.menu = Ext.create('Ext.menu.Menu', { + margin: '2 0 0 0', + shadow: false, + showSeparator: false, + items: [ + { + text: TR.i18n.manage_favorites, + iconCls: 'tr-menu-item-edit', + handler: function() { + if (TR.cmp.favorite.window) { + TR.cmp.favorite.window.show(); + } + else { + TR.cmp.favorite.window = Ext.create('Ext.window.Window', { + title: TR.i18n.manage_favorites, + iconCls: 'tr-window-title-favorite', + bodyStyle: 'padding:8px; background-color:#fff', + width: TR.conf.layout.grid_favorite_width, + height: TR.conf.layout.grid_favorite_height, + closeAction: 'hide', + resizable: false, + modal: true, + resetForm: function() { + TR.cmp.favorite.name.setValue(''); + }, + items: [ + { + xtype: 'form', + bodyStyle: 'border-style:none', + items: [ + { + xtype: 'textfield', + cls: 'tr-textfield', + fieldLabel: 'Name', + maxLength: 160, + enforceMaxLength: true, + labelWidth: TR.conf.layout.form_label_width, + width: TR.conf.layout.grid_favorite_width - 28, + listeners: { + added: function() { + TR.cmp.favorite.name = this; + }, + change: function() { + TR.cmp.favorite.save.xable(); + } + } + } + ] + }, + { + xtype: 'grid', + width: TR.conf.layout.grid_favorite_width - 28, + scroll: 'vertical', + multiSelect: true, + columns: [ + { + dataIndex: 'name', + width: TR.conf.layout.grid_favorite_width - 139, + style: 'display:none' + }, + { + dataIndex: 'lastUpdated', + width: 111, + style: 'display:none' + } + ], + setHeightInWindow: function(store) { + var h = (store.getCount() * 23) + 30, + sh = TR.util.viewport.getSize().y * 0.6; + this.setHeight(h > sh ? sh : h); + this.doLayout(); + this.up('window').doLayout(); + }, + store: TR.store.favorite, + tbar: { + id: 'favorite_t', + cls: 'dv-toolbar', + height: 30, + defaults: { + height: 24 + }, + items: [ + { + text: TR.i18n.sort_by + '..', + cls: 'dv-toolbar-btn-2', + listeners: { + added: function() { + TR.cmp.favorite.sortby = this; + }, + afterrender: function(b) { + this.addCls('dv-menu-togglegroup'); + this.menu = Ext.create('Ext.menu.Menu', { + shadowOffset: 1, + showSeparator: false, + width: 109, + height: 70, + items: [ + { + xtype: 'radiogroup', + cls: 'dv-radiogroup', + columns: 1, + vertical: true, + items: [ + { + boxLabel: TR.i18n.name, + name: 'sortby', + handler: function() { + if (this.getValue()) { + var store = TR.store.favorite; + store.sorting.field = 'name'; + store.sorting.direction = 'ASC'; + store.sortStore(); + this.up('menu').hide(); + } + } + }, + { + boxLabel: TR.i18n.last_updated, + name: 'sortby', + checked: true, + handler: function() { + if (this.getValue()) { + var store = TR.store.favorite; + store.sorting.field = 'lastUpdated'; + store.sorting.direction = 'DESC'; + store.sortStore(); + this.up('menu').hide(); + } + } + } + ] + } + ] + }); + } + } + }, + '->', + { + text: TR.i18n.rename, + cls: 'dv-toolbar-btn-2', + disabled: true, + xable: function() { + if (TR.cmp.favorite.grid.getSelectionModel().getSelection().length == 1) { + TR.cmp.favorite.rename.button.enable(); + } + else { + TR.cmp.favorite.rename.button.disable(); + } + }, + handler: function() { + var selected = TR.cmp.favorite.grid.getSelectionModel().getSelection()[0]; + var w = Ext.create('Ext.window.Window', { + title: TR.i18n.rename_favorite, + layout: 'fit', + width: TR.conf.layout.window_confirm_width, + bodyStyle: 'padding:10px 5px; background-color:#fff; text-align:center', + modal: true, + cmp: {}, + items: [ + { + xtype: 'textfield', + cls: 'dv-textfield', + maxLength: 160, + enforceMaxLength: true, + value: selected.data.name, + listeners: { + added: function() { + this.up('window').cmp.name = this; + }, + change: function() { + this.up('window').cmp.rename.xable(); + } + } + } + ], + bbar: [ + { + xtype: 'label', + style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:50%', + listeners: { + added: function() { + TR.cmp.favorite.rename.label = this; + } + } + }, + '->', + { + text: TR.i18n.cancel, + handler: function() { + this.up('window').close(); + } + }, + { + text: TR.i18n.rename, + disabled: true, + xable: function() { + var value = this.up('window').cmp.name.getValue(); + if (value) { + if (TR.store.favorite.findExact('name', value) == -1) { + this.enable(); + TR.cmp.favorite.rename.label.setText(''); + return; + } + else { + TR.cmp.favorite.rename.label.setText(TR.i18n.name_already_in_use); + } + } + this.disable(); + }, + handler: function() { + TR.util.crud.favorite.updateName(this.up('window').cmp.name.getValue()); + }, + listeners: { + afterrender: function() { + this.up('window').cmp.rename = this; + }, + change: function() { + this.xable(); + } + } + } + ], + listeners: { + afterrender: function() { + TR.cmp.favorite.rename.window = this; + } + } + }); + w.setPosition((screen.width/2)-(TR.conf.layout.window_confirm_width/2), TR.conf.layout.window_favorite_ypos + 100, true); + w.show(); + }, + listeners: { + added: function() { + TR.cmp.favorite.rename.button = this; + } + } + }, + { + text: TR.i18n.delete_object, + cls: 'dv-toolbar-btn-2', + disabled: true, + xable: function() { + if (TR.cmp.favorite.grid.getSelectionModel().getSelection().length) { + TR.cmp.favorite.del.enable(); + } + else { + TR.cmp.favorite.del.disable(); + } + }, + handler: function() { + var sel = TR.cmp.favorite.grid.getSelectionModel().getSelection(); + if (sel.length) { + var str = ''; + for (var i = 0; i < sel.length; i++) { + var out = sel[i].data.name.length > 35 ? (sel[i].data.name.substr(0,35) + '...') : sel[i].data.name; + str += '
' + out; + } + var w = Ext.create('Ext.window.Window', { + title: TR.i18n.delete_favorite, + width: TR.conf.layout.window_confirm_width, + bodyStyle: 'padding:10px 5px; background-color:#fff; text-align:center', + modal: true, + items: [ + { + html: TR.i18n.are_you_sure, + bodyStyle: 'border-style:none' + }, + { + html: str, + cls: 'dv-window-confirm-list' + } + ], + bbar: [ + { + text: TR.i18n.cancel, + handler: function() { + this.up('window').close(); + } + }, + '->', + { + text: TR.i18n.delete_object, + handler: function() { + this.up('window').close(); + TR.util.crud.favorite.del(function() { + TR.cmp.favorite.name.setValue(''); + TR.cmp.favorite.window.down('grid').setHeightInWindow(TR.store.favorite); + }); + } + } + ] + }); + w.setPosition((screen.width/2)-(TR.conf.layout.window_confirm_width/2), TR.conf.layout.window_favorite_ypos + 100, true); + w.show(); + } + }, + listeners: { + added: function() { + TR.cmp.favorite.del = this; + } + } + } + ] + }, + listeners: { + added: function() { + TR.cmp.favorite.grid = this; + }, + itemclick: function(g, r) { + TR.cmp.favorite.name.setValue(r.data.name); + TR.cmp.favorite.rename.button.xable(); + TR.cmp.favorite.del.xable(); + }, + itemdblclick: function() { + if (TR.cmp.favorite.save.xable()) { + TR.cmp.favorite.save.handler(); + } + } + } + } + ], + bbar: [ + { + xtype: 'label', + style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:70%', + listeners: { + added: function() { + TR.cmp.favorite.label = this; + } + } + }, + '->', + { + text: TR.i18n.save, + disabled: true, + xable: function() { + if (TR.cmp.favorite.name.getValue()) { + var index = TR.store.favorite.findExact('name', TR.cmp.favorite.name.getValue()); + if (index != -1) { + this.enable(); + TR.cmp.favorite.label.setText(''); + return true; + } + else { + this.enable(); + TR.cmp.favorite.label.setText(''); + return true; + } + } + else { + TR.cmp.favorite.label.setText(''); + } + + this.disable(); + return false; + }, + handler: function() { + if (this.xable()) { + var value = TR.cmp.favorite.name.getValue(); + if (TR.store.favorite.findExact('name', value) != -1) { + var item = value.length > 40 ? (value.substr(0,40) + '...') : value; + var w = Ext.create('Ext.window.Window', { + title: TR.i18n.save_favorite, + width: TR.conf.layout.window_confirm_width, + bodyStyle: 'padding:10px 5px; background-color:#fff; text-align:center', + modal: true, + items: [ + { + html: TR.i18n.are_you_sure, + bodyStyle: 'border-style:none' + }, + { + html: '
' + item, + cls: 'dv-window-confirm-list' + } + ], + bbar: [ + { + text: TR.i18n.cancel, + handler: function() { + this.up('window').close(); + } + }, + '->', + { + text: TR.i18n.overwrite, + handler: function() { + this.up('window').close(); + TR.util.crud.favorite.update(function() { + TR.cmp.favorite.window.resetForm(); + }); + + } + } + ] + }); + w.setPosition((screen.width/2)-(TR.conf.layout.window_confirm_width/2), TR.conf.layout.window_favorite_ypos + 100, true); + w.show(); + } + else { + TR.util.crud.favorite.create(function() { + TR.cmp.favorite.window.resetForm(); + TR.cmp.favorite.window.down('grid').setHeightInWindow(TR.store.favorite); + }); + } + } + }, + listeners: { + added: function() { + TR.cmp.favorite.save = this; + } + } + } + ], + listeners: { + show: function() { + TR.cmp.favorite.save.xable(); + this.down('grid').setHeightInWindow(TR.store.favorite); + } + } + }); + var w = TR.cmp.favorite.window; + w.setPosition((screen.width/2)-(TR.conf.layout.grid_favorite_width/2), TR.conf.layout.window_favorite_ypos, true); + w.show(); + } + }, + listeners: { + added: function() { + TR.cmp.toolbar.menuitem.datatable = this; + } + } + }, + '-', + { + xtype: 'grid', + cls: 'dv-menugrid', + width: 420, + scroll: 'vertical', + columns: [ + { + dataIndex: 'icon', + width: 25, + style: 'display:none' + }, + { + dataIndex: 'name', + width: 285, + style: 'display:none' + }, + { + dataIndex: 'lastUpdated', + width: 110, + style: 'display:none' + } + ], + setHeightInMenu: function(store) { + var h = store.getCount() * 26, + sh = TR.util.viewport.getSize().y * 0.6; + this.setHeight(h > sh ? sh : h); + this.doLayout(); + this.up('menu').doLayout(); + }, + store: TR.store.favorite, + listeners: { + itemclick: function(g, r) { + g.getSelectionModel().select([], false); + this.up('menu').hide(); + TR.util.crud.favorite.run(r.data.id); + } + } + } + ], + listeners: { + show: function() { + if (!TR.store.favorite.isloaded) { + TR.store.favorite.load({scope: this, callback: function() { + this.down('grid').setHeightInMenu(TR.store.favorite); + }}); + } + else { + this.down('grid').setHeightInMenu(TR.store.favorite); + } + } + } + }); + } + } + }, + { + xtype: 'button', text: TR.i18n.download + '..', execute: function(type) { TR.exe.execute( type ); === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/edit.png' Binary files dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/edit.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/edit.png 2012-05-09 08:30:28 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/favorite.png' Binary files dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/favorite.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/images/favorite.png 2012-05-09 08:30:28 +0000 differ