/** * Adds the "new" coiDisclosureAttachment to the CoiDisclosure Document. Before adding this method * executes validation. If the validation fails the attachment is not added. */ public void addNewCoiDisclosureAttachment() { this.refreshAttachmentReferences( Collections.singletonList(this.getNewCoiDisclosureAttachment())); this.syncNewFiles(Collections.singletonList(this.getNewCoiDisclosureAttachment())); final AddCoiDisclosureAttachmentRule rule = new AddCoiDisclosureAttachmentRuleImpl(); final AddCoiDisclosureAttachmentEvent event = new AddCoiDisclosureAttachmentEvent( coiDisclosureForm.getDocument(), newCoiDisclosureAttachment); assignDocumentId( Collections.singletonList(this.getNewCoiDisclosureAttachment()), this.createTypeToMaxDocNumber(getCoiDisclosure().getCoiDisclosureAttachments())); if (rule.processAddCoiDisclosureAttachmentRules(event)) { this.newCoiDisclosureAttachment.setCoiDisclosureId(getCoiDisclosure().getCoiDisclosureId()); newCoiDisclosureAttachment.setSequenceNumber(getCoiDisclosure().getSequenceNumber()); newCoiDisclosureAttachment.setEventTypeCode(getCoiDisclosure().getEventTypeCode() + ""); if (getCoiDisclosure().getCoiDisclProjects().size() > 0) { newCoiDisclosureAttachment.setProjectId( getCoiDisclosure().getCoiDisclProjects().get(0).getProjectId()); } this.getCoiDisclosure().addAttachment(newCoiDisclosureAttachment); getBusinessObjectService().save(newCoiDisclosureAttachment); this.initCoiDisclosureAttachment(); } }
private void initCoiDisclosureAttachment() { this.setNewCoiDisclosureAttachment(new CoiDisclosureAttachment(this.getCoiDisclosure())); CoiDisclosure coiDisclosure = coiDisclosureForm.getCoiDisclosureDocument().getCoiDisclosure(); String event = coiDisclosure.getEventTypeCode(); 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(); newCoiDisclosureAttachment.setProjectId(projectId); } }
/** 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 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); }