[seam-commits] Seam SVN: r8463 - in trunk/examples/quartz/src/org/jboss/seam/example/quartz: test and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jul 14 12:32:00 EDT 2008


Author: norman.richards at jboss.com
Date: 2008-07-14 12:32:00 -0400 (Mon, 14 Jul 2008)
New Revision: 8463

Added:
   trunk/examples/quartz/src/org/jboss/seam/example/quartz/PaymentHome.java
Removed:
   trunk/examples/quartz/src/org/jboss/seam/example/quartz/PaymentController.java
Modified:
   trunk/examples/quartz/src/org/jboss/seam/example/quartz/test/TestPaymentController.java
Log:
JBSEAM-3162

Deleted: trunk/examples/quartz/src/org/jboss/seam/example/quartz/PaymentController.java
===================================================================
--- trunk/examples/quartz/src/org/jboss/seam/example/quartz/PaymentController.java	2008-07-14 16:26:14 UTC (rev 8462)
+++ trunk/examples/quartz/src/org/jboss/seam/example/quartz/PaymentController.java	2008-07-14 16:32:00 UTC (rev 8463)
@@ -1,81 +0,0 @@
-package org.jboss.seam.example.quartz;
-
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Logger;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Transactional;
-import org.jboss.seam.annotations.web.RequestParameter;
-import org.jboss.seam.async.QuartzTriggerHandle;
-import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.PaymentProcessor;
-import org.jboss.seam.faces.FacesMessages;
-import org.jboss.seam.framework.EntityHome;
-import org.jboss.seam.log.Log;
-
- at Name("paymentHome")
-public class PaymentController 
-    extends EntityHome<Payment>
-{
-    @RequestParameter Long paymentId;
-    @In PaymentProcessor processor;
-    
-    @Logger Log log;
-
-    public String saveAndSchedule()
-    {
-        String result = persist();
-        
-        Payment payment = getInstance();
-        
-        log.info("scheduling instance #0", payment);
-        QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(), 
-                                                payment.getPaymentFrequency().getInterval(), 
-                                                payment.getPaymentEndDate(), 
-                                                payment);
-        
-        payment.setQuartzTriggerHandle( handle );
-
-        return result;
-    }
-
-    public String saveAndScheduleCron()
-    {
-        String result = persist();
-        
-        Payment payment = getInstance();
-        log.info("scheduling instance #0", payment);
-
-        QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(), 
-                                                payment.getPaymentCron(), 
-                                                payment.getPaymentEndDate(), 
-                                                payment);
-        
-        payment.setQuartzTriggerHandle( handle );
-
-        return result;
-    }
-
-    @Override
-    public Object getId() {
-        return paymentId;
-    }
-
-    @Transactional
-    public void cancel() {
-        Payment payment = getInstance();
-        
-        QuartzTriggerHandle handle = payment.getQuartzTriggerHandle();
-        payment.setQuartzTriggerHandle(null);
-        payment.setActive(false);
-        
-        try
-        {
-            handle.cancel();
-        }
-        catch (Exception nsole)
-        {
-            FacesMessages.instance().add("Payment already processed");
-        }
-    }
-    
-}

Added: trunk/examples/quartz/src/org/jboss/seam/example/quartz/PaymentHome.java
===================================================================
--- trunk/examples/quartz/src/org/jboss/seam/example/quartz/PaymentHome.java	                        (rev 0)
+++ trunk/examples/quartz/src/org/jboss/seam/example/quartz/PaymentHome.java	2008-07-14 16:32:00 UTC (rev 8463)
@@ -0,0 +1,81 @@
+package org.jboss.seam.example.quartz;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Logger;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Transactional;
+import org.jboss.seam.annotations.web.RequestParameter;
+import org.jboss.seam.async.QuartzTriggerHandle;
+import org.jboss.seam.example.quartz.Payment;
+import org.jboss.seam.example.quartz.PaymentProcessor;
+import org.jboss.seam.faces.FacesMessages;
+import org.jboss.seam.framework.EntityHome;
+import org.jboss.seam.log.Log;
+
+ at Name("paymentHome")
+public class PaymentHome
+    extends EntityHome<Payment>
+{
+    @RequestParameter Long paymentId;
+    @In PaymentProcessor processor;
+    
+    @Logger Log log;
+
+    public String saveAndSchedule()
+    {
+        String result = persist();
+        
+        Payment payment = getInstance();
+        
+        log.info("scheduling instance #0", payment);
+        QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(), 
+                                                payment.getPaymentFrequency().getInterval(), 
+                                                payment.getPaymentEndDate(), 
+                                                payment);
+        
+        payment.setQuartzTriggerHandle( handle );
+
+        return result;
+    }
+
+    public String saveAndScheduleCron()
+    {
+        String result = persist();
+        
+        Payment payment = getInstance();
+        log.info("scheduling instance #0", payment);
+
+        QuartzTriggerHandle handle = processor.schedulePayment(payment.getPaymentDate(), 
+                                                payment.getPaymentCron(), 
+                                                payment.getPaymentEndDate(), 
+                                                payment);
+        
+        payment.setQuartzTriggerHandle( handle );
+
+        return result;
+    }
+
+    @Override
+    public Object getId() {
+        return paymentId;
+    }
+
+    @Transactional
+    public void cancel() {
+        Payment payment = getInstance();
+        
+        QuartzTriggerHandle handle = payment.getQuartzTriggerHandle();
+        payment.setQuartzTriggerHandle(null);
+        payment.setActive(false);
+        
+        try
+        {
+            handle.cancel();
+        }
+        catch (Exception nsole)
+        {
+            FacesMessages.instance().add("Payment already processed");
+        }
+    }
+    
+}

Modified: trunk/examples/quartz/src/org/jboss/seam/example/quartz/test/TestPaymentController.java
===================================================================
--- trunk/examples/quartz/src/org/jboss/seam/example/quartz/test/TestPaymentController.java	2008-07-14 16:26:14 UTC (rev 8462)
+++ trunk/examples/quartz/src/org/jboss/seam/example/quartz/test/TestPaymentController.java	2008-07-14 16:32:00 UTC (rev 8463)
@@ -13,7 +13,7 @@
 import org.jboss.seam.async.TimerSchedule;
 import org.jboss.seam.core.Events;
 import org.jboss.seam.example.quartz.Payment;
-import org.jboss.seam.example.quartz.PaymentController;
+import org.jboss.seam.example.quartz.PaymentHome;
 import org.jboss.seam.log.Log;
 
 /**
@@ -22,7 +22,7 @@
  */
 @Name("paymentHome")
 @Install(precedence=MOCK)
-public class TestPaymentController extends PaymentController
+public class TestPaymentController extends PaymentHome
 {
     
     @In TestPaymentProcessor processor;




More information about the seam-commits mailing list