Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update to Roo 1.2.0.RELEASE

  • Loading branch information...
commit 311c6bb321bd404497dbf096c246ec82019d3591 1 parent 177c47e
@jamesward authored
Showing with 465 additions and 568 deletions.
  1. +2 −0  .gitignore
  2. +1 −1  Procfile
  3. +52 −114 pom.xml
  4. +2 −2 src/main/java/com/springsource/petclinic/domain/AbstractPerson.java
  5. +1 −0  src/main/java/com/springsource/petclinic/domain/AbstractPerson_Roo_Configurable.aj
  6. +1 −1  src/main/java/com/springsource/petclinic/domain/AbstractPerson_Roo_JavaBean.aj
  7. +25 −26 .../springsource/petclinic/domain/{AbstractPerson_Roo_Entity.aj → AbstractPerson_Roo_Jpa_ActiveRecord.aj}
  8. +1 −2  src/main/java/com/springsource/petclinic/domain/AbstractPerson_Roo_Jpa_Entity.aj
  9. +4 −13 src/main/java/com/springsource/petclinic/domain/AbstractPerson_Roo_ToString.aj
  10. +2 −2 src/main/java/com/springsource/petclinic/domain/Owner.java
  11. +1 −0  src/main/java/com/springsource/petclinic/domain/Owner_Roo_Configurable.aj
  12. +1 −0  src/main/java/com/springsource/petclinic/domain/Owner_Roo_JavaBean.aj
  13. +9 −10 src/main/java/com/springsource/petclinic/domain/{Owner_Roo_Entity.aj → Owner_Roo_Jpa_ActiveRecord.aj}
  14. +1 −0  src/main/java/com/springsource/petclinic/domain/Owner_Roo_Jpa_Entity.aj
  15. +4 −14 src/main/java/com/springsource/petclinic/domain/Owner_Roo_ToString.aj
  16. +2 −2 src/main/java/com/springsource/petclinic/domain/Pet.java
  17. +1 −0  src/main/java/com/springsource/petclinic/domain/Pet_Roo_Configurable.aj
  18. +0 −2  src/main/java/com/springsource/petclinic/domain/Pet_Roo_Finder.aj
  19. +1 −2  src/main/java/com/springsource/petclinic/domain/Pet_Roo_JavaBean.aj
  20. +24 −25 src/main/java/com/springsource/petclinic/domain/{Pet_Roo_Entity.aj → Pet_Roo_Jpa_ActiveRecord.aj}
  21. +1 −2  src/main/java/com/springsource/petclinic/domain/Pet_Roo_Jpa_Entity.aj
  22. +4 −10 src/main/java/com/springsource/petclinic/domain/Pet_Roo_ToString.aj
  23. +2 −2 src/main/java/com/springsource/petclinic/domain/Vet.java
  24. +1 −0  src/main/java/com/springsource/petclinic/domain/Vet_Roo_Configurable.aj
  25. +1 −0  src/main/java/com/springsource/petclinic/domain/Vet_Roo_JavaBean.aj
  26. +9 −10 src/main/java/com/springsource/petclinic/domain/{Vet_Roo_Entity.aj → Vet_Roo_Jpa_ActiveRecord.aj}
  27. +1 −0  src/main/java/com/springsource/petclinic/domain/Vet_Roo_Jpa_Entity.aj
  28. +4 −15 src/main/java/com/springsource/petclinic/domain/Vet_Roo_ToString.aj
  29. +2 −2 src/main/java/com/springsource/petclinic/domain/Visit.java
  30. +1 −0  src/main/java/com/springsource/petclinic/domain/Visit_Roo_Configurable.aj
  31. +0 −1  src/main/java/com/springsource/petclinic/domain/Visit_Roo_Finder.aj
  32. +1 −1  src/main/java/com/springsource/petclinic/domain/Visit_Roo_JavaBean.aj
  33. +24 −25 src/main/java/com/springsource/petclinic/domain/{Visit_Roo_Entity.aj → Visit_Roo_Jpa_ActiveRecord.aj}
  34. +1 −2  src/main/java/com/springsource/petclinic/domain/Visit_Roo_Jpa_Entity.aj
  35. +4 −9 src/main/java/com/springsource/petclinic/domain/Visit_Roo_ToString.aj
  36. +1 −1  src/main/java/com/springsource/petclinic/web/ApplicationConversionServiceFactoryBean.java
  37. +1 −2  src/main/java/com/springsource/petclinic/web/ApplicationConversionServiceFactoryBean_Roo_ConversionService.aj
  38. +1 −1  src/main/java/com/springsource/petclinic/web/OwnerController.java
  39. +19 −32 src/main/java/com/springsource/petclinic/web/OwnerController_Roo_Controller.aj
  40. +1 −1  src/main/java/com/springsource/petclinic/web/PetController.java
  41. +17 −31 src/main/java/com/springsource/petclinic/web/PetController_Roo_Controller.aj
  42. +1 −2  src/main/java/com/springsource/petclinic/web/PetController_Roo_Controller_Finder.aj
  43. +1 −1  src/main/java/com/springsource/petclinic/web/VetController.java
  44. +19 −32 src/main/java/com/springsource/petclinic/web/VetController_Roo_Controller.aj
  45. +1 −1  src/main/java/com/springsource/petclinic/web/VisitController.java
  46. +22 −41 src/main/java/com/springsource/petclinic/web/VisitController_Roo_Controller.aj
  47. +1 −1  src/main/java/com/springsource/petclinic/web/VisitController_Roo_Controller_Finder.aj
  48. +0 −16 src/main/resources/META-INF/persistence.xml
  49. +68 −21 src/main/resources/META-INF/spring/applicationContext.xml
  50. +5 −5 src/main/resources/META-INF/spring/database.properties
  51. +2 −2 src/main/resources/log4j.properties
  52. +2 −2 src/main/webapp/WEB-INF/i18n/application.properties
  53. +1 −1  src/main/webapp/WEB-INF/spring/webmvc-config.xml
  54. +10 −10 src/main/webapp/WEB-INF/tags/form/fields/column.tagx
  55. +7 −7 src/main/webapp/WEB-INF/tags/form/fields/table.tagx
  56. +7 −7 src/main/webapp/WEB-INF/views/menu.jspx
  57. +1 −1  src/main/webapp/WEB-INF/web.xml
  58. +2 −2 src/main/webapp/selenium/test-owner.xhtml
  59. +4 −4 src/main/webapp/selenium/test-vet.xhtml
  60. +2 −2 src/main/webapp/selenium/test-visit.xhtml
  61. +1 −0  src/test/java/com/springsource/petclinic/domain/OwnerDataOnDemand_Roo_Configurable.aj
  62. +16 −10 src/test/java/com/springsource/petclinic/domain/OwnerDataOnDemand_Roo_DataOnDemand.aj
  63. +1 −0  src/test/java/com/springsource/petclinic/domain/OwnerIntegrationTest_Roo_Configurable.aj
  64. +2 −2 src/test/java/com/springsource/petclinic/domain/OwnerIntegrationTest_Roo_IntegrationTest.aj
  65. +1 −0  src/test/java/com/springsource/petclinic/domain/PetDataOnDemand_Roo_Configurable.aj
  66. +15 −10 src/test/java/com/springsource/petclinic/domain/PetDataOnDemand_Roo_DataOnDemand.aj
  67. +1 −0  src/test/java/com/springsource/petclinic/domain/PetIntegrationTest_Roo_Configurable.aj
  68. +2 −2 src/test/java/com/springsource/petclinic/domain/PetIntegrationTest_Roo_IntegrationTest.aj
  69. +1 −0  src/test/java/com/springsource/petclinic/domain/VetDataOnDemand_Roo_Configurable.aj
  70. +16 −10 src/test/java/com/springsource/petclinic/domain/VetDataOnDemand_Roo_DataOnDemand.aj
  71. +1 −0  src/test/java/com/springsource/petclinic/domain/VetIntegrationTest_Roo_Configurable.aj
  72. +2 −2 src/test/java/com/springsource/petclinic/domain/VetIntegrationTest_Roo_IntegrationTest.aj
  73. +1 −0  src/test/java/com/springsource/petclinic/domain/VisitDataOnDemand_Roo_Configurable.aj
  74. +15 −9 src/test/java/com/springsource/petclinic/domain/VisitDataOnDemand_Roo_DataOnDemand.aj
  75. +1 −0  src/test/java/com/springsource/petclinic/domain/VisitIntegrationTest_Roo_Configurable.aj
  76. +2 −2 src/test/java/com/springsource/petclinic/domain/VisitIntegrationTest_Roo_IntegrationTest.aj
View
2  .gitignore
@@ -1,2 +1,4 @@
/log.roo
/target
+/.idea
+/*.iml
View
2  Procfile
@@ -1 +1 @@
-web: java $JAVA_OPTS -jar target/dependency/jetty-runner.jar --port $PORT target/*.war
+web: java $JAVA_OPTS -Dspring.profiles.active=prod -jar target/dependency/jetty-runner.jar --port $PORT target/*.war
View
166 pom.xml
@@ -7,11 +7,12 @@
<version>0.1.0.BUILD-SNAPSHOT</version>
<name>petclinic</name>
<properties>
- <roo.version>1.2.0.M1</roo.version>
- <spring.version>3.0.6.RELEASE</spring.version>
<aspectj.version>1.6.12.M2</aspectj.version>
- <slf4j.version>1.6.1</slf4j.version>
+ <java.version>1.6</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <roo.version>1.2.0.RELEASE</roo.version>
+ <slf4j.version>1.6.2</slf4j.version>
+ <spring.version>3.1.0.RELEASE</spring.version>
</properties>
<repositories>
<repository>
@@ -29,11 +30,6 @@
<name>Spring Roo Repository</name>
<url>http://spring-roo-repository.springsource.org/release</url>
</repository>
- <repository>
- <id>JBoss Repo</id>
- <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
- <name>JBoss Repo</name>
- </repository>
</repositories>
<pluginRepositories>
<pluginRepository>
@@ -57,7 +53,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.8.2</version>
+ <version>4.9</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -101,6 +97,11 @@
<artifactId>flexjson</artifactId>
<version>2.1</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.0.1</version>
+ </dependency>
<!-- ROO dependencies -->
<dependency>
<groupId>org.springframework.roo</groupId>
@@ -125,12 +126,6 @@
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -148,19 +143,19 @@
<version>${spring.version}</version>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- <version>${spring.version}</version>
+ <groupId>org.hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
- <version>3.6.7.Final</version>
+ <version>3.6.8.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <version>3.6.7.Final</version>
+ <version>3.6.8.Final</version>
<exclusions>
<exclusion>
<groupId>cglib</groupId>
@@ -220,13 +215,7 @@
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
- <version>1.5.4</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
+ <version>1.5.6</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
@@ -238,18 +227,6 @@
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
- <groupId>commons-pool</groupId>
- <artifactId>commons-pool</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xerces</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
@@ -257,25 +234,8 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
@@ -285,7 +245,7 @@
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
@@ -296,13 +256,7 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>1.2.1</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
+ <version>1.2.2</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
@@ -334,28 +288,12 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tiles</groupId>
- <artifactId>tiles-core</artifactId>
- <version>2.2.1</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
+ <version>1.5</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
- <version>2.2.1</version>
- </dependency>
- <dependency>
- <groupId>postgresql</groupId>
- <artifactId>postgresql</artifactId>
- <version>9.0-801.jdbc3</version>
+ <version>2.2.2</version>
</dependency>
</dependencies>
<build>
@@ -371,15 +309,16 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
- <source>1.6</source>
- <target>1.6</target>
- <encoding>UTF-8</encoding>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
- <version>1.2</version> <!-- NB: do use 1.3 or 1.3.x due to MASPECTJ-90 - wait for 1.4 -->
+ <version>1.2</version>
+ <!-- NB: do not use 1.3 or 1.3.x due to MASPECTJ-90 and do not use 1.4 due to declare parents issue -->
<dependencies>
<!-- NB: You must use Maven 2.0.9 or above or these are ignored (see MNG-2972) -->
<dependency>
@@ -409,8 +348,8 @@
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
- <source>1.6</source>
- <target>1.6</target>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
</configuration>
</plugin>
<plugin>
@@ -418,13 +357,13 @@
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
- <encoding>UTF-8</encoding>
+ <encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.8</version>
+ <version>2.9</version>
<configuration>
<printSummary>false</printSummary>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
@@ -446,13 +385,14 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
- <version>2.6</version>
+ <version>2.7</version>
</plugin>
<!-- IDE -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
- <version>2.7</version> <!-- Note 2.8 does not work with AspectJ aspect path -->
+ <version>2.7</version>
+ <!-- Note 2.8 does not work with AspectJ aspect path -->
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
@@ -492,51 +432,49 @@
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
- <version>7.4.2.v20110526</version>
+ <version>8.0.1.v20110908</version>
<configuration>
<webAppConfig>
<contextPath>/${project.name}</contextPath>
</webAppConfig>
</configuration>
</plugin>
- <plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
<configuration>
- <browser>*firefox</browser>
- <suite>src/main/webapp/selenium/test-suite.xhtml</suite>
- <results>${project.build.directory}/selenium.html</results>
- <startURL>http://localhost:4444/</startURL>
- </configuration>
+ <browser>*firefox</browser>
+ <suite>src/main/webapp/selenium/test-suite.xhtml</suite>
+ <results>${project.build.directory}/selenium.html</results>
+ <startURL>http://localhost:4444/</startURL>
+ </configuration>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
- <version>2.6.0</version>
+ <version>2.9.0</version>
</dependency>
</dependencies>
</plugin>
- <plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
- <goals>
- <goal>copy</goal>
- </goals>
+ <goals><goal>copy</goal></goals>
<configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty-runner</artifactId>
- <version>7.5.3.v20111011</version>
- <destFileName>jetty-runner.jar</destFileName>
- </artifactItem>
- </artifactItems>
- </configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-runner</artifactId>
+ <version>7.4.5.v20110725</version>
+ <destFileName>jetty-runner.jar</destFileName>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
</execution>
</executions>
</plugin>
View
4 src/main/java/com/springsource/petclinic/domain/AbstractPerson.java
@@ -6,13 +6,13 @@
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
+import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;
@RooJavaBean
@RooToString
-@RooEntity
+@RooJpaActiveRecord
public abstract class AbstractPerson {
@Size(min = 3, max = 30)
View
1  src/main/java/com/springsource/petclinic/domain/AbstractPerson_Roo_Configurable.aj
@@ -3,6 +3,7 @@
package com.springsource.petclinic.domain;
+import com.springsource.petclinic.domain.AbstractPerson;
import org.springframework.beans.factory.annotation.Configurable;
privileged aspect AbstractPerson_Roo_Configurable {
View
2  src/main/java/com/springsource/petclinic/domain/AbstractPerson_Roo_JavaBean.aj
@@ -3,7 +3,7 @@
package com.springsource.petclinic.domain;
-import java.lang.String;
+import com.springsource.petclinic.domain.AbstractPerson;
import java.util.Date;
privileged aspect AbstractPerson_Roo_JavaBean {
View
51 ...rce/petclinic/domain/AbstractPerson_Roo_Entity.aj → ...nic/domain/AbstractPerson_Roo_Jpa_ActiveRecord.aj
@@ -4,17 +4,40 @@
package com.springsource.petclinic.domain;
import com.springsource.petclinic.domain.AbstractPerson;
-import java.lang.Long;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.transaction.annotation.Transactional;
-privileged aspect AbstractPerson_Roo_Entity {
+privileged aspect AbstractPerson_Roo_Jpa_ActiveRecord {
@PersistenceContext
transient EntityManager AbstractPerson.entityManager;
+ public static final EntityManager AbstractPerson.entityManager() {
+ EntityManager em = new AbstractPerson() {
+ }.entityManager;
+ if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
+ return em;
+ }
+
+ public static long AbstractPerson.countAbstractpeople() {
+ return entityManager().createQuery("SELECT COUNT(o) FROM AbstractPerson o", Long.class).getSingleResult();
+ }
+
+ public static List<AbstractPerson> AbstractPerson.findAllAbstractpeople() {
+ return entityManager().createQuery("SELECT o FROM AbstractPerson o", AbstractPerson.class).getResultList();
+ }
+
+ public static AbstractPerson AbstractPerson.findAbstractPerson(Long id) {
+ if (id == null) return null;
+ return entityManager().find(AbstractPerson.class, id);
+ }
+
+ public static List<AbstractPerson> AbstractPerson.findAbstractPersonEntries(int firstResult, int maxResults) {
+ return entityManager().createQuery("SELECT o FROM AbstractPerson o", AbstractPerson.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
+ }
+
@Transactional
public void AbstractPerson.persist() {
if (this.entityManager == null) this.entityManager = entityManager();
@@ -52,28 +75,4 @@ privileged aspect AbstractPerson_Roo_Entity {
return merged;
}
- public static final EntityManager AbstractPerson.entityManager() {
- EntityManager em = new AbstractPerson() {
- }.entityManager;
- if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
- return em;
- }
-
- public static long AbstractPerson.countAbstractpeople() {
- return entityManager().createQuery("SELECT COUNT(o) FROM AbstractPerson o", Long.class).getSingleResult();
- }
-
- public static List<AbstractPerson> AbstractPerson.findAllAbstractpeople() {
- return entityManager().createQuery("SELECT o FROM AbstractPerson o", AbstractPerson.class).getResultList();
- }
-
- public static AbstractPerson AbstractPerson.findAbstractPerson(Long id) {
- if (id == null) return null;
- return entityManager().find(AbstractPerson.class, id);
- }
-
- public static List<AbstractPerson> AbstractPerson.findAbstractPersonEntries(int firstResult, int maxResults) {
- return entityManager().createQuery("SELECT o FROM AbstractPerson o", AbstractPerson.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
- }
-
}
View
3  src/main/java/com/springsource/petclinic/domain/AbstractPerson_Roo_Jpa_Entity.aj
@@ -3,8 +3,7 @@
package com.springsource.petclinic.domain;
-import java.lang.Integer;
-import java.lang.Long;
+import com.springsource.petclinic.domain.AbstractPerson;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
View
17 src/main/java/com/springsource/petclinic/domain/AbstractPerson_Roo_ToString.aj
@@ -3,23 +3,14 @@
package com.springsource.petclinic.domain;
-import java.lang.String;
+import com.springsource.petclinic.domain.AbstractPerson;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
privileged aspect AbstractPerson_Roo_ToString {
public String AbstractPerson.toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("Address: ").append(getAddress()).append(", ");
- sb.append("BirthDay: ").append(getBirthDay()).append(", ");
- sb.append("City: ").append(getCity()).append(", ");
- sb.append("Email: ").append(getEmail()).append(", ");
- sb.append("FirstName: ").append(getFirstName()).append(", ");
- sb.append("HomePage: ").append(getHomePage()).append(", ");
- sb.append("Id: ").append(getId()).append(", ");
- sb.append("LastName: ").append(getLastName()).append(", ");
- sb.append("Telephone: ").append(getTelephone()).append(", ");
- sb.append("Version: ").append(getVersion());
- return sb.toString();
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
View
4 src/main/java/com/springsource/petclinic/domain/Owner.java
@@ -4,13 +4,13 @@
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.OneToMany;
-import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
+import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;
@RooJavaBean
@RooToString
-@RooEntity
+@RooJpaActiveRecord
public class Owner extends AbstractPerson {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner")
View
1  src/main/java/com/springsource/petclinic/domain/Owner_Roo_Configurable.aj
@@ -3,6 +3,7 @@
package com.springsource.petclinic.domain;
+import com.springsource.petclinic.domain.Owner;
import org.springframework.beans.factory.annotation.Configurable;
privileged aspect Owner_Roo_Configurable {
View
1  src/main/java/com/springsource/petclinic/domain/Owner_Roo_JavaBean.aj
@@ -3,6 +3,7 @@
package com.springsource.petclinic.domain;
+import com.springsource.petclinic.domain.Owner;
import com.springsource.petclinic.domain.Pet;
import java.util.Set;
View
19 ...springsource/petclinic/domain/Owner_Roo_Entity.aj → ...ce/petclinic/domain/Owner_Roo_Jpa_ActiveRecord.aj
@@ -4,19 +4,10 @@
package com.springsource.petclinic.domain;
import com.springsource.petclinic.domain.Owner;
-import java.lang.Long;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
-privileged aspect Owner_Roo_Entity {
-
- @Transactional
- public Owner Owner.merge() {
- if (this.entityManager == null) this.entityManager = entityManager();
- Owner merged = this.entityManager.merge(this);
- this.entityManager.flush();
- return merged;
- }
+privileged aspect Owner_Roo_Jpa_ActiveRecord {
public static long Owner.countOwners() {
return entityManager().createQuery("SELECT COUNT(o) FROM Owner o", Long.class).getSingleResult();
@@ -35,4 +26,12 @@ privileged aspect Owner_Roo_Entity {
return entityManager().createQuery("SELECT o FROM Owner o", Owner.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
}
+ @Transactional
+ public Owner Owner.merge() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ Owner merged = this.entityManager.merge(this);
+ this.entityManager.flush();
+ return merged;
+ }
+
}
View
1  src/main/java/com/springsource/petclinic/domain/Owner_Roo_Jpa_Entity.aj
@@ -3,6 +3,7 @@
package com.springsource.petclinic.domain;
+import com.springsource.petclinic.domain.Owner;
import javax.persistence.Entity;
privileged aspect Owner_Roo_Jpa_Entity {
View
18 src/main/java/com/springsource/petclinic/domain/Owner_Roo_ToString.aj
@@ -3,24 +3,14 @@
package com.springsource.petclinic.domain;
-import java.lang.String;
+import com.springsource.petclinic.domain.Owner;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
privileged aspect Owner_Roo_ToString {
public String Owner.toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("Address: ").append(getAddress()).append(", ");
- sb.append("BirthDay: ").append(getBirthDay()).append(", ");
- sb.append("City: ").append(getCity()).append(", ");
- sb.append("Email: ").append(getEmail()).append(", ");
- sb.append("FirstName: ").append(getFirstName()).append(", ");
- sb.append("HomePage: ").append(getHomePage()).append(", ");
- sb.append("Id: ").append(getId()).append(", ");
- sb.append("LastName: ").append(getLastName()).append(", ");
- sb.append("Pets: ").append(getPets() == null ? "null" : getPets().size()).append(", ");
- sb.append("Telephone: ").append(getTelephone()).append(", ");
- sb.append("Version: ").append(getVersion());
- return sb.toString();
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
View
4 src/main/java/com/springsource/petclinic/domain/Pet.java
@@ -6,13 +6,13 @@
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
-import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
+import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;
@RooJavaBean
@RooToString
-@RooEntity(finders = { "findPetsByNameAndWeight", "findPetsByOwner", "findPetsBySendRemindersAndWeightLessThan", "findPetsByTypeAndNameLike" })
+@RooJpaActiveRecord(finders = { "findPetsByNameAndWeight", "findPetsByOwner", "findPetsBySendRemindersAndWeightLessThan", "findPetsByTypeAndNameLike" })
public class Pet {
@NotNull
View
1  src/main/java/com/springsource/petclinic/domain/Pet_Roo_Configurable.aj
@@ -3,6 +3,7 @@
package com.springsource.petclinic.domain;
+import com.springsource.petclinic.domain.Pet;
import org.springframework.beans.factory.annotation.Configurable;
privileged aspect Pet_Roo_Configurable {
View
2  src/main/java/com/springsource/petclinic/domain/Pet_Roo_Finder.aj
@@ -6,8 +6,6 @@ package com.springsource.petclinic.domain;
import com.springsource.petclinic.domain.Owner;
import com.springsource.petclinic.domain.Pet;
import com.springsource.petclinic.reference.PetType;
-import java.lang.Float;
-import java.lang.String;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
View
3  src/main/java/com/springsource/petclinic/domain/Pet_Roo_JavaBean.aj
@@ -4,9 +4,8 @@
package com.springsource.petclinic.domain;
import com.springsource.petclinic.domain.Owner;
+import com.springsource.petclinic.domain.Pet;
import com.springsource.petclinic.reference.PetType;
-import java.lang.Float;
-import java.lang.String;
privileged aspect Pet_Roo_JavaBean {
View
49 ...m/springsource/petclinic/domain/Pet_Roo_Entity.aj → ...urce/petclinic/domain/Pet_Roo_Jpa_ActiveRecord.aj
@@ -4,17 +4,39 @@
package com.springsource.petclinic.domain;
import com.springsource.petclinic.domain.Pet;
-import java.lang.Long;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.transaction.annotation.Transactional;
-privileged aspect Pet_Roo_Entity {
+privileged aspect Pet_Roo_Jpa_ActiveRecord {
@PersistenceContext
transient EntityManager Pet.entityManager;
+ public static final EntityManager Pet.entityManager() {
+ EntityManager em = new Pet().entityManager;
+ if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
+ return em;
+ }
+
+ public static long Pet.countPets() {
+ return entityManager().createQuery("SELECT COUNT(o) FROM Pet o", Long.class).getSingleResult();
+ }
+
+ public static List<Pet> Pet.findAllPets() {
+ return entityManager().createQuery("SELECT o FROM Pet o", Pet.class).getResultList();
+ }
+
+ public static Pet Pet.findPet(Long id) {
+ if (id == null) return null;
+ return entityManager().find(Pet.class, id);
+ }
+
+ public static List<Pet> Pet.findPetEntries(int firstResult, int maxResults) {
+ return entityManager().createQuery("SELECT o FROM Pet o", Pet.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
+ }
+
@Transactional
public void Pet.persist() {
if (this.entityManager == null) this.entityManager = entityManager();
@@ -52,27 +74,4 @@ privileged aspect Pet_Roo_Entity {
return merged;
}
- public static final EntityManager Pet.entityManager() {
- EntityManager em = new Pet().entityManager;
- if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
- return em;
- }
-
- public static long Pet.countPets() {
- return entityManager().createQuery("SELECT COUNT(o) FROM Pet o", Long.class).getSingleResult();
- }
-
- public static List<Pet> Pet.findAllPets() {
- return entityManager().createQuery("SELECT o FROM Pet o", Pet.class).getResultList();
- }
-
- public static Pet Pet.findPet(Long id) {
- if (id == null) return null;
- return entityManager().find(Pet.class, id);
- }
-
- public static List<Pet> Pet.findPetEntries(int firstResult, int maxResults) {
- return entityManager().createQuery("SELECT o FROM Pet o", Pet.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
- }
-
}
View
3  src/main/java/com/springsource/petclinic/domain/Pet_Roo_Jpa_Entity.aj
@@ -3,8 +3,7 @@
package com.springsource.petclinic.domain;
-import java.lang.Integer;
-import java.lang.Long;
+import com.springsource.petclinic.domain.Pet;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
View
14 src/main/java/com/springsource/petclinic/domain/Pet_Roo_ToString.aj
@@ -3,20 +3,14 @@
package com.springsource.petclinic.domain;
-import java.lang.String;
+import com.springsource.petclinic.domain.Pet;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
privileged aspect Pet_Roo_ToString {
public String Pet.toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("Id: ").append(getId()).append(", ");
- sb.append("Name: ").append(getName()).append(", ");
- sb.append("Owner: ").append(getOwner()).append(", ");
- sb.append("Type: ").append(getType()).append(", ");
- sb.append("Version: ").append(getVersion()).append(", ");
- sb.append("Weight: ").append(getWeight()).append(", ");
- sb.append("SendReminders: ").append(isSendReminders());
- return sb.toString();
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
View
4 src/main/java/com/springsource/petclinic/domain/Vet.java
@@ -8,13 +8,13 @@
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
+import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;
@RooJavaBean
@RooToString
-@RooEntity
+@RooJpaActiveRecord
public class Vet extends AbstractPerson {
@NotNull
View
1  src/main/java/com/springsource/petclinic/domain/Vet_Roo_Configurable.aj
@@ -3,6 +3,7 @@
package com.springsource.petclinic.domain;
+import com.springsource.petclinic.domain.Vet;
import org.springframework.beans.factory.annotation.Configurable;
privileged aspect Vet_Roo_Configurable {
View
1  src/main/java/com/springsource/petclinic/domain/Vet_Roo_JavaBean.aj
@@ -3,6 +3,7 @@
package com.springsource.petclinic.domain;
+import com.springsource.petclinic.domain.Vet;
import com.springsource.petclinic.reference.Specialty;
import java.util.Calendar;
View
19 ...m/springsource/petclinic/domain/Vet_Roo_Entity.aj → ...urce/petclinic/domain/Vet_Roo_Jpa_ActiveRecord.aj
@@ -4,19 +4,10 @@
package com.springsource.petclinic.domain;
import com.springsource.petclinic.domain.Vet;
-import java.lang.Long;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
-privileged aspect Vet_Roo_Entity {
-
- @Transactional
- public Vet Vet.merge() {
- if (this.entityManager == null) this.entityManager = entityManager();
- Vet merged = this.entityManager.merge(this);
- this.entityManager.flush();
- return merged;
- }
+privileged aspect Vet_Roo_Jpa_ActiveRecord {
public static long Vet.countVets() {
return entityManager().createQuery("SELECT COUNT(o) FROM Vet o", Long.class).getSingleResult();
@@ -35,4 +26,12 @@ privileged aspect Vet_Roo_Entity {
return entityManager().createQuery("SELECT o FROM Vet o", Vet.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
}
+ @Transactional
+ public Vet Vet.merge() {
+ if (this.entityManager == null) this.entityManager = entityManager();
+ Vet merged = this.entityManager.merge(this);
+ this.entityManager.flush();
+ return merged;
+ }
+
}
View
1  src/main/java/com/springsource/petclinic/domain/Vet_Roo_Jpa_Entity.aj
@@ -3,6 +3,7 @@
package com.springsource.petclinic.domain;
+import com.springsource.petclinic.domain.Vet;
import javax.persistence.Entity;
privileged aspect Vet_Roo_Jpa_Entity {
View
19 src/main/java/com/springsource/petclinic/domain/Vet_Roo_ToString.aj
@@ -3,25 +3,14 @@
package com.springsource.petclinic.domain;
-import java.lang.String;
+import com.springsource.petclinic.domain.Vet;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
privileged aspect Vet_Roo_ToString {
public String Vet.toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("Address: ").append(getAddress()).append(", ");
- sb.append("BirthDay: ").append(getBirthDay()).append(", ");
- sb.append("City: ").append(getCity()).append(", ");
- sb.append("Email: ").append(getEmail()).append(", ");
- sb.append("EmployedSince: ").append(getEmployedSince() == null ? "null" : getEmployedSince().getTime()).append(", ");
- sb.append("FirstName: ").append(getFirstName()).append(", ");
- sb.append("HomePage: ").append(getHomePage()).append(", ");
- sb.append("Id: ").append(getId()).append(", ");
- sb.append("LastName: ").append(getLastName()).append(", ");
- sb.append("Specialty: ").append(getSpecialty()).append(", ");
- sb.append("Telephone: ").append(getTelephone()).append(", ");
- sb.append("Version: ").append(getVersion());
- return sb.toString();
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
View
4 src/main/java/com/springsource/petclinic/domain/Visit.java
@@ -8,13 +8,13 @@
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;
import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
+import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;
@RooJavaBean
@RooToString
-@RooEntity(finders = { "findVisitsByDescriptionAndVisitDate", "findVisitsByVisitDateBetween", "findVisitsByDescriptionLike" })
+@RooJpaActiveRecord(finders = { "findVisitsByDescriptionAndVisitDate", "findVisitsByVisitDateBetween", "findVisitsByDescriptionLike" })
public class Visit {
@Size(max = 255)
View
1  src/main/java/com/springsource/petclinic/domain/Visit_Roo_Configurable.aj
@@ -3,6 +3,7 @@
package com.springsource.petclinic.domain;
+import com.springsource.petclinic.domain.Visit;
import org.springframework.beans.factory.annotation.Configurable;
privileged aspect Visit_Roo_Configurable {
View
1  src/main/java/com/springsource/petclinic/domain/Visit_Roo_Finder.aj
@@ -4,7 +4,6 @@
package com.springsource.petclinic.domain;
import com.springsource.petclinic.domain.Visit;
-import java.lang.String;
import java.util.Date;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
View
2  src/main/java/com/springsource/petclinic/domain/Visit_Roo_JavaBean.aj
@@ -5,7 +5,7 @@ package com.springsource.petclinic.domain;
import com.springsource.petclinic.domain.Pet;
import com.springsource.petclinic.domain.Vet;
-import java.lang.String;
+import com.springsource.petclinic.domain.Visit;
import java.util.Date;
privileged aspect Visit_Roo_JavaBean {
View
49 ...springsource/petclinic/domain/Visit_Roo_Entity.aj → ...ce/petclinic/domain/Visit_Roo_Jpa_ActiveRecord.aj
@@ -4,17 +4,39 @@
package com.springsource.petclinic.domain;
import com.springsource.petclinic.domain.Visit;
-import java.lang.Long;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.transaction.annotation.Transactional;
-privileged aspect Visit_Roo_Entity {
+privileged aspect Visit_Roo_Jpa_ActiveRecord {
@PersistenceContext
transient EntityManager Visit.entityManager;
+ public static final EntityManager Visit.entityManager() {
+ EntityManager em = new Visit().entityManager;
+ if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
+ return em;
+ }
+
+ public static long Visit.countVisits() {
+ return entityManager().createQuery("SELECT COUNT(o) FROM Visit o", Long.class).getSingleResult();
+ }
+
+ public static List<Visit> Visit.findAllVisits() {
+ return entityManager().createQuery("SELECT o FROM Visit o", Visit.class).getResultList();
+ }
+
+ public static Visit Visit.findVisit(Long id) {
+ if (id == null) return null;
+ return entityManager().find(Visit.class, id);
+ }
+
+ public static List<Visit> Visit.findVisitEntries(int firstResult, int maxResults) {
+ return entityManager().createQuery("SELECT o FROM Visit o", Visit.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
+ }
+
@Transactional
public void Visit.persist() {
if (this.entityManager == null) this.entityManager = entityManager();
@@ -52,27 +74,4 @@ privileged aspect Visit_Roo_Entity {
return merged;
}
- public static final EntityManager Visit.entityManager() {
- EntityManager em = new Visit().entityManager;
- if (em == null) throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
- return em;
- }
-
- public static long Visit.countVisits() {
- return entityManager().createQuery("SELECT COUNT(o) FROM Visit o", Long.class).getSingleResult();
- }
-
- public static List<Visit> Visit.findAllVisits() {
- return entityManager().createQuery("SELECT o FROM Visit o", Visit.class).getResultList();
- }
-
- public static Visit Visit.findVisit(Long id) {
- if (id == null) return null;
- return entityManager().find(Visit.class, id);
- }
-
- public static List<Visit> Visit.findVisitEntries(int firstResult, int maxResults) {
- return entityManager().createQuery("SELECT o FROM Visit o", Visit.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
- }
-
}
View
3  src/main/java/com/springsource/petclinic/domain/Visit_Roo_Jpa_Entity.aj
@@ -3,8 +3,7 @@
package com.springsource.petclinic.domain;
-import java.lang.Integer;
-import java.lang.Long;
+import com.springsource.petclinic.domain.Visit;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
View
13 src/main/java/com/springsource/petclinic/domain/Visit_Roo_ToString.aj
@@ -3,19 +3,14 @@
package com.springsource.petclinic.domain;
-import java.lang.String;
+import com.springsource.petclinic.domain.Visit;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
privileged aspect Visit_Roo_ToString {
public String Visit.toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("Description: ").append(getDescription()).append(", ");
- sb.append("Id: ").append(getId()).append(", ");
- sb.append("Pet: ").append(getPet()).append(", ");
- sb.append("Version: ").append(getVersion()).append(", ");
- sb.append("Vet: ").append(getVet()).append(", ");
- sb.append("VisitDate: ").append(getVisitDate());
- return sb.toString();
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
View
2  src/main/java/com/springsource/petclinic/web/ApplicationConversionServiceFactoryBean.java
@@ -2,7 +2,7 @@
import org.springframework.format.FormatterRegistry;
import org.springframework.format.support.FormattingConversionServiceFactoryBean;
-import org.springframework.roo.addon.web.mvc.controller.RooConversionService;
+import org.springframework.roo.addon.web.mvc.controller.converter.RooConversionService;
/**
* A central place to register application converters and formatters.
View
3  ...ain/java/com/springsource/petclinic/web/ApplicationConversionServiceFactoryBean_Roo_ConversionService.aj
@@ -7,8 +7,7 @@ import com.springsource.petclinic.domain.Owner;
import com.springsource.petclinic.domain.Pet;
import com.springsource.petclinic.domain.Vet;
import com.springsource.petclinic.domain.Visit;
-import java.lang.Long;
-import java.lang.String;
+import com.springsource.petclinic.web.ApplicationConversionServiceFactoryBean;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.core.convert.converter.Converter;
import org.springframework.format.FormatterRegistry;
View
2  src/main/java/com/springsource/petclinic/web/OwnerController.java
@@ -1,7 +1,7 @@
package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Owner;
-import org.springframework.roo.addon.web.mvc.controller.RooWebScaffold;
+import org.springframework.roo.addon.web.mvc.controller.scaffold.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
View
51 src/main/java/com/springsource/petclinic/web/OwnerController_Roo_Controller.aj
@@ -5,18 +5,14 @@ package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Owner;
import com.springsource.petclinic.domain.Pet;
+import com.springsource.petclinic.web.OwnerController;
import java.io.UnsupportedEncodingException;
-import java.lang.Integer;
-import java.lang.Long;
-import java.lang.String;
-import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.joda.time.format.DateTimeFormat;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -26,11 +22,10 @@ import org.springframework.web.util.WebUtils;
privileged aspect OwnerController_Roo_Controller {
- @RequestMapping(method = RequestMethod.POST)
+ @RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String OwnerController.create(@Valid Owner owner, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
- uiModel.addAttribute("owner", owner);
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, owner);
return "owners/create";
}
uiModel.asMap().clear();
@@ -38,14 +33,13 @@ privileged aspect OwnerController_Roo_Controller {
return "redirect:/owners/" + encodeUrlPathSegment(owner.getId().toString(), httpServletRequest);
}
- @RequestMapping(params = "form", method = RequestMethod.GET)
+ @RequestMapping(params = "form", produces = "text/html")
public String OwnerController.createForm(Model uiModel) {
- uiModel.addAttribute("owner", new Owner());
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, new Owner());
return "owners/create";
}
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+ @RequestMapping(value = "/{id}", produces = "text/html")
public String OwnerController.show(@PathVariable("id") Long id, Model uiModel) {
addDateTimeFormatPatterns(uiModel);
uiModel.addAttribute("owner", Owner.findOwner(id));
@@ -53,7 +47,7 @@ privileged aspect OwnerController_Roo_Controller {
return "owners/show";
}
- @RequestMapping(method = RequestMethod.GET)
+ @RequestMapping(produces = "text/html")
public String OwnerController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
if (page != null || size != null) {
int sizeNo = size == null ? 10 : size.intValue();
@@ -68,11 +62,10 @@ privileged aspect OwnerController_Roo_Controller {
return "owners/list";
}
- @RequestMapping(method = RequestMethod.PUT)
+ @RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String OwnerController.update(@Valid Owner owner, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
- uiModel.addAttribute("owner", owner);
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, owner);
return "owners/update";
}
uiModel.asMap().clear();
@@ -80,14 +73,13 @@ privileged aspect OwnerController_Roo_Controller {
return "redirect:/owners/" + encodeUrlPathSegment(owner.getId().toString(), httpServletRequest);
}
- @RequestMapping(value = "/{id}", params = "form", method = RequestMethod.GET)
+ @RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String OwnerController.updateForm(@PathVariable("id") Long id, Model uiModel) {
- uiModel.addAttribute("owner", Owner.findOwner(id));
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, Owner.findOwner(id));
return "owners/update";
}
- @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
public String OwnerController.delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
Owner owner = Owner.findOwner(id);
owner.remove();
@@ -97,20 +89,16 @@ privileged aspect OwnerController_Roo_Controller {
return "redirect:/owners";
}
- @ModelAttribute("owners")
- public Collection<Owner> OwnerController.populateOwners() {
- return Owner.findAllOwners();
- }
-
- @ModelAttribute("pets")
- public Collection<Pet> OwnerController.populatePets() {
- return Pet.findAllPets();
- }
-
void OwnerController.addDateTimeFormatPatterns(Model uiModel) {
uiModel.addAttribute("owner_birthday_date_format", DateTimeFormat.patternForStyle("M-", LocaleContextHolder.getLocale()));
}
+ void OwnerController.populateEditForm(Model uiModel, Owner owner) {
+ uiModel.addAttribute("owner", owner);
+ addDateTimeFormatPatterns(uiModel);
+ uiModel.addAttribute("pets", Pet.findAllPets());
+ }
+
String OwnerController.encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) {
String enc = httpServletRequest.getCharacterEncoding();
if (enc == null) {
@@ -118,8 +106,7 @@ privileged aspect OwnerController_Roo_Controller {
}
try {
pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
- }
- catch (UnsupportedEncodingException uee) {}
+ } catch (UnsupportedEncodingException uee) {}
return pathSegment;
}
View
2  src/main/java/com/springsource/petclinic/web/PetController.java
@@ -1,8 +1,8 @@
package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Pet;
-import org.springframework.roo.addon.web.mvc.controller.RooWebScaffold;
import org.springframework.roo.addon.web.mvc.controller.finder.RooWebFinder;
+import org.springframework.roo.addon.web.mvc.controller.scaffold.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
View
48 src/main/java/com/springsource/petclinic/web/PetController_Roo_Controller.aj
@@ -6,17 +6,13 @@ package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Owner;
import com.springsource.petclinic.domain.Pet;
import com.springsource.petclinic.reference.PetType;
+import com.springsource.petclinic.web.PetController;
import java.io.UnsupportedEncodingException;
-import java.lang.Integer;
-import java.lang.Long;
-import java.lang.String;
import java.util.Arrays;
-import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -26,10 +22,10 @@ import org.springframework.web.util.WebUtils;
privileged aspect PetController_Roo_Controller {
- @RequestMapping(method = RequestMethod.POST)
+ @RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String PetController.create(@Valid Pet pet, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
- uiModel.addAttribute("pet", pet);
+ populateEditForm(uiModel, pet);
return "pets/create";
}
uiModel.asMap().clear();
@@ -37,20 +33,20 @@ privileged aspect PetController_Roo_Controller {
return "redirect:/pets/" + encodeUrlPathSegment(pet.getId().toString(), httpServletRequest);
}
- @RequestMapping(params = "form", method = RequestMethod.GET)
+ @RequestMapping(params = "form", produces = "text/html")
public String PetController.createForm(Model uiModel) {
- uiModel.addAttribute("pet", new Pet());
+ populateEditForm(uiModel, new Pet());
return "pets/create";
}
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+ @RequestMapping(value = "/{id}", produces = "text/html")
public String PetController.show(@PathVariable("id") Long id, Model uiModel) {
uiModel.addAttribute("pet", Pet.findPet(id));
uiModel.addAttribute("itemId", id);
return "pets/show";
}
- @RequestMapping(method = RequestMethod.GET)
+ @RequestMapping(produces = "text/html")
public String PetController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
if (page != null || size != null) {
int sizeNo = size == null ? 10 : size.intValue();
@@ -64,10 +60,10 @@ privileged aspect PetController_Roo_Controller {
return "pets/list";
}
- @RequestMapping(method = RequestMethod.PUT)
+ @RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String PetController.update(@Valid Pet pet, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
- uiModel.addAttribute("pet", pet);
+ populateEditForm(uiModel, pet);
return "pets/update";
}
uiModel.asMap().clear();
@@ -75,13 +71,13 @@ privileged aspect PetController_Roo_Controller {
return "redirect:/pets/" + encodeUrlPathSegment(pet.getId().toString(), httpServletRequest);
}
- @RequestMapping(value = "/{id}", params = "form", method = RequestMethod.GET)
+ @RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String PetController.updateForm(@PathVariable("id") Long id, Model uiModel) {
- uiModel.addAttribute("pet", Pet.findPet(id));
+ populateEditForm(uiModel, Pet.findPet(id));
return "pets/update";
}
- @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
public String PetController.delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
Pet pet = Pet.findPet(id);
pet.remove();
@@ -91,19 +87,10 @@ privileged aspect PetController_Roo_Controller {
return "redirect:/pets";
}
- @ModelAttribute("owners")
- public Collection<Owner> PetController.populateOwners() {
- return Owner.findAllOwners();
- }
-
- @ModelAttribute("pets")
- public Collection<Pet> PetController.populatePets() {
- return Pet.findAllPets();
- }
-
- @ModelAttribute("pettypes")
- public Collection<PetType> PetController.populatePetTypes() {
- return Arrays.asList(PetType.class.getEnumConstants());
+ void PetController.populateEditForm(Model uiModel, Pet pet) {
+ uiModel.addAttribute("pet", pet);
+ uiModel.addAttribute("owners", Owner.findAllOwners());
+ uiModel.addAttribute("pettypes", Arrays.asList(PetType.values()));
}
String PetController.encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) {
@@ -113,8 +100,7 @@ privileged aspect PetController_Roo_Controller {
}
try {
pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
- }
- catch (UnsupportedEncodingException uee) {}
+ } catch (UnsupportedEncodingException uee) {}
return pathSegment;
}
View
3  src/main/java/com/springsource/petclinic/web/PetController_Roo_Controller_Finder.aj
@@ -6,8 +6,7 @@ package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Owner;
import com.springsource.petclinic.domain.Pet;
import com.springsource.petclinic.reference.PetType;
-import java.lang.Float;
-import java.lang.String;
+import com.springsource.petclinic.web.PetController;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
View
2  src/main/java/com/springsource/petclinic/web/VetController.java
@@ -1,7 +1,7 @@
package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Vet;
-import org.springframework.roo.addon.web.mvc.controller.RooWebScaffold;
+import org.springframework.roo.addon.web.mvc.controller.scaffold.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
View
51 src/main/java/com/springsource/petclinic/web/VetController_Roo_Controller.aj
@@ -5,19 +5,15 @@ package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Vet;
import com.springsource.petclinic.reference.Specialty;
+import com.springsource.petclinic.web.VetController;
import java.io.UnsupportedEncodingException;
-import java.lang.Integer;
-import java.lang.Long;
-import java.lang.String;
import java.util.Arrays;
-import java.util.Collection;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.joda.time.format.DateTimeFormat;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -27,11 +23,10 @@ import org.springframework.web.util.WebUtils;
privileged aspect VetController_Roo_Controller {
- @RequestMapping(method = RequestMethod.POST)
+ @RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String VetController.create(@Valid Vet vet, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
- uiModel.addAttribute("vet", vet);
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, vet);
return "vets/create";
}
uiModel.asMap().clear();
@@ -39,14 +34,13 @@ privileged aspect VetController_Roo_Controller {
return "redirect:/vets/" + encodeUrlPathSegment(vet.getId().toString(), httpServletRequest);
}
- @RequestMapping(params = "form", method = RequestMethod.GET)
+ @RequestMapping(params = "form", produces = "text/html")
public String VetController.createForm(Model uiModel) {
- uiModel.addAttribute("vet", new Vet());
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, new Vet());
return "vets/create";
}
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+ @RequestMapping(value = "/{id}", produces = "text/html")
public String VetController.show(@PathVariable("id") Long id, Model uiModel) {
addDateTimeFormatPatterns(uiModel);
uiModel.addAttribute("vet", Vet.findVet(id));
@@ -54,7 +48,7 @@ privileged aspect VetController_Roo_Controller {
return "vets/show";
}
- @RequestMapping(method = RequestMethod.GET)
+ @RequestMapping(produces = "text/html")
public String VetController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
if (page != null || size != null) {
int sizeNo = size == null ? 10 : size.intValue();
@@ -69,11 +63,10 @@ privileged aspect VetController_Roo_Controller {
return "vets/list";
}
- @RequestMapping(method = RequestMethod.PUT)
+ @RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String VetController.update(@Valid Vet vet, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
- uiModel.addAttribute("vet", vet);
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, vet);
return "vets/update";
}
uiModel.asMap().clear();
@@ -81,14 +74,13 @@ privileged aspect VetController_Roo_Controller {
return "redirect:/vets/" + encodeUrlPathSegment(vet.getId().toString(), httpServletRequest);
}
- @RequestMapping(value = "/{id}", params = "form", method = RequestMethod.GET)
+ @RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String VetController.updateForm(@PathVariable("id") Long id, Model uiModel) {
- uiModel.addAttribute("vet", Vet.findVet(id));
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, Vet.findVet(id));
return "vets/update";
}
- @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
public String VetController.delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
Vet vet = Vet.findVet(id);
vet.remove();
@@ -98,21 +90,17 @@ privileged aspect VetController_Roo_Controller {
return "redirect:/vets";
}
- @ModelAttribute("vets")
- public Collection<Vet> VetController.populateVets() {
- return Vet.findAllVets();
- }
-
- @ModelAttribute("specialtys")
- public Collection<Specialty> VetController.populateSpecialtys() {
- return Arrays.asList(Specialty.class.getEnumConstants());
- }
-
void VetController.addDateTimeFormatPatterns(Model uiModel) {
uiModel.addAttribute("vet_birthday_date_format", DateTimeFormat.patternForStyle("M-", LocaleContextHolder.getLocale()));
uiModel.addAttribute("vet_employedsince_date_format", DateTimeFormat.patternForStyle("M-", LocaleContextHolder.getLocale()));
}
+ void VetController.populateEditForm(Model uiModel, Vet vet) {
+ uiModel.addAttribute("vet", vet);
+ addDateTimeFormatPatterns(uiModel);
+ uiModel.addAttribute("specialtys", Arrays.asList(Specialty.values()));
+ }
+
String VetController.encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) {
String enc = httpServletRequest.getCharacterEncoding();
if (enc == null) {
@@ -120,8 +108,7 @@ privileged aspect VetController_Roo_Controller {
}
try {
pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
- }
- catch (UnsupportedEncodingException uee) {}
+ } catch (UnsupportedEncodingException uee) {}
return pathSegment;
}
View
2  src/main/java/com/springsource/petclinic/web/VisitController.java
@@ -1,8 +1,8 @@
package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Visit;
-import org.springframework.roo.addon.web.mvc.controller.RooWebScaffold;
import org.springframework.roo.addon.web.mvc.controller.finder.RooWebFinder;
+import org.springframework.roo.addon.web.mvc.controller.scaffold.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
View
63 src/main/java/com/springsource/petclinic/web/VisitController_Roo_Controller.aj
@@ -6,12 +6,9 @@ package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Pet;
import com.springsource.petclinic.domain.Vet;
import com.springsource.petclinic.domain.Visit;
+import com.springsource.petclinic.web.VisitController;
import java.io.UnsupportedEncodingException;
-import java.lang.Integer;
-import java.lang.Long;
-import java.lang.String;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
@@ -19,7 +16,6 @@ import org.joda.time.format.DateTimeFormat;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -29,11 +25,10 @@ import org.springframework.web.util.WebUtils;
privileged aspect VisitController_Roo_Controller {
- @RequestMapping(method = RequestMethod.POST)
+ @RequestMapping(method = RequestMethod.POST, produces = "text/html")
public String VisitController.create(@Valid Visit visit, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
- uiModel.addAttribute("visit", visit);
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, visit);
return "visits/create";
}
uiModel.asMap().clear();
@@ -41,19 +36,18 @@ privileged aspect VisitController_Roo_Controller {
return "redirect:/visits/" + encodeUrlPathSegment(visit.getId().toString(), httpServletRequest);
}
- @RequestMapping(params = "form", method = RequestMethod.GET)
+ @RequestMapping(params = "form", produces = "text/html")
public String VisitController.createForm(Model uiModel) {
- uiModel.addAttribute("visit", new Visit());
- addDateTimeFormatPatterns(uiModel);
- List dependencies = new ArrayList();
+ populateEditForm(uiModel, new Visit());
+ List<String[]> dependencies = new ArrayList<String[]>();
if (Pet.countPets() == 0) {
- dependencies.add(new String[]{"pet", "pets"});
+ dependencies.add(new String[] { "pet", "pets" });
}
uiModel.addAttribute("dependencies", dependencies);
return "visits/create";
}
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+ @RequestMapping(value = "/{id}", produces = "text/html")
public String VisitController.show(@PathVariable("id") Long id, Model uiModel) {
addDateTimeFormatPatterns(uiModel);
uiModel.addAttribute("visit", Visit.findVisit(id));
@@ -61,7 +55,7 @@ privileged aspect VisitController_Roo_Controller {
return "visits/show";
}
- @RequestMapping(method = RequestMethod.GET)
+ @RequestMapping(produces = "text/html")
public String VisitController.list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
if (page != null || size != null) {
int sizeNo = size == null ? 10 : size.intValue();
@@ -76,11 +70,10 @@ privileged aspect VisitController_Roo_Controller {
return "visits/list";
}
- @RequestMapping(method = RequestMethod.PUT)
+ @RequestMapping(method = RequestMethod.PUT, produces = "text/html")
public String VisitController.update(@Valid Visit visit, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
- uiModel.addAttribute("visit", visit);
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, visit);
return "visits/update";
}
uiModel.asMap().clear();
@@ -88,14 +81,13 @@ privileged aspect VisitController_Roo_Controller {
return "redirect:/visits/" + encodeUrlPathSegment(visit.getId().toString(), httpServletRequest);
}
- @RequestMapping(value = "/{id}", params = "form", method = RequestMethod.GET)
+ @RequestMapping(value = "/{id}", params = "form", produces = "text/html")
public String VisitController.updateForm(@PathVariable("id") Long id, Model uiModel) {
- uiModel.addAttribute("visit", Visit.findVisit(id));
- addDateTimeFormatPatterns(uiModel);
+ populateEditForm(uiModel, Visit.findVisit(id));
return "visits/update";
}
- @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
+ @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html")
public String VisitController.delete(@PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
Visit visit = Visit.findVisit(id);
visit.remove();
@@ -105,25 +97,15 @@ privileged aspect VisitController_Roo_Controller {
return "redirect:/visits";
}
- @ModelAttribute("pets")
- public Collection<Pet> VisitController.populatePets() {
- return Pet.findAllPets();
- }
-
- @ModelAttribute("vets")
- public Collection<Vet> VisitController.populateVets() {
- return Vet.findAllVets();
- }
-
- @ModelAttribute("visits")
- public Collection<Visit> VisitController.populateVisits() {
- return Visit.findAllVisits();
- }
-
void VisitController.addDateTimeFormatPatterns(Model uiModel) {
uiModel.addAttribute("visit_visitdate_date_format", DateTimeFormat.patternForStyle("M-", LocaleContextHolder.getLocale()));
- uiModel.addAttribute("visit_minvisitdate_date_format", DateTimeFormat.patternForStyle("M-", LocaleContextHolder.getLocale()));
- uiModel.addAttribute("visit_maxvisitdate_date_format", DateTimeFormat.patternForStyle("M-", LocaleContextHolder.getLocale()));
+ }
+
+ void VisitController.populateEditForm(Model uiModel, Visit visit) {
+ uiModel.addAttribute("visit", visit);
+ addDateTimeFormatPatterns(uiModel);
+ uiModel.addAttribute("pets", Pet.findAllPets());
+ uiModel.addAttribute("vets", Vet.findAllVets());
}
String VisitController.encodeUrlPathSegment(String pathSegment, HttpServletRequest httpServletRequest) {
@@ -133,8 +115,7 @@ privileged aspect VisitController_Roo_Controller {
}
try {
pathSegment = UriUtils.encodePathSegment(pathSegment, enc);
- }
- catch (UnsupportedEncodingException uee) {}
+ } catch (UnsupportedEncodingException uee) {}
return pathSegment;
}
View
2  src/main/java/com/springsource/petclinic/web/VisitController_Roo_Controller_Finder.aj
@@ -4,7 +4,7 @@
package com.springsource.petclinic.web;
import com.springsource.petclinic.domain.Visit;
-import java.lang.String;
+import com.springsource.petclinic.web.VisitController;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.ui.Model;
View
16 src/main/resources/META-INF/persistence.xml
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
-<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
- <provider>org.hibernate.ejb.HibernatePersistence</provider>
- <properties>
- <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
- <!-- value="create" to build a new database on each run; value="update" to modify an existing database; value="create-drop" means the same as "create" but also drops tables when Hibernate closes; value="validate" makes no changes to the database -->
- <property name="hibernate.hbm2ddl.auto" value="update"/>
- <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
- <property name="hibernate.connection.charSet" value="UTF-8"/>
- <!-- Uncomment the following two properties for JBoss only -->
- <!-- property name="hibernate.validator.apply_to_ddl" value="false" /-->
- <!-- property name="hibernate.validator.autoregister_listeners" value="false" /-->
- </properties>
- </persistence-unit>
-</persistence>
View
89 src/main/resources/META-INF/spring/applicationContext.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<!--
This will automatically locate any and all property files you have
within your classpath, provided they fall under the META-INF/spring
@@ -47,28 +47,75 @@
<context:exclude-filter expression=".*_Roo_.*" type="regex"/>
<context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation"/>
</context:component-scan>
- <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
- <property name="driverClassName" value="${database.driverClassName}"/>
- <property name="url" value="#{ 'jdbc:postgresql://' + @dbUrl.getHost() + @dbUrl.getPath() }"/>
- <property name="username" value="#{ @dbUrl.getUserInfo().split(':')[0] }"/>
- <property name="password" value="#{ @dbUrl.getUserInfo().split(':')[1] }"/>
- <property name="testOnBorrow" value="true"/>
- <property name="testOnReturn" value="true"/>
- <property name="testWhileIdle" value="true"/>
- <property name="timeBetweenEvictionRunsMillis" value="1800000"/>
- <property name="numTestsPerEvictionRun" value="3"/>
- <property name="minEvictableIdleTimeMillis" value="1800000"/>
- <property name="validationQuery" value="SELECT version();"/>
- </bean>
+
<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
+
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
- <bean class="java.net.URI" id="dbUrl">
- <constructor-arg value="${DATABASE_URL}"/>
- </bean>
- <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
- <property name="persistenceUnitName" value="persistenceUnit"/>
- <property name="dataSource" ref="dataSource"/>
- </bean>
+
+ <beans profile="default">
+ <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
+ <property name="persistenceUnitName" value="persistenceUnit"/>
+ <property name="jpaProperties">
+ <props>
+ <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
+ <prop key="hibernate.hbm2ddl.auto">create</prop>
+ <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
+ <prop key="hibernate.connection.charSet">UTF-8"</prop>
+ </props>
+ </property>
+ <property name="dataSource" ref="dataSource"/>
+ </bean>
+
+ <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
+ <property name="driverClassName" value="${database.driverClassName}"/>
+ <property name="url" value="${database.url}"/>
+ <property name="username" value="${database.username}"/>
+ <property name="password" value="${database.password}"/>
+ <property name="testOnBorrow" value="true"/>
+ <property name="testOnReturn" value="true"/>
+ <property name="testWhileIdle" value="true"/>
+ <property name="timeBetweenEvictionRunsMillis" value="1800000"/>
+ <property name="numTestsPerEvictionRun" value="3"/>
+ <property name="minEvictableIdleTimeMillis" value="1800000"/>
+ </bean>
+ </beans>
+
+ <beans profile="prod">
+ <!-- This profile uses a DATABASE_URL to connect to a PostgreSQL database -->
+ <!-- The format for DATABASE_URL is: postgres://user:password@hostname/databasename -->
+
+ <bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="entityManagerFactory">
+ <property name="persistenceUnitName" value="persistenceUnit"/>
+ <property name="jpaProperties">
+ <props>
+ <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
+ <prop key="hibernate.hbm2ddl.auto">update</prop>
+ <prop key="hibernate.ejb.naming_strategy">org.hibernate.cfg.ImprovedNamingStrategy</prop>
+ <prop key="hibernate.connection.charSet">UTF-8"</prop>
+ </props>
+ </property>
+ <property name="dataSource" ref="dataSource"/>
+ </bean>
+
+ <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
+ <property name="driverClassName" value="${database.driverClassName}"/>
+ <property name="url" value="#{ 'jdbc:postgresql://' + @dbUrl.getHost() + @dbUrl.getPath() }"/>
+ <property name="username" value="#{ @dbUrl.getUserInfo().split(':')[0] }"/>
+ <property name="password" value="#{ @dbUrl.getUserInfo().split(':')[1] }"/>
+ <property name="testOnBorrow" value="true"/>
+ <property name="testOnReturn" value="true"/>
+ <property name="testWhileIdle" value="true"/>
+ <property name="timeBetweenEvictionRunsMillis" value="1800000"/>
+ <property name="numTestsPerEvictionRun" value="3"/>
+ <property name="minEvictableIdleTimeMillis" value="1800000"/>
+ <property name="validationQuery" value="SELECT version();"/>
+ </bean>
+
+ <bean class="java.net.URI" id="dbUrl">
+ <constructor-arg value="${DATABASE_URL}"/>
+ </bean>
+ </beans>
+
</beans>
View
10 src/main/resources/META-INF/spring/database.properties
@@ -1,6 +1,6 @@
-#Updated at Thu Nov 03 22:21:44 MDT 2011
-#Thu Nov 03 22:21:44 MDT 2011
+#Updated at Tue Feb 07 08:08:52 MST 2012
+#Tue Feb 07 08:08:52 MST 2012
+database.driverClassName=org.hsqldb.jdbcDriver
+database.url=jdbc\:hsqldb\:mem\:petclinic
+database.username=sa
database.password=
-database.url=jdbc\:postgresql\://localhost\:5432
-database.username=
-database.driverClassName=org.postgresql.Driver
View
4 src/main/resources/log4j.properties
@@ -1,5 +1,5 @@
-#Updated at Sun Oct 16 13:55:33 MDT 2011
-#Sun Oct 16 13:55:33 MDT 2011
+#Updated at Tue Feb 07 08:08:59 MST 2012
+#Tue Feb 07 08:08:59 MST 2012
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.rootLogger=INFO, stdout
log4j.appender.R.File=application.log
View
4 src/main/webapp/WEB-INF/i18n/application.properties
@@ -1,5 +1,5 @@
-#Updated at Sun Oct 16 13:55:32 MDT 2011
-#Sun Oct 16 13:55:32 MDT 2011
+#Updated at Tue Feb 07 08:08:59 MST 2012
+#Tue Feb 07 08:08:59 MST 2012
application_name=Petclinic
label_com_springsource_petclinic_domain_owner=Owner
label_com_springsource_petclinic_domain_owner_address=Address
View
2  src/main/webapp/WEB-INF/spring/webmvc-config.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<beans xml