use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class AmazonWebServicesBillingServiceImpl method buildDINote.
private Note buildDINote() {
Note diNote = new Note();
diNote.setNoteText(getHelpNoteText());
diNote.setAuthorUniversalIdentifier(GlobalVariables.getUserSession().getPerson().getPrincipalId());
diNote.setNotePostedTimestampToCurrent();
return diNote;
}
use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class RecurringDisbursementVoucherDocumentServiceImpl method noteChangeOnRecurringDV.
private void noteChangeOnRecurringDV(RecurringDisbursementVoucherDocument recurringDV, String noteText, Set<String> setOfStrings) {
if (!setOfStrings.isEmpty()) {
Note note = buildNoteBase();
note.setNoteText(noteText + StringUtils.join(setOfStrings, ", "));
;
recurringDV.addNote(note);
try {
getDocumentService().saveDocument(recurringDV);
} catch (WorkflowException e) {
throw new RuntimeException("noteChangeOnRecurringDV() Unable to save note.", e);
}
}
}
use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class RecurringDisbursementVoucherDocumentServiceImpl method buildNoteBase.
private Note buildNoteBase() {
Note noteBase = new Note();
noteBase.setAuthorUniversalIdentifier(GlobalVariables.getUserSession().getPerson().getPrincipalId());
noteBase.setNotePostedTimestampToCurrent();
return noteBase;
}
use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class PurchaseOrderDocument method appSpecificRouteDocumentToUser.
/**
* Sends FYI workflow request to the given user on this document.
*
* @param workflowDocument the associated workflow document.
* @param routePrincipalId the network ID of the user to be sent to.
* @param annotation the annotation notes contained in this document.
* @param responsibility the responsibility specified in the request.
* @throws WorkflowException
*/
public void appSpecificRouteDocumentToUser(WorkflowDocument workflowDocument, String routePrincipalId, String annotation, String responsibility) throws WorkflowException {
if (ObjectUtils.isNotNull(workflowDocument)) {
boolean isActiveUser = this.isActiveUser(routePrincipalId);
Map<String, String> permissionDetails = new HashMap<String, String>();
permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, workflowDocument.getDocumentTypeName());
permissionDetails.put(KimConstants.AttributeConstants.ACTION_REQUEST_CD, KewApiConstants.ACTION_REQUEST_FYI_REQ);
boolean canReceiveAdHocRequest = KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(routePrincipalId, KewApiConstants.KEW_NAMESPACE, KewApiConstants.AD_HOC_REVIEW_PERMISSION, permissionDetails, new HashMap<String, String>());
if (!isActiveUser || !canReceiveAdHocRequest) {
String principalName = SpringContext.getBean(PersonService.class).getPerson(routePrincipalId).getName();
String errorText = "cannot send FYI to the user: " + principalName + "; Annotation: " + annotation;
LOG.info(errorText);
Note note = SpringContext.getBean(DocumentService.class).createNoteFromDocument(this, errorText);
this.addNote(SpringContext.getBean(NoteService.class).save(note));
} else {
String annotationNote = (ObjectUtils.isNull(annotation)) ? "" : annotation;
String responsibilityNote = (ObjectUtils.isNull(responsibility)) ? "" : responsibility;
String currentNodeName = getCurrentRouteNodeName(workflowDocument);
workflowDocument.adHocToPrincipal(ActionRequestType.FYI, currentNodeName, annotationNote, routePrincipalId, responsibilityNote, true);
}
}
}
use of org.kuali.kfs.krad.bo.Note in project cu-kfs by CU-CommunityApps.
the class VendorBatchServiceImpl method loadDocumentAttachments.
/*
* add 'attachments' to vendor document. attachment file names is in input csv file.
* Attachment files are upload to "staging.directory"/vendorBatch/attachment folder
*/
private void loadDocumentAttachments(Document document, List<String> attachments) {
String attachmentsPath = new File(batchInputFileTypes.get(0).getDirectoryPath()).toString() + "/attachment";
for (String attachment : attachments) {
Note note = new Note();
note.setNoteText("Procurement vendor batch process - add attachment");
note.setRemoteObjectIdentifier(document.getObjectId());
note.setAuthorUniversalIdentifier(getSystemUser().getPrincipalId());
note.setNoteTypeCode(KFSConstants.NoteTypeEnum.BUSINESS_OBJECT_NOTE_TYPE.getCode());
note.setNotePostedTimestampToCurrent();
// attempt to load file
String fileName = attachmentsPath + "/" + attachment;
File attachmentFile = new File(fileName);
if (!attachmentFile.exists()) {
continue;
}
try {
FileInputStream fileInputStream = new FileInputStream(fileName);
Integer fileSize = Integer.parseInt(Long.toString(attachmentFile.length()));
// TODO : Files.probeContentType is supported by java 7. Not sure if this will be an issue
String mimeTypeCode = getMimeTypeFromAttachmentFile(attachmentFile);
// TODO : urlconnection is working for java 7 and under, but it return null for 'docx/pptx/xslx'
// String type = URLConnection.guessContentTypeFromName(attachmentFile.getAbsolutePath());
LOG.info("Mime type " + fileName + " " + mimeTypeCode);
String attachType = KFSConstants.EMPTY_STRING;
Attachment noteAttachment = attachmentService.createAttachment(document.getDocumentHeader(), attachment, mimeTypeCode, fileSize, fileInputStream, attachType);
note.addAttachment(noteAttachment);
document.addNote(note);
} catch (FileNotFoundException e) {
continue;
} catch (IOException e1) {
throw new RuntimeException("Unable to create attachment for File: " + fileName, e1);
}
}
}
Aggregations