[jboss-cvs] JBossAS SVN: r97888 - projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 16 07:52:32 EST 2009
Author: lvlcek at redhat.com
Date: 2009-12-16 07:52:32 -0500 (Wed, 16 Dec 2009)
New Revision: 97888
Added:
projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationCreate.java
Log:
Added: projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationCreate.java
===================================================================
--- projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationCreate.java (rev 0)
+++ projects/snowdrop/examples/trunk/sportsclub/sportsclub-reservations-web/src/main/java/org/jboss/snowdrop/samples/sportsclub/jsf/beans/ReservationCreate.java 2009-12-16 12:52:32 UTC (rev 97888)
@@ -0,0 +1,65 @@
+package org.jboss.snowdrop.samples.sportsclub.jsf.beans;
+
+import org.jboss.snowdrop.samples.sportsclub.domain.entity.Reservation;
+import org.jboss.snowdrop.samples.sportsclub.domain.entity.Account;
+import org.jboss.snowdrop.samples.sportsclub.domain.entity.Equipment;
+import org.jboss.snowdrop.samples.sportsclub.service.ReservationService;
+
+import java.util.Calendar;
+import java.util.Locale;
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:lvlcek at redhat.com">Lukas Vlcek</a>
+ */
+public class ReservationCreate
+{
+ private ReservationService reservationService;
+
+ private Reservation reservation;
+
+ public void init()
+ {
+ // reseravtion is for one month starting today
+ Calendar cal = Calendar.getInstance(Locale.US);
+ cal.clear();
+ Date from = cal.getTime(); // now
+
+ cal.setLenient(true);
+ int month = cal.get(Calendar.MONTH);
+ cal.set(Calendar.MONTH, ++month);
+ Date to = cal.getTime(); // next month
+
+ setReservation(new Reservation());
+ getReservation().setAccount(new Account());
+ getReservation().setEquipment(new Equipment());
+ getReservation().setFrom(from);
+ getReservation().setTo(to);
+ }
+
+ public String create()
+ {
+ getReservationService().create();
+ return "success";
+ }
+
+ public Reservation getReservation()
+ {
+ return reservation;
+ }
+
+ public void setReservation(Reservation reservation)
+ {
+ this.reservation = reservation;
+ }
+
+ public ReservationService getReservationService()
+ {
+ return reservationService;
+ }
+
+ public void setReservationService(ReservationService reservationService)
+ {
+ this.reservationService = reservationService;
+ }
+}
More information about the jboss-cvs-commits
mailing list