Skip to content
Snippets Groups Projects
Commit 8fba986a authored by michaelisvy's avatar michaelisvy
Browse files

added comments

parent 41ec22b4
No related branches found
No related tags found
No related merge requests found
......@@ -15,15 +15,10 @@
*/
package org.springframework.samples.petclinic.web;
import java.util.Collection;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.samples.petclinic.model.Owner;
import org.springframework.samples.petclinic.service.ClinicService;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
......@@ -31,7 +26,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
......@@ -64,6 +58,8 @@ public class OwnerResource {
// TODO: should be improved so we have a single method parameter
@RequestMapping(value = "/owner/{ownerId}", method = RequestMethod.POST)
public Owner updateOwner(@ModelAttribute Owner ownerModel, @RequestBody Owner ownerRequest) {
// seems like a workaround. I haven't found a proper way to inject to have @ModelAttribute pupulate object
// first and then have the delta come from @RequestBody
ownerModel.setFirstName(ownerRequest.getFirstName());
ownerModel.setLastName(ownerRequest.getLastName());
ownerModel.setCity(ownerRequest.getCity());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment