Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • s51119/broken-petclinic
  • s72462/broken-petclinic
  • s61200/broken-petclinic
  • s76620/broken-petclinic
  • s76545/broken-petclinic
  • s76915/broken-petclinic
  • s70130/broken-petclinic
  • s72523/broken-petclinic
  • s77047/broken-petclinic
  • s70178/broken-petclinic
  • s76522/broken-petclinic
  • s76426/broken-petclinic
  • s76863/broken-petclinic
  • s76856/broken-petclinic
  • s76728/broken-petclinic
  • williamreetz/broken-petclinic
  • s77034/broken-petclinic
  • s76400/broken-petclinic
  • s72288/broken-petclinic
  • s76608/broken-petclinic
20 results
Select Git revision
Show changes
Showing
with 0 additions and 670 deletions
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[2.2.3.RELEASE]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
<enableImports><![CDATA[true]]></enableImports>
<configs>
</configs>
<configSets>
</configSets>
</beansProjectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
<artifactId>org.springframework.samples.petclinic</artifactId>
<name>org.springframework.samples.petclinic</name>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<properties>
<spring.version>3.0.0.M3</spring.version>
</properties>
<dependencies>
<!-- Compile dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
</dependency>
<!-- Needed for fileupload -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<!-- Embedded database -->
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
<!-- Composite-view & layout framework -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.0.7</version>
</dependency>
<!-- Clean URLs with JSPs -->
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>3.1.0</version>
</dependency>
<!-- Spring Framework Project libraries -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Spring JavaScript Project -->
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-js</artifactId>
<version>2.0.7.RELEASE</version>
</dependency>
<!-- Container-provided dependencies-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>org.springsource.maven.snapshot</id>
<name>SpringSource Maven Central-compatible Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package org.springframework.samples.petclinic;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class HomeController {
@RequestMapping(value="/", method = RequestMethod.GET)
public String get() {
return "home";
}
}
package org.springframework.samples.petclinic.appointments;
import java.util.Date;
public class Appointment {
private String owner;
private String ownerPhone;
private String pet;
private String notes;
private Date dateTime;
public String getOwner() {
return owner;
}
public String getOwnerPhone() {
return ownerPhone;
}
public String getPet() {
return pet;
}
public Date getDateTime() {
return dateTime;
}
public String getNotes() {
return notes;
}
}
package org.springframework.samples.petclinic.appointments;
import java.util.Date;
public interface AppointmentBook {
Appointments getAppointmentsForToday();
Appointments getAppointmentsForDay(Date day);
Long createAppointment(AppointmentForm form);
}
\ No newline at end of file
package org.springframework.samples.petclinic.appointments;
import java.util.Date;
public class AppointmentForm {
private Long doctor;
private Long owner;
private String pet;
private Date date;
private Date time;
private String notes;
public Long getDoctor() {
return doctor;
}
public void setDoctor(Long doctor) {
this.doctor = doctor;
}
public Long getOwner() {
return owner;
}
public void setOwner(Long owner) {
this.owner = owner;
}
public String getPet() {
return pet;
}
public void setPet(String pet) {
this.pet = pet;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
}
\ No newline at end of file
package org.springframework.samples.petclinic.appointments;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class Appointments {
private Map<String, List<Appointment>> vetAppointments = new LinkedHashMap<String, List<Appointment>>();
public Map<String, List<Appointment>> getAllByVet() {
return vetAppointments;
}
}
package org.springframework.samples.petclinic.appointments;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/appointments")
public class AppointmentsController {
private AppointmentBook appointmentBook;
@Autowired
public AppointmentsController(AppointmentBook appointmentBook) {
this.appointmentBook = appointmentBook;
}
@RequestMapping(method = RequestMethod.GET)
public Appointments get() {
return appointmentBook.getAppointmentsForToday();
}
@RequestMapping(value="/{day}", method = RequestMethod.GET)
public Appointments getForDay(@PathVariable Date day) {
return appointmentBook.getAppointmentsForDay(day);
}
@RequestMapping(value="/new", method = RequestMethod.GET)
public AppointmentForm getNewForm() {
return new AppointmentForm();
}
@RequestMapping(method = RequestMethod.POST)
public String post(AppointmentForm form) {
appointmentBook.createAppointment(form);
return "redirect:/appointments";
}
}
package org.springframework.samples.petclinic.appointments;
import java.util.Date;
import org.springframework.stereotype.Repository;
@Repository
public class StubAppointmentBook implements AppointmentBook {
public Appointments getAppointmentsForDay(Date day) {
return new Appointments();
}
public Appointments getAppointmentsForToday() {
return new Appointments();
}
public Long createAppointment(AppointmentForm form) {
return 1L;
}
}
package org.springframework.samples.petclinic.owners;
public class Owner {
private Long id;
private String firstName;
private String lastName;
private String address;
private String city;
private String phone;
public Owner() {
}
public Owner(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
\ No newline at end of file
package org.springframework.samples.petclinic.owners;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.petclinic.util.ExternalContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping(value="/owners/{owner}")
public class OwnerController {
private final OwnerRepository repository;
@Autowired
public OwnerController(OwnerRepository repository) {
this.repository = repository;
}
@RequestMapping(method=RequestMethod.GET)
public String get(@PathVariable Long owner, Model model) {
model.addAttribute(repository.getOwner(owner));
return "owner";
}
@RequestMapping(value="/edit", method=RequestMethod.GET)
public Owner getEditForm(@PathVariable Long owner) {
return repository.getOwner(owner);
}
@RequestMapping(method = RequestMethod.PUT)
public void put(Owner owner, ExternalContext response) {
repository.saveOwner(owner);
response.redirect(owner.getId());
}
}
\ No newline at end of file
package org.springframework.samples.petclinic.owners;
import java.util.Collection;
public interface OwnerRepository {
Collection<Owner> findOwnersByLastName(String lastName);
Owner getOwner(Long id);
Long saveOwner(Owner owner);
}
\ No newline at end of file
package org.springframework.samples.petclinic.owners;
public class OwnerSearchForm {
private String lastName;
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
package org.springframework.samples.petclinic.owners;
import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping("/owners")
public class OwnersController {
private final OwnerRepository repository;
@Autowired
public OwnersController(OwnerRepository repository) {
this.repository = repository;
}
@RequestMapping(method = RequestMethod.GET)
public OwnerSearchForm get() {
return new OwnerSearchForm();
}
@RequestMapping(value="/search", method = RequestMethod.GET)
public Collection<Owner> getSearchResults(@RequestParam String lastName) {
return repository.findOwnersByLastName(lastName);
}
@RequestMapping(value="/new", method = RequestMethod.GET)
public Owner getNewForm() {
return new Owner();
}
@RequestMapping(method = RequestMethod.POST)
public String post(Owner owner) {
Long ownerId = repository.saveOwner(owner);
return "redirect:/owners/" + ownerId;
}
}
package org.springframework.samples.petclinic.owners;
import java.util.Collection;
import org.springframework.stereotype.Repository;
@Repository
public class StubOwnerRepository implements OwnerRepository {
public Collection<Owner> findOwnersByLastName(String lastName) {
return null;
}
public Owner getOwner(Long id) {
return new Owner(id);
}
public Long saveOwner(Owner owner) {
return 1L;
}
}
package org.springframework.samples.petclinic.owners.pets;
public enum Gender {
MALE, FEMALE
}
package org.springframework.samples.petclinic.owners.pets;
import java.util.Date;
import org.springframework.samples.petclinic.util.Measurement;
public class Pet {
private String name;
private String species;
private String breed;
private Gender gender;
private Date birthDate;
private Measurement weight;
public String getName() {
return name;
}
}
package org.springframework.samples.petclinic.owners.pets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.samples.petclinic.util.ExternalContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping(value="/owners/{owner}/pets/{pet}")
public class PetController {
private final PetRepository repository;
@Autowired
public PetController(PetRepository repository) {
this.repository = repository;
}
@RequestMapping(method=RequestMethod.GET)
public Pet get(Long owner, String pet) {
return repository.getPet(owner, pet);
}
@RequestMapping(value="/edit", method=RequestMethod.GET)
public Pet getEditForm(Long owner, String pet) {
return repository.getPet(owner, pet);
}
@RequestMapping(method = RequestMethod.PUT)
public void put(Pet pet, ExternalContext response) {
repository.savePet(pet);
response.redirect(pet.getName());
}
@RequestMapping(method = RequestMethod.DELETE)
public void delete(Long owner, String pet, ExternalContext context) {
context.forResource("owners").redirect(owner);
}
}
\ No newline at end of file
package org.springframework.samples.petclinic.owners.pets;
public interface PetRepository {
Pet getPet(Long owner, String name);
void savePet(Pet pet);
}
package org.springframework.samples.petclinic.owners.pets;
import org.springframework.stereotype.Repository;
@Repository
public class StubPetRepository implements PetRepository {
public Pet getPet(Long owner, String name) {
return null;
}
public void savePet(Pet pet) {
}
}