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());
}
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();
}
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;
}
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;
}
Aggregations