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