use of org.mifos.dto.domain.OfficeUpdateRequest in project head by mifos.
the class OffAction method update.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
OffActionForm offActionForm = (OffActionForm) form;
ActionForward forward = null;
OfficeDto sessionOffice = (OfficeDto) SessionUtils.getAttribute(OfficeConstants.OFFICE_DTO, request);
Short officeId = sessionOffice.getOfficeId();
Integer versionNum = sessionOffice.getVersionNum();
OfficeUpdateRequest officeUpdateRequest = officeUpdateRequestFrom(offActionForm);
boolean isParentOfficeChanged = this.officeServiceFacade.updateOffice(officeId, versionNum, officeUpdateRequest);
if (isParentOfficeChanged) {
forward = mapping.findForward(ActionForwards.update_cache_success.toString());
} else {
forward = mapping.findForward(ActionForwards.update_success.toString());
}
return forward;
}
use of org.mifos.dto.domain.OfficeUpdateRequest in project head by mifos.
the class OffAction method officeUpdateRequestFrom.
private OfficeUpdateRequest officeUpdateRequestFrom(OffActionForm offActionForm) throws OfficeException {
OfficeStatus newStatus = null;
if (getShortValue(offActionForm.getOfficeStatus()) != null) {
newStatus = OfficeStatus.getOfficeStatus(getShortValue(offActionForm.getOfficeStatus()));
}
OfficeLevel newlevel = OfficeLevel.getOfficeLevel(getShortValue(offActionForm.getOfficeLevel()));
Short parentOfficeId = getShortValue(offActionForm.getParentOfficeId());
Address address = offActionForm.getAddress();
AddressDto addressDto = null;
if (address != null) {
addressDto = Address.toDto(address);
}
return new OfficeUpdateRequest(offActionForm.getOfficeName(), offActionForm.getShortName(), newStatus.getValue(), newlevel.getValue(), parentOfficeId, addressDto);
}
Aggregations