dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06395
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2032: Playing with Quartz Schedular and Java Mail API
------------------------------------------------------------
revno: 2032
committer: Bharath Kumar <chbharathk@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-06-23 15:47:56 +0530
message:
Playing with Quartz Schedular and Java Mail API
added:
local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/mail/
local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/mail/MailService.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/SendMailAction.java
local/in/dhis-web-sandboxbk/src/main/webapp/dhis-web-reports/sendMailResult.vm
modified:
local/in/dhis-in-services/dhis-in-service-scheduler/pom.xml
local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/scheduler/HelloJob.java
local/in/dhis-in-services/dhis-in-service-scheduler/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-sandboxbk/pom.xml
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/GenerateInputScreenAction.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/GetDataElementsAction.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/advanced/action/GenerateAdvancedReportResultAction.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserResultAction.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/importing/action/ImportingResultAction.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/linelisting/action/GenerateLinelistingReportAnalyserResultAction.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/progress/action/GenerateProgressAnalyserResultAction.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java
local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/util/ReportService.java
local/in/dhis-web-sandboxbk/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-sandboxbk/src/main/resources/struts.xml
local/in/dhis-web-sandboxbk/src/main/webapp/WEB-INF/web.xml
local/in/dhis-web-sandboxbk/src/main/webapp/dhis-web-reports/menu.vm
--
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 'local/in/dhis-in-services/dhis-in-service-scheduler/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-scheduler/pom.xml 2010-06-07 06:41:39 +0000
+++ local/in/dhis-in-services/dhis-in-service-scheduler/pom.xml 2010-06-23 10:17:56 +0000
@@ -52,5 +52,13 @@
<artifactId>commons-math</artifactId>
</dependency>
+ <!-- Java Mail API -->
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+
+
</dependencies>
</project>
=== added directory 'local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/mail'
=== added file 'local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/mail/MailService.java'
--- local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/mail/MailService.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/mail/MailService.java 2010-06-23 10:17:56 +0000
@@ -0,0 +1,139 @@
+package org.hisp.dhis.mail;
+
+import java.util.Properties;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.activation.FileDataSource;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+
+public class MailService
+{
+
+ public static final String MAIL_SERVER = "smtp.gmail.com";
+
+ public static final String USERNAME = "hisptransfer@xxxxxxxxx";
+
+ public static final String PASSWORD = "hispindia@09";
+
+ public String sendEmail()
+ {
+
+ String stusMessage = "Mail sent Successfully";
+
+ try
+ {
+ String fromAddress = "hisptransfer@xxxxxxxxx";
+ String toAddress = "akashjindal.in@xxxxxxxxx";
+ String subject = "This is a test Message";
+ String message = "Hello Hows u?";
+
+ Properties properties = System.getProperties();
+ properties.put( "mail.smtps.host", MAIL_SERVER );
+ properties.put( "mail.smtps.auth", "true" );
+
+ Session session = Session.getInstance( properties );
+ MimeMessage msg = new MimeMessage( session );
+
+ msg.setFrom( new InternetAddress( fromAddress ) );
+ msg.addRecipients( Message.RecipientType.TO, toAddress );
+ msg.setSubject( subject );
+ msg.setText( message );
+
+ Transport tr = session.getTransport( "smtps" );
+ tr.connect( MAIL_SERVER, USERNAME, PASSWORD );
+ tr.sendMessage( msg, msg.getAllRecipients() );
+ tr.close();
+ }
+ catch ( AddressException ex )
+ {
+ System.out.println( ex.getMessage() );
+ stusMessage = "Mail couldn't sent becuase " + ex.getMessage();
+ }
+ catch ( MessagingException ex )
+ {
+ System.out.println( ex.getMessage() );
+ stusMessage = "Mail couldn't sent becuase " + ex.getMessage();
+ }
+
+ return stusMessage;
+ }
+
+ public String sendEmailWithAttachment()
+ {
+ String stusMessage = "Mail sent Successfully";
+
+ try
+ {
+ String fromAddress = "hisptransfer@xxxxxxxxx";
+ String toAddress = "suneelkumar.chevvu@xxxxxxxxx";
+ String subject = "This is a test Mail with attachment";
+ // String message = "Hello Hows u?";
+
+ String fileAttachment = "c:/HP_OrgUnits.xls";
+
+ // Get system properties
+ Properties properties = System.getProperties();
+ properties.put( "mail.smtps.host", MAIL_SERVER );
+ properties.put( "mail.smtps.auth", "true" );
+
+ // Get session
+ Session session = Session.getInstance( properties );
+
+ // Define message
+ MimeMessage message = new MimeMessage( session );
+
+ message.setFrom( new InternetAddress( fromAddress ) );
+ message.addRecipient( Message.RecipientType.TO, new InternetAddress( toAddress ) );
+ message.setSubject( subject );
+
+ // create the message part
+ MimeBodyPart messageBodyPart = new MimeBodyPart();
+
+ // fill message
+ messageBodyPart.setText( "Hi from Bharath with attachment" );
+
+ Multipart multipart = new MimeMultipart();
+ multipart.addBodyPart( messageBodyPart );
+
+ // Part two is attachment
+ messageBodyPart = new MimeBodyPart();
+ DataSource source = new FileDataSource( fileAttachment );
+ messageBodyPart.setDataHandler( new DataHandler( source ) );
+ messageBodyPart.setFileName( fileAttachment );
+ multipart.addBodyPart( messageBodyPart );
+
+ // Put parts in message
+ message.setContent( multipart );
+
+ // Send the message
+ //Transport.send( message );
+ Transport tr = session.getTransport( "smtps" );
+ tr.connect( MAIL_SERVER, USERNAME, PASSWORD );
+ tr.sendMessage( message, message.getAllRecipients() );
+ tr.close();
+
+ }
+ catch ( AddressException ex )
+ {
+ System.out.println( ex.getMessage() );
+ stusMessage = "Mail couldn't sent becuase " + ex.getMessage();
+ }
+ catch ( MessagingException ex )
+ {
+ System.out.println( ex.getMessage() );
+ stusMessage = "Mail couldn't sent becuase " + ex.getMessage();
+ }
+
+ return stusMessage;
+ }
+}
=== modified file 'local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/scheduler/HelloJob.java'
--- local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/scheduler/HelloJob.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-scheduler/src/main/java/org/hisp/dhis/scheduler/HelloJob.java 2010-06-23 10:17:56 +0000
@@ -1,15 +1,40 @@
package org.hisp.dhis.scheduler;
+import java.util.Calendar;
import java.util.Date;
+import org.hisp.dhis.mail.MailService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
public class HelloJob implements Job
{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private MailService mailService = new MailService();
+
+ public void setMailService( MailService mailService )
+ {
+ this.mailService = mailService;
+ }
+
+
public void execute( JobExecutionContext arg0 ) throws JobExecutionException
{
System.out.println("Hello World Quartz Scheduler: " + new Date());
+ Calendar cal = Calendar.getInstance();
+
+ cal.setTime( new Date() );
+
+ /*
+ if( cal.get( Calendar.HOUR_OF_DAY ) == 16 && cal.get( Calendar.MINUTE ) == 30 )
+ {
+ mailService.sendEmail();
+ System.out.println("Message may sent");
+ }
+ */
}
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-scheduler/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-in-services/dhis-in-service-scheduler/src/main/resources/META-INF/dhis/beans.xml 2010-06-04 11:50:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-scheduler/src/main/resources/META-INF/dhis/beans.xml 2010-06-23 10:17:56 +0000
@@ -2,19 +2,30 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- Store definitions -->
<!-- Service definitions -->
+ <bean id="org.hisp.dhis.mail.MailService"
+ class="org.hisp.dhis.mail.MailService">
+ </bean>
+<bean id="org.hisp.dhis.scheduler.HelloJob"
+ class="org.hisp.dhis.scheduler.HelloJob">
+ <property name="mailService">
+ <ref bean="org.hisp.dhis.mail.MailService"/>
+ </property>
+
+ </bean>
<!-- Startup routine definitions -->
<bean id="org.hisp.dhis.scheduler.HelloSchedule"
class="org.hisp.dhis.scheduler.HelloSchedule">
+
</bean>
=== modified file 'local/in/dhis-web-sandboxbk/pom.xml'
--- local/in/dhis-web-sandboxbk/pom.xml 2010-06-15 11:26:37 +0000
+++ local/in/dhis-web-sandboxbk/pom.xml 2010-06-23 10:17:56 +0000
@@ -47,11 +47,13 @@
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-service-core</artifactId>
</dependency>
+ <!--
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-service-jdbc</artifactId>
<version>${version}</version>
- </dependency>
+ </dependency>
+ -->
<dependency>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web-commons</artifactId>
@@ -85,15 +87,15 @@
</dependency>
<!-- Web -->
-
+<!--
<dependency>
<groupId>com.opensymphony</groupId>
<artifactId>webwork</artifactId>
<version>${version}</version>
</dependency>
-
+ -->
<!-- Other -->
-
+ <!--
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
@@ -103,7 +105,7 @@
<artifactId>mysql-connector-java</artifactId>
<version>5.0.4</version>
</dependency>
-
+ -->
</dependencies>
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/GenerateInputScreenAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/GenerateInputScreenAction.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/GenerateInputScreenAction.java 2010-06-23 10:17:56 +0000
@@ -4,8 +4,8 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import org.hisp.dhis.dataset.DataEntryForm;
-import org.hisp.dhis.dataset.DataEntryFormService;
+import org.hisp.dhis.dataentryform.DataEntryForm;
+import org.hisp.dhis.dataentryform.DataEntryFormService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/GetDataElementsAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/GetDataElementsAction.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/GetDataElementsAction.java 2010-06-23 10:17:56 +0000
@@ -6,7 +6,7 @@
import java.util.List;
import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.options.displayproperty.DefaultDisplayPropertyHandler;
@@ -29,10 +29,10 @@
this.dataElementService = dataElementService;
}
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+ private DataElementCategoryService dataElementCategoryOptionComboService;
public void setDataElementCategoryOptionComboService(
- DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ DataElementCategoryService dataElementCategoryOptionComboService )
{
this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
}
=== added file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/SendMailAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/SendMailAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/action/SendMailAction.java 2010-06-23 10:17:56 +0000
@@ -0,0 +1,48 @@
+package org.hisp.dhis.reports.action;
+
+import org.hisp.dhis.mail.MailService;
+
+import com.opensymphony.xwork2.Action;
+
+public class SendMailAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private MailService mailService;
+
+ public void setMailService( MailService mailService )
+ {
+ this.mailService = mailService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private String resultMessage;
+
+ public String getResultMessage()
+ {
+ return resultMessage;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+
+ //resultMessage = mailService.sendEmail();
+
+ resultMessage = mailService.sendEmailWithAttachment();
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/advanced/action/GenerateAdvancedReportResultAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/advanced/action/GenerateAdvancedReportResultAction.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/advanced/action/GenerateAdvancedReportResultAction.java 2010-06-23 10:17:56 +0000
@@ -34,7 +34,7 @@
import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetStore;
@@ -138,9 +138,9 @@
this.dataValueService = dataValueService;
}
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+ private DataElementCategoryService dataElementCategoryOptionComboService;
- public void setDataElementCategoryOptionComboService( DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ public void setDataElementCategoryOptionComboService( DataElementCategoryService dataElementCategoryOptionComboService )
{
this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
}
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserResultAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserResultAction.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/feedback/action/GenerateFeedbackReportAnalyserResultAction.java 2010-06-23 10:17:56 +0000
@@ -34,7 +34,7 @@
import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetStore;
@@ -135,10 +135,10 @@
this.dataValueService = dataValueService;
}
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+ private DataElementCategoryService dataElementCategoryOptionComboService;
public void setDataElementCategoryOptionComboService(
- DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ DataElementCategoryService dataElementCategoryOptionComboService )
{
this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
}
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/importing/action/ImportingResultAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/importing/action/ImportingResultAction.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/importing/action/ImportingResultAction.java 2010-06-23 10:17:56 +0000
@@ -3,16 +3,12 @@
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.ArrayList;
-import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DataValueService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -71,9 +67,9 @@
this.dataValueService = dataValueService;
}
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+ private DataElementCategoryService dataElementCategoryOptionComboService;
- public void setDataElementCategoryOptionComboService( DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ public void setDataElementCategoryOptionComboService( DataElementCategoryService dataElementCategoryOptionComboService )
{
this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
}
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/linelisting/action/GenerateLinelistingReportAnalyserResultAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/linelisting/action/GenerateLinelistingReportAnalyserResultAction.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/linelisting/action/GenerateLinelistingReportAnalyserResultAction.java 2010-06-23 10:17:56 +0000
@@ -39,7 +39,7 @@
import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetStore;
@@ -149,10 +149,10 @@
this.dataValueService = dataValueService;
}
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+ private DataElementCategoryService dataElementCategoryOptionComboService;
public void setDataElementCategoryOptionComboService(
- DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ DataElementCategoryService dataElementCategoryOptionComboService )
{
this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
}
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/progress/action/GenerateProgressAnalyserResultAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/progress/action/GenerateProgressAnalyserResultAction.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/progress/action/GenerateProgressAnalyserResultAction.java 2010-06-23 10:17:56 +0000
@@ -27,7 +27,7 @@
import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetStore;
@@ -130,9 +130,9 @@
this.dataValueService = dataValueService;
}
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+ private DataElementCategoryService dataElementCategoryOptionComboService;
- public void setDataElementCategoryOptionComboService( DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ public void setDataElementCategoryOptionComboService( DataElementCategoryService dataElementCategoryOptionComboService )
{
this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
}
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/routine/action/GenerateRoutineReportAnalyserResultAction.java 2010-06-23 10:17:56 +0000
@@ -35,7 +35,7 @@
import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetStore;
@@ -129,9 +129,9 @@
this.dataValueService = dataValueService;
}
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+ private DataElementCategoryService dataElementCategoryOptionComboService;
- public void setDataElementCategoryOptionComboService( DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ public void setDataElementCategoryOptionComboService( DataElementCategoryService dataElementCategoryOptionComboService )
{
this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
}
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/upward/action/GenerateUpwardReportAnalyserResultAction.java 2010-06-23 10:17:56 +0000
@@ -38,7 +38,7 @@
import org.hisp.dhis.aggregation.AggregationService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetStore;
@@ -149,10 +149,10 @@
this.dataValueService = dataValueService;
}
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+ private DataElementCategoryService dataElementCategoryOptionComboService;
public void setDataElementCategoryOptionComboService(
- DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ DataElementCategoryService dataElementCategoryOptionComboService )
{
this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
}
=== modified file 'local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/util/ReportService.java'
--- local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/util/ReportService.java 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/java/org/hisp/dhis/reports/util/ReportService.java 2010-06-23 10:17:56 +0000
@@ -20,11 +20,8 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.datavalue.DataValue;
import org.hisp.dhis.datavalue.DataValueService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
@@ -72,10 +69,10 @@
this.dataValueService = dataValueService;
}
- private DataElementCategoryOptionComboService dataElementCategoryOptionComboService;
+ private DataElementCategoryService dataElementCategoryOptionComboService;
public void setDataElementCategoryOptionComboService(
- DataElementCategoryOptionComboService dataElementCategoryOptionComboService )
+ DataElementCategoryService dataElementCategoryOptionComboService )
{
this.dataElementCategoryOptionComboService = dataElementCategoryOptionComboService;
}
=== modified file 'local/in/dhis-web-sandboxbk/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-sandboxbk/src/main/resources/META-INF/dhis/beans.xml 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/resources/META-INF/dhis/beans.xml 2010-06-23 10:17:56 +0000
@@ -31,7 +31,7 @@
</property>
<property name="dataElementCategoryOptionComboService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService"/>
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</property>
<property name="periodService">
<ref bean="org.hisp.dhis.period.PeriodService"/>
@@ -70,7 +70,7 @@
<ref bean="org.hisp.dhis.dataset.DataSetService"/>
</property>
<property name="dataEntryFormService">
- <ref bean="org.hisp.dhis.dataset.DataEntryFormService"/>
+ <ref bean="org.hisp.dhis.dataentryform.DataEntryFormService"/>
</property>
</bean>
@@ -101,7 +101,7 @@
</property>
<property name="dataElementCategoryOptionComboService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService"/>
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</property>
<property name="periodService">
<ref bean="org.hisp.dhis.period.PeriodService"/>
@@ -158,7 +158,7 @@
</property>
<property name="dataElementCategoryOptionComboService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService"/>
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</property>
<property name="periodService">
<ref bean="org.hisp.dhis.period.PeriodService"/>
@@ -211,7 +211,7 @@
</property>
<property name="dataElementCategoryOptionComboService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService"/>
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</property>
<property name="periodService">
<ref bean="org.hisp.dhis.period.PeriodService"/>
@@ -270,7 +270,7 @@
</property>
<property name="dataElementCategoryOptionComboService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService"/>
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</property>
<property name="periodService">
<ref bean="org.hisp.dhis.period.PeriodService"/>
@@ -316,7 +316,7 @@
</property>
<property name="dataElementCategoryOptionComboService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService"/>
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</property>
<property name="periodService">
<ref bean="org.hisp.dhis.period.PeriodService"/>
@@ -360,7 +360,7 @@
<property name="dataValueService"
ref="org.hisp.dhis.datavalue.DataValueService"/>
<property name="dataElementCategoryOptionComboService"
- ref="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService"/>
+ ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</bean>
<bean id="org.hisp.dhis.reports.util.DBConnection"
@@ -385,6 +385,17 @@
</property>
</bean>
+<!-- Send E-mail -->
+ <bean id="org.hisp.dhis.reports.action.SendMailAction"
+ class="org.hisp.dhis.reports.action.SendMailAction"
+ scope="prototype">
+
+ <property name="mailService">
+ <ref bean="org.hisp.dhis.mail.MailService"/>
+ </property>
+ </bean>
+
+
<!-- Importing From OLD DB -->
<bean id="org.hisp.dhis.reports.importing.action.ImportingResultAction"
class="org.hisp.dhis.reports.importing.action.ImportingResultAction" scope="prototype">
@@ -399,7 +410,7 @@
<property name="dataValueService"
ref="org.hisp.dhis.datavalue.DataValueService"/>
<property name="dataElementCategoryOptionComboService"
- ref="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService"/>
+ ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
<property name="dbConnection">
<ref bean="org.hisp.dhis.reports.util.DBConnection"/>
</property>
@@ -414,7 +425,7 @@
<ref bean="org.hisp.dhis.dataelement.DataElementService"/>
</property>
<property name="dataElementCategoryOptionComboService">
- <ref bean="org.hisp.dhis.dataelement.DataElementCategoryOptionComboService"/>
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</property>
</bean>
=== modified file 'local/in/dhis-web-sandboxbk/src/main/resources/struts.xml'
--- local/in/dhis-web-sandboxbk/src/main/resources/struts.xml 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/resources/struts.xml 2010-06-23 10:17:56 +0000
@@ -180,7 +180,17 @@
class="org.hisp.dhis.reports.action.ReportsHomePageAction">
<result name="success" type="velocity">/dhis-web-reports/gapMinderResult.vm</result>
</action>
-
+
+<!-- Send E-mail -->
+
+ <action name="sendMail"
+ class="org.hisp.dhis.reports.action.SendMailAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-reports/sendMailResult.vm</param>
+ <param name="menu">/dhis-web-reports/menu.vm</param>
+ </action>
+
+
<!-- AJAX Requests -->
<action name="getDataElements"
class="org.hisp.dhis.reports.action.GetDataElementsAction">
=== modified file 'local/in/dhis-web-sandboxbk/src/main/webapp/WEB-INF/web.xml'
--- local/in/dhis-web-sandboxbk/src/main/webapp/WEB-INF/web.xml 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/webapp/WEB-INF/web.xml 2010-06-23 10:17:56 +0000
@@ -18,7 +18,7 @@
<filter-class>org.hisp.dhis.servlet.filter.HttpRedirectFilter</filter-class>
<init-param>
<param-name>redirectPath</param-name>
- <param-value>dhis-web-reports-in/index.action</param-value>
+ <param-value>dhis-web-reports/index.action</param-value>
</init-param>
</filter>
<filter>
=== modified file 'local/in/dhis-web-sandboxbk/src/main/webapp/dhis-web-reports/menu.vm'
--- local/in/dhis-web-sandboxbk/src/main/webapp/dhis-web-reports/menu.vm 2010-06-04 11:50:05 +0000
+++ local/in/dhis-web-sandboxbk/src/main/webapp/dhis-web-reports/menu.vm 2010-06-23 10:17:56 +0000
@@ -30,6 +30,9 @@
<li>
<a href = "gapMinder.action" target="_blank">GapMinder</a>
</li>
+ <li>
+ <a href = "sendMail.action">Send e-mail</a>
+ </li>
</ul>
=== added file 'local/in/dhis-web-sandboxbk/src/main/webapp/dhis-web-reports/sendMailResult.vm'
--- local/in/dhis-web-sandboxbk/src/main/webapp/dhis-web-reports/sendMailResult.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-sandboxbk/src/main/webapp/dhis-web-reports/sendMailResult.vm 2010-06-23 10:17:56 +0000
@@ -0,0 +1,2 @@
+
+<h3>$resultMessage</h3>
\ No newline at end of file