use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.
the class SavingsProductChangeLogController method showAllAuditLogsForSavingsProducts.
@ModelAttribute("auditLog")
@RequestMapping(method = RequestMethod.GET)
public AuditLogScreenDto showAllAuditLogsForSavingsProducts(@RequestParam(value = "productId", required = true) Integer productId) {
SavingsProductDto productDetails = adminServiceFacade.retrieveSavingsProductDetails(productId);
List<AuditLogDto> auditLogRecords = adminServiceFacade.retrieveSavingsProductAuditLogs(productId);
return new AuditLogScreenDto(productDetails.getProductDetails().getId(), productDetails.getProductDetails().getName(), productDetails.getProductDetails().getCreatedDateFormatted(), auditLogRecords);
}
use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.
the class DeleteCoaController method showForm.
@ModelAttribute("formBean")
@RequestMapping(method = RequestMethod.GET)
public CoaFormBean showForm(@RequestParam(value = "id", required = true) Short id) {
CoaDto coaDto = coaServiceFacade.getCoaDTO(id);
CoaFormBean formBean = new CoaFormBean();
formBean.setCoaName(coaDto.getAccountName());
formBean.setGlCode(coaDto.getGlCodeString());
formBean.setAccountId(id);
return formBean;
}
use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.
the class MonthClosingController method showPopulatedForm.
@ModelAttribute("monthClosingFormBean")
public MonthClosingFormBean showPopulatedForm() {
MonthClosingFormBean formBean = new MonthClosingFormBean();
Date monthClosingDateToSet = monthClosingServiceFacade.getMonthClosingDate();
if (monthClosingDateToSet == null) {
monthClosingDateToSet = new DateTime().toDate();
}
formBean.setDate(new DateTime(monthClosingDateToSet));
formBean.setLocale(Locale.getDefault());
return formBean;
}
use of org.springframework.web.bind.annotation.ModelAttribute in project spring-petclinic by spring-projects.
the class VisitController method loadPetWithVisit.
/**
* Called before each and every @RequestMapping annotated method.
* 2 goals:
* - Make sure we always have fresh data
* - Since we do not use the session scope, make sure that Pet object always has an id
* (Even though id is not part of the form fields)
*
* @param petId
* @return Pet
*/
@ModelAttribute("visit")
public Visit loadPetWithVisit(@PathVariable("petId") int petId, Map<String, Object> model) {
Pet pet = this.pets.findById(petId);
model.put("pet", pet);
Visit visit = new Visit();
pet.addVisit(visit);
return visit;
}
use of org.springframework.web.bind.annotation.ModelAttribute in project spring-framework by spring-projects.
the class ModelInitializer method getAttributeName.
private String getAttributeName(Class<?> valueType, MethodParameter parameter) {
Method method = parameter.getMethod();
ModelAttribute annot = AnnotatedElementUtils.findMergedAnnotation(method, ModelAttribute.class);
if (annot != null && StringUtils.hasText(annot.value())) {
return annot.value();
}
// TODO: Conventions does not deal with async wrappers
return ClassUtils.getShortNameAsProperty(valueType);
}
Aggregations