protected void doCallbackOperationForAttachment(Attachment attachment, TaskContext context) { if (attachment != null) { if (attachment.getAttachedBy() != null) { User entity = doCallbackAndReturnUserOperation(attachment.getAttachedBy().getId(), context); if (entity != null) { ((InternalAttachment)attachment).setAttachedBy(entity); } } } }
public long addAttachment(long taskId, Attachment attachment, Content content) { Task task = persistenceContext.findTask(taskId); persistenceContext.persistAttachment(attachment); persistenceContext.persistContent(content); ((InternalAttachment) attachment).setContent(content); persistenceContext.addAttachmentToTask(attachment, task); return attachment.getId(); }
attach.setId(10); attach.setName("virus"); attach.setContentType("ROM"); attach.setAttachedAt(new Date()); user = TaskModelProvider.getFactory().newUser(); ((InternalOrganizationalEntity) user).setId("Wintermute"); attach.setAttachedBy(user); attach.setSize(payload.getBytes().length); attach.setAttachmentContentId(comment.getId()); taskData.addAttachment(attach);
TaskSummary taskSum = tasks.get(0); Attachment attach = TaskModelProvider.getFactory().newAttachment(); ((InternalAttachment)attach).setAccessType(AccessType.Inline); ((InternalAttachment)attach).setAttachedAt(new Date()); ((InternalAttachment)attach).setName("My first doc"); ((InternalAttachment)attach).setContentType("String"); Content content = TaskModelProvider.getFactory().newContent(); ((InternalContent)content).setContent(ContentMarshallerHelper.marshallContent(task, "This is my first inline document", null)); ((InternalAttachment)attach2).setAccessType(AccessType.Inline); ((InternalAttachment)attach2).setAttachedAt(new Date()); ((InternalAttachment)attach2).setName("My second doc"); ((InternalAttachment)attach2).setContentType("String"); Content content2 = TaskModelProvider.getFactory().newContent(); ((InternalContent)content2).setContent(ContentMarshallerHelper.marshallContent(task, "This is my second inline document", null));
public Long execute(Context cntxt) { TaskContext context = (TaskContext) cntxt; Attachment attachmentImpl = attachment; if (attachmentImpl == null) { attachmentImpl = jaxbAttachment; } Content contentImpl = content; if (contentImpl == null) { contentImpl = jaxbContent; } if (rawContent != null && contentImpl == null) { Task task = context.getPersistenceContext().findTask(taskId); contentImpl = TaskModelProvider.getFactory().newContent(); ContentMarshallerContext ctx = TaskContentRegistry.get().getMarshallerContext(task.getTaskData().getDeploymentId()); ((InternalContent)contentImpl).setContent(ContentMarshallerHelper.marshallContent(task, rawContent, ctx.getEnvironment())); ((InternalAttachment)attachmentImpl).setSize(contentImpl.getContent().length); } doCallbackOperationForAttachment(attachmentImpl, context); return context.getTaskAttachmentService().addAttachment(taskId, attachmentImpl, contentImpl); }
InternalAttachment attach = (InternalAttachment) TaskModelProvider.getFactory().newAttachment(); if( jaxbAttach.getId() != null ) { attach.setId(jaxbAttach.getId()); attach.setName(jaxbAttach.getName()); attach.setContentType(jaxbAttach.getContentType()); attach.setAttachedAt(jaxbAttach.getAttachedAt()); attach.setAttachedBy(createUser(((JaxbAttachment) jaxbAttach).getAttachedById())); attach.setSize(jaxbAttach.getSize()); attach.setAttachmentContentId(jaxbAttach.getAttachmentContentId()); attachments.add(attach);