Search in sources :

Example 6 with ModelAttribute

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;
}
Also used : LoanProductFormDto(org.mifos.dto.screen.LoanProductFormDto) LoanProductRequest(org.mifos.dto.domain.LoanProductRequest) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with ModelAttribute

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;
}
Also used : LoanProductFormDto(org.mifos.dto.screen.LoanProductFormDto) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 8 with ModelAttribute

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();
}
Also used : BreadcrumbBuilder(org.mifos.ui.core.controller.BreadcrumbBuilder) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute)

Example 9 with ModelAttribute

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);
}
Also used : ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) MethodParameter(org.springframework.core.MethodParameter) ResolvableType(org.springframework.core.ResolvableType) ReactiveAdapter(org.springframework.core.ReactiveAdapter)

Example 10 with ModelAttribute

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);
}
Also used : DatabaseSettingsCommand(org.libresonic.player.command.DatabaseSettingsCommand) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute)

Aggregations

ModelAttribute (org.springframework.web.bind.annotation.ModelAttribute)34 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)14 LinkedHashMap (java.util.LinkedHashMap)3 Locale (java.util.Locale)3 Method (java.lang.reflect.Method)2 ArrayList (java.util.ArrayList)2 AuditLogDto (org.mifos.dto.domain.AuditLogDto)2 LoanProductRequest (org.mifos.dto.domain.LoanProductRequest)2 ReportCategoryDto (org.mifos.dto.domain.ReportCategoryDto)2 AuditLogScreenDto (org.mifos.dto.screen.AuditLogScreenDto)2 LoanProductFormDto (org.mifos.dto.screen.LoanProductFormDto)2 InvocableHandlerMethod (org.springframework.web.method.support.InvocableHandlerMethod)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 BasicDBObject (com.mongodb.BasicDBObject)1 DBObject (com.mongodb.DBObject)1 UserAccount (com.springone.myrestaurants.domain.UserAccount)1 IncludePage (freemarker.ext.servlet.IncludePage)1 ApiOperation (io.swagger.annotations.ApiOperation)1 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1