use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.
the class EditLoanProductFormController method showPopulatedForm.
@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("loanProduct")
public LoanProductFormBean showPopulatedForm(@RequestParam(value = "productId", required = true) Integer productId) {
LoanProductFormDto referenceData = this.adminServiceFacade.retrieveLoanProductFormReferenceData();
LoanProductRequest loanProductRequest = adminServiceFacade.retrieveLoanProductDetails(productId);
LoanProductFormBean loanProductFormBean = loanProductFormBeanAssembler.populateWithReferenceData(referenceData);
loanProductFormBeanAssembler.populateWithLoanProductDetails(loanProductFormBean, loanProductRequest);
return loanProductFormBean;
}
use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.
the class DefineLoanProductsFormController method showPopulatedForm.
@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("loanProduct")
public LoanProductFormBean showPopulatedForm() {
LoanProductFormDto loanProductRefData = this.adminServiceFacade.retrieveLoanProductFormReferenceData();
LoanProductFormBean loanProductFormBean = loanProductFormBeanAssembler.populateWithReferenceData(loanProductRefData);
loanProductFormBean.setIncludeInLoanCycleCounter(false);
loanProductFormBean.setInstallmentFrequencyRecurrenceEvery(Integer.valueOf(1));
loanProductFormBean.setGracePeriodDurationInInstallments(Integer.valueOf(0));
loanProductFormBean.setLoanAmountByLastLoanAmount(loanProductFormBean.createByLastLoanAmountBeans());
loanProductFormBean.setLoanAmountByLoanCycle(loanProductFormBean.createByLoanCycleBeans());
SameForAllLoanBean installmentsSameForAllLoans = new SameForAllLoanBean();
installmentsSameForAllLoans.setMin(Double.valueOf("1"));
loanProductFormBean.setInstallmentsSameForAllLoans(installmentsSameForAllLoans);
loanProductFormBean.setInstallmentsByLastLoanAmount(loanProductFormBean.createByLastLoanAmountBeans());
loanProductFormBean.setInstallmentsByLoanCycle(loanProductFormBean.createByLoanCycleBeans());
return loanProductFormBean;
}
use of org.springframework.web.bind.annotation.ModelAttribute in project head by mifos.
the class PentahoReportingController method getBreadCrumbs.
@ModelAttribute("breadcrumbs")
public List<BreadCrumbsLinks> getBreadCrumbs(HttpServletRequest request) {
Integer reportId = getReportId(request);
String reportName = this.pentahoReportsService.getReportName(reportId);
return new BreadcrumbBuilder().withLink("tab.Reports", REPORTS_MAIN_URL).withLink(reportName, "viewPentahoReport.ftl?reportId=" + reportId).build();
}
use of org.springframework.web.bind.annotation.ModelAttribute in project spring-framework by spring-projects.
the class ErrorsMethodArgumentResolver method getModelAttributeName.
private String getModelAttributeName(MethodParameter parameter) {
Assert.isTrue(parameter.getParameterIndex() > 0, "Errors argument must be immediately after a model attribute argument.");
int index = parameter.getParameterIndex() - 1;
MethodParameter attributeParam = new MethodParameter(parameter.getMethod(), index);
Class<?> attributeType = attributeParam.getParameterType();
ResolvableType type = ResolvableType.forMethodParameter(attributeParam);
ReactiveAdapter adapter = getAdapterRegistry().getAdapter(type.resolve());
Assert.isNull(adapter, "Errors/BindingResult cannot be used with an async model attribute. " + "Either declare the model attribute without the async wrapper type " + "or handle WebExchangeBindException through the async type.");
ModelAttribute annot = parameter.getParameterAnnotation(ModelAttribute.class);
if (annot != null && StringUtils.hasText(annot.value())) {
return annot.value();
}
// TODO: Conventions does not deal with async wrappers
return ClassUtils.getShortNameAsProperty(attributeType);
}
use of org.springframework.web.bind.annotation.ModelAttribute in project libresonic by Libresonic.
the class DatabaseSettingsController method formBackingObject.
@ModelAttribute
protected void formBackingObject(Model model) throws Exception {
DatabaseSettingsCommand command = new DatabaseSettingsCommand();
command.setConfigType(settingsService.getDatabaseConfigType());
command.setEmbedDriver(settingsService.getDatabaseConfigEmbedDriver());
command.setEmbedPassword(settingsService.getDatabaseConfigEmbedPassword());
command.setEmbedUrl(settingsService.getDatabaseConfigEmbedUrl());
command.setEmbedUsername(settingsService.getDatabaseConfigEmbedUsername());
command.setJNDIName(settingsService.getDatabaseConfigJNDIName());
command.setMysqlVarcharMaxlength(settingsService.getDatabaseMysqlVarcharMaxlength());
command.setUsertableQuote(settingsService.getDatabaseUsertableQuote());
model.addAttribute("command", command);
}
Aggregations