Examples of Pet


Examples of org.springframework.samples.petclinic.Pet

    loadPetsAndVisits(owner);
    return owner;
  }

  public Pet loadPet(int id) throws DataAccessException {
    Pet pet = (Pet) getBrokerTemplate().selectOne("loadPetById", "id", new Integer(id));
    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.Pet

  protected void loadPetsAndVisits(Owner owner) {
    List pets = getBrokerTemplate().selectMany("loadPetsByOwner", "id", owner.getId());
    // load visits
    for (Iterator pi = pets.iterator(); pi.hasNext();) {
      Pet pet = (Pet) pi.next();
      loadVisits(pet);
      owner.addPet(pet);
    }
  }
View Full Code Here

Examples of org.springframework.samples.petclinic.Pet

    setSessionForm(true);
  }

  /** Method creates a new <code>Visit</code> with the correct <code>Pet</code> info */
  protected Object formBackingObject(HttpServletRequest request) throws ServletException {
    Pet pet = getClinic().loadPet(ServletRequestUtils.getRequiredIntParameter(request, "petId"));
    Visit visit = new Visit();
    pet.addVisit(visit);
    return visit;
  }
View Full Code Here

Examples of org.springframework.samples.petclinic.Pet

    // get the Pet referred to by id in the request
    return getClinic().loadPet(ServletRequestUtils.getRequiredIntParameter(request, "petId"));
  }

  protected void onBind(HttpServletRequest request, Object command) throws ServletException {
    Pet pet = (Pet) command;
    int typeId = ServletRequestUtils.getRequiredIntParameter(request, "typeId");
    pet.setType((PetType) EntityUtils.getById(getClinic().getPetTypes(), PetType.class, typeId));
  }
View Full Code Here

Examples of org.springframework.samples.petclinic.Pet

    pet.setType((PetType) EntityUtils.getById(getClinic().getPetTypes(), PetType.class, typeId));
  }

  /** Method updates an existing Pet */
  protected ModelAndView onSubmit(Object command) throws ServletException {
    Pet pet = (Pet) command;
    // delegate the update to the business layer
    getClinic().storePet(pet);
    return new ModelAndView(getSuccessView(), "ownerId", pet.getOwner().getId());
  }
View Full Code Here

Examples of org.springframework.samples.petclinic.Pet

    return refData;
  }

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

Examples of org.springframework.samples.petclinic.Pet

    owner.addPet(pet);
    return pet;
  }

  protected void onBind(HttpServletRequest request, Object command) {
    Pet pet = (Pet) command;
    int typeId = Integer.parseInt(request.getParameter("typeId"));
    pet.setType((PetType) EntityUtils.getById(getClinic().getPetTypes(), PetType.class, typeId));
  }
View Full Code Here

Examples of org.springframework.samples.petclinic.Pet

    pet.setType((PetType) EntityUtils.getById(getClinic().getPetTypes(), PetType.class, typeId));
  }

  /** Method inserts a new Pet */
  protected ModelAndView onSubmit(Object command) throws ServletException {
    Pet pet = (Pet) command;
    // delegate the insert to the Business layer
    getClinic().storePet(pet);
    return new ModelAndView(getSuccessView(), "ownerId", pet.getOwner().getId());
  }
View Full Code Here

Examples of org.springframework.samples.petclinic.model.Pet

        dataBinder.setDisallowedFields("id");
    }

    @RequestMapping(value = "/owners/*/pets/{petId}/visits/new", method = RequestMethod.GET)
    public String initNewVisitForm(@PathVariable("petId") int petId, Map<String, Object> model) {
        Pet pet = this.clinicService.findPetById(petId);
        Visit visit = new Visit();
        pet.addVisit(visit);
        model.put("visit", visit);
        return "pets/createOrUpdateVisitForm";
    }
View Full Code Here

Examples of org.springframework.samples.petportal.domain.Pet

    }
    return key;
  }

  public int addPet(String species, String breed, String name, Date birthdate) {
    Pet pet = new Pet(species, breed, name, birthdate);
    return addPet(pet);
  }
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.