[jboss-cvs] jboss-seam/examples/quartz/src/org/jboss/seam/example/quartz ...
Michael Yuan
michael.yuan at jboss.com
Tue Jun 19 01:30:06 EDT 2007
User: myuan
Date: 07/06/19 01:30:06
Modified: examples/quartz/src/org/jboss/seam/example/quartz
Payment.java PaymentController.java
PaymentProcessor.java
Log:
add end time support
Revision Changes Path
1.3 +8 -0 jboss-seam/examples/quartz/src/org/jboss/seam/example/quartz/Payment.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Payment.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/quartz/src/org/jboss/seam/example/quartz/Payment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Payment.java 5 Jun 2007 17:02:42 -0000 1.2
+++ Payment.java 19 Jun 2007 05:30:06 -0000 1.3
@@ -41,6 +41,7 @@
private boolean active = true;
private String paymentCron;
+ private Date paymentEndDate;
private Frequency paymentFrequency = Frequency.DAILY;
@@ -83,6 +84,13 @@
this.paymentDate = paymentDate;
}
+ public Date getPaymentEndDate() {
+ return paymentEndDate;
+ }
+ public void setPaymentEndDate(Date paymentEndDate) {
+ this.paymentEndDate = paymentEndDate;
+ }
+
public Date getCreatedDate() {
return createdDate;
}
1.3 +6 -0 jboss-seam/examples/quartz/src/org/jboss/seam/example/quartz/PaymentController.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PaymentController.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/quartz/src/org/jboss/seam/example/quartz/PaymentController.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- PaymentController.java 5 Jun 2007 17:02:42 -0000 1.2
+++ PaymentController.java 19 Jun 2007 05:30:06 -0000 1.3
@@ -10,6 +10,8 @@
import org.jboss.seam.log.Log;
import org.jboss.seam.core.QuartzDispatcher.QuartzTriggerHandle;
+import java.util.Date;
+
@Name("paymentHome")
public class PaymentController
extends EntityHome<Payment>
@@ -24,10 +26,12 @@
String result = persist();
Payment payment = getInstance();
+ payment.setPaymentDate (new Date ());
log.info("scheduling instance #0", payment);
QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(),
payment.getPaymentFrequency().getInterval(),
+ payment.getPaymentEndDate(),
payment);
payment.setQuartzTriggerHandle( handle );
@@ -40,10 +44,12 @@
String result = persist();
Payment payment = getInstance();
+ payment.setPaymentDate (new Date ());
log.info("scheduling instance #0", payment);
QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(),
payment.getPaymentCron(),
+ payment.getPaymentEndDate(),
payment);
payment.setQuartzTriggerHandle( handle );
1.3 +5 -2 jboss-seam/examples/quartz/src/org/jboss/seam/example/quartz/PaymentProcessor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PaymentProcessor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/quartz/src/org/jboss/seam/example/quartz/PaymentProcessor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- PaymentProcessor.java 5 Jun 2007 17:02:42 -0000 1.2
+++ PaymentProcessor.java 19 Jun 2007 05:30:06 -0000 1.3
@@ -12,8 +12,9 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Transactional;
import org.jboss.seam.annotations.timer.Expiration;
+import org.jboss.seam.annotations.timer.FinalExpiration;
import org.jboss.seam.annotations.timer.IntervalDuration;
-import org.jboss.seam.annotations.timer.Cron;
+import org.jboss.seam.annotations.timer.IntervalCron;
import org.jboss.seam.log.Log;
import org.jboss.seam.core.QuartzDispatcher.QuartzTriggerHandle;
@@ -31,6 +32,7 @@
@Transactional
public QuartzTriggerHandle schedulePayment(@Expiration Date when,
@IntervalDuration Long interval,
+ @FinalExpiration Date stoptime,
Payment payment)
{
payment = entityManager.merge(payment);
@@ -53,7 +55,8 @@
@Asynchronous
@Transactional
public QuartzTriggerHandle schedulePayment(@Expiration Date when,
- @Cron String cron,
+ @IntervalCron String cron,
+ @FinalExpiration Date stoptime,
Payment payment)
{
payment = entityManager.merge(payment);
More information about the jboss-cvs-commits
mailing list