protected void addNotes( String documentNumber, List<SubObjectCode> listOfSubObjects, String messageKey, PersistableBusinessObject noteParent, Note noteTemplate) { for (int i = 0; i < listOfSubObjects.size(); i += getNumSubObjectsPerNote()) { try { String subAccountString = createSubObjectChunk(listOfSubObjects, i, i + getNumSubObjectsPerNote()); if (StringUtils.isNotBlank(subAccountString)) { String noteTextTemplate = kualiConfigurationService.getPropertyValueAsString(messageKey); String noteText = MessageFormat.format(noteTextTemplate, subAccountString); Note note = noteService.createNote( noteTemplate, noteParent, GlobalVariables.getUserSession().getPrincipalId()); note.setNoteText(noteText); note.setNotePostedTimestampToCurrent(); noteService.save(note); } } catch (Exception e) { LOG.error("Unable to create/save notes for document " + documentNumber, e); throw new RuntimeException("Unable to create/save notes for document " + documentNumber, e); } } }
protected void addMaintenanceLockedNotes( String documentNumber, Map<SubObjectCode, String> lockedSubObjects, String messageKey, PersistableBusinessObject noteParent, Note noteTemplate) { for (Map.Entry<SubObjectCode, String> entry : lockedSubObjects.entrySet()) { try { SubObjectCode subObjCd = entry.getKey(); String subObjectString = subObjCd.getUniversityFiscalYear() + " - " + subObjCd.getChartOfAccountsCode() + " - " + subObjCd.getAccountNumber() + " - " + subObjCd.getFinancialObjectCode() + " - " + subObjCd.getFinancialSubObjectCode(); if (StringUtils.isNotBlank(subObjectString)) { String noteTextTemplate = kualiConfigurationService.getPropertyValueAsString(messageKey); String noteText = MessageFormat.format(noteTextTemplate, subObjectString, entry.getValue()); Note note = noteService.createNote( noteTemplate, noteParent, GlobalVariables.getUserSession().getPrincipalId()); note.setNoteText(noteText); note.setNotePostedTimestampToCurrent(); noteService.save(note); } } catch (Exception e) { LOG.error("Unable to create/save notes for document " + documentNumber, e); throw new RuntimeException("Unable to create/save notes for document " + documentNumber, e); } } }