mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
Reorganizadas las clases y renombradas a cheapy
This commit is contained in:
parent
6fe1d6b1fb
commit
48ae594b90
22 changed files with 39 additions and 165 deletions
4
pom.xml
4
pom.xml
|
@ -4,7 +4,7 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>spring-petclinic</artifactId>
|
||||
<artifactId>spring-cheapy</artifactId>
|
||||
<version>2.4.2</version>
|
||||
|
||||
<parent>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<name>petclinic</name>
|
||||
<name>cheapy</name>
|
||||
|
||||
<properties>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.samples.petclinic;
|
||||
package org.springframework.cheapy;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
@ -26,10 +26,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
*
|
||||
*/
|
||||
@SpringBootApplication(proxyBeanMethods = false)
|
||||
public class PetClinicApplication {
|
||||
public class CheapyApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PetClinicApplication.class, args);
|
||||
SpringApplication.run(CheapyApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.samples.petclinic.model;
|
||||
package org.springframework.cheapy.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.samples.petclinic.model;
|
||||
package org.springframework.cheapy.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.MappedSuperclass;
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.samples.petclinic.owner;
|
||||
package org.springframework.cheapy.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -32,7 +32,6 @@ import javax.validation.constraints.NotEmpty;
|
|||
import org.springframework.beans.support.MutableSortDefinition;
|
||||
import org.springframework.beans.support.PropertyComparator;
|
||||
import org.springframework.core.style.ToStringCreator;
|
||||
import org.springframework.samples.petclinic.model.Person;
|
||||
|
||||
/**
|
||||
* Simple JavaBean domain object representing an owner.
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.samples.petclinic.model;
|
||||
package org.springframework.cheapy.model;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.MappedSuperclass;
|
|
@ -17,4 +17,4 @@
|
|||
/**
|
||||
* The classes in this package represent utilities used by the domain.
|
||||
*/
|
||||
package org.springframework.samples.petclinic.model;
|
||||
package org.springframework.cheapy.model;
|
|
@ -13,10 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.samples.petclinic.owner;
|
||||
package org.springframework.cheapy.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.cheapy.model.Owner;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.query.Param;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.samples.petclinic.system;
|
||||
package org.springframework.cheapy.system;
|
||||
|
||||
import javax.cache.configuration.MutableConfiguration;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.samples.petclinic.system;
|
||||
package org.springframework.cheapy.system;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||
* Also see how a view that resolves to "error" has been added ("error.html").
|
||||
*/
|
||||
@Controller
|
||||
class CrashController {
|
||||
public class CrashController {
|
||||
|
||||
@GetMapping("/oups")
|
||||
public String triggerException() {
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.samples.petclinic.system;
|
||||
package org.springframework.cheapy.system;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
@ -13,8 +13,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.samples.petclinic.owner;
|
||||
package org.springframework.cheapy.web;
|
||||
|
||||
import org.springframework.cheapy.model.Owner;
|
||||
import org.springframework.cheapy.repository.OwnerRepository;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
@ -36,7 +38,7 @@ import java.util.Map;
|
|||
* @author Michael Isvy
|
||||
*/
|
||||
@Controller
|
||||
class OwnerController {
|
||||
public class OwnerController {
|
||||
|
||||
private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm";
|
||||
|
|
@ -1,15 +1,9 @@
|
|||
|
||||
|
||||
|\ _,,,--,,_
|
||||
/,`.-'`' ._ \-;;,_
|
||||
_______ __|,4- ) )_ .;.(__`'-'__ ___ __ _ ___ _______
|
||||
| | '---''(_/._)-'(_\_) | | | | | | | | |
|
||||
| _ | ___|_ _| | | | | |_| | | | __ _ _
|
||||
| |_| | |___ | | | | | | | | | | \ \ \ \
|
||||
| ___| ___| | | | _| |___| | _ | | _| \ \ \ \
|
||||
| | | |___ | | | |_| | | | | | | |_ ) ) ) )
|
||||
|___| |_______| |___| |_______|_______|___|_| |__|___|_______| / / / /
|
||||
==================================================================/_/_/_/
|
||||
__^__ __^__
|
||||
( ___ )------------------------------------( ___ )
|
||||
| / | | \ |
|
||||
| / | Cheapy | \ |
|
||||
|___| |___|
|
||||
(_____)------------------------------------(_____)
|
||||
|
||||
:: Built with Spring Boot :: ${spring-boot.version}
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="shortcut icon" type="image/x-icon" th:href="@{/resources/images/favicon.png}">
|
||||
<link rel="shortcut icon" type="image/x-icon" th:href="@{/resources/images/cheapy.png}">
|
||||
|
||||
<title>PetClinic :: a Spring Framework demonstration</title>
|
||||
<title>Cheapy</title>
|
||||
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
<html xmlns:th="https://www.thymeleaf.org"
|
||||
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
|
||||
|
||||
<body>
|
||||
|
||||
<h2>
|
||||
<th:block th:if="${pet['new']}">New </th:block>
|
||||
Pet
|
||||
</h2>
|
||||
<form th:object="${pet}" class="form-horizontal" method="post">
|
||||
<input type="hidden" name="id" th:value="*{id}" />
|
||||
<div class="form-group has-feedback">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">Owner</label>
|
||||
<div class="col-sm-10">
|
||||
<span th:text="${pet.owner?.firstName + ' ' + pet.owner?.lastName}" />
|
||||
</div>
|
||||
</div>
|
||||
<input
|
||||
th:replace="~{fragments/inputField :: input ('Name', 'name', 'text')}" />
|
||||
<input
|
||||
th:replace="~{fragments/inputField :: input ('Birth Date', 'birthDate', 'date')}" />
|
||||
<input
|
||||
th:replace="~{fragments/selectField :: select ('Type', 'type', ${types})}" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button
|
||||
th:with="text=${pet['new']} ? 'Add Pet' : 'Update Pet'"
|
||||
class="btn btn-default" type="submit" th:text="${text}">Add
|
||||
Pet</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,61 +0,0 @@
|
|||
<html xmlns:th="https://www.thymeleaf.org"
|
||||
th:replace="~{fragments/layout :: layout (~{::body},'owners')}">
|
||||
|
||||
<body>
|
||||
|
||||
<h2>
|
||||
<th:block th:if="${visit['new']}">New </th:block>
|
||||
Visit
|
||||
</h2>
|
||||
|
||||
<b>Pet</b>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Birth Date</th>
|
||||
<th>Type</th>
|
||||
<th>Owner</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td th:text="${pet.name}"></td>
|
||||
<td
|
||||
th:text="${#temporals.format(pet.birthDate, 'yyyy-MM-dd')}"></td>
|
||||
<td th:text="${pet.type}"></td>
|
||||
<td
|
||||
th:text="${pet.owner?.firstName + ' ' + pet.owner?.lastName}"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<form th:object="${visit}" class="form-horizontal" method="post">
|
||||
<div class="form-group has-feedback">
|
||||
<input
|
||||
th:replace="~{fragments/inputField :: input ('Date', 'date', 'date')}" />
|
||||
<input
|
||||
th:replace="~{fragments/inputField :: input ('Description', 'description', 'text')}" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<input type="hidden" name="petId" th:value="${pet.id}" />
|
||||
<button class="btn btn-default" type="submit">Add Visit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<br />
|
||||
<b>Previous Visits</b>
|
||||
<table class="table table-striped">
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr th:if="${!visit['new']}" th:each="visit : ${pet.visits}">
|
||||
<td th:text="${#temporals.format(visit.date, 'yyyy-MM-dd')}"></td>
|
||||
<td th:text=" ${visit.description}"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,27 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns:th="https://www.thymeleaf.org"
|
||||
th:replace="~{fragments/layout :: layout (~{::body},'vets')}">
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Veterinarians</h2>
|
||||
|
||||
<table id="vets" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Specialties</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr th:each="vet : ${vets.vetList}">
|
||||
<td th:text="${vet.firstName + ' ' + vet.lastName}"></td>
|
||||
<td><span th:each="specialty : ${vet.specialties}"
|
||||
th:text="${specialty.name + ' '}" /> <span
|
||||
th:if="${vet.nrOfSpecialties == 0}">none</span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.samples.petclinic;
|
||||
package org.springframework.cheapy.integration;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.samples.petclinic.model;
|
||||
package org.springframework.cheapy.model;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
@ -23,6 +23,7 @@ import javax.validation.ConstraintViolation;
|
|||
import javax.validation.Validator;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.cheapy.model.Person;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
|
||||
|
|
@ -14,12 +14,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.samples.petclinic.service;
|
||||
package org.springframework.cheapy.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.cheapy.model.BaseEntity;
|
||||
import org.springframework.orm.ObjectRetrievalFailureException;
|
||||
import org.springframework.samples.petclinic.model.BaseEntity;
|
||||
|
||||
/**
|
||||
* Utility methods for handling entities. Separate from the BaseEntity class mainly
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.samples.petclinic.model.BaseEntity;
|
|||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
* @see org.springframework.samples.petclinic.model.BaseEntity
|
||||
* @see org.springframework.cheapy.model.BaseEntity
|
||||
* @since 29.10.2003
|
||||
*/
|
||||
public abstract class EntityUtils {
|
|
@ -14,12 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.samples.petclinic.system;
|
||||
package org.springframework.cheapy.system;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.cheapy.system.CrashController;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.samples.petclinic.owner;
|
||||
package org.springframework.cheapy.web;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collections;
|
||||
|
@ -28,6 +28,8 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.cheapy.model.Owner;
|
||||
import org.springframework.cheapy.repository.OwnerRepository;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.hamcrest.Matchers.empty;
|
Loading…
Reference in a new issue