创建对象

public class AttachmentFactory {

private static AttachmentDO create(Attachment attachment) {
    return AttachmentDO
            .builder()
            .id(attachment.getId())
            .name(attachment.getName())
            .description(attachment.getDescription())
            .taskId(attachment.getTaskId())
            .type(attachment.getType())
            .url(attachment.getUrl())
            .createTime(DateUtils.toLocalDateTime(attachment.getCreateTime()))
            .removalTime(DateUtils.toLocalDateTime(attachment.getRemovalTime()))
            .rootProcessInstanceId(attachment.getRootProcessInstanceId())
            .processInstanceId(attachment.getProcessInstanceId())
            .build();
}

}

》》》》》》》》》》》》》》》》
package yssWork.domin;

import org.camunda.bpm.engine.TaskService;

import java.util.Date;

public interface Attachment {

/** unique id for this attachment */
String getId();

/** free user defined short (max 255 chars) name for this attachment */
String getName();

/** free user defined short (max 255 chars) name for this attachment */
void setName(String name);

/** long (max 255 chars) explanation what this attachment is about in context of the task and/or process instance it's linked to. */
String getDescription();

/** long (max 255 chars) explanation what this attachment is about in context of the task and/or process instance it's linked to. */
void setDescription(String description);

/** indication of the type of content that this attachment refers to. Can be mime type or any other indication. */
String getType();

/** reference to the task to which this attachment is associated. */
String getTaskId();

/** reference to the process instance to which this attachment is associated. */
String getProcessInstanceId();

/** the remote URL in case this is remote content.  If the attachment content was
 * {@link TaskService#createAttachment(String, String, String, String, String, java.io.InputStream) uploaded with an input stream},
 * then this method returns null and the content can be fetched with {@link TaskService#getAttachmentContent(String)}. */
String getUrl();

/** The time when the attachment was created. */
Date getCreateTime();

/** reference to the root process instance id of the process instance on which this attachment was made */
String getRootProcessInstanceId();

/** The time the historic attachment will be removed. */
Date getRemovalTime();

}
》》》》》》》》》》》》》》》》》》
package yssWork.domin;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AttachmentDO {

/**
 * 附件Id
 */
private String id;
/**
 * 附件名
 */
private String name;
/**
 * 附件描述
 */
private String description;
/**
 * 任务Id
 */
private String taskId;
/**
 * 附件类型
 */
private String type;
/**
 * 附件URL
 */
private String url;
/**
 * 创建时间
 */
private LocalDateTime createTime;
/**
 * 清除时间
 */
private LocalDateTime removalTime;
/**
 * 根流程实例Id
 */
private String rootProcessInstanceId;
/**
 * 流程实例Id
 */
private String processInstanceId;

}
》》》》》》》》》》》》》》》》》
根据AttchmentId获取附件
@Override
public Optional findById(String attachmentId) {
Attachment attachment = taskService.getAttachment(attachmentId);
return AttachmentFactory.createByAttachment(attachment);
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值