public void deleteDocumentContent(long taskId, long contentId) { Task task = persistenceContext.findTask(taskId); ((InternalTaskData) task.getTaskData()).setDocumentContentId(-1); Content content = persistenceContext.findContent(contentId); persistenceContext.removeContent(content); }
public void deleteAttachment(long taskId, long attachmentId) { Task task = persistenceContext.findTask(taskId); Attachment attachment = persistenceContext.removeAttachmentFromTask(task, attachmentId); Content content = persistenceContext.findContent(attachment.getAttachmentContentId()); persistenceContext.removeContent(content); }
public void deleteFault(long taskId, String userId) { Task task = persistenceContext.findTask(taskId); long contentId = task.getTaskData().getFaultContentId(); Content content = persistenceContext.findContent(contentId); FaultData data = TaskModelProvider.getFactory().newFaultData(); persistenceContext.removeContent(content); persistenceContext.setFaultToTask(null, data, task); }
public void deleteOutput(long taskId, String userId) { Task task = persistenceContext.findTask(taskId); long contentId = task.getTaskData().getOutputContentId(); Content content = persistenceContext.findContent(contentId); Map<String, Object> initialContent = new HashMap<>(); ContentMarshallerContext context = TaskContentRegistry.get().getMarshallerContext(task); Object unmarshalledObject = ContentMarshallerHelper.unmarshall(content.getContent(), context.getEnvironment(), context.getClassloader()); if(unmarshalledObject != null && unmarshalledObject instanceof Map){ // set initial content before updating with this params initialContent.putAll((Map<String, Object>)unmarshalledObject); } taskEventSupport.fireBeforeTaskOutputVariablesChanged(task, this.context, initialContent); ContentData data = TaskModelProvider.getFactory().newContentData(); persistenceContext.removeContent(content); persistenceContext.setOutputToTask(null, data, task); taskEventSupport.fireAfterTaskOutputVariablesChanged(task, this.context, null); }