From db3fc815be1b7da89ff69c0b181d37a8a37a507b Mon Sep 17 00:00:00 2001 From: Dapeng Date: Mon, 19 Sep 2016 16:48:58 +0800 Subject: [PATCH] restructure ui layout --- pom.xml | 452 ++---------------- .../petclinic/PetClinicApplication.java | 12 + .../petclinic/web/CrashController.java | 40 -- .../samples/petclinic/web/OwnerResource.java | 4 +- .../samples/petclinic/web/PetResource.java | 47 +- .../petclinic/web/PetTypeFormatter.java | 66 --- .../samples/petclinic/web/PetValidator.java | 6 +- .../samples/petclinic/web/VetResource.java | 7 +- .../petclinic/web/VisitController.java | 8 +- .../samples/petclinic/web/package-info.java | 8 - src/main/resources/application.properties | 22 + src/main/resources/cache/ehcache.xml | 17 - src/main/resources/cache/ehcache.xsd | 419 ---------------- .../datatables/datatables.properties | 6 - src/main/resources/logback.xml | 25 - src/main/resources/spring/business-config.xml | 96 ---- .../resources/spring/data-access.properties | 41 -- .../resources/spring/datasource-config.xml | 43 -- src/main/resources/spring/mvc-core-config.xml | 75 --- src/main/resources/spring/mvc-view-config.xml | 15 - src/main/resources/spring/tools-config.xml | 49 -- src/main/webapp/WEB-INF/web.xml | 95 ---- src/main/webapp/index.html | 7 +- src/main/webapp/resources/css/petclinic.css | 20 - .../scripts/app/fragments/bodyHeader.html | 41 +- .../webapp/scripts/app/fragments/footer.html | 13 +- .../webapp/scripts/app/pet/PetController.js | 6 +- src/main/webapp/scripts/app/pet/petForm.html | 60 ++- 28 files changed, 182 insertions(+), 1518 deletions(-) create mode 100644 src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java delete mode 100644 src/main/java/org/springframework/samples/petclinic/web/CrashController.java delete mode 100644 src/main/java/org/springframework/samples/petclinic/web/PetTypeFormatter.java delete mode 100644 src/main/java/org/springframework/samples/petclinic/web/package-info.java create mode 100644 src/main/resources/application.properties delete mode 100644 src/main/resources/cache/ehcache.xml delete mode 100644 src/main/resources/cache/ehcache.xsd delete mode 100644 src/main/resources/dandelion/datatables/datatables.properties delete mode 100644 src/main/resources/logback.xml delete mode 100644 src/main/resources/spring/business-config.xml delete mode 100644 src/main/resources/spring/data-access.properties delete mode 100644 src/main/resources/spring/datasource-config.xml delete mode 100644 src/main/resources/spring/mvc-core-config.xml delete mode 100644 src/main/resources/spring/mvc-view-config.xml delete mode 100644 src/main/resources/spring/tools-config.xml delete mode 100644 src/main/webapp/WEB-INF/web.xml diff --git a/pom.xml b/pom.xml index fefabaeec..adb519718 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,13 @@ 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 1.4.0.RELEASE + + org.springframework.samples spring-petclinic 1.0.0-SNAPSHOT @@ -8,441 +15,72 @@ petclinic war - - - - 1.8 - UTF-8 - UTF-8 - - - 4.1.6.RELEASE - 1.8.0.RELEASE - - - - 2.2 - 1.2 - 7.0.47 - 2.2.7 - - - 4.3.8.Final - - - 4.3.1.Final - - - 7.0.42 - 2.6.10 - 2.3.2 - - - 1.8.5 - - - 1.1.3 - 1.7.12 - - - 2.0.0 - - - 4.12 - 3.0.0 - - - 1.3 - 1.1.1 - 2.7 - 3.2.0.GA - 2.4.5 - - - - 2.3.0 - 1.10.3 - 2.0.3-1 - 0.10.1 - - 5.1.22 - - 2.7 - - - - org.jadira.usertype - usertype.core - ${jadira-usertype-core.version} + org.springframework.boot + spring-boot-starter-web - - org.apache.tomcat - tomcat-servlet-api - ${tomcat.servlet.version} - provided - - - javax.servlet.jsp - jsp-api - 2.1 - provided - - - org.glassfish.web - jstl-impl - 1.2 - - - javax.servlet - servlet-api - - - - com.sun.xml.bind - jaxb-impl - ${jaxb-impl.version} + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.springframework.boot + spring-boot-starter-cache + + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-devtools + + + + org.apache.tomcat.embed + tomcat-embed-jasper provided - - - com.jayway.jsonpath - json-path - ${json-path.version} - test - - - - org.springframework.data - spring-data-jpa - ${spring-data-jpa.version} - - - org.springframework - * - - - - - org.springframework - spring-jdbc - ${spring-framework.version} - - - org.springframework - spring-aop - ${spring-framework.version} - - - org.springframework - spring-webmvc - ${spring-framework.version} - - - org.springframework - spring-tx - ${spring-framework.version} - - - - org.springframework - spring-context-support - ${spring-framework.version} - - - org.springframework - spring-orm - ${spring-framework.version} - - - org.springframework - spring-oxm - ${spring-framework.version} - - - commons-lang - commons-lang - - + javax.servlet + jstl - - org.aspectj - aspectjrt - ${aspectj.version} - - - org.aspectj - aspectjweaver - ${aspectj.version} - runtime - - - - - org.apache.tomcat - tomcat-jdbc - ${tomcat-jdbc.version} - runtime - - - - - org.slf4j - slf4j-api - ${slf4j.version} - compile - - - ch.qos.logback - logback-classic - ${logback.version} - runtime - - - - - joda-time - joda-time - ${jodatime.version} - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson.datatype.joda.version} - - - - joda-time - joda-time-hibernate - ${jodatime-hibernate.version} - - - joda-time - joda-time-jsptags - ${jodatime-jsptags.version} - - - - org.hsqldb hsqldb - ${hsqldb.version} runtime - - - - - org.hibernate - hibernate-entitymanager - ${hibernate.version} - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - - - org.hibernate - hibernate-ehcache - ${hibernate.version} - - - net.sf.ehcache - ehcache-core - ${ehcache.version} - - - commons-logging - commons-logging - - - - - - org.webjars - bootstrap - ${webjars-bootstrap.version} - - - org.webjars - jquery-ui - ${webjars-jquery-ui.version} - - - org.webjars - jquery - ${webjars-jquery.version} - - - - - org.springframework - spring-test - ${spring-framework.version} - test - - - junit - junit - ${junit.version} - test - - - org.assertj - assertj-core - ${assertj.version} - + + org.projectlombok + lombok + 1.16.10 + provided + - - com.github.dandelion - datatables-jsp - ${dandelion.version} - - - com.github.dandelion - datatables-export-itext - ${dandelion.version} + org.springframework.boot + spring-boot-starter-test + test - - install - - - - ${project.basedir}/src/test/java - - - ${project.basedir}/src/test/resources - - - org.apache.maven.plugins - maven-compiler-plugin - 3.0 + org.springframework.boot + spring-boot-maven-plugin - - - - true - ${java.version} - ${java.version} - true + true - - org.apache.maven.plugins - maven-surefire-plugin - 2.13 - - - **/*Tests.java - - - - - org.apache.maven.plugins - maven-war-plugin - 2.3 - - petclinic - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.9 - - true - true - 2.0 - - **/*.* - - - - org.springframework.ide.eclipse.core.springbuilder - - - org.eclipse.m2e.core.maven2Builder - - - - org.eclipse.jdt.core.javanature - org.springframework.ide.eclipse.core.springnature - org.eclipse.m2e.core.maven2Nature - - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.4 - - - jar-with-dependencies - - - - - org.apache.tomcat.maven - tomcat7-maven-plugin - 2.2 - - tomcat-development-server - 9966 - /petclinic - - - - org.codehaus.mojo - cobertura-maven-plugin - ${cobertura.version} - - - - - - clean - check - - - - - - - - - - org.codehaus.mojo - cobertura-maven-plugin - ${cobertura.version} - - - html - - - - - - - demopetclinic diff --git a/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java b/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java new file mode 100644 index 000000000..72dc6087a --- /dev/null +++ b/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java @@ -0,0 +1,12 @@ +package org.springframework.samples.petclinic; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class PetClinicApplication { + + public static void main(String[] args) { + SpringApplication.run(PetClinicApplication.class, args); + } +} diff --git a/src/main/java/org/springframework/samples/petclinic/web/CrashController.java b/src/main/java/org/springframework/samples/petclinic/web/CrashController.java deleted file mode 100644 index e413f3f3b..000000000 --- a/src/main/java/org/springframework/samples/petclinic/web/CrashController.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * 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. - */ -package org.springframework.samples.petclinic.web; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; - -/** - * Controller used to showcase what happens when an exception is thrown - * - * @author Michael Isvy - *

- * Also see how the bean of type 'SimpleMappingExceptionResolver' has been declared inside - * /WEB-INF/mvc-core-config.xml - */ -@Controller -public class CrashController { - - @RequestMapping(value = "/oups", method = RequestMethod.GET) - public String triggerException() { - throw new RuntimeException("Expected: controller used to showcase what " + - "happens when an exception is thrown"); - } - - -} diff --git a/src/main/java/org/springframework/samples/petclinic/web/OwnerResource.java b/src/main/java/org/springframework/samples/petclinic/web/OwnerResource.java index 851a3ff75..e9cba805c 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/OwnerResource.java +++ b/src/main/java/org/springframework/samples/petclinic/web/OwnerResource.java @@ -31,6 +31,8 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; +import javax.validation.Valid; + /** * @author Juergen Hoeller * @author Ken Krebs @@ -98,7 +100,7 @@ public class OwnerResource { * Update Owner */ @RequestMapping(value = "/owner/{ownerId}", method = RequestMethod.PUT) - public Owner updateOwner(@PathVariable("ownerId") int ownerId, @RequestBody Owner ownerRequest) { + public Owner updateOwner(@PathVariable("ownerId") int ownerId, @Valid @RequestBody Owner ownerRequest) { Owner ownerModel = retrieveOwner(ownerId); // This is done by hand for simplicity purpose. In a real life use-case we should consider using MapStruct. ownerModel.setFirstName(ownerRequest.getFirstName()); diff --git a/src/main/java/org/springframework/samples/petclinic/web/PetResource.java b/src/main/java/org/springframework/samples/petclinic/web/PetResource.java index 3651968bb..c96b3571b 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/PetResource.java +++ b/src/main/java/org/springframework/samples/petclinic/web/PetResource.java @@ -15,19 +15,23 @@ */ package org.springframework.samples.petclinic.web; -import java.util.Collection; +import java.util.Date; import java.util.Map; +import lombok.Getter; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.format.annotation.DateTimeFormat; import org.springframework.samples.petclinic.model.Owner; import org.springframework.samples.petclinic.model.Pet; import org.springframework.samples.petclinic.model.PetType; import org.springframework.samples.petclinic.service.ClinicService; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -43,23 +47,22 @@ public class PetResource { private final ClinicService clinicService; - @Autowired public PetResource(ClinicService clinicService) { this.clinicService = clinicService; } - @ModelAttribute("types") - public Collection populatePetTypes() { - return this.clinicService.findPetTypes(); - } - @InitBinder public void setAllowedFields(WebDataBinder dataBinder) { dataBinder.setDisallowedFields("id"); } - @RequestMapping(value = "/owners/{ownerId}/pets/new", method = RequestMethod.GET) + @GetMapping("/petTypes") + Object getPetTypes() { + return clinicService.findPetTypes(); + } + + @GetMapping("/owners/{ownerId}/pets/new") public String initCreationForm(@PathVariable("ownerId") int ownerId, Map model) { Owner owner = this.clinicService.findOwnerById(ownerId); Pet pet = new Pet(); @@ -68,7 +71,7 @@ public class PetResource { return "pets/createOrUpdatePetForm"; } - @RequestMapping(value = "/owners/{ownerId}/pets/new", method = RequestMethod.POST) + @PostMapping("/owners/{ownerId}/pets/new") public String processCreationForm(@ModelAttribute("pet") Pet pet, BindingResult result, SessionStatus status) { new PetValidator().validate(pet, result); if (result.hasErrors()) { @@ -80,10 +83,10 @@ public class PetResource { } } - @RequestMapping(value = "/owner/*/pet/{petId}", method = RequestMethod.GET) - public Pet findPet(@PathVariable("petId") int petId) { + @GetMapping("/owner/*/pet/{petId}") + public PetDetails findPet(@PathVariable("petId") int petId) { Pet pet = this.clinicService.findPetById(petId); - return pet; + return new PetDetails(pet); } @RequestMapping(value = "/owners/{ownerId}/pets/{petId}/edit", method = {RequestMethod.PUT, RequestMethod.POST}) @@ -99,4 +102,24 @@ public class PetResource { } } + @Getter + static class PetDetails { + + long id; + String name; + String owner; + @DateTimeFormat(pattern = "yyyy-MM-dd") + Date birthDate; + PetType type; + + PetDetails(Pet pet) { + this.id = pet.getId(); + this.name = pet.getName(); + this.owner = pet.getOwner().getFirstName() + " " + pet.getOwner().getLastName(); + this.birthDate = pet.getBirthDate(); + this.type = pet.getType(); + } + + } + } diff --git a/src/main/java/org/springframework/samples/petclinic/web/PetTypeFormatter.java b/src/main/java/org/springframework/samples/petclinic/web/PetTypeFormatter.java deleted file mode 100644 index 3d47d2201..000000000 --- a/src/main/java/org/springframework/samples/petclinic/web/PetTypeFormatter.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * 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. - */ -package org.springframework.samples.petclinic.web; - - -import java.text.ParseException; -import java.util.Collection; -import java.util.Locale; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.format.Formatter; -import org.springframework.samples.petclinic.model.PetType; -import org.springframework.samples.petclinic.service.ClinicService; - -/** - * Instructs Spring MVC on how to parse and print elements of type 'PetType'. Starting from Spring 3.0, Formatters have - * come as an improvement in comparison to legacy PropertyEditors. See the following links for more details: - The - * Spring ref doc: http://static.springsource.org/spring/docs/current/spring-framework-reference/html/validation.html#format-Formatter-SPI - * - A nice blog entry from Gordon Dickens: http://gordondickens.com/wordpress/2010/09/30/using-spring-3-0-custom-type-converter/ - *

- * Also see how the bean 'conversionService' has been declared inside /WEB-INF/mvc-core-config.xml - * - * @author Mark Fisher - * @author Juergen Hoeller - * @author Michael Isvy - */ -public class PetTypeFormatter implements Formatter { - - private final ClinicService clinicService; - - - @Autowired - public PetTypeFormatter(ClinicService clinicService) { - this.clinicService = clinicService; - } - - @Override - public String print(PetType petType, Locale locale) { - return petType.getName(); - } - - @Override - public PetType parse(String text, Locale locale) throws ParseException { - Collection findPetTypes = this.clinicService.findPetTypes(); - for (PetType type : findPetTypes) { - if (type.getName().equals(text)) { - return type; - } - } - throw new ParseException("type not found: " + text, 0); - } - -} diff --git a/src/main/java/org/springframework/samples/petclinic/web/PetValidator.java b/src/main/java/org/springframework/samples/petclinic/web/PetValidator.java index 03a1bca7c..fbb7dd5be 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/PetValidator.java +++ b/src/main/java/org/springframework/samples/petclinic/web/PetValidator.java @@ -35,14 +35,14 @@ public class PetValidator { } else if (pet.isNew() && pet.getOwner().getPet(name, true) != null) { errors.rejectValue("name", "duplicate", "already exists"); } - + // type validation if (pet.isNew() && pet.getType() == null) { errors.rejectValue("type", "required", "required"); } - + // birth date validation - if (pet.getBirthDate()==null) { + if (pet.getBirthDate() == null) { errors.rejectValue("birthDate", "required", "required"); } } diff --git a/src/main/java/org/springframework/samples/petclinic/web/VetResource.java b/src/main/java/org/springframework/samples/petclinic/web/VetResource.java index 968c4d259..7661e97f4 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/VetResource.java +++ b/src/main/java/org/springframework/samples/petclinic/web/VetResource.java @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.samples.petclinic.model.Vet; import org.springframework.samples.petclinic.service.ClinicService; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -36,17 +37,13 @@ public class VetResource { private final ClinicService clinicService; - @Autowired public VetResource(ClinicService clinicService) { this.clinicService = clinicService; } - @RequestMapping(value="/vets", method = RequestMethod.GET, - produces = MediaType.APPLICATION_JSON_VALUE) + @GetMapping("/vets") public Collection showResourcesVetList() { return this.clinicService.findVets(); } - - } diff --git a/src/main/java/org/springframework/samples/petclinic/web/VisitController.java b/src/main/java/org/springframework/samples/petclinic/web/VisitController.java index f3f6f3ffb..705ed2b5c 100644 --- a/src/main/java/org/springframework/samples/petclinic/web/VisitController.java +++ b/src/main/java/org/springframework/samples/petclinic/web/VisitController.java @@ -26,9 +26,11 @@ import org.springframework.samples.petclinic.service.ClinicService; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -72,13 +74,13 @@ public class VisitController { } // Spring MVC calls method loadPetWithVisit(...) before initNewVisitForm is called - @RequestMapping(value = "/owners/*/pets/{petId}/visits/new", method = RequestMethod.GET) + @GetMapping("/owners/*/pets/{petId}/visits/new") public String initNewVisitForm(@PathVariable("petId") int petId, Map model) { return "pets/createOrUpdateVisitForm"; } // Spring MVC calls method loadPetWithVisit(...) before processNewVisitForm is called - @RequestMapping(value = "/owners/{ownerId}/pets/{petId}/visits/new", method = RequestMethod.POST) + @PostMapping("/owners/{ownerId}/pets/{petId}/visits/new") public String processNewVisitForm(@Valid Visit visit, BindingResult result) { if (result.hasErrors()) { return "pets/createOrUpdateVisitForm"; @@ -88,7 +90,7 @@ public class VisitController { } } - @RequestMapping(value = "/owners/*/pets/{petId}/visits", method = RequestMethod.GET) + @GetMapping("/owners/*/pets/{petId}/visits") public String showVisits(@PathVariable int petId, Map model) { model.put("visits", this.clinicService.findPetById(petId).getVisits()); return "visitList"; diff --git a/src/main/java/org/springframework/samples/petclinic/web/package-info.java b/src/main/java/org/springframework/samples/petclinic/web/package-info.java deleted file mode 100644 index c909ccf7f..000000000 --- a/src/main/java/org/springframework/samples/petclinic/web/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ - -/** - * - * The classes in this package represent PetClinic's web presentation layer. - * - */ -package org.springframework.samples.petclinic.web; - diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 000000000..025f89af9 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,22 @@ +# database init, supports mysql too +database=hsqldb +spring.datasource.schema=classpath*:db/${database}/schema.sql +spring.datasource.data=classpath*:db/${database}/data.sql + +# Web +spring.mvc.view.prefix=/WEB-INF/jsp/ +spring.mvc.view.suffix=.jsp + +# JPA +spring.jpa.hibernate.ddl-auto=none + +# Internationalization +spring.messages.basename=messages/messages + +# Actuator / Management +management.contextPath=/manage + +# Logging +logging.level.org.springframework=INFO + +server.context-path=/petclinic \ No newline at end of file diff --git a/src/main/resources/cache/ehcache.xml b/src/main/resources/cache/ehcache.xml deleted file mode 100644 index 32e509953..000000000 --- a/src/main/resources/cache/ehcache.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/src/main/resources/cache/ehcache.xsd b/src/main/resources/cache/ehcache.xsd deleted file mode 100644 index bfc19ddb1..000000000 --- a/src/main/resources/cache/ehcache.xsd +++ /dev/null @@ -1,419 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/dandelion/datatables/datatables.properties b/src/main/resources/dandelion/datatables/datatables.properties deleted file mode 100644 index 08b1e439c..000000000 --- a/src/main/resources/dandelion/datatables/datatables.properties +++ /dev/null @@ -1,6 +0,0 @@ -# ================================== -# Dandelion-Datatables configuration -# ================================== - -# Disable the asset management of Dandelion-Core for all non-DataTable-related assets -main.standalone=true \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml deleted file mode 100644 index 830ef37de..000000000 --- a/src/main/resources/logback.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - true - - - - - - - - %-5level %logger{0} - %msg%n - - - - - - - - - - diff --git a/src/main/resources/spring/business-config.xml b/src/main/resources/spring/business-config.xml deleted file mode 100644 index 99cf4c1d3..000000000 --- a/src/main/resources/spring/business-config.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/spring/data-access.properties b/src/main/resources/spring/data-access.properties deleted file mode 100644 index c1cc3cefd..000000000 --- a/src/main/resources/spring/data-access.properties +++ /dev/null @@ -1,41 +0,0 @@ -# Properties file with JDBC and JPA settings. -# -# Applied by from -# various application context XML files (e.g., "applicationContext-*.xml"). -# Targeted at system administrators, to avoid touching the context XML files. - -#------------------------------------------------------------------------------- -# HSQL Settings - -jdbc.driverClassName=org.hsqldb.jdbcDriver -jdbc.url=jdbc:hsqldb:mem:petclinic -jdbc.username=sa -jdbc.password= - -# Properties that control the population of schema and data for a new data source -jdbc.initLocation=classpath:db/hsqldb/initDB.sql -jdbc.dataLocation=classpath:db/hsqldb/populateDB.sql - -# Property that determines which database to use with an AbstractJpaVendorAdapter -jpa.database=HSQL - -jpa.showSql=true - -#------------------------------------------------------------------------------- -# MySQL Settings - -#jdbc.driverClassName=com.mysql.jdbc.Driver -#jdbc.url=jdbc:mysql://localhost:3306/petclinic -#jdbc.username=root -#jdbc.password= - -# Properties that control the population of schema and data for a new data source -#jdbc.initLocation=classpath:db/mysql/initDB.sql -#jdbc.dataLocation=classpath:db/mysql/populateDB.sql - -# Property that determines which Hibernate dialect to use -# (only applied with "applicationContext-hibernate.xml") -#hibernate.dialect=org.hibernate.dialect.MySQLDialect - -# Property that determines which database to use with an AbstractJpaVendorAdapter -#jpa.database=MYSQL diff --git a/src/main/resources/spring/datasource-config.xml b/src/main/resources/spring/datasource-config.xml deleted file mode 100644 index f74129963..000000000 --- a/src/main/resources/spring/datasource-config.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/spring/mvc-core-config.xml b/src/main/resources/spring/mvc-core-config.xml deleted file mode 100644 index 51d2ce828..000000000 --- a/src/main/resources/spring/mvc-core-config.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/spring/mvc-view-config.xml b/src/main/resources/spring/mvc-view-config.xml deleted file mode 100644 index 190005f34..000000000 --- a/src/main/resources/spring/mvc-view-config.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/src/main/resources/spring/tools-config.xml b/src/main/resources/spring/tools-config.xml deleted file mode 100644 index 1be7e3b6c..000000000 --- a/src/main/resources/spring/tools-config.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index fb397e89d..000000000 --- a/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - Spring PetClinic - Spring PetClinic sample application - - - spring.profiles.active - jpa - - - - - - - - - - - contextConfigLocation - classpath:spring/business-config.xml, classpath:spring/tools-config.xml - - - - org.springframework.web.context.ContextLoaderListener - - - - - petclinic - org.springframework.web.servlet.DispatcherServlet - - contextConfigLocation - classpath:spring/mvc-core-config.xml - - 1 - - - - petclinic - / - - - - - - - httpMethodFilter - org.springframework.web.filter.HiddenHttpMethodFilter - - - - httpMethodFilter - petclinic - - - - - encodingFilter - org.springframework.web.filter.CharacterEncodingFilter - - encoding - UTF-8 - - - forceEncoding - true - - - - - encodingFilter - /* - - - \ No newline at end of file diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 44123baf8..e98ef1fe2 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -5,9 +5,8 @@ PetClinic :: a Spring Framework demonstration - - - + + @@ -20,9 +19,7 @@

-
-
diff --git a/src/main/webapp/resources/css/petclinic.css b/src/main/webapp/resources/css/petclinic.css index 76a8ef83d..e69de29bb 100644 --- a/src/main/webapp/resources/css/petclinic.css +++ b/src/main/webapp/resources/css/petclinic.css @@ -1,20 +0,0 @@ -.container { - padding-top: 10px; - width: 700px; -} - -.form-horizontal { - width: 100%; -} - -input[type="text"] { - height: 25px; -} - -.navbar .nav > li > a { - color: #000000; -} - -.form-horizontal .control-label { - text-align: left; -} diff --git a/src/main/webapp/scripts/app/fragments/bodyHeader.html b/src/main/webapp/scripts/app/fragments/bodyHeader.html index 8bdf23977..43faefce2 100644 --- a/src/main/webapp/scripts/app/fragments/bodyHeader.html +++ b/src/main/webapp/scripts/app/fragments/bodyHeader.html @@ -1,23 +1,24 @@ + \ No newline at end of file diff --git a/src/main/webapp/scripts/app/fragments/footer.html b/src/main/webapp/scripts/app/fragments/footer.html index 683e19cc2..7a64bc41b 100644 --- a/src/main/webapp/scripts/app/fragments/footer.html +++ b/src/main/webapp/scripts/app/fragments/footer.html @@ -1,11 +1,4 @@ - - - - - - - - +
+ Sponsored by Pivotal +
diff --git a/src/main/webapp/scripts/app/pet/PetController.js b/src/main/webapp/scripts/app/pet/PetController.js index a766a281c..a454a4448 100644 --- a/src/main/webapp/scripts/app/pet/PetController.js +++ b/src/main/webapp/scripts/app/pet/PetController.js @@ -1,13 +1,11 @@ 'use strict'; function loadPet($scope, $resource, $stateParams) { - var petResource = $resource('/petclinic/owner/' + $stateParams.ownerid +"/pet/" +$stateParams.petid); + var petResource = $resource('/petclinic/owner/' + $stateParams.ownerid +"/pet/" + $stateParams.petid); $scope.pet = petResource.get(); + $scope.types = $resource("/petclinic/petTypes").query(); } - - - /* * Form used to create and edit pets */ diff --git a/src/main/webapp/scripts/app/pet/petForm.html b/src/main/webapp/scripts/app/pet/petForm.html index d8aa79bdc..a1a090738 100644 --- a/src/main/webapp/scripts/app/pet/petForm.html +++ b/src/main/webapp/scripts/app/pet/petForm.html @@ -1,44 +1,38 @@ - - -
-

Pet (work in progress)

+

Pet

+
-
-
- - {{pet.owner.firstName}} {{pet.owner.lastName}} -
-
- - +
+ +
+

{{pet.owner}}

+
+
+ +
+ +
+ Name is required.
-
- - +
+ +
+ +
+ birth date is required.
- - -
-
-
- - - - - - - - + +
+ +
+ +
-