dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28862
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14488: Event report, more properties
------------------------------------------------------------
revno: 14488
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-03-27 14:53:54 +0100
message:
Event report, more properties
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml
dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java
dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2014-03-26 21:55:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2014-03-27 13:53:54 +0000
@@ -35,6 +35,8 @@
import org.hisp.dhis.common.BaseAnalyticalObject;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.user.User;
/**
@@ -44,6 +46,26 @@
extends BaseAnalyticalObject
{
/**
+ * Program. Required.
+ */
+ private Program program;
+
+ /**
+ * Program stage.
+ */
+ private ProgramStage programStage;
+
+ /**
+ * Start date.
+ */
+ private Date startDate;
+
+ /**
+ * End date.
+ */
+ private Date endDate;
+
+ /**
* Dimensions to crosstabulate / use as columns.
*/
private List<String> columnDimensions = new ArrayList<String>();
@@ -90,6 +112,46 @@
// Getters and setters
// -------------------------------------------------------------------------
+ public Program getProgram()
+ {
+ return program;
+ }
+
+ public void setProgram( Program program )
+ {
+ this.program = program;
+ }
+
+ public ProgramStage getProgramStage()
+ {
+ return programStage;
+ }
+
+ public void setProgramStage( ProgramStage programStage )
+ {
+ this.programStage = programStage;
+ }
+
+ 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 List<String> getColumnDimensions()
{
return columnDimensions;
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2014-03-26 21:55:22 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2014-03-27 13:53:54 +0000
@@ -71,6 +71,16 @@
<property name="userOrganisationUnitGrandChildren" />
+ <many-to-one name="program" class="org.hisp.dhis.program.Program"
+ column="programid" not-null="true" foreign-key="fk_eventreport_programid" />
+
+ <many-to-one name="programStage" class="org.hisp.dhis.program.ProgramStage"
+ column="programstageid" foreign-key="fk_eventreport_programstageid" />
+
+ <property name="startDate" />
+
+ <property name="endDate" />
+
<list name="columnDimensions" table="eventreport_columns">
<cache usage="read-write" />
<key column="eventreportid" foreign-key="fk_eventreport_columns_eventreportid" />
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java 2014-03-26 21:55:22 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java 2014-03-27 13:53:54 +0000
@@ -28,12 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.junit.Assert.assertEquals;
+
import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import static org.junit.Assert.*;
-
/**
* @author Lars Helge Overland
*/
@@ -43,12 +45,27 @@
@Autowired
private EventReportService eventReportService;
+ @Autowired
+ private ProgramService programService;
+
+ private Program prA;
+
+ @Override
+ public void setUpTest()
+ {
+ prA = createProgram( 'A', null, null );
+ programService.addProgram( prA );
+ }
+
@Test
public void testSaveGet()
{
EventReport erA = new EventReport( "erA" );
+ erA.setProgram( prA );
EventReport erB = new EventReport( "erB" );
+ erB.setProgram( prA );
EventReport erC = new EventReport( "erC" );
+ erC.setProgram( prA );
int idA = eventReportService.saveEventReport( erA );
int idB = eventReportService.saveEventReport( erB );
=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2014-03-19 16:49:47 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2014-03-27 13:53:54 +0000
@@ -1011,9 +1011,12 @@
program.setProgramStages( programStages );
program.setType( Program.MULTIPLE_EVENTS_WITH_REGISTRATION );
- for ( ProgramStage programStage : programStages )
+ if ( programStages != null )
{
- programStage.setProgram( program );
+ for ( ProgramStage programStage : programStages )
+ {
+ programStage.setProgram( program );
+ }
}
program.getOrganisationUnits().add( organisationUnit );