Examples of addPet()


Examples of org.springframework.samples.petclinic.Owner.addPet()

  @RequestMapping(method = RequestMethod.GET)
  public String setupForm(@PathVariable("ownerId") int ownerId, Model model) {
    Owner owner = this.clinic.loadOwner(ownerId);
    Pet pet = new Pet();
    owner.addPet(pet);
    model.addAttribute("pet", pet);
    return "pets/form";
  }

  @RequestMapping(method = RequestMethod.POST)
View Full Code Here

Examples of org.springframework.samples.petclinic.Owner.addPet()

    }
    catch (EmptyResultDataAccessException ex) {
      throw new ObjectRetrievalFailureException(Pet.class, new Integer(id));
    }
    Owner owner = loadOwner(pet.getOwnerId());
    owner.addPet(pet);
    pet.setType(EntityUtils.getById(getPetTypes(), PetType.class, pet.getTypeId()));
    loadVisits(pet);
    return pet;
  }
View Full Code Here

Examples of org.springframework.samples.petclinic.Owner.addPet()

    Pet pet = new Pet();
    pet.setName("bowser");
    Collection<PetType> types = this.clinic.getPetTypes();
    pet.setType(EntityUtils.getById(types, PetType.class, 2));
    pet.setBirthDate(new Date());
    o6.addPet(pet);
    assertEquals(found + 1, o6.getPets().size());
    this.clinic.storeOwner(o6);
    // assertTrue(!pet.isNew()); -- NOT TRUE FOR TOPLINK (before commit)
    o6 = this.clinic.loadOwner(6);
    assertEquals(found + 1, o6.getPets().size());
View Full Code Here

Examples of org.springframework.samples.petclinic.model.Owner.addPet()

                    new JdbcPetRowMapper());
        } catch (EmptyResultDataAccessException ex) {
            throw new ObjectRetrievalFailureException(Pet.class, new Integer(id));
        }
        Owner owner = this.ownerRepository.findById(pet.getOwnerId());
        owner.addPet(pet);
        pet.setType(EntityUtils.getById(findPetTypes(), PetType.class, pet.getTypeId()));

        List<Visit> visits = this.visitRepository.findByPetId(pet.getId());
        for (Visit visit : visits) {
            pet.addVisit(visit);
View Full Code Here

Examples of org.springframework.samples.petclinic.model.Owner.addPet()

    @RequestMapping(value = "/owners/{ownerId}/pets/new", method = RequestMethod.GET)
    public String initCreationForm(@PathVariable("ownerId") int ownerId, Map<String, Object> model) {
        Owner owner = this.clinicService.findOwnerById(ownerId);
        Pet pet = new Pet();
        owner.addPet(pet);
        model.put("pet", pet);
        return "pets/createOrUpdatePetForm";
    }

    @RequestMapping(value = "/owners/{ownerId}/pets/new", method = RequestMethod.POST)
View Full Code Here

Examples of org.springframework.samples.petclinic.model.Owner.addPet()

      Pet pet = new Pet();
      pet.setName("bowser");
      Collection<PetType> types = this.clinicService.findPetTypes();
      pet.setType(EntityUtils.getById(types, PetType.class, 2));
      pet.setBirthDate(new DateTime());
      owner6.addPet(pet);
      assertEquals(found + 1, owner6.getPets().size());
      // both storePet and storeOwner are necessary to cover all ORM tools
      this.clinicService.savePet(pet);
      this.clinicService.saveOwner(owner6);
      owner6 = this.clinicService.findOwnerById(6);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.