Search in sources :

Example 1 with CollectionSheetDataViewAssembler

use of org.mifos.application.servicefacade.CollectionSheetDataViewAssembler in project head by mifos.

the class CollectionSheetEntryAction method preview.

@TransactionDemarcate(joinToken = true)
public ActionForward preview(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) throws Exception {
    logTrackingInfo("preview", request, form);
    request.setAttribute(Constants.CURRENTFLOWKEY, request.getParameter(Constants.CURRENTFLOWKEY));
    final CollectionSheetEntryGridDto previousCollectionSheetEntryDto = retrieveFromRequestCollectionSheetEntryDto(request);
    final CollectionSheetDataDto dataView = new CollectionSheetDataViewAssembler().toDto(request, previousCollectionSheetEntryDto);
    final CollectionSheetEntryGridDto collectionSheetEntry = collectionSheetServiceFacade.previewCollectionSheetEntry(previousCollectionSheetEntryDto, dataView);
    storeOnRequestCollectionSheetEntryDto(request, collectionSheetEntry);
    final ActionErrors errors = new ActionErrors();
    final ActionErrors errorsFromValidation = new CollectionSheetEntryDtoPostPreviewValidator().validate(collectionSheetEntry.getBulkEntryParent(), errors, getUserContext(request).getPreferredLocale());
    if (errorsFromValidation.size() > 0) {
        this.addErrors(request, errorsFromValidation);
        return mapping.findForward(CollectionSheetEntryConstants.PREVIEWFAILURE);
    }
    return mapping.findForward(CollectionSheetEntryConstants.PREVIEWSUCCESS);
}
Also used : CollectionSheetDataDto(org.mifos.application.collectionsheet.util.helpers.CollectionSheetDataDto) CollectionSheetDataViewAssembler(org.mifos.application.servicefacade.CollectionSheetDataViewAssembler) ActionErrors(org.apache.struts.action.ActionErrors) CollectionSheetEntryGridDto(org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

ActionErrors (org.apache.struts.action.ActionErrors)1 CollectionSheetEntryGridDto (org.mifos.application.collectionsheet.business.CollectionSheetEntryGridDto)1 CollectionSheetDataDto (org.mifos.application.collectionsheet.util.helpers.CollectionSheetDataDto)1 CollectionSheetDataViewAssembler (org.mifos.application.servicefacade.CollectionSheetDataViewAssembler)1 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)1