|
|
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import scot.carricksoftware.grants.capitalisation.images.personimages.CapitalisePersonImage;
|
|
|
import scot.carricksoftware.grants.commands.images.PersonImageCommand;
|
|
|
import scot.carricksoftware.grants.commands.images.PersonImageCommandImpl;
|
|
|
import scot.carricksoftware.grants.constants.*;
|
|
|
@@ -37,12 +38,17 @@ public class PersonImageFormControllerImpl implements PersonImageFormController
|
|
|
private final PersonImageCommandValidatorImpl personImageCommandValidatorImpl;
|
|
|
private final PersonService personService;
|
|
|
private final ImageService imageService;
|
|
|
+ private final CapitalisePersonImage capitalisePersonImage;
|
|
|
|
|
|
|
|
|
public PersonImageFormControllerImpl(PersonImageService personImageService,
|
|
|
PersonImageCommandConverterImpl personImageCommandConverter,
|
|
|
PersonImageConverterImpl personImageConverter,
|
|
|
- PersonImageCommandValidatorImpl personImageCommandValidatorImpl, PersonService personService, ImageService imageService) {
|
|
|
+ PersonImageCommandValidatorImpl personImageCommandValidatorImpl,
|
|
|
+ PersonService personService,
|
|
|
+ ImageService imageService,
|
|
|
+ CapitalisePersonImage capitalisePersonImage) {
|
|
|
+
|
|
|
this.personImageService = personImageService;
|
|
|
this.personImageCommandConverter = personImageCommandConverter;
|
|
|
|
|
|
@@ -51,6 +57,7 @@ public class PersonImageFormControllerImpl implements PersonImageFormController
|
|
|
this.personImageCommandValidatorImpl = personImageCommandValidatorImpl;
|
|
|
this.personService = personService;
|
|
|
this.imageService = imageService;
|
|
|
+ this.capitalisePersonImage = capitalisePersonImage;
|
|
|
}
|
|
|
|
|
|
@SuppressWarnings("SameReturnValue")
|
|
|
@@ -79,6 +86,7 @@ public class PersonImageFormControllerImpl implements PersonImageFormController
|
|
|
public String saveOrUpdate(@Valid @ModelAttribute PersonImageCommand personImageCommand, BindingResult bindingResult, Model model) {
|
|
|
logger.debug("PersonImageFormControllerImpl::saveOrUpdate");
|
|
|
|
|
|
+ capitalisePersonImage.capitalise(personImageCommand);
|
|
|
personImageCommandValidatorImpl.validate(personImageCommand, bindingResult);
|
|
|
|
|
|
if (bindingResult.hasErrors()) {
|