Examples of addPet()


Examples of org.activejpa.examples.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.activejpa.examples.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

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

        p2 = (Pet) system.save(p2);
       
        Owner owner = new Owner();
        owner.setFirstName("Tom");
        owner.setLastName("Cruise");
        owner.addPet(p1);
        owner.addPet(p2);
        owner = (Owner) system.save(owner);
    }

    private void initVets(PrevalentSystem system) {
View Full Code Here

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

       
        Owner owner = new Owner();
        owner.setFirstName("Tom");
        owner.setLastName("Cruise");
        owner.addPet(p1);
        owner.addPet(p2);
        owner = (Owner) system.save(owner);
    }

    private void initVets(PrevalentSystem system) {
        Specialty s1 = new Specialty();
View Full Code Here

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

  }

  protected Object formBackingObject(HttpServletRequest request) throws ServletException {
    Owner owner = getClinic().loadOwner(RequestUtils.getRequiredIntParameter(request, "ownerId"));
    Pet pet = new Pet();
    owner.addPet(pet);
    return pet;
  }

  protected void onBind(HttpServletRequest request, Object command) {
    Pet pet = (Pet) command;
View Full Code Here

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

    if (pet == null) {
      throw new ObjectRetrievalFailureException(Pet.class, new Integer(id));
    }
    //load owner
    Owner owner = (Owner) getBrokerTemplate().selectOne("loadOwnerByPet", "id", pet.getId());
    owner.addPet(pet);
    // load visits
    loadVisits(pet);
    return pet;
  }
View Full Code Here

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

  }

  protected Object formBackingObject(HttpServletRequest request) throws ServletException {
    Owner owner = getClinic().loadOwner(ServletRequestUtils.getRequiredIntParameter(request, "ownerId"));
    Pet pet = new Pet();
    owner.addPet(pet);
    return pet;
  }

  protected void onBind(HttpServletRequest request, Object command) {
    Pet pet = (Pet) command;
View Full Code Here

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

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

  @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
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.