Search in sources :

Example 6 with Attachment

use of org.kie.kogito.process.workitem.Attachment in project kogito-runtimes by kiegroup.

the class HumanTaskHelper method deleteAttachment.

public static boolean deleteAttachment(KogitoWorkItem item, Object id, String user) {
    Map<Object, Attachment> attachments = asHumanTask(item).getAttachments();
    Attachment attachment = attachments.get(id);
    if (attachment == null || !attachment.getUpdatedBy().equals(user)) {
        return false;
    }
    return attachments.remove(id) != null;
}
Also used : Attachment(org.kie.kogito.process.workitem.Attachment)

Example 7 with Attachment

use of org.kie.kogito.process.workitem.Attachment in project kogito-runtimes by kiegroup.

the class HumanTaskHelper method addAttachment.

public static Attachment addAttachment(KogitoWorkItem item, AttachmentInfo attachmentInfo, String user) {
    HumanTaskWorkItemImpl humanTask = asHumanTask(item);
    Object id = getNewId();
    Attachment attachment = buildAttachment(id, attachmentInfo, user);
    humanTask.getAttachments().put(id, attachment);
    return attachment;
}
Also used : Attachment(org.kie.kogito.process.workitem.Attachment)

Aggregations

Attachment (org.kie.kogito.process.workitem.Attachment)7 Date (java.util.Date)3 Comment (org.kie.kogito.process.workitem.Comment)3 Any (com.google.protobuf.Any)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 BsonString (org.bson.BsonString)1 BsonWriter (org.bson.BsonWriter)1 Document (org.bson.Document)1 EncoderContext (org.bson.codecs.EncoderContext)1 HumanTaskWorkItemImpl (org.jbpm.process.instance.impl.humantask.HumanTaskWorkItemImpl)1 HumanTaskNodeInstance (org.jbpm.workflow.instance.node.HumanTaskNodeInstance)1 WorkItemNodeInstance (org.jbpm.workflow.instance.node.WorkItemNodeInstance)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1 KogitoWorkItemImpl (org.kie.kogito.process.workitems.impl.KogitoWorkItemImpl)1 ProcessInstanceMarshallerException (org.kie.kogito.serialization.process.ProcessInstanceMarshallerException)1 KogitoWorkItemsProtobuf (org.kie.kogito.serialization.process.protobuf.KogitoWorkItemsProtobuf)1