/* * edit an existing note */ public void editNote(int noteToModify) { CoiDisclosureNotepad notepadObject = this.getCoiDisclosure().getCoiDisclosureNotepads().get(noteToModify); notepadObject.setUpdateUser(GlobalVariables.getUserSession().getPrincipalName()); notepadObject.setUpdateTimestamp(dateTimeService.getCurrentTimestamp()); notepadObject.setEditable(true); }
public void setOriginalDisclosureIdsIfNecessary(CoiDisclosure disclosure) { for (CoiDisclosureAttachment attachment : disclosure.getCoiDisclosureAttachments()) { if (attachment.getOriginalCoiDisclosureId() == null) { attachment.setOriginalCoiDisclosureId(disclosure.getCoiDisclosureId()); } } for (CoiDisclosureNotepad note : disclosure.getCoiDisclosureNotepads()) { if (note.getOriginalCoiDisclosureId() == null) { note.setOriginalCoiDisclosureId(disclosure.getCoiDisclosureId()); } } }
/** This method is called by the action class to add a new note */ public void addNewNote() { final AddCoiDisclosureNotepadRule rule = new AddCoiDisclosureNotepadRuleImpl(); final AddCoiDisclosureNotepadEvent event = new AddCoiDisclosureNotepadEvent( (CoiDisclosureDocument) coiDisclosureForm.getDocument(), this.newCoiDisclosureNotepad); if (rule.processAddCoiDisclosureNotepadRules(event)) { newCoiDisclosureNotepad.setCreateUser(GlobalVariables.getUserSession().getPrincipalName()); newCoiDisclosureNotepad.setCreateTimestamp( ((DateTimeService) KcServiceLocator.getService(Constants.DATE_TIME_SERVICE_NAME)) .getCurrentTimestamp()); addNewNotepad(newCoiDisclosureNotepad); initCoiDisclosureNotepad(); } }
private void addNewNotepad(CoiDisclosureNotepad notepad) { setUpdateFields(notepad); // set notepad to be editable notepad.resetUpdateTimestamp(); notepad.setEditable(false); notepad.setCoiDisclosureId(getCoiDisclosure().getCoiDisclosureId()); notepad.setCoiDisclosureNumber(getCoiDisclosure().getCoiDisclosureNumber()); notepad.setSequenceNumber(getCoiDisclosure().getSequenceNumber()); notepad.setEntryNumber(getNextEntryNumber()); if (getCoiDisclosure().getCoiDisclProjects().size() > 0) { notepad.setProjectId(getCoiDisclosure().getCoiDisclProjects().get(0).getProjectId()); } if (notepad.getFinancialEntity() == null && notepad.getFinancialEntityId() != null) { // due to the readonly view change for disabled fin ents, we need to make sure to have a // financial entity otherwise the fin ent will be blank on add. notepad.refreshReferenceObject("financialEntity"); } getBusinessObjectService().save(notepad); getCoiDisclosure().getCoiDisclosureNotepads().add(notepad); }
protected void initializeNotePaseUserNames(List<CoiDisclosureNotepad> notepads) { for (CoiDisclosureNotepad notePad : notepads) { Person person = this.getPersonService().getPersonByPrincipalName(notePad.getUpdateUser()); notePad.setUpdateUserFullName( person == null ? String.format(PERSON_NOT_FOUND_FORMAT_STRING, notePad.getUpdateUser()) : person.getName()); if (StringUtils.isNotBlank(notePad.getCreateUser())) { Person creator = this.getPersonService().getPersonByPrincipalName(notePad.getCreateUser()); notePad.setCreateUserFullName( creator == null ? String.format(PERSON_NOT_FOUND_FORMAT_STRING, notePad.getCreateUser()) : creator.getName()); } else { notePad.setCreateUserFullName(""); } } }
private void initCoiDisclosureNotepad() { final CoiDisclosureNotepad notepad = new CoiDisclosureNotepad(getCoiDisclosure()); notepad.setEntryNumber(getNextEntryNumber()); CoiDisclosure coiDisclosure = coiDisclosureForm.getCoiDisclosureDocument().getCoiDisclosure(); String event = coiDisclosure.getEventTypeCode(); // If disclosure is an automatic event disclosure, prepopulate the projectId so that // this can be displayed in the notes and attachments projectId field. We do not want // a drop down in this case since there is only one value. if (StringUtils.equalsIgnoreCase(event, CoiDisclosureEventType.AWARD) || StringUtils.equalsIgnoreCase(event, CoiDisclosureEventType.DEVELOPMENT_PROPOSAL) || StringUtils.equalsIgnoreCase(event, CoiDisclosureEventType.INSTITUTIONAL_PROPOSAL) || StringUtils.equalsIgnoreCase(event, CoiDisclosureEventType.IRB_PROTOCOL)) { String projectId = coiDisclosure.getCoiDisclProjects().get(0).getProjectId(); notepad.setProjectId(projectId); } notepad.setEventTypeCode(event); notepad.setEditable(true); // If Assigned Reviewers create a comment in the Review Actions ==> Add Review Comment, pre-set // the Note Type drop down to Reviewer Comment if (canAddCoiDisclosureNotes() && coiDisclosure.isSubmitted() && addCoiReviewerComments) { notepad.setNoteTypeCode(CoiNoteType.REVIEWER_COMMENT_NOTE_TYPE_CODE); } setNewCoiDisclosureNotepad(notepad); }