/*
  * 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);
 }
 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);
 }
 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);
 }