Refine search
/** * Return the Pet with the given name, or null if none found for this Owner. * * @param name to test * @return true if pet name is already in use */ public Pet getPet(String name) { return getPet(name, false); }
@RequestMapping(value = "/owner/{ownerId}/getVisits", method = RequestMethod.GET) public ResponseEntity<List<Visit>> getOwnerVisits(@PathVariable int ownerId){ List<Pet> petList = this.owners.findById(ownerId).getPets(); List<Visit> visitList = new ArrayList<Visit>(); petList.forEach(pet -> visitList.addAll(pet.getVisits())); return new ResponseEntity<List<Visit>>(visitList, HttpStatus.OK); } }
@Override public String toString() { return new ToStringCreator(this) .append("id", this.getId()) .append("new", this.isNew()) .append("lastName", this.getLastName()) .append("firstName", this.getFirstName()) .append("address", this.address) .append("city", this.city) .append("telephone", this.telephone) .toString(); } }
public List<Pet> getPets() { List<Pet> sortedPets = new ArrayList<>(getPetsInternal()); PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true)); return Collections.unmodifiableList(sortedPets); }
public void addPet(Pet pet) { if (pet.isNew()) { getPetsInternal().add(pet); } pet.setOwner(this); }
/** * Return the Pet with the given name, or null if none found for this Owner. * * @param name to test * @return true if pet name is already in use */ public Pet getPet(String name, boolean ignoreNew) { name = name.toLowerCase(); for (Pet pet : getPetsInternal()) { if (!ignoreNew || !pet.isNew()) { String compName = pet.getName(); compName = compName.toLowerCase(); if (compName.equals(name)) { return pet; } } } return null; }