org.activiti.engine.TaskService.createAttachment()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(399)

本文整理了Java中org.activiti.engine.TaskService.createAttachment()方法的一些代码示例,展示了TaskService.createAttachment()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TaskService.createAttachment()方法的具体详情如下:
包路径:org.activiti.engine.TaskService
类名称:TaskService
方法名:createAttachment

TaskService.createAttachment介绍

[英]Add a new attachment to a task and/or a process instance and use an input stream to provide the content
[中]向任务和/或流程实例添加新附件,并使用输入流提供内容

代码示例

代码示例来源:origin: org.activiti/activiti-rest

Attachment createdAttachment = taskService.createAttachment(type, task.getId(), task.getProcessInstanceId(), name, description, file.getInputStream());

代码示例来源:origin: org.flowable/flowable5-compatibility

@Override
public Attachment createAttachment(String attachmentType, String taskId, String processInstanceId, String attachmentName, String attachmentDescription, InputStream content, String url) {
  try {
    org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(Authentication.getAuthenticatedUserId());
    if (content != null) {
      return new Flowable5AttachmentWrapper(getProcessEngine().getTaskService().createAttachment(attachmentType, taskId, processInstanceId, attachmentName, attachmentDescription, content));
    } else {
      return new Flowable5AttachmentWrapper(getProcessEngine().getTaskService().createAttachment(attachmentType, taskId, processInstanceId, attachmentName, attachmentDescription, url));
    }
  } catch (org.activiti.engine.ActivitiException e) {
    handleActivitiException(e);
    return null;
  }
}

代码示例来源:origin: org.activiti/activiti-explorer

public Attachment getAttachment() throws InvalidValueException {
 // Force validation of the fields
 commit();
 if(attachment != null) {
  applyValuesToAttachment();
 } else {
  // Create new attachment based on values
  // TODO: use explorerApp to get service
  attachment = taskService.createAttachment(UrlAttachmentRenderer.ATTACHMENT_TYPE, taskId, processInstanceId, 
    getAttachmentName(), getAttachmentDescription(), getAttachmentUrl());
 }
 return attachment;
}

代码示例来源:origin: org.activiti/activiti-explorer

public Attachment getAttachment() throws InvalidValueException {
 // Force validation of the fields
 form.commit();
 
 // Check if file is uploaded
 if(!fileUploaded) {
  InvalidValueException ive = new InvalidValueException(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_FILE_REQUIRED));
  form.setComponentError(ive);
  throw ive;
 }
 
 if(attachment != null) {
  applyValuesToAttachment();
 } else {
  // Create new attachment based on values
  // TODO: use explorerApp to get services
  attachment = taskService.createAttachment(mimeType, taskId, processInstanceId, 
    getAttachmentName(), getAttachmentDescription(), new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
 }
 return attachment;
}

代码示例来源:origin: org.activiti/activiti-rest

protected AttachmentResponse createSimpleAttachment(AttachmentRequest attachmentRequest, Task task) {
 if (attachmentRequest.getName() == null) {
  throw new ActivitiIllegalArgumentException("Attachment name is required.");
 }
 Attachment createdAttachment = taskService.createAttachment(attachmentRequest.getType(), task.getId(), task.getProcessInstanceId(), attachmentRequest.getName(),
   attachmentRequest.getDescription(), attachmentRequest.getExternalUrl());
 return restResponseFactory.createAttachmentResponse(createdAttachment);
}

相关文章

微信公众号

最新文章

更多