public ActionForward regenerateCorrespondence( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { MeetingHelperBase meetingHelper = ((MeetingFormBase) form).getMeetingHelper(); meetingHelper.setRegeneratedCorrespondences(new ArrayList<ProtocolCorrespondence>()); for (ProtocolCorrespondence protocolCorrespondence : meetingHelper.getCorrespondences()) { if (protocolCorrespondence.isRegenerateFlag()) { ProtocolBase protocol = protocolCorrespondence.getProtocol(); AttachmentDataSource dataSource = generateCorrespondenceDocumentAndAttach(protocol, protocolCorrespondence); PrintableAttachment source = new PrintableAttachment(); if (dataSource != null) { protocolCorrespondence.setCorrespondence(dataSource.getData()); protocolCorrespondence.setFinalFlag(false); protocolCorrespondence.setCreateUser(GlobalVariables.getUserSession().getPrincipalName()); protocolCorrespondence.setCreateTimestamp( KcServiceLocator.getService(DateTimeService.class).getCurrentTimestamp()); } meetingHelper.getRegeneratedCorrespondences().add(protocolCorrespondence); } } getBusinessObjectService().save(meetingHelper.getRegeneratedCorrespondences()); return mapping.findForward("correspondence"); }
/* * validate required/format of the properties of bo. also validate business rules. */ private boolean isValidToSave(MeetingHelperBase meetingHelper, boolean readOnly) { if (readOnly) { return false; } GlobalVariables.getMessageMap().addToErrorPath(COMMITTEE_SCHEDULE_ERROR_PATH); getDictionaryValidationService().validateBusinessObject(meetingHelper.getCommitteeSchedule()); GlobalVariables.getMessageMap().removeFromErrorPath(COMMITTEE_SCHEDULE_ERROR_PATH); boolean valid = GlobalVariables.getMessageMap().hasNoErrors(); try { valid &= applyRules( new MeetingSaveEvent( Constants.EMPTY_STRING, getCommitteeDocument( meetingHelper .getCommitteeSchedule() .getParentCommittee() .getCommitteeDocument() .getDocumentHeader() .getDocumentNumber()), meetingHelper, ErrorType.HARDERROR)); } catch (NullPointerException e) { // NPE When Accessing Meeting Actions Tab on IRB Schedule // https://github.com/rSmart/issues/issues/449 LOG.warn( "Possible behavior change; not changing value of `valid` variable. It remains: " + valid); } return valid; }