Search in sources :

Example 1 with ProductConfigurationDto

use of org.mifos.dto.screen.ProductConfigurationDto in project head by mifos.

the class AdminServiceFacadeWebTier method retrieveProductConfiguration.

@Override
public ProductConfigurationDto retrieveProductConfiguration() {
    ProductTypeEntity loanProductConfiguration = this.loanProductDao.findLoanProductConfiguration();
    ProductTypeEntity savingsProductConfiguration = this.savingsProductDao.findSavingsProductConfiguration();
    return new ProductConfigurationDto(loanProductConfiguration.getLatenessDays().intValue(), savingsProductConfiguration.getDormancyDays().intValue());
}
Also used : ProductConfigurationDto(org.mifos.dto.screen.ProductConfigurationDto) ProductTypeEntity(org.mifos.accounts.productdefinition.business.ProductTypeEntity)

Example 2 with ProductConfigurationDto

use of org.mifos.dto.screen.ProductConfigurationDto in project head by mifos.

the class LatenessDormancyControllerTest method shouldReturnedPopulatedForm.

@Test
public void shouldReturnedPopulatedForm() throws Exception {
    // setup
    LatenessDormancyFormBean expectedFormBean = new LatenessDormancyFormBean();
    expectedFormBean.setLatenessDays(1);
    expectedFormBean.setDormancyDays(1);
    // stubbing
    when(adminServiceFacade.retrieveProductConfiguration()).thenReturn(new ProductConfigurationDto(1, 1));
    // exercise test
    LatenessDormancyFormBean returnedFormBean = latenessDormancyController.showPopulatedForm();
    // verification
    Assert.assertThat(returnedFormBean, is(expectedFormBean));
    Mockito.verify(adminServiceFacade).retrieveProductConfiguration();
}
Also used : ProductConfigurationDto(org.mifos.dto.screen.ProductConfigurationDto) Test(org.junit.Test)

Example 3 with ProductConfigurationDto

use of org.mifos.dto.screen.ProductConfigurationDto in project head by mifos.

the class LatenessDormancyController method processFormSubmit.

@RequestMapping(method = RequestMethod.POST)
public String processFormSubmit(@RequestParam(value = CANCEL_PARAM, required = false) String cancel, @Valid @ModelAttribute("formBean") LatenessDormancyFormBean formBean, BindingResult result, SessionStatus status) {
    String viewName = REDIRECT_TO_ADMIN_SCREEN;
    if (StringUtils.isNotBlank(cancel)) {
        viewName = REDIRECT_TO_ADMIN_SCREEN;
        status.setComplete();
    } else if (result.hasErrors()) {
        viewName = "editLatenessDormancy";
    } else {
        ProductConfigurationDto productConfigurationDto = new ProductConfigurationDto(formBean.getLatenessDays(), formBean.getDormancyDays());
        this.adminServiceFacade.updateProductConfiguration(productConfigurationDto);
        status.setComplete();
    }
    return viewName;
}
Also used : ProductConfigurationDto(org.mifos.dto.screen.ProductConfigurationDto) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with ProductConfigurationDto

use of org.mifos.dto.screen.ProductConfigurationDto in project head by mifos.

the class LatenessDormancyController method showPopulatedForm.

@RequestMapping(method = RequestMethod.GET)
@ModelAttribute("formBean")
public LatenessDormancyFormBean showPopulatedForm() {
    ProductConfigurationDto productConfiguration = adminServiceFacade.retrieveProductConfiguration();
    LatenessDormancyFormBean formBean = new LatenessDormancyFormBean();
    formBean.setLatenessDays(productConfiguration.getLatenessDays());
    formBean.setDormancyDays(productConfiguration.getDormancyDays());
    return formBean;
}
Also used : ProductConfigurationDto(org.mifos.dto.screen.ProductConfigurationDto) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ProductConfigurationDto (org.mifos.dto.screen.ProductConfigurationDto)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Test (org.junit.Test)1 ProductTypeEntity (org.mifos.accounts.productdefinition.business.ProductTypeEntity)1 ModelAttribute (org.springframework.web.bind.annotation.ModelAttribute)1