Seam SVN: r10715 - branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2009-04-29 03:12:52 -0400 (Wed, 29 Apr 2009)
New Revision: 10715
Modified:
branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Framework.xml
Log:
JBSEAM-4155 - fixed typos in documentation
Modified: branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Framework.xml
===================================================================
--- branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Framework.xml 2009-04-29 06:37:07 UTC (rev 10714)
+++ branches/community/Seam_2_1/doc/Seam_Reference_Guide/en-US/Framework.xml 2009-04-29 07:12:52 UTC (rev 10715)
@@ -330,7 +330,7 @@
event when a transaction succeeds (a call to <literal>persist()</literal>,
<literal>update()</literal> or <literal>remove()</literal> succeeds). By observing
this event we can refresh our queries when the underlying entities are changed. If
- we only want to refresh certain queries when a particular entity is persited,
+ we only want to refresh certain queries when a particular entity is persisted,
updated or removed we can observe the
<literal>org.jboss.seam.afterTransactionSuccess.<name></literal>
event (where <literal><name></literal> is the name of the entity).
@@ -533,7 +533,7 @@
<para>
Unfortunately Query objects don't work well with
<emphasis>join fetch</emphasis> queries - the use of pagination with
- these queries is not recomended, and you'll have to implement your own
+ these queries is not recommended, and you'll have to implement your own
method of calculating the total number of results (by overriding
<literal>getCountEjbql()</literal>.
</para>
15 years, 9 months
Seam SVN: r10714 - examples/trunk/booking/ear.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-29 02:37:07 -0400 (Wed, 29 Apr 2009)
New Revision: 10714
Modified:
examples/trunk/booking/ear/pom.xml
Log:
update ant script to reflect folder name change
Modified: examples/trunk/booking/ear/pom.xml
===================================================================
--- examples/trunk/booking/ear/pom.xml 2009-04-29 06:33:45 UTC (rev 10713)
+++ examples/trunk/booking/ear/pom.xml 2009-04-29 06:37:07 UTC (rev 10714)
@@ -61,8 +61,8 @@
<tasks>
<property name="archive.name" value="${project.build.finalName}"/>
<property name="ear.staging.dir" value="${project.build.directory}/${archive.name}"/>
- <property name="ejb-jar.staging.dir" value="../${archive.name}-ejb/target/classes"/>
- <property name="war.staging.dir" value="../${archive.name}-war/target/${archive.name}"/>
+ <property name="ejb-jar.staging.dir" value="../ejb-jar/target/classes"/>
+ <property name="war.staging.dir" value="../war/target/${archive.name}"/>
<property name="ear.deploy.dir" value="${jboss.home}/server/${jboss.domain}/deploy/${archive.name}.ear"/>
<property name="ejb-jar.deploy.dir" value="${ear.deploy.dir}/${archive.name}-ejb.jar"/>
15 years, 9 months
Seam SVN: r10713 - in examples/trunk/booking: ejb-jar and 13 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-29 02:33:45 -0400 (Wed, 29 Apr 2009)
New Revision: 10713
Added:
examples/trunk/booking/ejb-jar/
examples/trunk/booking/ejb-jar/pom.xml
examples/trunk/booking/ejb-jar/src/
examples/trunk/booking/ejb-jar/src/main/
examples/trunk/booking/ejb-jar/src/main/java/
examples/trunk/booking/ejb-jar/src/main/java/org/
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/binding/
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/Booking.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/User.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/BookingAgent.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/BookingAgentBean.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/HotelSearch.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/HotelSearchBean.java
examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/SearchCriteria.java
examples/trunk/booking/ejb-jar/src/main/resources/
examples/trunk/booking/ejb-jar/src/main/resources/META-INF/
examples/trunk/booking/ejb-jar/src/main/resources/META-INF/beans.xml
examples/trunk/booking/ejb-jar/src/main/resources/META-INF/persistence.xml
examples/trunk/booking/ejb-jar/src/main/resources/import.sql
examples/trunk/booking/ejb-jar/src/test/
examples/trunk/booking/ejb-jar/src/test/java/
Log:
recover from SVN move disaster
Property changes on: examples/trunk/booking/ejb-jar
___________________________________________________________________
Name: svn:ignore
+ target
Added: examples/trunk/booking/ejb-jar/pom.xml
===================================================================
--- examples/trunk/booking/ejb-jar/pom.xml (rev 0)
+++ examples/trunk/booking/ejb-jar/pom.xml 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,281 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.seam.examples</groupId>
+ <artifactId>seam-booking</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>seam-booking-ejb</artifactId>
+ <packaging>ejb</packaging>
+ <name>Seam Booking Example (EJB module)</name>
+
+ <build>
+ <finalName>${project.artifactId}</finalName>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/resources/test-suite.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-core-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-faces</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logger</artifactId>
+ <version>1.0.0-SNAPSHOT</version> <!-- TODO push to version-matrix -->
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-integration-test-dependencies</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <stripVersion>true</stripVersion>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness</artifactId>
+ <version>1.0.0-SNAPSHOT</version> <!-- inheritence isn't working here -->
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
+ </artifactItem>
+ <!--
+ <artifactItem>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+ -->
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/resources/test-suite.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ <systemProperties>
+ <property>
+ <name>jboss.home</name>
+ <value>${jboss.home}</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.standalone</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.container.extraConfigurationDir</name>
+ <value>../../</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.container.forceRestart</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.runIntegrationTests</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.libraryDirectory</name>
+ <value>${project.build.directory}/dependency/lib</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.outputDirectory</name>
+ <value>${project.build.directory}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+
+ <!--
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <version>3.1.0-Alpha1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jbossws</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-transaction-api</artifactId>
+ <groupId>org.jboss.javaee</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jboss.jbossws</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness-jboss-as-50</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>dump-test-artifacts</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-artifacts</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.jboss.testharness.api.TCK</mainClass>
+ <classpathScope>test</classpathScope>
+ <systemProperties>
+ <systemProperty>
+ <key>dumpArtifacts</key>
+ <value>true</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.testPackage</key>
+ <value>${project.groupId}</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.outputDirectory</key>
+ <value>${project.build.directory}/test-artifacts</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.libraryDirectory</key>
+ <value>${project.build.directory}/dependency/lib</value>
+ </systemProperty>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+</project>
Added: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/Booking.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/Booking.java (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/Booking.java 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,229 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.model;
+
+import static javax.persistence.TemporalType.DATE;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+/**
+ * <p><strong>Booking</strong> is the model/entity class that represents a hotel
+ * booking.</p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+@Entity
+class Booking implements Serializable
+{
+ private Long id;
+ private User user;
+ private Hotel hotel;
+ private Date checkinDate;
+ private Date checkoutDate;
+ private String creditCard;
+ private String creditCardName;
+ private int creditCardExpiryMonth;
+ private int creditCardExpiryYear;
+ private boolean smoking;
+ private int beds;
+
+ public Booking()
+ {
+ }
+
+ public Booking(Hotel hotel, User user)
+ {
+ this.hotel = hotel;
+ this.user = user;
+ }
+
+ @Id
+ @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @NotNull
+ @Temporal(DATE)
+ public Date getCheckinDate()
+ {
+ return checkinDate;
+ }
+
+ public void setCheckinDate(Date datetime)
+ {
+ this.checkinDate = datetime;
+ }
+
+ @NotNull
+ @ManyToOne
+ public Hotel getHotel()
+ {
+ return hotel;
+ }
+
+ public void setHotel(Hotel hotel)
+ {
+ this.hotel = hotel;
+ }
+
+ @NotNull
+ @ManyToOne
+ public User getUser()
+ {
+ return user;
+ }
+
+ public void setUser(User user)
+ {
+ this.user = user;
+ }
+
+ @NotNull
+ @Temporal(TemporalType.DATE)
+ public Date getCheckoutDate()
+ {
+ return checkoutDate;
+ }
+
+ public void setCheckoutDate(Date checkoutDate)
+ {
+ this.checkoutDate = checkoutDate;
+ }
+
+ @NotNull(message = "Credit card number is required")
+ @Size(min = 16, max = 16, message = "Credit card number must 16 digits long")
+ @Pattern(regexp = "^\\d*$", message = "Credit card number must be numeric")
+ public String getCreditCard()
+ {
+ return creditCard;
+ }
+
+ public void setCreditCard(String creditCard)
+ {
+ this.creditCard = creditCard;
+ }
+
+ public boolean isSmoking()
+ {
+ return smoking;
+ }
+
+ public void setSmoking(boolean smoking)
+ {
+ this.smoking = smoking;
+ }
+
+ public int getBeds()
+ {
+ return beds;
+ }
+
+ public void setBeds(int beds)
+ {
+ this.beds = beds;
+ }
+
+ @NotNull(message = "Credit card name is required")
+ @Size(min = 3, max = 70, message = "Credit card name is required")
+ public String getCreditCardName()
+ {
+ return creditCardName;
+ }
+
+ public void setCreditCardName(String creditCardName)
+ {
+ this.creditCardName = creditCardName;
+ }
+
+ public int getCreditCardExpiryMonth()
+ {
+ return creditCardExpiryMonth;
+ }
+
+ public void setCreditCardExpiryMonth(int creditCardExpiryMonth)
+ {
+ this.creditCardExpiryMonth = creditCardExpiryMonth;
+ }
+
+ public int getCreditCardExpiryYear()
+ {
+ return creditCardExpiryYear;
+ }
+
+ public void setCreditCardExpiryYear(int creditCardExpiryYear)
+ {
+ this.creditCardExpiryYear = creditCardExpiryYear;
+ }
+
+ @Transient
+ public String getDescription()
+ {
+ DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
+ return hotel == null ? null : hotel.getName() +
+ ", " + df.format(getCheckinDate()) +
+ " to " + df.format(getCheckoutDate());
+ }
+
+ @Transient
+ public BigDecimal getTotal()
+ {
+ return hotel.getPrice().multiply(new BigDecimal(getNights()));
+ }
+
+ @Transient
+ public int getNights()
+ {
+ return (int) (checkoutDate.getTime() - checkinDate.getTime()) / 1000 / 60 / 60 / 24;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Booking(" + user + ", " + hotel + ")";
+ }
+}
Added: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,156 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * <p><strong>Hotel</strong> is the model/entity class that represents a hotel.</p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+@Entity
+class Hotel implements Serializable
+{
+ private Long id;
+ private String name;
+ private String address;
+ private String city;
+ private String state;
+ private String zip;
+ private String country;
+ private BigDecimal price;
+
+ @Id
+ @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @Size(max = 50)
+ @NotNull
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @Size(max = 100)
+ @NotNull
+ public String getAddress()
+ {
+ return address;
+ }
+
+ public void setAddress(String address)
+ {
+ this.address = address;
+ }
+
+ @Size(max = 40)
+ @NotNull
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ @Size(min = 4, max = 6)
+ @NotNull
+ public String getZip()
+ {
+ return zip;
+ }
+
+ public void setZip(String zip)
+ {
+ this.zip = zip;
+ }
+
+ @Size(min = 2, max = 10)
+ @NotNull
+ public String getState()
+ {
+ return state;
+ }
+
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+
+ @Size(min = 2, max = 40)
+ @NotNull
+ public String getCountry()
+ {
+ return country;
+ }
+
+ public void setCountry(String country)
+ {
+ this.country = country;
+ }
+
+ @Column(precision = 6, scale = 2)
+ public BigDecimal getPrice()
+ {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price)
+ {
+ this.price = price;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
+ }
+}
Added: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/User.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/User.java (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/model/User.java 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.model;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+/**
+ * <p><strong>User</strong> is the model/entity class that represents a customer
+ * who may book a hotel.</p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+@Entity
+@Table(name = "Customer")
+class User implements Serializable
+{
+ private String username;
+ private String password;
+ private String name;
+
+ public User(String name, String password, String username)
+ {
+ this.name = name;
+ this.password = password;
+ this.username = username;
+ }
+
+ public User()
+ {
+ }
+
+ @NotNull
+ @Size(max = 100)
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @NotNull
+ @Size(min = 5, max = 15)
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ @Id
+ @Size(min = 4, max = 15)
+ @Pattern(regexp = "^\\w*$", message = "not a valid username")
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "User(" + username + ")";
+ }
+}
Added: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/BookingAgent.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/BookingAgent.java (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/BookingAgent.java 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
+
+import javax.ejb.Local;
+import org.jboss.seam.examples.booking.model.Booking;
+import org.jboss.seam.examples.booking.model.Hotel;
+
+/**
+ * @author Dan Allen
+ */
+public
+@Local
+interface BookingAgent
+{
+ void selectHotel(Hotel hotel);
+
+ void bookHotel();
+
+ void validateBooking();
+
+ void cancel();
+
+ void confirm();
+
+ Hotel getHotelSelection();
+
+ Booking getBooking();
+
+ boolean isBookingValid();
+
+ void destroy();
+}
Added: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/BookingAgentBean.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/BookingAgentBean.java (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/BookingAgentBean.java 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
+
+import java.util.Calendar;
+import static javax.persistence.PersistenceContextType.EXTENDED;
+import javax.annotation.Named;
+import javax.context.Conversation;
+import javax.context.ConversationScoped;
+import javax.context.RequestScoped;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Current;
+import javax.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.jboss.seam.examples.booking.model.Booking;
+import org.jboss.seam.examples.booking.model.Hotel;
+import org.jboss.seam.examples.booking.model.User;
+import org.jboss.seam.international.StatusMessages;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
+
+public
+@Named("bookingAgent")
+@Stateful
+@ConversationScoped
+class BookingAgentBean implements BookingAgent
+{
+ //private @Logger Log log;
+
+ @PersistenceContext(type = EXTENDED) EntityManager em;
+
+ @Current Conversation conversation;
+
+ @Current StatusMessages statusMessages;
+
+ private Hotel hotelSelection;
+
+ private Booking booking;
+
+ private boolean bookingValid;
+
+ public void selectHotel(Hotel hotel)
+ {
+ conversation.begin();
+ // get a fresh reference that's managed by the conversational persistence context
+ hotelSelection = em.find(Hotel.class, hotel.getId());
+ }
+
+ public void bookHotel()
+ {
+ // FIXME use current user
+ User user = em.find(User.class, "dan");
+ booking = new Booking(hotelSelection, user);
+ // push logic into Booking?
+ Calendar calendar = Calendar.getInstance();
+ booking.setCheckinDate(calendar.getTime());
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ booking.setCheckoutDate(calendar.getTime());
+ hotelSelection = null;
+ statusMessages.add("You've initiated a booking at {0}.", booking.getHotel().getName());
+ }
+
+ public void validateBooking()
+ {
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
+ if (booking.getCheckinDate().before(calendar.getTime()))
+ {
+ statusMessages.addToControl("booking:checkinDate:input", "Check in date must be a future date");
+ bookingValid = false;
+ }
+ else if (!booking.getCheckinDate().before(booking.getCheckoutDate()))
+ {
+ statusMessages.addToControl("booking:checkoutDate:input", "Check out date must be after check in date");
+ bookingValid = false;
+ }
+ else
+ {
+ bookingValid = true;
+ }
+ }
+
+ public void confirm()
+ {
+ em.persist(booking);
+ //log.info("New booking confirmed for...");
+ statusMessages.add("You're booked!");
+ conversation.end();
+ }
+
+ public void cancel()
+ {
+ booking = null;
+ hotelSelection = null;
+ conversation.end();
+ }
+
+ public
+ @Produces
+ @Named
+ @ConversationScoped
+ Booking getBooking()
+ {
+ return booking;
+ }
+
+ public
+ @Produces
+ @Named("hotel")
+ @RequestScoped
+ Hotel getHotelSelection()
+ {
+ return booking != null ? booking.getHotel() : hotelSelection;
+ }
+
+ public boolean isBookingValid()
+ {
+ return bookingValid;
+ }
+
+ @Remove
+ public void destroy()
+ {
+ }
+}
Added: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/HotelSearch.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/HotelSearch.java (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/HotelSearch.java 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
+
+import java.util.List;
+import javax.ejb.Local;
+import org.jboss.seam.examples.booking.model.Hotel;
+
+public
+@Local
+interface HotelSearch
+{
+ public void find();
+
+ public void previousPage();
+
+ public void nextPage();
+
+ public List<Hotel> getHotels();
+
+ public boolean isNextPageAvailable();
+
+ public boolean isPreviousPageAvailable();
+
+ public void destroy();
+}
Added: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/HotelSearchBean.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/HotelSearchBean.java (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/HotelSearchBean.java 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,112 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Named;
+import javax.context.SessionScoped;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Current;
+import javax.inject.Produces;
+import javax.inject.manager.Manager;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.jboss.seam.examples.booking.model.Hotel;
+
+public
+@Named("hotelSearch")
+@Stateful
+@SessionScoped
+class HotelSearchBean implements HotelSearch
+{
+ @Current Manager manager;
+ @Current SearchCriteria criteria;
+
+ private @PersistenceContext EntityManager em;
+ private boolean nextPageAvailable = false;
+ private List<Hotel> hotels = new ArrayList<Hotel>();
+
+ public void find()
+ {
+ criteria.firstPage();
+ queryHotels(criteria);
+ }
+
+ public void nextPage()
+ {
+ criteria.nextPage();
+ queryHotels(criteria);
+ }
+
+ public void previousPage()
+ {
+ criteria.previousPage();
+ queryHotels(criteria);
+ }
+
+ public
+ @Produces
+ @Named
+ //@RequestScoped // if enabled, variable doesn't get updated after the action is executed w/o a redirect
+ List<Hotel> getHotels()
+ {
+ return hotels;
+ }
+
+ public boolean isNextPageAvailable()
+ {
+ return nextPageAvailable;
+ }
+
+ public boolean isPreviousPageAvailable()
+ {
+ return criteria.getPage() > 0;
+ }
+
+ @Remove
+ public void destroy()
+ {
+ }
+
+ private void queryHotels(SearchCriteria criteria)
+ {
+ List<Hotel> results = em.createQuery(
+ "select h from Hotel h where lower(h.name) like :pattern or lower(h.city) like :pattern or lower(h.zip) like :pattern or lower(h.address) like :pattern").
+ setParameter("pattern", criteria.getSearchPattern()).setMaxResults(criteria.getPageSize() + 1).setFirstResult(criteria.getPage() * criteria.getPageSize()).
+ getResultList();
+
+ System.out.println("Found " + results.size() + " hotels");
+ nextPageAvailable = results.size() > criteria.getPageSize();
+ if (nextPageAvailable)
+ {
+ hotels = new ArrayList<Hotel>(results.subList(0, criteria.getPageSize()));
+ }
+ else
+ {
+ hotels = results;
+ }
+ }
+}
Added: examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/SearchCriteria.java
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/SearchCriteria.java (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/session/SearchCriteria.java 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
+
+import java.io.Serializable;
+import javax.annotation.Named;
+import javax.context.SessionScoped;
+
+public
+@Named
+@SessionScoped
+class SearchCriteria implements Serializable
+{
+ private static final char SQL_WILDCARD_CHAR = '%';
+ private static final String SQL_WILDCARD_STR = String.valueOf(SQL_WILDCARD_CHAR);
+ private static final String REPEAT_SQL_WIDCARD_REGEX = SQL_WILDCARD_STR + "+";
+ private static final char HUMAN_WILDCARD_CHAR = '*';
+
+ private String searchString = "";
+ private int pageSize = 5;
+ private int page = 0;
+
+ public String getSearchPattern()
+ {
+ if (searchString == null || searchString.length() == 0)
+ {
+ return SQL_WILDCARD_STR;
+ }
+
+ StringBuilder pattern = new StringBuilder();
+ pattern.append(searchString.toLowerCase().replace(HUMAN_WILDCARD_CHAR, SQL_WILDCARD_CHAR).replaceAll(REPEAT_SQL_WIDCARD_REGEX, SQL_WILDCARD_STR));
+ if (pattern.length() == 0 || pattern.charAt(0) != SQL_WILDCARD_CHAR)
+ {
+ pattern.insert(0, SQL_WILDCARD_CHAR);
+ }
+ if (pattern.length() > 1 && pattern.charAt(pattern.length() - 1) != SQL_WILDCARD_CHAR)
+ {
+ pattern.append(SQL_WILDCARD_CHAR);
+ }
+ return pattern.toString();
+ }
+
+ public int getPage()
+ {
+ return page;
+ }
+
+ public void setPage(int page)
+ {
+ this.page = page;
+ }
+
+ public int getPageSize()
+ {
+ return pageSize;
+ }
+
+ public void setPageSize(int pageSize)
+ {
+ this.pageSize = pageSize;
+ }
+
+ public String getSearchString()
+ {
+ return searchString;
+ }
+
+ public void setSearchString(String searchString)
+ {
+ this.searchString = (searchString != null ? searchString.trim() : null);
+ }
+
+ public void nextPage()
+ {
+ page++;
+ }
+
+ public void previousPage()
+ {
+ if (page > 0)
+ {
+ page--;
+ }
+ }
+
+ public void firstPage()
+ {
+ page = 0;
+ }
+}
Added: examples/trunk/booking/ejb-jar/src/main/resources/META-INF/beans.xml
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/resources/META-INF/beans.xml (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/resources/META-INF/beans.xml 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:faces="urn:java:org.jboss.seam.faces">
+ <Deploy>
+ <Standard/>
+ <Production/>
+ <faces:Faces/>
+ </Deploy>
+</Beans>
Added: examples/trunk/booking/ejb-jar/src/main/resources/META-INF/persistence.xml
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/resources/META-INF/persistence.xml (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/resources/META-INF/persistence.xml 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="booking">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>bookingDatasource</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <!-- These are the default for JBoss EJB 3, but not for Hibernate EntityManager -->
+ <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
+ <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: examples/trunk/booking/ejb-jar/src/main/resources/import.sql
===================================================================
--- examples/trunk/booking/ejb-jar/src/main/resources/import.sql (rev 0)
+++ examples/trunk/booking/ejb-jar/src/main/resources/import.sql 2009-04-29 06:33:45 UTC (rev 10713)
@@ -0,0 +1,24 @@
+insert into Customer (username, password, name) values ('gavin', 'mexico', 'Gavin King')
+insert into Customer (username, password, name) values ('pete', 'edinburgh', 'Pete Muir')
+insert into Customer (username, password, name) values ('shane', 'brisbane', 'Shane Bryzak')
+insert into Customer (username, password, name) values ('dan', 'maryland', 'Dan Allen')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (1, 120, 'Marriott Courtyard', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (2, 180, 'Doubletree', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (3, 450, 'W Hotel', 'Union Square, Manhattan', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (4, 450, 'W Hotel', 'Lexington Ave, Manhattan', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (5, 250, 'Hotel Rouge', '1315 16th Street NW', 'Washington', 'DC', '20036', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (6, 300, '70 Park Avenue Hotel', '70 Park Avenue', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (8, 300, 'Conrad Miami', '1395 Brickell Ave', 'Miami', 'FL', '33131', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (9, 80, 'Sea Horse Inn', '2106 N Clairemont Ave', 'Eau Claire', 'WI', '54703', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (10, 90, 'Super 8 Eau Claire Campus Area', '1151 W Macarthur Ave', 'Eau Claire', 'WI', '54701', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (11, 160, 'Marriot Downtown', '55 Fourth Street', 'San Francisco', 'CA', '94103', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (12, 200, 'Hilton Diagonal Mar', 'Passeig del Taulat 262-264', 'Barcelona', 'Catalunya', '08019', 'Spain')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (13, 210, 'Hilton Tel Aviv', 'Independence Park', 'Tel Aviv', '', '63405', 'Israel')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (14, 240, 'InterContinental Tokyo Bay', 'Takeshiba Pier', 'Tokyo', '', '105', 'Japan')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (15, 130, 'Hotel Beaulac', ' Esplanade Léopold-Robert 2', 'Neuchatel', '', '2000', 'Switzerland')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (16, 140, 'Conrad Treasury Place', 'William & George Streets', 'Brisbane', 'QLD', '4001', 'Australia')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (17, 230, 'Ritz Carlton', '1228 Sherbrooke St', 'West Montreal', 'Quebec', 'H3G1H6', 'Canada')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (18, 460, 'Ritz Carlton', 'Peachtree Rd, Buckhead', 'Atlanta', 'GA', '30326', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (19, 220, 'Swissotel', '68 Market Street', 'Sydney', 'NSW', '2000', 'Australia')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (20, 250, 'Meliá White House', 'Albany Street', 'Regents Park London', '', 'NW13UP', 'Great Britain')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (21, 210, 'Hotel Allegro', '171 West Randolph Street', 'Chicago', 'IL', '60601', 'USA')
15 years, 9 months
Seam SVN: r10712 - in examples/trunk/booking: war and 10 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-29 02:32:41 -0400 (Wed, 29 Apr 2009)
New Revision: 10712
Added:
examples/trunk/booking/war/
examples/trunk/booking/war/pom.xml
examples/trunk/booking/war/src/
examples/trunk/booking/war/src/main/
examples/trunk/booking/war/src/main/webapp/
examples/trunk/booking/war/src/main/webapp/WEB-INF/
examples/trunk/booking/war/src/main/webapp/WEB-INF/faces-config.xml
examples/trunk/booking/war/src/main/webapp/WEB-INF/fragments/
examples/trunk/booking/war/src/main/webapp/WEB-INF/fragments/hotel.xhtml
examples/trunk/booking/war/src/main/webapp/WEB-INF/layout/
examples/trunk/booking/war/src/main/webapp/WEB-INF/layout/template.xhtml
examples/trunk/booking/war/src/main/webapp/WEB-INF/web.xml
examples/trunk/booking/war/src/main/webapp/book.xhtml
examples/trunk/booking/war/src/main/webapp/confirm.xhtml
examples/trunk/booking/war/src/main/webapp/css/
examples/trunk/booking/war/src/main/webapp/css/screen.css
examples/trunk/booking/war/src/main/webapp/favicon.ico
examples/trunk/booking/war/src/main/webapp/home.xhtml
examples/trunk/booking/war/src/main/webapp/hotel.xhtml
examples/trunk/booking/war/src/main/webapp/img/
examples/trunk/booking/war/src/main/webapp/img/bg.gif
examples/trunk/booking/war/src/main/webapp/img/btn.bg.gif
examples/trunk/booking/war/src/main/webapp/img/cal-next.png
examples/trunk/booking/war/src/main/webapp/img/cal-prev.png
examples/trunk/booking/war/src/main/webapp/img/cnt.bg.gif
examples/trunk/booking/war/src/main/webapp/img/dtpick.gif
examples/trunk/booking/war/src/main/webapp/img/hdr.ad.jpg
examples/trunk/booking/war/src/main/webapp/img/hdr.bar.jpg
examples/trunk/booking/war/src/main/webapp/img/hdr.bg.gif
examples/trunk/booking/war/src/main/webapp/img/hdr.title.gif
examples/trunk/booking/war/src/main/webapp/img/header_line.gif
examples/trunk/booking/war/src/main/webapp/img/input.bg.gif
examples/trunk/booking/war/src/main/webapp/img/sdb.bg.gif
examples/trunk/booking/war/src/main/webapp/img/spinner.gif
examples/trunk/booking/war/src/main/webapp/img/th.bg.gif
examples/trunk/booking/war/src/main/webapp/index.html
examples/trunk/booking/war/src/main/webapp/main.xhtml
examples/trunk/booking/war/src/main/webapp/resources/
examples/trunk/booking/war/src/main/webapp/resources/property/
examples/trunk/booking/war/src/main/webapp/resources/property/display.xhtml
examples/trunk/booking/war/src/main/webapp/resources/property/edit.xhtml
Log:
recover from SVN move disaster
Property changes on: examples/trunk/booking/war
___________________________________________________________________
Name: svn:ignore
+ target
Added: examples/trunk/booking/war/pom.xml
===================================================================
--- examples/trunk/booking/war/pom.xml (rev 0)
+++ examples/trunk/booking/war/pom.xml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.seam.examples</groupId>
+ <artifactId>seam-booking</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>seam-booking-war</artifactId>
+ <packaging>war</packaging>
+ <name>Seam Booking Example (Web module)</name>
+
+ <build>
+ <defaultGoal>package</defaultGoal>
+ <finalName>${project.parent.artifactId}</finalName>
+ </build>
+
+ <dependencies>
+
+ <!--
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ -->
+
+ <!-- is this necessary? is it for upgrading to EL 1.2? -->
+ <!--
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+
+ <!--
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-faces</artifactId>
+ </dependency>
+ -->
+
+ <!-- pulled in by seam-el
+ <dependency>
+ <groupId>org.jboss.el</groupId>
+ <artifactId>jboss-el</artifactId>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+
+ </dependencies>
+
+</project>
Added: examples/trunk/booking/war/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/WEB-INF/faces-config.xml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
+
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+
+ <navigation-case>
+ <from-action>#{bookingAgent.cancel}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/main.xhtml</from-view-id>
+
+ <!-- navigation rules are required to reset request-scoped producer variables -->
+ <!--
+ <navigation-case>
+ <from-action>#{hotelSearch.find}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
+ <navigation-case>
+ <from-action>#{hotelSearch.nextPage}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
+ -->
+
+ <navigation-case>
+ <from-action>#{bookingAgent.selectHotel(_hotel)}</from-action>
+ <to-view-id>/hotel.xhtml</to-view-id>
+ <if>#{bookingAgent.hotelSelection != null}</if>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/hotel.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-action>#{bookingAgent.bookHotel}</from-action>
+ <to-view-id>/book.xhtml</to-view-id>
+ <if>#{bookingAgent.booking != null}</if>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/book.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-action>#{bookingAgent.validateBooking}</from-action>
+ <to-view-id>/confirm.xhtml</to-view-id>
+ <if>#{bookingAgent.bookingValid}</if>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/confirm.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-action>#{bookingAgent.confirm}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+</faces-config>
Added: examples/trunk/booking/war/src/main/webapp/WEB-INF/fragments/hotel.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/WEB-INF/fragments/hotel.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/WEB-INF/fragments/hotel.xhtml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,21 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:p="http://http://java.sun.com/jsf/composite/property">
+
+ <p:display label="Name" value="#{hotel.name}"/>
+ <p:display label="Address" value="#{hotel.address}"/>
+ <p:display label="City" value="#{hotel.city}"/>
+ <p:display label="State" value="#{hotel.state}"/>
+ <p:display label="Zip" value="#{hotel.zip}"/>
+ <p:display label="Country" value="#{hotel.country}"/>
+ <p:display label="Nightly rate" override="true">
+ <h:outputText value="#{hotel.price}">
+ <f:convertNumber type="currency" currencySymbol="$"/>
+ </h:outputText>
+ </p:display>
+
+</ui:composition>
Added: examples/trunk/booking/war/src/main/webapp/WEB-INF/layout/template.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/WEB-INF/layout/template.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/WEB-INF/layout/template.xhtml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,45 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"><ui:remove><!-- Using <f:view> as the root prevents conversation from propagating correctly--></ui:remove>
+ <h:head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>JBoss Suites: Seam Framework</title>
+ <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
+ <link href="#{request.contextPath}/css/screen.css" rel="stylesheet" type="text/css"/>
+ <ui:insert name="head"/>
+ </h:head>
+ <h:body>
+ <div id="document">
+ <div id="header">
+ <div id="title"><h:graphicImage value="/img/hdr.title.gif" alt="JBoss Suites: seam framework demo"/></div>
+ <div id="status">
+ <h:link id="about" outcome="/home.xhtml" value="About"/>
+ #{' | '}
+ <h:link id="search" outcome="/main.xhtml" value="Search"/>
+ <ui:remove><!--
+ Welcome #{user.name} or use (#{user.name})
+ | <h:link id="search" outcome="/main.xhtml" value="Search"/>
+ | <h:link id="settings" outcome="/password.xhtml" value="Settings"/>
+ | <s:link id="logout" action="#{identity.logout}" value="Logout"/>
+ --></ui:remove>
+ </div>
+ </div>
+ <div id="container">
+ <div id="sidebar">
+ <ui:insert name="sidebar"/>
+ </div>
+ <div id="content">
+ <ui:insert name="content"/>
+ </div>
+ </div>
+ <div id="footer">
+ Created with Seam 3.0, Web Beans, EJB 3.0 and JSF 2.0
+ <br/>
+ #{javax.context.conversation}
+ </div>
+ </div>
+ </h:body>
+</html>
Added: examples/trunk/booking/war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/WEB-INF/web.xml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <display-name>Seam Booking Example</display-name>
+
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.seam</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+ <security-constraint>
+ <display-name>Restrict access to XHTML documents</display-name>
+ <web-resource-collection>
+ <web-resource-name>XHTML</web-resource-name>
+ <url-pattern>*.xhtml</url-pattern>
+ </web-resource-collection>
+ <auth-constraint/>
+ </security-constraint>
+
+</web-app>
Added: examples/trunk/booking/war/src/main/webapp/book.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/book.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/book.xhtml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,115 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:p="http://http://java.sun.com/jsf/composite/property"
+ template="/WEB-INF/layout/template.xhtml">
+
+ <ui:define name="content">
+ <div class="section">
+ <h1>Book Hotel</h1>
+ </div>
+
+ <div class="section">
+ <div class="entry errors">
+ <h:messages id="messages" globalOnly="true"/>
+ </div>
+
+ <ui:include src="/WEB-INF/fragments/hotel.xhtml"/>
+
+ <div style="clear: both;"/>
+
+ <h:form id="booking">
+ <fieldset>
+
+ <p:edit id="checkinDate" label="Check-in date">
+ <h:inputText id="input" value="#{booking.checkinDate}">
+ <f:convertDateTime type="date" pattern="MM/dd/yyyy"/>
+ </h:inputText>
+ </p:edit>
+
+ <p:edit id="checkoutDate" label="Check-out date">
+ <h:inputText id="input" value="#{booking.checkoutDate}">
+ <f:convertDateTime type="date" pattern="MM/dd/yyyy"/>
+ </h:inputText>
+ </p:edit>
+
+ <p:edit id="beds" label="Room preference">
+ <h:selectOneMenu id="input" value="#{booking.beds}">
+ <f:selectItem itemLabel="One king-size bed" itemValue="1"/>
+ <f:selectItem itemLabel="Two double beds" itemValue="2"/>
+ <f:selectItem itemLabel="Three beds" itemValue="3"/>
+ </h:selectOneMenu>
+ </p:edit>
+
+ <p:edit id="smoking" label="Smoking preference">
+ <h:selectOneRadio id="input" value="#{booking.smoking}" layout="pageDirection" styleClass="radio">
+ <f:selectItem itemLabel="Smoking" itemValue="true"/>
+ <f:selectItem itemLabel="Non Smoking" itemValue="false"/>
+ </h:selectOneRadio>
+ </p:edit>
+
+ <p:edit id="creditCardName" label="Credit card name">
+ <h:inputText id="input" value="#{booking.creditCardName}"/>
+ </p:edit>
+
+ <p:edit id="creditCardNumber" label="Credit card #">
+ <h:inputText id="input" value="#{booking.creditCard}"/>
+ </p:edit>
+
+ <p:edit id="creditCardExpiry" label="Credit card expiry">
+ <h:selectOneMenu id="input" value="#{booking.creditCardExpiryMonth}">
+ <f:selectItem itemLabel="Jan" itemValue="1"/>
+ <f:selectItem itemLabel="Feb" itemValue="2"/>
+ <f:selectItem itemLabel="Mar" itemValue="3"/>
+ <f:selectItem itemLabel="Apr" itemValue="4"/>
+ <f:selectItem itemLabel="May" itemValue="5"/>
+ <f:selectItem itemLabel="Jun" itemValue="6"/>
+ <f:selectItem itemLabel="Jul" itemValue="7"/>
+ <f:selectItem itemLabel="Aug" itemValue="8"/>
+ <f:selectItem itemLabel="Sep" itemValue="9"/>
+ <f:selectItem itemLabel="Oct" itemValue="10"/>
+ <f:selectItem itemLabel="Nov" itemValue="11"/>
+ <f:selectItem itemLabel="Dec" itemValue="12"/>
+ </h:selectOneMenu>
+ <h:selectOneMenu id="input2" value="#{booking.creditCardExpiryYear}">
+ <f:selectItem itemLabel="2009" itemValue="2009"/>
+ <f:selectItem itemLabel="2010" itemValue="2010"/>
+ <f:selectItem itemLabel="2011" itemValue="2011"/>
+ <f:selectItem itemLabel="2012" itemValue="2012"/>
+ <f:selectItem itemLabel="2013" itemValue="2013"/>
+ </h:selectOneMenu>
+ </p:edit>
+
+ <div class="buttonBox">
+ <h:commandButton id="proceed" value="Proceed" action="#{bookingAgent.validateBooking}"/>
+ #{' '}
+ <h:commandButton id="cancel" value="Cancel" action="#{bookingAgent.cancel}" immediate="true"/>
+ </div>
+
+ </fieldset>
+ </h:form>
+ </div>
+
+ </ui:define>
+
+ <ui:define name="sidebar">
+
+ <h1>Workspace management</h1>
+ <p>
+ As you can see, Seam makes it easy to work in multiple windows or
+ multiple browser tabs. But you can even switch between multiple tasks
+ inside a single browser tab! The "Workspaces" section showcases this
+ advanced feature.
+ </p>
+ <p>
+ <a href="#" onclick="window.open('exp/workspaceExp.html','exp','width=752,height=500,scrollbars=yes');">
+ How does the workspace list work?
+ </a>
+ </p>
+
+ </ui:define>
+
+</ui:composition>
Added: examples/trunk/booking/war/src/main/webapp/confirm.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/confirm.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/confirm.xhtml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,63 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:p="http://http://java.sun.com/jsf/composite/property"
+ template="/WEB-INF/layout/template.xhtml">
+
+ <ui:define name="content">
+
+ <div class="section">
+ <h1>Confirm Hotel Booking</h1>
+ </div>
+
+ <div class="section">
+
+ <ui:include src="/WEB-INF/fragments/hotel.xhtml"/>
+
+ <p:display label="Total payment" override="true">
+ <h:outputText value="#{booking.total}">
+ <f:convertNumber type="currency" currencySymbol="$"/>
+ </h:outputText>
+ </p:display>
+
+ <p:display label="Check-in date" value="#{booking.checkinDate}"/>
+ <p:display label="Check-out date" value="#{booking.checkoutDate}"/>
+ <p:display label="Credit card #" value="#{booking.creditCard}"/>
+
+ <div class="buttonBox">
+ <h:form id="confirm">
+ <h:commandButton id="confirm" value="Confirm" action="#{bookingAgent.confirm}"/>
+ #{' '}
+ <h:button id="revise" value="Revise" outcome="/book.xhtml">
+ <f:param name="cid" value="#{javax.context.conversation.id}"/>
+ </h:button>
+ #{' '}
+ <h:commandButton id="cancel" value="Cancel" action="#{bookingAgent.cancel}" immediate="true"/>
+ </h:form>
+ </div>
+
+ </div>
+
+ </ui:define>
+
+ <ui:define name="sidebar">
+ <h1>Back button navigation</h1>
+ <p>
+ When you click "Confirm", the new booking is written to the database,
+ the conversation ends, and state associated with the conversation is
+ automatically destroyed by Seam. After you confirm your booking, try
+ hitting the back button on your web browser and clicking "Confirm"
+ again. Seam makes it easy implement applications that behave elegantly
+ in response to the back, forward and refresh buttons.
+ </p>
+ <p>
+ <a href="#" onclick="window.open('exp/confirmExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What happens when the conversation ends?
+ </a>
+ </p>
+ </ui:define>
+
+</ui:composition>
Added: examples/trunk/booking/war/src/main/webapp/css/screen.css
===================================================================
--- examples/trunk/booking/war/src/main/webapp/css/screen.css (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/css/screen.css 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,271 @@
+/* Setup defaults since variable in browsers
+----------------------------------------------- */
+body, div, span, dd, dt, dl, img, ul, ol, li, p, h1, h2, h3, h4, h5, form, hr, fieldset {
+ margin: 0;
+ padding: 0;
+}
+/* Element Defaults
+----------------------------------------------- */
+html {
+ height: 100%;
+ background-color: #DBD4C6;
+ overflow-y: scroll;
+}
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: small;
+ line-height: 1.25em;
+ color: #362F2D;
+ position: relative;
+ width: 760px;
+ height: 100%;
+ margin-left: auto;
+ margin-right: auto;
+}
+a img {
+ border: none;
+}
+.label {
+ font-weight: bold;
+ color: #5E5147;
+}
+input {
+ border: 1px solid #C3BBB6;
+ padding: 4px;
+ margin: 5px 0;
+ background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+}
+select {
+ border: 1px solid #C3BBB6;
+ padding: 4px;
+ margin: 5px 0;
+ background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+}
+ol, ul {
+ margin: 10px 0px 10px 6px;
+}
+li {
+ margin: 10px 12px;
+}
+fieldset {
+ border: 0;
+}
+/* Layout
+----------------------------------------------- */
+#document {
+ padding: 0 1px;
+ background: #fff url(../img/bg.gif) 0 0 repeat-y;
+ float: left;
+ border-bottom: 1px solid #C3BBB6;
+}
+#header {
+ float: left;
+ width: 758px;
+ height: 46px;
+ background: url(../img/hdr.bg.gif) 0 0 repeat-x;
+}
+#container {
+ float: left;
+ width: 758px;
+ background: url(../img/hdr.bar.jpg) 0 0 repeat-x;
+}
+#sidebar {
+ float: left;
+ width: 190px;
+ margin-top: 96px;
+ padding: 20px 10px 0 10px;
+ background: url(../img/sdb.bg.gif) 0 0 no-repeat;
+}
+#content {
+ float: left;
+ width: 548px;
+ margin-top: 75px;
+ padding-top: 5px;
+ background: #fff url(../img/cnt.bg.gif) 0 0 repeat-x;
+}
+#footer {
+ clear: both;
+ margin-top: 40px;
+ float: left;
+ padding: 20px;
+ border-top: 1px solid #C3BBB6;
+ background-color: #fff;
+ width: 718px;
+ text-align: right;
+}
+/* General
+----------------------------------------------- */
+input[type="submit"], input[type="button"] {
+ font-weight: bold;
+ color: #fff;
+ border: 1px solid #5D1414;
+ height: 26px;
+ background: #fff url(../img/btn.bg.gif) 0 0 repeat-x;
+ border-style: none;
+}
+.center {
+ text-align: center;
+}
+.entry {
+ clear: both;
+ padding-top: 10px;
+}
+.entry .label {
+ float: left;
+ padding-right: 5px;
+ font-weight: bold;
+ width: 160px;
+ text-align: right;
+}
+.entry .input, .entry .output, .entry .error {
+ float: right;
+ width: 350px;
+ text-align: left;
+}
+/* Sidebar
+----------------------------------------------- */
+.notes {
+ text-align: center;
+ font-size: small;
+}
+.subnotes {
+ margin-top: 1em;
+ font-size: small;
+}
+.errors {
+ font-size: small;
+ font-weight: bold;
+ text-align: center;
+ color: #600;
+}
+.errors div {
+ text-align: left;
+}
+.errors span {
+ text-align: left;
+}
+.errors input {
+ border: 1px solid #600;
+}
+.errors ul {
+ list-style: none;
+}
+.buttonBox {
+ text-align: center;
+ padding: 5px 0;
+ clear: both;
+}
+#sidebar p {
+ font-size: small;
+ color: #8B7869;
+ line-height: 150%;
+ padding-bottom: 10px;
+}
+#sidebar li {
+ font-size: small;
+ color: #8B7869;
+}
+#sidebar h1 {
+ line-height: normal;
+ font-weight: bold;
+ font-size: small;
+}
+/*
+#sidebar p:hover {
+ color: #362F2D;
+}
+*/
+/* Content
+----------------------------------------------- */
+#content .section {
+ float: left;
+ width: 518px;
+ padding: 15px 15px 0 15px;
+}
+#content .section h1 {
+ font-family: "Trebuchet MS", Arial, sans-serif;
+ line-height: normal;
+ font-weight: normal;
+ font-size: large;
+}
+#content .section p {
+ line-height: 150%;
+ padding: 10px 0;
+ font-size: small;
+}
+#content table {
+ width: 100%;
+ border: 1px solid #D2C9C4;
+ border-collapse: collapse;
+}
+#content table caption {
+ padding-bottom: 6px;
+ text-align: left;
+ font-weight: bold;
+}
+#content table thead th {
+ border-left: 1px solid #D2C9C4;
+ background: #fff url(../img/th.bg.gif) 0 100% repeat-x;
+ border-bottom: 1px solid #D2C9C4;
+ padding: 6px;
+ text-align: left;
+ font-size: small;
+}
+#content table tbody td {
+ border-left: 1px solid #E4DBD5;
+ padding: 4px;
+ border-bottom: 1px solid #D2C9C4;
+ font-size: small;
+}
+td.action {
+ text-align: center;
+}
+#content dt {
+ font-weight: bold;
+ float: left;
+ width: 33%;
+}
+#content dd {
+ padding-left: 10px;
+ float: left;
+ width: 66%;
+}
+#content table.radio {
+ border: 0px;
+}
+#content table.radio tbody tr td {
+ border: 0px;
+ border-left: 0px;
+ border-bottom: 0px;
+}
+/* Header
+----------------------------------------------- */
+#title {
+ float: left;
+ padding: 1px 0 6px 15px;
+}
+#status {
+ color: #C7B299;
+ float: right;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ font-size: x-small;
+ text-align: right;
+ padding-top: 14px;
+ padding-right: 15px;
+}
+#status a {
+ color: #C7B299;
+ text-decoration: none;
+}
+/* Homepage Modifications
+----------------------------------------------- */
+#pgHome #container {
+ background: url(../img/hdr.ad.jpg) 0 0 repeat-x;
+}
+#pgHome #sidebar {
+ margin-top: 207px;
+}
+#pgHome #content {
+ margin-top: 183px;
+}
Added: examples/trunk/booking/war/src/main/webapp/favicon.ico
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/favicon.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/home.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/home.xhtml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,87 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+ <title>JBoss Suites: Seam Framework</title>
+ <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
+ <link href="#{request.contextPath}/css/screen.css" rel="stylesheet" type="text/css"/>
+ </head>
+ <body id="pgHome">
+ <f:view>
+ <div id="document">
+ <div id="header">
+ <div id="title"><h:graphicImage value="/img/hdr.title.gif" alt="JBoss Suites: seam framework demo"/></div>
+ </div>
+ <div id="container">
+ <div id="sidebar">
+ <h:link id="search" outcome="/main.xhtml" value="Search"/>
+ <ui:remove>
+ <h:form id="login">
+ <fieldset>
+ <div>
+ <h:outputLabel id="UsernameLabel" for="username">Login Name</h:outputLabel>
+ <h:inputText id="username" value="#{identity.username}" style="width: 175px;"/>
+ <div class="errors"><h:message id="UsernameMessage" for="username"/></div>
+ </div>
+ <div>
+ <h:outputLabel id="PasswordLabel" for="password">Password</h:outputLabel>
+ <h:inputSecret id="password" value="#{identity.password}" style="width: 175px;"/>
+ </div>
+ <div class="errors"><h:messages id="messages" globalOnly="true"/></div>
+ <div class="buttonBox"><h:commandButton id="login" action="#{identity.login}" value="Account Login"/></div>
+ <div class="notes"><!--<h:link id="register" outcome="/register.xhtml" value="Register New User"/>--></div>
+ <div class="subnotes">
+ Or use a demo account:
+ <ul>
+ <li>gavin/mexico</li>
+ <li>pete/edinburgh</li>
+ <li>shane/brisbane</li>
+ <li>dan/maryland</li>
+ </ul>
+ </div>
+ </fieldset>
+ </h:form>
+ </ui:remove>
+ </div>
+ <div id="content">
+ <div class="section">
+
+ <h1>About this example application</h1>
+
+ <p>
+ This sample application demonstrates how easy it is to develop stateful web
+ applications using JBoss Seam. Just register, login, and book a room to see
+ Seam in action. Throughout the application you'll see popup links like
+ the ones at the bottom of this page. Click them to see how the application
+ works under the hood.
+ </p>
+
+ <p>
+ Note: Please do NOT enter personal information or your credit card number in
+ this sample application.
+ </p>
+
+ <p>
+ <a href="#" onclick="window.open('exp/introExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What is JBoss Seam?
+ </a>
+ </p>
+
+ <p>
+ <a href="#" onclick="window.open('exp/loginExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What happens when I login?
+ </a>
+ </p>
+
+ </div>
+ </div>
+ </div>
+ <div id="footer">Created with Seam 3.0, Web Beans, EJB 3.0 and JSF 2.0</div>
+ </div>
+ </f:view>
+ </body>
+</html>
Added: examples/trunk/booking/war/src/main/webapp/hotel.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/hotel.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/hotel.xhtml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,54 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ template="/WEB-INF/layout/template.xhtml">
+
+ <ui:define name="content">
+
+ <div class="section">
+ <h1>View Hotel</h1>
+ </div>
+
+ <div class="section">
+ <ui:include src="/WEB-INF/fragments/hotel.xhtml"/>
+
+ <div class="buttonBox">
+ <h:form id="actions">
+ <h:commandButton id="bookHotel" action="#{bookingAgent.bookHotel}" value="Book Hotel"/>
+ #{' '}
+ <h:commandButton id="cancel" action="#{bookingAgent.cancel}" value="Return to Search" immediate="true"/>
+ </h:form>
+ </div>
+
+ </div>
+
+ </ui:define>
+
+ <ui:define name="sidebar">
+
+ <h1>Don't kill your database</h1>
+ <p>
+ Keeping conversational state in memory in the middle tier is a great
+ way to improve your application's scalability. It saves hitting the
+ database every time we refresh a page, to re-read the data we were
+ just looking at five seconds ago. By using Seam's conversation
+ context, we get a natural cache of data associated with the what the
+ user is currently doing. By nature, this cache has a more efficient
+ eviction policy than the MRU-type algorithms used by a typical
+ second-level data cache in an O/R mapping engine like Hibernate (at
+ least for some kinds of data). Of course, you should use a clever
+ combination of second-level caching and conversational data caching to
+ achieve the best performance for your application.
+ </p>
+ <p>
+ <a href="#" onclick="window.open('exp/bookingExp.html','exp','width=752,height=500,scrollbars=yes');">
+ How does the hotel booking wizard work?
+ </a>
+ </p>
+
+ </ui:define>
+
+</ui:composition>
Added: examples/trunk/booking/war/src/main/webapp/img/bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/btn.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/btn.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/cal-next.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/cal-next.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/cal-prev.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/cal-prev.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/cnt.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/cnt.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/dtpick.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/dtpick.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/hdr.ad.jpg
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/hdr.ad.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/hdr.bar.jpg
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/hdr.bar.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/hdr.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/hdr.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/hdr.title.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/hdr.title.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/header_line.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/header_line.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/input.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/input.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/sdb.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/sdb.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/spinner.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/spinner.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/img/th.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/war/src/main/webapp/img/th.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/war/src/main/webapp/index.html
===================================================================
--- examples/trunk/booking/war/src/main/webapp/index.html (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/index.html 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1 @@
+<html><head><meta http-equiv="Refresh" content="0; URL=home.seam"/></head></html>
Added: examples/trunk/booking/war/src/main/webapp/main.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/main.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/main.xhtml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,174 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ template="/WEB-INF/layout/template.xhtml">
+
+ <ui:define name="head">
+ <script type="text/javascript">
+function controlSpinner(behavior)
+{
+ if (behavior.name == 'begin')
+ {
+ document.getElementById('activity').style.display = 'inline';
+ }
+ else if (behavior.name == 'complete')
+ {
+ document.getElementById('activity').style.display = 'none';
+ }
+}
+ </script>
+ </ui:define>
+
+ <ui:define name="content">
+
+ <div class="section">
+
+ <span class="errors">
+ <h:messages id="messages" globalOnly="true"/>
+ </span>
+
+ <h1>Search Hotels</h1>
+
+ <h:form id="searchForm" prependId="false">
+ <fieldset>
+ <h:inputText id="searchString" value="#{searchCriteria.searchString}" style="width: 165px;">
+ <f:ajax event="keyup" listener="#{hotelSearch.find}" render="searchResults" onevent="controlSpinner"/>
+ </h:inputText>
+ #{' '}
+ <h:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}">
+ <f:ajax listener="#{hotelSearch.find}" execute="searchString" render="searchResults" onevent="controlSpinner"/>
+ </h:commandButton>
+ #{' '}
+ <span id="activity" style="display: none;"><h:graphicImage id="spinner" value="/img/spinner.gif"/></span>
+ <br/>
+ <h:outputLabel id="lblPageSize" for="pageSize" value="Maximum results:"/>
+ #{' '}
+ <h:selectOneMenu id="pageSize" value="#{searchCriteria.pageSize}">
+ <f:selectItem itemLabel="5" itemValue="5"/>
+ <f:selectItem itemLabel="10" itemValue="10"/>
+ <f:selectItem itemLabel="20" itemValue="20"/>
+ </h:selectOneMenu>
+ </fieldset>
+ </h:form>
+ </div>
+
+ <h:panelGroup id="searchResults">
+ <div class="section">
+ <h:outputText id="noHotelsMsg" value="No Hotels Found" rendered="#{empty hotels}"/>
+ <h:form id="hotelSelectionForm">
+ <h:dataTable id="hotels" value="#{hotels}" var="_hotel" rendered="#{not empty hotels}"
+ columnClasses=",,,,action">
+ <h:column id="nameCol">
+ <f:facet id="nameFct" name="header">Name</f:facet>
+ #{_hotel.name}
+ </h:column>
+ <h:column id="addressCol">
+ <f:facet id="addressFct" name="header">Address</f:facet>
+ #{_hotel.address}
+ </h:column>
+ <h:column id="locationCol">
+ <f:facet id="locationFct" name="header">Location</f:facet>
+ #{_hotel.city}, #{_hotel.state}, #{_hotel.country}
+ </h:column>
+ <h:column id="zipCol">
+ <f:facet id="zipFct" name="header">Zip</f:facet>
+ #{_hotel.zip}
+ </h:column>
+ <h:column id="actionCol">
+ <f:facet id="actionFct" name="header">Action</f:facet>
+ <h:commandLink id="view" value="View" action="#{bookingAgent.selectHotel(_hotel)}" style="white-space: nowrap;"/>
+ <ui:remove>
+ <h:commandButton id="view" value="View" action="#{bookingAgent.selectHotel(_hotel)}"/>
+ </ui:remove>
+ </h:column>
+ </h:dataTable>
+ </h:form>
+ <h:form id="paginationForm">
+ <h:commandButton id="previousResults" value="Previous page" action="#{hotelSearch.previousPage}" rendered="#{hotelSearch.previousPageAvailable}"/>
+ #{' '}
+ <h:commandButton id="moreResults" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
+ <ui:remove>
+ <!-- links in Mojarra are broken -->
+ <h:commandLink id="previousResults" value="More results" action="#{hotelSearch.previousPage}" rendered="#{hotelSearch.previousPageAvailable}">
+ <f:ajax listener="#{hotelSearch.previousPage}" render="searchResults"/>
+ </h:commandLink>
+ <h:commandLink id="moreResults" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}">
+ <f:ajax listener="#{hotelSearch.nextPage}" render="searchResults"/>
+ </h:commandLink>
+ </ui:remove>
+ </h:form>
+ </div>
+ </h:panelGroup>
+
+<ui:remove>
+<!--
+<div class="section">
+ <h1>Current Hotel Bookings</h1>
+</div>
+<div class="section">
+ <h:form id="bookings">
+ <h:outputText id="NoBookingsFoundMessage" value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
+ <h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
+ <h:column id="column1">
+ <f:facet id="NameFacet" name="header">Name</f:facet>
+ #{book.hotel.name}
+ </h:column>
+ <h:column id="column2">
+ <f:facet id="AddressFacet" name="header">Address</f:facet>
+ #{book.hotel.address}
+ </h:column>
+ <h:column id="column3">
+ <f:facet id="CityStateFacet" name="header">City, State</f:facet>
+ #{book.hotel.city}, #{book.hotel.state}
+ </h:column>
+ <h:column id="column4">
+ <f:facet id="CheckInDateFacet" name="header">Check in date</f:facet>
+ <h:outputText id="BookingCheckInDate" value="#{book.checkinDate}"/>
+ </h:column>
+ <h:column id="column5">
+ <f:facet id="CheckOutDateFacet" name="header">Check out date</f:facet>
+ <h:outputText id="BookingCheckOutDate" value="#{book.checkoutDate}"/>
+ </h:column>
+ <h:column id="column6">
+ <f:facet id="ConfNumberFacet" name="header">Confirmation number</f:facet>
+ #{book.id}
+ </h:column>
+ <h:column id="column7">
+ <f:facet id="ActionFacet" name="header">Action</f:facet>
+ <h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
+ </h:column>
+ </h:dataTable>
+ </h:form>
+</div>
+-->
+</ui:remove>
+
+ </ui:define>
+
+ <ui:define name="sidebar">
+
+ <h1>State management in Seam</h1>
+ <p>
+ State in Seam is <em>contextual</em>. When you click "Find Hotels", the application
+ retrieves a list of hotels from the database and caches it in the session context. When you
+ navigate to one of the hotel records by clicking the "View Hotel" link, a <em>conversation</em>
+ begins. The conversation is attached to a particular tab, in a particular browser window. You can
+ navigate to multiple hotels using "open in new tab" or "open in new window" in your web browser.
+ Each window will execute in the context of a different conversation. The application keeps state
+ associated with your hotel booking in the conversation context, which ensures that the concurrent
+ conversations do not interfere with each other.
+ </p>
+
+ <p>
+ <a href="#" onclick="window.open('exp/mainExp.html','exp','width=752,height=500,scrollbars=yes');">
+ How does the search page work?
+ </a>
+ </p>
+
+ </ui:define>
+
+</ui:composition>
Added: examples/trunk/booking/war/src/main/webapp/resources/property/display.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/resources/property/display.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/resources/property/display.xhtml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,30 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:comp="http://java.sun.com/jsf/composite">
+
+ <comp:interface>
+ <comp:attribute name="label" required="true"/>
+ <comp:attribute name="value" required="false"/>
+ <comp:attribute name="override" required="false" default="false"/>
+ </comp:interface>
+
+ <!-- the override is a workaround because assigning an id to the output dynamically is not working -->
+ <!-- TODO allow for a template to be specified, falling back to a default -->
+ <comp:implementation>
+ <div class="entry">
+ <span class="label">#{cc.attrs.label}:</span>
+ <span class="output">
+ <c:choose>
+ <c:when test="#{cc.attrs.override}"><comp:insertChildren/></c:when>
+ <c:otherwise>#{cc.attrs.value}</c:otherwise>
+ </c:choose>
+ </span>
+ </div>
+ </comp:implementation>
+
+</ui:composition>
Added: examples/trunk/booking/war/src/main/webapp/resources/property/edit.xhtml
===================================================================
--- examples/trunk/booking/war/src/main/webapp/resources/property/edit.xhtml (rev 0)
+++ examples/trunk/booking/war/src/main/webapp/resources/property/edit.xhtml 2009-04-29 06:32:41 UTC (rev 10712)
@@ -0,0 +1,35 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:comp="http://java.sun.com/jsf/composite">
+
+ <comp:interface>
+ <comp:attribute name="label" required="true"/>
+ <comp:attribute name="required" required="false"/>
+ </comp:interface>
+
+ <!-- TODO allow for a template to be specified, falling back to a default -->
+ <!-- TODO detect required from child or from bean validation annotation -->
+ <comp:implementation>
+
+ <c:set var="required" value="#{cc.attrs.required eq null ? true : cc.attrs.required}"/>
+ <c:set var="invalid" value="#{not empty facesContext.getMessageList(cc.clientId.concat(':input'))}"/>
+
+ <div class="entry">
+ <h:outputLabel value="#{cc.attrs.label}:" for="input" styleClass="label#{invalid ? ' errors' : ''}">
+ <c:if test="#{required}"><span class="required">*</span></c:if>
+ </h:outputLabel>
+ <span class="input#{invalid ? ' errors' : ''}">
+ <comp:insertChildren/>
+ </span>
+ <h:message for="input" styleClass="error errors"/>
+ </div>
+
+ </comp:implementation>
+
+
+</ui:composition>
15 years, 9 months
Seam SVN: r10711 - examples/trunk/booking.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-29 02:27:07 -0400 (Wed, 29 Apr 2009)
New Revision: 10711
Modified:
examples/trunk/booking/pom.xml
Log:
rename module folders to unqualified name
Modified: examples/trunk/booking/pom.xml
===================================================================
--- examples/trunk/booking/pom.xml 2009-04-29 06:23:17 UTC (rev 10710)
+++ examples/trunk/booking/pom.xml 2009-04-29 06:27:07 UTC (rev 10711)
@@ -16,9 +16,9 @@
<description>The Seam booking example for deployment to a Java EE 5 application server</description>
<modules>
- <module>${project.artifactId}-ejb</module>
- <module>${project.artifactId}-war</module>
- <module>${project.artifactId}-ear</module>
+ <module>ejb-jar</module>
+ <module>war</module>
+ <module>ear</module>
</modules>
<build>
15 years, 9 months
Seam SVN: r10710 - examples/trunk/booking.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-29 02:23:17 -0400 (Wed, 29 Apr 2009)
New Revision: 10710
Removed:
examples/trunk/booking/seam-booking-ejb/
Log:
rename folders to unqualified name
15 years, 9 months
Seam SVN: r10709 - examples/trunk/booking.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-29 02:21:19 -0400 (Wed, 29 Apr 2009)
New Revision: 10709
Removed:
examples/trunk/booking/seam-booking-war/
Log:
half of rename folder
15 years, 9 months
Seam SVN: r10708 - in examples/trunk/booking: ear and 1 other directory.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-29 02:20:39 -0400 (Wed, 29 Apr 2009)
New Revision: 10708
Added:
examples/trunk/booking/ear/
examples/trunk/booking/ear/pom.xml
Removed:
examples/trunk/booking/ear/pom.xml
examples/trunk/booking/seam-booking-ear/
Log:
rename folders to unqualified name
Copied: examples/trunk/booking/ear (from rev 10613, examples/trunk/booking/seam-booking-ear)
Deleted: examples/trunk/booking/ear/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-ear/pom.xml 2009-04-23 16:04:24 UTC (rev 10613)
+++ examples/trunk/booking/ear/pom.xml 2009-04-29 06:20:39 UTC (rev 10708)
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.jboss.seam.examples</groupId>
- <artifactId>seam-booking</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>seam-booking-ear</artifactId>
- <packaging>ear</packaging>
- <name>Seam Booking Example (Enterprise application)</name>
-
- <build>
- <defaultGoal>package</defaultGoal>
- <finalName>${project.parent.artifactId}</finalName>
- <plugins>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ear-plugin</artifactId>
- <configuration>
- <defaultJavaBundleDir>lib</defaultJavaBundleDir>
- <jboss>
- <version>4.2</version>
- <!-- loader-repository gets added automatically by Web Beans -->
- <!--<loader-repository>${project.groupId}:loader=${project.build.finalName}</loader-repository>-->
- <data-sources>
- <data-source>${project.parent.artifactId}-ds.xml</data-source>
- </data-sources>
- </jboss>
- <modules>
- <webModule>
- <groupId>${project.groupId}</groupId>
- <artifactId>seam-booking-war</artifactId>
- <contextRoot>/seam-booking</contextRoot>
- </webModule>
- </modules>
- </configuration>
- </plugin>
-
- </plugins>
- </build>
-
- <dependencies>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>${project.parent.artifactId}-ejb</artifactId>
- <type>ejb</type>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>${project.parent.artifactId}-war</artifactId>
- <type>war</type>
- </dependency>
-
- </dependencies>
-</project>
Copied: examples/trunk/booking/ear/pom.xml (from rev 10707, examples/trunk/booking/seam-booking-ear/pom.xml)
===================================================================
--- examples/trunk/booking/ear/pom.xml (rev 0)
+++ examples/trunk/booking/ear/pom.xml 2009-04-29 06:20:39 UTC (rev 10708)
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.seam.examples</groupId>
+ <artifactId>seam-booking</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>seam-booking-ear</artifactId>
+ <packaging>ear</packaging>
+ <name>Seam Booking Example (Enterprise application)</name>
+
+ <build>
+ <defaultGoal>package</defaultGoal>
+ <finalName>${project.parent.artifactId}</finalName>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <defaultJavaBundleDir>lib</defaultJavaBundleDir>
+ <jboss>
+ <version>4.2</version>
+ <!-- loader-repository gets added automatically by Web Beans -->
+ <!--<loader-repository>${project.groupId}:loader=${project.build.finalName}</loader-repository>-->
+ <data-sources>
+ <data-source>${project.parent.artifactId}-ds.xml</data-source>
+ </data-sources>
+ </jboss>
+ <modules>
+ <webModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>seam-booking-war</artifactId>
+ <contextRoot>/seam-booking</contextRoot>
+ </webModule>
+ </modules>
+ <version>5</version>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <id>explode</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>explode-to-jboss-as</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <property name="archive.name" value="${project.build.finalName}"/>
+ <property name="ear.staging.dir" value="${project.build.directory}/${archive.name}"/>
+ <property name="ejb-jar.staging.dir" value="../${archive.name}-ejb/target/classes"/>
+ <property name="war.staging.dir" value="../${archive.name}-war/target/${archive.name}"/>
+
+ <property name="ear.deploy.dir" value="${jboss.home}/server/${jboss.domain}/deploy/${archive.name}.ear"/>
+ <property name="ejb-jar.deploy.dir" value="${ear.deploy.dir}/${archive.name}-ejb.jar"/>
+ <property name="war.deploy.dir" value="${ear.deploy.dir}/${archive.name}.war"/>
+
+ <condition property="deployed">
+ <available file="${ear.deploy.dir}"/>
+ </condition>
+
+ <mkdir dir="${ear.deploy.dir}"/>
+ <mkdir dir="${ejb-jar.deploy.dir}"/>
+ <mkdir dir="${war.deploy.dir}"/>
+
+ <copy todir="${ejb-jar.deploy.dir}" verbose="false" preservelastmodified="true" includeEmptyDirs="false">
+ <fileset dir="${ejb-jar.staging.dir}"/>
+ </copy>
+
+ <!-- Read as: if none of the files in EJB-JAR are newer than application.xml, set the property ejb-jar.unchanged -->
+ <uptodate property="ejb-jar.unchanged" targetfile="${ear.deploy.dir}/META-INF/application.xml">
+ <srcfiles dir="${ejb-jar.deploy.dir}" includes="**/*"/>
+ </uptodate>
+
+ <copy todir="${war.deploy.dir}" verbose="false" preservelastmodified="true" includeEmptyDirs="false">
+ <fileset dir="${war.staging.dir}"/>
+ </copy>
+
+ <!-- Read as: if none of the config files in WAR are newer than application.xml, set the property webapp-config.unchanged -->
+ <uptodate property="webapp-config.unchanged" targetfile="${ear.deploy.dir}/META-INF/application.xml">
+ <srcfiles dir="${war.deploy.dir}">
+ <include name="WEB-INF/web.xml"/>
+ </srcfiles>
+ </uptodate>
+
+ <!-- Only touch application.xml if the application is not deployed, a file in EJB-JAR has changed or a webapp config file has changed -->
+ <condition property="restart">
+ <or>
+ <not><isset property="deployed"/></not>
+ <not><isset property="ejb-jar.unchanged"/></not>
+ <not><isset property="webapp-config.unchanged"/></not>
+ </or>
+ </condition>
+
+ <!-- do a checksum to see if application.xml, jboss-app.xml, or -ds.xml need to be updated -->
+ <!-- this copy implicitly touches application.xml if the restart property is set since it is generated each time -->
+ <copy todir="${ear.deploy.dir}" verbose="false" preservelastmodified="true" includeEmptyDirs="false">
+ <fileset dir="${ear.staging.dir}">
+ <include name="**/*" if="restart"/>
+ <exclude name="**/*" unless="restart"/>
+ <exclude name="*.war"/>
+ <exclude name="*.jar"/>
+ </fileset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>restart</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>restart-on-jboss-as</id>
+ <phase>validate</phase>
+ <configuration>
+ <tasks>
+ <property name="deploy.dir" value="${jboss.home}/server/${jboss.domain}/deploy"/>
+ <property name="ear.archive.name" value="${project.build.finalName}.ear"/>
+ <property name="ear.deploy.dir" value="${deploy.dir}/${ear.archive.name}"/>
+ <available property="deployed" file="${ear.deploy.dir}/META-INF/application.xml" type="file"/>
+ <touch>
+ <fileset dir="${deploy.dir}">
+ <include name="${ear.archive.name}/META-INF/application.xml" if="deployed"/>
+ </fileset>
+ </touch>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>undeploy</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>undeploy-from-jboss-as</id>
+ <phase>validate</phase>
+ <configuration>
+ <tasks>
+ <property name="ear.deploy.dir" value="${jboss.home}/server/${jboss.domain}/deploy/${project.build.finalName}.ear"/>
+ <delete dir="${ear.deploy.dir}" quiet="true" failonerror="true"/>
+ <delete file="${ear.deploy.dir}" quiet="true" failonerror="true"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.parent.artifactId}-ejb</artifactId>
+ <type>ejb</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.parent.artifactId}-war</artifactId>
+ <type>war</type>
+ </dependency>
+
+ </dependencies>
+</project>
15 years, 9 months
Seam SVN: r10707 - in examples/trunk/booking: seam-booking-ear and 14 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-29 02:07:09 -0400 (Wed, 29 Apr 2009)
New Revision: 10707
Added:
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/BookingAgent.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/BookingAgentBean.java
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/fragments/
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/fragments/hotel.xhtml
examples/trunk/booking/seam-booking-war/src/main/webapp/book.xhtml
examples/trunk/booking/seam-booking-war/src/main/webapp/confirm.xhtml
examples/trunk/booking/seam-booking-war/src/main/webapp/hotel.xhtml
examples/trunk/booking/seam-booking-war/src/main/webapp/resources/
examples/trunk/booking/seam-booking-war/src/main/webapp/resources/property/
examples/trunk/booking/seam-booking-war/src/main/webapp/resources/property/display.xhtml
examples/trunk/booking/seam-booking-war/src/main/webapp/resources/property/edit.xhtml
Removed:
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/
examples/trunk/booking/seam-booking-war/src/main/java/
Modified:
examples/trunk/booking/pom.xml
examples/trunk/booking/seam-booking-ear/pom.xml
examples/trunk/booking/seam-booking-ejb/pom.xml
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/HotelSearch.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/HotelSearchBean.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/SearchCriteria.java
examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/beans.xml
examples/trunk/booking/seam-booking-war/pom.xml
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml
examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css
examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml
Log:
major update including full booking flow
Modified: examples/trunk/booking/pom.xml
===================================================================
--- examples/trunk/booking/pom.xml 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/pom.xml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -26,6 +26,7 @@
<pluginManagement>
<plugins>
+ <!-- version matrix or parent? -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
@@ -34,6 +35,7 @@
</configuration>
</plugin>
+ <!-- version matrix or parent? -->
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
@@ -45,6 +47,12 @@
</pluginManagement>
</build>
+ <properties>
+ <!-- To override jboss.home, set the jboss.home property in an active profile in the Maven 2 settings.xml file -->
+ <jboss.home>${env.JBOSS_HOME}</jboss.home>
+ <jboss.domain>default</jboss.domain>
+ </properties>
+
<profiles>
<profile>
@@ -54,6 +62,14 @@
</properties>
</profile>
+ <profile>
+ <id>undeploy</id>
+ </profile>
+
+ <profile>
+ <id>restart</id>
+ </profile>
+
</profiles>
<dependencyManagement>
@@ -78,12 +94,14 @@
<dependencies>
+ <!--
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
+ -->
</dependencies>
Modified: examples/trunk/booking/seam-booking-ear/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-ear/pom.xml 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-ear/pom.xml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -19,17 +19,7 @@
<finalName>${project.parent.artifactId}</finalName>
<plugins>
- <!--
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jboss-maven-plugin</artifactId>
- <configuration>
- <fileName>${project.build.directory}/${project.build.finalName}</fileName>
- </configuration>
- </plugin>
- -->
-
- <plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<defaultJavaBundleDir>lib</defaultJavaBundleDir>
@@ -55,12 +45,6 @@
</plugins>
</build>
- <properties>
- <!-- To override jboss.home, set the jboss.home property in an active profile in the Maven 2 settings.xml file -->
- <jboss.home>${env.JBOSS_HOME}</jboss.home>
- <jboss.domain>default</jboss.domain>
- </properties>
-
<profiles>
<profile>
@@ -71,6 +55,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
+ <id>explode-to-jboss-as</id>
<phase>package</phase>
<configuration>
<tasks>
@@ -151,6 +136,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
+ <id>restart-on-jboss-as</id>
<phase>validate</phase>
<configuration>
<tasks>
@@ -184,6 +170,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
+ <id>undeploy-from-jboss-as</id>
<phase>validate</phase>
<configuration>
<tasks>
Modified: examples/trunk/booking/seam-booking-ejb/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-ejb/pom.xml 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-ejb/pom.xml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -16,11 +16,55 @@
<build>
<finalName>${project.artifactId}</finalName>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/resources/test-suite.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </plugin>
+
+ </plugins>
</build>
<dependencies>
<dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-core-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<scope>provided</scope>
@@ -45,11 +89,193 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-faces</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
<artifactId>jsr299-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logger</artifactId>
+ <version>1.0.0-SNAPSHOT</version> <!-- TODO push to version-matrix -->
+ </dependency>
+
</dependencies>
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-integration-test-dependencies</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <stripVersion>true</stripVersion>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness</artifactId>
+ <version>1.0.0-SNAPSHOT</version> <!-- inheritence isn't working here -->
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
+ </artifactItem>
+ <!--
+ <artifactItem>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
+ </artifactItem>
+ -->
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/resources/test-suite.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ <systemProperties>
+ <property>
+ <name>jboss.home</name>
+ <value>${jboss.home}</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.standalone</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.container.extraConfigurationDir</name>
+ <value>../../</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.container.forceRestart</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.runIntegrationTests</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.libraryDirectory</name>
+ <value>${project.build.directory}/dependency/lib</value>
+ </property>
+ <property>
+ <name>org.jboss.testharness.outputDirectory</name>
+ <value>${project.build.directory}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+
+ <!--
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-api</artifactId>
+ <version>3.1.0-Alpha1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jbossws</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-transaction-api</artifactId>
+ <groupId>org.jboss.javaee</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jboss-jaxrpc</artifactId>
+ <groupId>jboss.jbossws</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness-jboss-as-50</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>dump-test-artifacts</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-artifacts</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.jboss.testharness.api.TCK</mainClass>
+ <classpathScope>test</classpathScope>
+ <systemProperties>
+ <systemProperty>
+ <key>dumpArtifacts</key>
+ <value>true</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.testPackage</key>
+ <value>${project.groupId}</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.outputDirectory</key>
+ <value>${project.build.directory}/test-artifacts</value>
+ </systemProperty>
+ <systemProperty>
+ <key>org.jboss.testharness.libraryDirectory</key>
+ <value>${project.build.directory}/dependency/lib</value>
+ </systemProperty>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
</project>
Modified: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java 2009-04-29 06:07:09 UTC (rev 10707)
@@ -1,19 +1,24 @@
-/*
+/*
* JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
* $Id$
*/
package org.jboss.seam.examples.booking.model;
@@ -25,7 +30,6 @@
import java.text.DateFormat;
import java.util.Date;
-import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@@ -71,18 +75,6 @@
this.user = user;
}
- @Transient
- public BigDecimal getTotal()
- {
- return hotel.getPrice().multiply(new BigDecimal(getNights()));
- }
-
- @Transient
- public int getNights()
- {
- return (int) (checkoutDate.getTime() - checkinDate.getTime()) / 1000 / 60 / 60 / 24;
- }
-
@Id
@GeneratedValue
public Long getId()
@@ -96,7 +88,6 @@
}
@NotNull
- @Basic
@Temporal(DATE)
public Date getCheckinDate()
{
@@ -108,8 +99,8 @@
this.checkinDate = datetime;
}
+ @NotNull
@ManyToOne
- @NotNull
public Hotel getHotel()
{
return hotel;
@@ -120,8 +111,8 @@
this.hotel = hotel;
}
+ @NotNull
@ManyToOne
- @NotNull
public User getUser()
{
return user;
@@ -132,9 +123,8 @@
this.user = user;
}
- @Basic
+ @NotNull
@Temporal(TemporalType.DATE)
- @NotNull
public Date getCheckoutDate()
{
return checkoutDate;
@@ -158,15 +148,6 @@
this.creditCard = creditCard;
}
- @Transient
- public String getDescription()
- {
- DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
- return hotel == null ? null : hotel.getName() +
- ", " + df.format(getCheckinDate()) +
- " to " + df.format(getCheckoutDate());
- }
-
public boolean isSmoking()
{
return smoking;
@@ -219,9 +200,30 @@
this.creditCardExpiryYear = creditCardExpiryYear;
}
+ @Transient
+ public String getDescription()
+ {
+ DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
+ return hotel == null ? null : hotel.getName() +
+ ", " + df.format(getCheckinDate()) +
+ " to " + df.format(getCheckoutDate());
+ }
+
+ @Transient
+ public BigDecimal getTotal()
+ {
+ return hotel.getPrice().multiply(new BigDecimal(getNights()));
+ }
+
+ @Transient
+ public int getNights()
+ {
+ return (int) (checkoutDate.getTime() - checkinDate.getTime()) / 1000 / 60 / 60 / 24;
+ }
+
@Override
public String toString()
{
- return "Booking(" + user + "," + hotel + ")";
+ return "Booking(" + user + ", " + hotel + ")";
}
}
Modified: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java 2009-04-29 06:07:09 UTC (rev 10707)
@@ -1,19 +1,24 @@
-/*
+/*
* JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
* $Id$
*/
package org.jboss.seam.examples.booking.model;
Modified: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java 2009-04-29 06:07:09 UTC (rev 10707)
@@ -1,19 +1,24 @@
-/*
+/*
* JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
*
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
* $Id$
*/
package org.jboss.seam.examples.booking.model;
Copied: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session (from rev 10613, examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action)
Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/BookingAgent.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/BookingAgent.java (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/BookingAgent.java 2009-04-29 06:07:09 UTC (rev 10707)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
+
+import javax.ejb.Local;
+import org.jboss.seam.examples.booking.model.Booking;
+import org.jboss.seam.examples.booking.model.Hotel;
+
+/**
+ * @author Dan Allen
+ */
+public
+@Local
+interface BookingAgent
+{
+ void selectHotel(Hotel hotel);
+
+ void bookHotel();
+
+ void validateBooking();
+
+ void cancel();
+
+ void confirm();
+
+ Hotel getHotelSelection();
+
+ Booking getBooking();
+
+ boolean isBookingValid();
+
+ void destroy();
+}
Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/BookingAgentBean.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/BookingAgentBean.java (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/BookingAgentBean.java 2009-04-29 06:07:09 UTC (rev 10707)
@@ -0,0 +1,148 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
+
+import java.util.Calendar;
+import static javax.persistence.PersistenceContextType.EXTENDED;
+import javax.annotation.Named;
+import javax.context.Conversation;
+import javax.context.ConversationScoped;
+import javax.context.RequestScoped;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Current;
+import javax.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.jboss.seam.examples.booking.model.Booking;
+import org.jboss.seam.examples.booking.model.Hotel;
+import org.jboss.seam.examples.booking.model.User;
+import org.jboss.seam.international.StatusMessages;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
+
+public
+@Named("bookingAgent")
+@Stateful
+@ConversationScoped
+class BookingAgentBean implements BookingAgent
+{
+ //private @Logger Log log;
+
+ @PersistenceContext(type = EXTENDED) EntityManager em;
+
+ @Current Conversation conversation;
+
+ @Current StatusMessages statusMessages;
+
+ private Hotel hotelSelection;
+
+ private Booking booking;
+
+ private boolean bookingValid;
+
+ public void selectHotel(Hotel hotel)
+ {
+ conversation.begin();
+ // get a fresh reference that's managed by the conversational persistence context
+ hotelSelection = em.find(Hotel.class, hotel.getId());
+ }
+
+ public void bookHotel()
+ {
+ // FIXME use current user
+ User user = em.find(User.class, "dan");
+ booking = new Booking(hotelSelection, user);
+ // push logic into Booking?
+ Calendar calendar = Calendar.getInstance();
+ booking.setCheckinDate(calendar.getTime());
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ booking.setCheckoutDate(calendar.getTime());
+ hotelSelection = null;
+ statusMessages.add("You've initiated a booking at {0}.", booking.getHotel().getName());
+ }
+
+ public void validateBooking()
+ {
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
+ if (booking.getCheckinDate().before(calendar.getTime()))
+ {
+ statusMessages.addToControl("booking:checkinDate:input", "Check in date must be a future date");
+ bookingValid = false;
+ }
+ else if (!booking.getCheckinDate().before(booking.getCheckoutDate()))
+ {
+ statusMessages.addToControl("booking:checkoutDate:input", "Check out date must be after check in date");
+ bookingValid = false;
+ }
+ else
+ {
+ bookingValid = true;
+ }
+ }
+
+ public void confirm()
+ {
+ em.persist(booking);
+ //log.info("New booking confirmed for...");
+ statusMessages.add("You're booked!");
+ conversation.end();
+ }
+
+ public void cancel()
+ {
+ booking = null;
+ hotelSelection = null;
+ conversation.end();
+ }
+
+ public
+ @Produces
+ @Named
+ @ConversationScoped
+ Booking getBooking()
+ {
+ return booking;
+ }
+
+ public
+ @Produces
+ @Named("hotel")
+ @RequestScoped
+ Hotel getHotelSelection()
+ {
+ return booking != null ? booking.getHotel() : hotelSelection;
+ }
+
+ public boolean isBookingValid()
+ {
+ return bookingValid;
+ }
+
+ @Remove
+ public void destroy()
+ {
+ }
+}
Modified: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/HotelSearch.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearch.java 2009-04-23 16:04:24 UTC (rev 10613)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/HotelSearch.java 2009-04-29 06:07:09 UTC (rev 10707)
@@ -1,4 +1,27 @@
-package org.jboss.seam.examples.booking.action;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
import java.util.List;
import javax.ejb.Local;
Modified: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/HotelSearchBean.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearchBean.java 2009-04-23 16:04:24 UTC (rev 10613)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/HotelSearchBean.java 2009-04-29 06:07:09 UTC (rev 10707)
@@ -1,9 +1,31 @@
-package org.jboss.seam.examples.booking.action;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Named;
-import javax.context.RequestScoped;
import javax.context.SessionScoped;
import javax.ejb.Remove;
import javax.ejb.Stateful;
@@ -48,7 +70,7 @@
public
@Produces
@Named
- @RequestScoped
+ //@RequestScoped // if enabled, variable doesn't get updated after the action is executed w/o a redirect
List<Hotel> getHotels()
{
return hotels;
Modified: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/SearchCriteria.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/SearchCriteria.java 2009-04-23 16:04:24 UTC (rev 10613)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/session/SearchCriteria.java 2009-04-29 06:07:09 UTC (rev 10707)
@@ -1,4 +1,27 @@
-package org.jboss.seam.examples.booking.action;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.session;
import java.io.Serializable;
import javax.annotation.Named;
@@ -9,12 +32,33 @@
@SessionScoped
class SearchCriteria implements Serializable
{
+ private static final char SQL_WILDCARD_CHAR = '%';
+ private static final String SQL_WILDCARD_STR = String.valueOf(SQL_WILDCARD_CHAR);
+ private static final String REPEAT_SQL_WIDCARD_REGEX = SQL_WILDCARD_STR + "+";
+ private static final char HUMAN_WILDCARD_CHAR = '*';
+
private String searchString = "";
private int pageSize = 5;
private int page = 0;
- public String getSearchPattern() {
- return searchString == null ? "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%';
+ public String getSearchPattern()
+ {
+ if (searchString == null || searchString.length() == 0)
+ {
+ return SQL_WILDCARD_STR;
+ }
+
+ StringBuilder pattern = new StringBuilder();
+ pattern.append(searchString.toLowerCase().replace(HUMAN_WILDCARD_CHAR, SQL_WILDCARD_CHAR).replaceAll(REPEAT_SQL_WIDCARD_REGEX, SQL_WILDCARD_STR));
+ if (pattern.length() == 0 || pattern.charAt(0) != SQL_WILDCARD_CHAR)
+ {
+ pattern.insert(0, SQL_WILDCARD_CHAR);
+ }
+ if (pattern.length() > 1 && pattern.charAt(pattern.length() - 1) != SQL_WILDCARD_CHAR)
+ {
+ pattern.append(SQL_WILDCARD_CHAR);
+ }
+ return pattern.toString();
}
public int getPage()
@@ -44,7 +88,7 @@
public void setSearchString(String searchString)
{
- this.searchString = searchString;
+ this.searchString = (searchString != null ? searchString.trim() : null);
}
public void nextPage()
@@ -54,7 +98,8 @@
public void previousPage()
{
- if (page > 0) {
+ if (page > 0)
+ {
page--;
}
}
Modified: examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/beans.xml
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/beans.xml 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/beans.xml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:faces="urn:java:org.jboss.seam.faces">
+ <Deploy>
+ <Standard/>
+ <Production/>
+ <faces:Faces/>
+ </Deploy>
+</Beans>
Modified: examples/trunk/booking/seam-booking-war/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-war/pom.xml 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-war/pom.xml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -23,13 +23,24 @@
<!--
<dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss.el</groupId>
- <artifactId>jboss-el</artifactId>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ -->
+
+ <!-- is this necessary? is it for upgrading to EL 1.2? -->
+ <!--
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
@@ -39,9 +50,18 @@
</dependency>
-->
+ <!--
<dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-ri</artifactId>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-faces</artifactId>
+ </dependency>
+ -->
+
+ <!-- pulled in by seam-el
+ <dependency>
+ <groupId>org.jboss.el</groupId>
+ <artifactId>jboss-el</artifactId>
+ <scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
@@ -49,6 +69,7 @@
</exclusion>
</exclusions>
</dependency>
+ -->
</dependencies>
Modified: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -3,28 +3,81 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
-
- <application>
+
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+
+ <navigation-case>
+ <from-action>#{bookingAgent.cancel}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/main.xhtml</from-view-id>
+
+ <!-- navigation rules are required to reset request-scoped producer variables -->
<!--
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ <navigation-case>
+ <from-action>#{hotelSearch.find}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
+ <navigation-case>
+ <from-action>#{hotelSearch.nextPage}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
-->
- </application>
+ <navigation-case>
+ <from-action>#{bookingAgent.selectHotel(_hotel)}</from-action>
+ <to-view-id>/hotel.xhtml</to-view-id>
+ <if>#{bookingAgent.hotelSelection != null}</if>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
<navigation-rule>
- <!-- navigation rules are required to reset request-scoped producer variables -->
- <from-view-id>/main.xhtml</from-view-id>
- <navigation-case>
- <from-action>#{hotelSearch.find}</from-action>
- <to-view-id>/main.xhtml</to-view-id>
- <if>#{true}</if>
- <redirect/>
- </navigation-case>
- <navigation-case>
- <from-action>#{hotelSearch.nextPage}</from-action>
- <to-view-id>/main.xhtml</to-view-id>
- <if>#{true}</if>
- <redirect/>
- </navigation-case>
+ <from-view-id>/hotel.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-action>#{bookingAgent.bookHotel}</from-action>
+ <to-view-id>/book.xhtml</to-view-id>
+ <if>#{bookingAgent.booking != null}</if>
+ <redirect/>
+ </navigation-case>
+
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/book.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-action>#{bookingAgent.validateBooking}</from-action>
+ <to-view-id>/confirm.xhtml</to-view-id>
+ <if>#{bookingAgent.bookingValid}</if>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/confirm.xhtml</from-view-id>
+
+ <navigation-case>
+ <from-action>#{bookingAgent.confirm}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
+
+ </navigation-rule>
+
</faces-config>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/fragments/hotel.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/fragments/hotel.xhtml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/fragments/hotel.xhtml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -0,0 +1,21 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:p="http://http://java.sun.com/jsf/composite/property">
+
+ <p:display label="Name" value="#{hotel.name}"/>
+ <p:display label="Address" value="#{hotel.address}"/>
+ <p:display label="City" value="#{hotel.city}"/>
+ <p:display label="State" value="#{hotel.state}"/>
+ <p:display label="Zip" value="#{hotel.zip}"/>
+ <p:display label="Country" value="#{hotel.country}"/>
+ <p:display label="Nightly rate" override="true">
+ <h:outputText value="#{hotel.price}">
+ <f:convertNumber type="currency" currencySymbol="$"/>
+ </h:outputText>
+ </p:display>
+
+</ui:composition>
Modified: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -1,25 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<f:view xmlns="http://www.w3.org/1999/xhtml"
+<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- contentType="text/html">
-<html>
- <head>
+ xmlns:f="http://java.sun.com/jsf/core"><ui:remove><!-- Using <f:view> as the root prevents conversation from propagating correctly--></ui:remove>
+ <h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>JBoss Suites: Seam Framework</title>
<link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
<link href="#{request.contextPath}/css/screen.css" rel="stylesheet" type="text/css"/>
- </head>
- <body>
+ <ui:insert name="head"/>
+ </h:head>
+ <h:body>
<div id="document">
<div id="header">
<div id="title"><h:graphicImage value="/img/hdr.title.gif" alt="JBoss Suites: seam framework demo"/></div>
<div id="status">
+ <h:link id="about" outcome="/home.xhtml" value="About"/>
+ #{' | '}
<h:link id="search" outcome="/main.xhtml" value="Search"/>
<ui:remove><!--
- Welcome #{user.name}
+ Welcome #{user.name} or use (#{user.name})
| <h:link id="search" outcome="/main.xhtml" value="Search"/>
| <h:link id="settings" outcome="/password.xhtml" value="Settings"/>
| <s:link id="logout" action="#{identity.logout}" value="Logout"/>
@@ -34,8 +35,11 @@
<ui:insert name="content"/>
</div>
</div>
- <div id="footer">Created with Seam 3.0, Web Beans, EJB 3.0 and JSF 2.0</div>
+ <div id="footer">
+ Created with Seam 3.0, Web Beans, EJB 3.0 and JSF 2.0
+ <br/>
+ #{javax.context.conversation}
+ </div>
</div>
- </body>
+ </h:body>
</html>
-</f:view>
Modified: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -5,18 +5,21 @@
version="2.5">
<display-name>Seam Booking Example</display-name>
-
- <!--
+
<context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.xhtml</param-value>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
</context-param>
- -->
<context-param>
- <param-name>facelets.DEVELOPMENT</param-name>
+ <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
<param-value>true</param-value>
</context-param>
+
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
@@ -32,5 +35,14 @@
<session-config>
<session-timeout>10</session-timeout>
</session-config>
+
+ <security-constraint>
+ <display-name>Restrict access to XHTML documents</display-name>
+ <web-resource-collection>
+ <web-resource-name>XHTML</web-resource-name>
+ <url-pattern>*.xhtml</url-pattern>
+ </web-resource-collection>
+ <auth-constraint/>
+ </security-constraint>
</web-app>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/book.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/book.xhtml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/book.xhtml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -0,0 +1,115 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:p="http://http://java.sun.com/jsf/composite/property"
+ template="/WEB-INF/layout/template.xhtml">
+
+ <ui:define name="content">
+ <div class="section">
+ <h1>Book Hotel</h1>
+ </div>
+
+ <div class="section">
+ <div class="entry errors">
+ <h:messages id="messages" globalOnly="true"/>
+ </div>
+
+ <ui:include src="/WEB-INF/fragments/hotel.xhtml"/>
+
+ <div style="clear: both;"/>
+
+ <h:form id="booking">
+ <fieldset>
+
+ <p:edit id="checkinDate" label="Check-in date">
+ <h:inputText id="input" value="#{booking.checkinDate}">
+ <f:convertDateTime type="date" pattern="MM/dd/yyyy"/>
+ </h:inputText>
+ </p:edit>
+
+ <p:edit id="checkoutDate" label="Check-out date">
+ <h:inputText id="input" value="#{booking.checkoutDate}">
+ <f:convertDateTime type="date" pattern="MM/dd/yyyy"/>
+ </h:inputText>
+ </p:edit>
+
+ <p:edit id="beds" label="Room preference">
+ <h:selectOneMenu id="input" value="#{booking.beds}">
+ <f:selectItem itemLabel="One king-size bed" itemValue="1"/>
+ <f:selectItem itemLabel="Two double beds" itemValue="2"/>
+ <f:selectItem itemLabel="Three beds" itemValue="3"/>
+ </h:selectOneMenu>
+ </p:edit>
+
+ <p:edit id="smoking" label="Smoking preference">
+ <h:selectOneRadio id="input" value="#{booking.smoking}" layout="pageDirection" styleClass="radio">
+ <f:selectItem itemLabel="Smoking" itemValue="true"/>
+ <f:selectItem itemLabel="Non Smoking" itemValue="false"/>
+ </h:selectOneRadio>
+ </p:edit>
+
+ <p:edit id="creditCardName" label="Credit card name">
+ <h:inputText id="input" value="#{booking.creditCardName}"/>
+ </p:edit>
+
+ <p:edit id="creditCardNumber" label="Credit card #">
+ <h:inputText id="input" value="#{booking.creditCard}"/>
+ </p:edit>
+
+ <p:edit id="creditCardExpiry" label="Credit card expiry">
+ <h:selectOneMenu id="input" value="#{booking.creditCardExpiryMonth}">
+ <f:selectItem id="Jan" itemLabel="Jan" itemValue="1"/>
+ <f:selectItem id="Feb" itemLabel="Feb" itemValue="2"/>
+ <f:selectItem id="Mar" itemLabel="Mar" itemValue="3"/>
+ <f:selectItem id="Apr" itemLabel="Apr" itemValue="4"/>
+ <f:selectItem id="May" itemLabel="May" itemValue="5"/>
+ <f:selectItem id="Jun" itemLabel="Jun" itemValue="6"/>
+ <f:selectItem id="Jul" itemLabel="Jul" itemValue="7"/>
+ <f:selectItem id="Aug" itemLabel="Aug" itemValue="8"/>
+ <f:selectItem id="Sep" itemLabel="Sep" itemValue="9"/>
+ <f:selectItem id="Oct" itemLabel="Oct" itemValue="10"/>
+ <f:selectItem id="Nov" itemLabel="Nov" itemValue="11"/>
+ <f:selectItem id="Dec" itemLabel="Dec" itemValue="12"/>
+ </h:selectOneMenu>
+ <h:selectOneMenu id="input2" value="#{booking.creditCardExpiryYear}">
+ <f:selectItem id="Year2005" itemLabel="2005" itemValue="2005"/>
+ <f:selectItem id="Year2006" itemLabel="2006" itemValue="2006"/>
+ <f:selectItem id="Year2007" itemLabel="2007" itemValue="2007"/>
+ <f:selectItem id="Year2008" itemLabel="2008" itemValue="2008"/>
+ <f:selectItem id="Year2009" itemLabel="2009" itemValue="2009"/>
+ </h:selectOneMenu>
+ </p:edit>
+
+ <div class="buttonBox">
+ <h:commandButton id="proceed" value="Proceed" action="#{bookingAgent.validateBooking}"/>
+ #{' '}
+ <h:commandButton id="cancel" value="Cancel" action="#{bookingAgent.cancel}" immediate="true"/>
+ </div>
+
+ </fieldset>
+ </h:form>
+ </div>
+
+ </ui:define>
+
+ <ui:define name="sidebar">
+
+ <h1>Workspace management</h1>
+ <p>
+ As you can see, Seam makes it easy to work in multiple windows or
+ multiple browser tabs. But you can even switch between multiple tasks
+ inside a single browser tab! The "Workspaces" section showcases this
+ advanced feature.
+ </p>
+ <p>
+ <a href="#" onclick="window.open('exp/workspaceExp.html','exp','width=752,height=500,scrollbars=yes');">
+ How does the workspace list work?
+ </a>
+ </p>
+
+ </ui:define>
+
+</ui:composition>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/confirm.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/confirm.xhtml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/confirm.xhtml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -0,0 +1,63 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:p="http://http://java.sun.com/jsf/composite/property"
+ template="/WEB-INF/layout/template.xhtml">
+
+ <ui:define name="content">
+
+ <div class="section">
+ <h1>Confirm Hotel Booking</h1>
+ </div>
+
+ <div class="section">
+
+ <ui:include src="/WEB-INF/fragments/hotel.xhtml"/>
+
+ <p:display label="Total payment" override="true">
+ <h:outputText value="#{booking.total}">
+ <f:convertNumber type="currency" currencySymbol="$"/>
+ </h:outputText>
+ </p:display>
+
+ <p:display label="Check-in date" value="#{booking.checkinDate}"/>
+ <p:display label="Check-out date" value="#{booking.checkoutDate}"/>
+ <p:display label="Credit card #" value="#{booking.creditCard}"/>
+
+ <div class="buttonBox">
+ <h:form id="confirm">
+ <h:commandButton id="confirm" value="Confirm" action="#{bookingAgent.confirm}"/>
+ #{' '}
+ <h:button id="revise" value="Revise" outcome="/book.xhtml">
+ <f:param name="cid" value="#{javax.context.conversation.id}"/>
+ </h:button>
+ #{' '}
+ <h:commandButton id="cancel" value="Cancel" action="#{bookingAgent.cancel}" immediate="true"/>
+ </h:form>
+ </div>
+
+ </div>
+
+ </ui:define>
+
+ <ui:define name="sidebar">
+ <h1>Back button navigation</h1>
+ <p>
+ When you click "Confirm", the new booking is written to the database,
+ the conversation ends, and state associated with the conversation is
+ automatically destroyed by Seam. After you confirm your booking, try
+ hitting the back button on your web browser and clicking "Confirm"
+ again. Seam makes it easy implement applications that behave elegantly
+ in response to the back, forward and refresh buttons.
+ </p>
+ <p>
+ <a href="#" onclick="window.open('exp/confirmExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What happens when the conversation ends?
+ </a>
+ </p>
+ </ui:define>
+
+</ui:composition>
Modified: examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css 2009-04-29 06:07:09 UTC (rev 10707)
@@ -1,278 +1,271 @@
/* Setup defaults since variable in browsers
----------------------------------------------- */
body, div, span, dd, dt, dl, img, ul, ol, li, p, h1, h2, h3, h4, h5, form, hr, fieldset {
- margin: 0;
- padding: 0;
+ margin: 0;
+ padding: 0;
}
/* Element Defaults
----------------------------------------------- */
html {
- height: 100%;
- background-color: #DBD4C6;
+ height: 100%;
+ background-color: #DBD4C6;
+ overflow-y: scroll;
}
-img {
- border: 0;
-}
body {
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-size: small;
- line-height: 1.25em;
- color: #362F2D;
- position: relative;
- width: 760px;
- height: 100%;
- margin-left: auto;
- margin-right: auto;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: small;
+ line-height: 1.25em;
+ color: #362F2D;
+ position: relative;
+ width: 760px;
+ height: 100%;
+ margin-left: auto;
+ margin-right: auto;
}
+a img {
+ border: none;
+}
.label {
- font-weight: bold;
- color: #5E5147;
+ font-weight: bold;
+ color: #5E5147;
}
input {
- border: 1px solid #C3BBB6;
- padding: 4px;
- margin: 5px 0;
- background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+ border: 1px solid #C3BBB6;
+ padding: 4px;
+ margin: 5px 0;
+ background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
}
select {
- border: 1px solid #C3BBB6;
- padding: 4px;
- margin: 5px 0;
- background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+ border: 1px solid #C3BBB6;
+ padding: 4px;
+ margin: 5px 0;
+ background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
}
ol, ul {
- margin: 10px 0px 10px 6px;
+ margin: 10px 0px 10px 6px;
}
li {
- margin: 10px 12px;
+ margin: 10px 12px;
}
fieldset {
- border: 0;
+ border: 0;
}
/* Layout
----------------------------------------------- */
#document {
- padding: 0 1px;
- background: #fff url(../img/bg.gif) 0 0 repeat-y;
- float: left;
- border-bottom: 1px solid #C3BBB6;
+ padding: 0 1px;
+ background: #fff url(../img/bg.gif) 0 0 repeat-y;
+ float: left;
+ border-bottom: 1px solid #C3BBB6;
}
#header {
- float: left;
- width: 758px;
- height: 46px;
- background: url(../img/hdr.bg.gif) 0 0 repeat-x;
+ float: left;
+ width: 758px;
+ height: 46px;
+ background: url(../img/hdr.bg.gif) 0 0 repeat-x;
}
#container {
- float: left;
- width: 758px;
- background: url(../img/hdr.bar.jpg) 0 0 repeat-x;
+ float: left;
+ width: 758px;
+ background: url(../img/hdr.bar.jpg) 0 0 repeat-x;
}
#sidebar {
- float: left;
- width: 190px;
- margin-top: 96px;
- padding: 20px 10px 0 10px;
- background: url(../img/sdb.bg.gif) 0 0 no-repeat;
+ float: left;
+ width: 190px;
+ margin-top: 96px;
+ padding: 20px 10px 0 10px;
+ background: url(../img/sdb.bg.gif) 0 0 no-repeat;
}
#content {
- float: left;
- width: 548px;
- margin-top: 75px;
- padding-top: 5px;
- background: #fff url(../img/cnt.bg.gif) 0 0 repeat-x;
+ float: left;
+ width: 548px;
+ margin-top: 75px;
+ padding-top: 5px;
+ background: #fff url(../img/cnt.bg.gif) 0 0 repeat-x;
}
#footer {
- clear: both;
- margin-top: 40px;
- float: left;
- padding: 20px;
- border-top: 1px solid #C3BBB6;
- background-color: #fff;
- width: 718px;
- text-align: right;
+ clear: both;
+ margin-top: 40px;
+ float: left;
+ padding: 20px;
+ border-top: 1px solid #C3BBB6;
+ background-color: #fff;
+ width: 718px;
+ text-align: right;
}
/* General
----------------------------------------------- */
input[type="submit"], input[type="button"] {
- font-weight: bold;
- color: #fff;
- border: 1px solid #5D1414;
- height: 26px;
- background: #fff url(../img/btn.bg.gif) 0 0 repeat-x;
- border-style: none;
+ font-weight: bold;
+ color: #fff;
+ border: 1px solid #5D1414;
+ height: 26px;
+ background: #fff url(../img/btn.bg.gif) 0 0 repeat-x;
+ border-style: none;
}
.center {
- text-align: center;
+ text-align: center;
}
.entry {
- clear: both;
- padding-top: 10px;
+ clear: both;
+ padding-top: 10px;
}
.entry .label {
- float: left;
- padding-right: 5px;
- font-weight: bold;
- width: 150px;
- text-align: right;
+ float: left;
+ padding-right: 5px;
+ font-weight: bold;
+ width: 160px;
+ text-align: right;
}
-.entry .output {
- float: right;
- width: 360px;
- padding-top: 10px;
- text-align: left;
+.entry .input, .entry .output, .entry .error {
+ float: right;
+ width: 350px;
+ text-align: left;
}
-.entry .input {
- float: right;
- width: 360px;
- text-align: left;
-}
-.entry .error {
- float: right;
- width: 360px;
- text-align: left;
-}
/* Sidebar
----------------------------------------------- */
.notes {
- text-align: center;
- font-size: small;
+ text-align: center;
+ font-size: small;
}
.subnotes {
margin-top: 1em;
- font-size: small;
+ font-size: small;
}
.errors {
- font-size: small;
- font-weight: bold;
- text-align: center;
- color: #600;
+ font-size: small;
+ font-weight: bold;
+ text-align: center;
+ color: #600;
}
.errors div {
- text-align: left;
+ text-align: left;
}
.errors span {
- text-align: left;
+ text-align: left;
}
.errors input {
- border: 1px solid #600;
+ border: 1px solid #600;
}
.errors ul {
- list-style: none;
+ list-style: none;
}
.buttonBox {
- text-align: center;
- padding: 5px 0;
- clear: both;
+ text-align: center;
+ padding: 5px 0;
+ clear: both;
}
#sidebar p {
- font-size: small;
- color: #8B7869;
- line-height: 150%;
- padding-bottom: 10px;
+ font-size: small;
+ color: #8B7869;
+ line-height: 150%;
+ padding-bottom: 10px;
}
#sidebar li {
- font-size: small;
- color: #8B7869;
+ font-size: small;
+ color: #8B7869;
}
#sidebar h1 {
- line-height: normal;
- font-weight: bold;
- font-size: small;
+ line-height: normal;
+ font-weight: bold;
+ font-size: small;
}
/*
#sidebar p:hover {
- color: #362F2D;
+ color: #362F2D;
}
*/
/* Content
----------------------------------------------- */
#content .section {
- float: left;
- width: 518px;
- padding: 15px 15px 0 15px;
+ float: left;
+ width: 518px;
+ padding: 15px 15px 0 15px;
}
#content .section h1 {
- font-family: "Trebuchet MS", Arial, sans-serif;
- line-height: normal;
- font-weight: normal;
- font-size: large;
+ font-family: "Trebuchet MS", Arial, sans-serif;
+ line-height: normal;
+ font-weight: normal;
+ font-size: large;
}
#content .section p {
- line-height: 150%;
- padding: 10px 0;
- font-size: small;
+ line-height: 150%;
+ padding: 10px 0;
+ font-size: small;
}
#content table {
- width: 100%;
- border: 1px solid #D2C9C4;
- border-collapse: collapse;
+ width: 100%;
+ border: 1px solid #D2C9C4;
+ border-collapse: collapse;
}
#content table caption {
- padding-bottom: 6px;
- text-align: left;
- font-weight: bold;
+ padding-bottom: 6px;
+ text-align: left;
+ font-weight: bold;
}
#content table thead th {
- border-left: 1px solid #D2C9C4;
- background: #fff url(../img/th.bg.gif) 0 100% repeat-x;
- border-bottom: 1px solid #D2C9C4;
- padding: 6px;
- text-align: left;
- font-size: small;
+ border-left: 1px solid #D2C9C4;
+ background: #fff url(../img/th.bg.gif) 0 100% repeat-x;
+ border-bottom: 1px solid #D2C9C4;
+ padding: 6px;
+ text-align: left;
+ font-size: small;
}
#content table tbody td {
- border-left: 1px solid #E4DBD5;
- padding: 4px;
- border-bottom: 1px solid #D2C9C4;
- font-size: small;
+ border-left: 1px solid #E4DBD5;
+ padding: 4px;
+ border-bottom: 1px solid #D2C9C4;
+ font-size: small;
}
+td.action {
+ text-align: center;
+}
#content dt {
- font-weight: bold;
- float: left;
- width: 33%;
+ font-weight: bold;
+ float: left;
+ width: 33%;
}
#content dd {
- padding-left: 10px;
- float: left;
- width: 66%;
+ padding-left: 10px;
+ float: left;
+ width: 66%;
}
#content table.radio {
- border: 0px;
+ border: 0px;
}
#content table.radio tbody tr td {
- border: 0px;
- border-left: 0px;
- border-bottom: 0px;
+ border: 0px;
+ border-left: 0px;
+ border-bottom: 0px;
}
/* Header
----------------------------------------------- */
#title {
- float: left;
- padding: 1px 0 6px 15px;
+ float: left;
+ padding: 1px 0 6px 15px;
}
#status {
- color: #C7B299;
- float: right;
- font-family: Verdana, Arial, Helvetica, sans-serif;
- font-weight: bold;
- font-size: x-small;
- text-align: right;
- padding-top: 14px;
- padding-right: 15px;
+ color: #C7B299;
+ float: right;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ font-size: x-small;
+ text-align: right;
+ padding-top: 14px;
+ padding-right: 15px;
}
#status a {
- color: #C7B299;
- text-decoration: none;
+ color: #C7B299;
+ text-decoration: none;
}
/* Homepage Modifications
----------------------------------------------- */
#pgHome #container {
- background: url(../img/hdr.ad.jpg) 0 0 repeat-x;
+ background: url(../img/hdr.ad.jpg) 0 0 repeat-x;
}
#pgHome #sidebar {
- margin-top: 207px;
+ margin-top: 207px;
}
#pgHome #content {
- margin-top: 183px;
+ margin-top: 183px;
}
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/hotel.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/hotel.xhtml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/hotel.xhtml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -0,0 +1,54 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ template="/WEB-INF/layout/template.xhtml">
+
+ <ui:define name="content">
+
+ <div class="section">
+ <h1>View Hotel</h1>
+ </div>
+
+ <div class="section">
+ <ui:include src="/WEB-INF/fragments/hotel.xhtml"/>
+
+ <div class="buttonBox">
+ <h:form id="actions">
+ <h:commandButton id="bookHotel" action="#{bookingAgent.bookHotel}" value="Book Hotel"/>
+ #{' '}
+ <h:commandButton id="cancel" action="#{bookingAgent.cancel}" value="Return to Search" immediate="true"/>
+ </h:form>
+ </div>
+
+ </div>
+
+ </ui:define>
+
+ <ui:define name="sidebar">
+
+ <h1>Don't kill your database</h1>
+ <p>
+ Keeping conversational state in memory in the middle tier is a great
+ way to improve your application's scalability. It saves hitting the
+ database every time we refresh a page, to re-read the data we were
+ just looking at five seconds ago. By using Seam's conversation
+ context, we get a natural cache of data associated with the what the
+ user is currently doing. By nature, this cache has a more efficient
+ eviction policy than the MRU-type algorithms used by a typical
+ second-level data cache in an O/R mapping engine like Hibernate (at
+ least for some kinds of data). Of course, you should use a clever
+ combination of second-level caching and conversational data caching to
+ achieve the best performance for your application.
+ </p>
+ <p>
+ <a href="#" onclick="window.open('exp/bookingExp.html','exp','width=752,height=500,scrollbars=yes');">
+ How does the hotel booking wizard work?
+ </a>
+ </p>
+
+ </ui:define>
+
+</ui:composition>
Modified: examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml 2009-04-29 06:03:37 UTC (rev 10706)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -7,6 +7,22 @@
xmlns:s="http://jboss.com/products/seam/taglib"
template="/WEB-INF/layout/template.xhtml">
+ <ui:define name="head">
+ <script type="text/javascript">
+function controlSpinner(behavior)
+{
+ if (behavior.name == 'begin')
+ {
+ document.getElementById('activity').style.display = 'inline';
+ }
+ else if (behavior.name == 'complete')
+ {
+ document.getElementById('activity').style.display = 'none';
+ }
+}
+ </script>
+ </ui:define>
+
<ui:define name="content">
<div class="section">
@@ -17,24 +33,17 @@
<h1>Search Hotels</h1>
- <h:form id="searchForm">
+ <h:form id="searchForm" prependId="false">
<fieldset>
<h:inputText id="searchString" value="#{searchCriteria.searchString}" style="width: 165px;">
- <f:ajax event="keyup" listener="#{hotelSearch.find}" render="searchResults"/>
+ <f:ajax event="keyup" listener="#{hotelSearch.find}" render="searchResults" onevent="controlSpinner"/>
</h:inputText>
#{' '}
<h:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}">
- <ui:remove><f:ajax listener="#{hotelSearch.find}" render="searchResults"/></ui:remove>
+ <f:ajax listener="#{hotelSearch.find}" execute="searchString" render="searchResults" onevent="controlSpinner"/>
</h:commandButton>
- <ui:remove>
- <!--
- <a:status id="status">
- <f:facet id="startStatus" name="start">
- <h:graphicImage id="SpinnerGif" value="/img/spinner.gif"/>
- </f:facet>
- </a:status>
- -->
- </ui:remove>
+ #{' '}
+ <span id="activity" style="display: none;"><h:graphicImage id="spinner" value="/img/spinner.gif"/></span>
<br/>
<h:outputLabel id="lblPageSize" for="pageSize" value="Maximum results:"/>
#{' '}
@@ -50,28 +59,34 @@
<h:panelGroup id="searchResults">
<div class="section">
<h:outputText id="noHotelsMsg" value="No Hotels Found" rendered="#{empty hotels}"/>
- <h:dataTable id="hotels" value="#{hotels}" var="_hotel" rendered="#{not empty hotels}">
- <h:column id="nameCol">
- <f:facet id="nameFct" name="header">Name</f:facet>
- #{_hotel.name}
- </h:column>
- <h:column id="addressCol">
- <f:facet id="addressFct" name="header">Address</f:facet>
- #{_hotel.address}
- </h:column>
- <h:column id="locationCol">
- <f:facet id="locationFct" name="header">Location</f:facet>
- #{_hotel.city}, #{_hotel.state}, #{_hotel.country}
- </h:column>
- <h:column id="zipCol">
- <f:facet id="zipFct" name="header">Zip</f:facet>
- #{_hotel.zip}
- </h:column>
- <h:column id="actionCol">
- <f:facet id="actionFct" name="header">Action</f:facet>
- <ui:remove><!--<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>--></ui:remove>
- </h:column>
- </h:dataTable>
+ <h:form id="hotelSelectionForm">
+ <h:dataTable id="hotels" value="#{hotels}" var="_hotel" rendered="#{not empty hotels}"
+ columnClasses=",,,,action">
+ <h:column id="nameCol">
+ <f:facet id="nameFct" name="header">Name</f:facet>
+ #{_hotel.name}
+ </h:column>
+ <h:column id="addressCol">
+ <f:facet id="addressFct" name="header">Address</f:facet>
+ #{_hotel.address}
+ </h:column>
+ <h:column id="locationCol">
+ <f:facet id="locationFct" name="header">Location</f:facet>
+ #{_hotel.city}, #{_hotel.state}, #{_hotel.country}
+ </h:column>
+ <h:column id="zipCol">
+ <f:facet id="zipFct" name="header">Zip</f:facet>
+ #{_hotel.zip}
+ </h:column>
+ <h:column id="actionCol">
+ <f:facet id="actionFct" name="header">Action</f:facet>
+ <h:commandLink id="view" value="View" action="#{bookingAgent.selectHotel(_hotel)}" style="white-space: nowrap;"/>
+ <ui:remove>
+ <h:commandButton id="view" value="View" action="#{bookingAgent.selectHotel(_hotel)}"/>
+ </ui:remove>
+ </h:column>
+ </h:dataTable>
+ </h:form>
<h:form id="paginationForm">
<h:commandButton id="previousResults" value="Previous page" action="#{hotelSearch.previousPage}" rendered="#{hotelSearch.previousPageAvailable}"/>
#{' '}
@@ -90,6 +105,7 @@
</h:panelGroup>
<ui:remove>
+<!--
<div class="section">
<h1>Current Hotel Bookings</h1>
</div>
@@ -128,6 +144,7 @@
</h:dataTable>
</h:form>
</div>
+-->
</ui:remove>
</ui:define>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/resources/property/display.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/resources/property/display.xhtml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/resources/property/display.xhtml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -0,0 +1,30 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:comp="http://java.sun.com/jsf/composite">
+
+ <comp:interface>
+ <comp:attribute name="label" required="true"/>
+ <comp:attribute name="value" required="false"/>
+ <comp:attribute name="override" required="false" default="false"/>
+ </comp:interface>
+
+ <!-- the override is a workaround because assigning an id to the output dynamically is not working -->
+ <!-- TODO allow for a template to be specified, falling back to a default -->
+ <comp:implementation>
+ <div class="entry">
+ <span class="label">#{cc.attrs.label}:</span>
+ <span class="output">
+ <c:choose>
+ <c:when test="#{cc.attrs.override}"><comp:insertChildren/></c:when>
+ <c:otherwise>#{cc.attrs.value}</c:otherwise>
+ </c:choose>
+ </span>
+ </div>
+ </comp:implementation>
+
+</ui:composition>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/resources/property/edit.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/resources/property/edit.xhtml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/resources/property/edit.xhtml 2009-04-29 06:07:09 UTC (rev 10707)
@@ -0,0 +1,35 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ xmlns:comp="http://java.sun.com/jsf/composite">
+
+ <comp:interface>
+ <comp:attribute name="label" required="true"/>
+ <comp:attribute name="required" required="false"/>
+ </comp:interface>
+
+ <!-- TODO allow for a template to be specified, falling back to a default -->
+ <!-- TODO detect required from child or from bean validation annotation -->
+ <comp:implementation>
+
+ <c:set var="required" value="#{cc.attrs.required eq null ? true : cc.attrs.required}"/>
+ <c:set var="invalid" value="#{not empty facesContext.getMessageList(cc.clientId.concat(':input'))}"/>
+
+ <div class="entry">
+ <h:outputLabel value="#{cc.attrs.label}:" for="input" styleClass="label#{invalid ? ' errors' : ''}">
+ <c:if test="#{required}"><span class="required">*</span></c:if>
+ </h:outputLabel>
+ <span class="input#{invalid ? ' errors' : ''}">
+ <comp:insertChildren/>
+ </span>
+ <h:message for="input" styleClass="error errors"/>
+ </div>
+
+ </comp:implementation>
+
+
+</ui:composition>
15 years, 9 months
Seam SVN: r10706 - modules/trunk/faces/src/main/java/org/jboss/seam/faces/annotations.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-29 02:03:37 -0400 (Wed, 29 Apr 2009)
New Revision: 10706
Removed:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/annotations/Converter.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/annotations/Validator.java
Log:
don't need, these are in JSF 2
Deleted: modules/trunk/faces/src/main/java/org/jboss/seam/faces/annotations/Converter.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/annotations/Converter.java 2009-04-29 06:01:57 UTC (rev 10705)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/annotations/Converter.java 2009-04-29 06:03:37 UTC (rev 10706)
@@ -1,32 +0,0 @@
-package org.jboss.seam.faces.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Allows a Seam component to act as a JSF converter. The
- * annotated class must be a Seam component, and must
- * implement javax.faces.convert.Converter.
- *
- * @author Gavin King
- *
- */
-@Target(TYPE)
-@Retention(RUNTIME)
-@Documented
-public @interface Converter
-{
- /**
- * The JSF converter id. Default to the component name.
- */
- String id() default "";
- /**
- * If specified, register this component as the default
- * converter for a type.
- */
- Class forClass() default void.class;
-}
Deleted: modules/trunk/faces/src/main/java/org/jboss/seam/faces/annotations/Validator.java
===================================================================
--- modules/trunk/faces/src/main/java/org/jboss/seam/faces/annotations/Validator.java 2009-04-29 06:01:57 UTC (rev 10705)
+++ modules/trunk/faces/src/main/java/org/jboss/seam/faces/annotations/Validator.java 2009-04-29 06:03:37 UTC (rev 10706)
@@ -1,27 +0,0 @@
-package org.jboss.seam.faces.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Allows a Seam component to act as a JSF validator. The
- * annotated class must be a Seam component, and must
- * implement javax.faces.validator.Validator.
- *
- * @author Gavin King
- *
- */
-@Target(TYPE)
-@Retention(RUNTIME)
-@Documented
-public @interface Validator
-{
- /**
- * The JSF validator id. Default to the component name.
- */
- String id() default "";
-}
15 years, 9 months