AttachmentEntity attachment = new AttachmentEntity(); attachment.setName(attachmentName); attachment.setDescription(attachmentDescription); attachment.setType(attachmentType); attachment.setTaskId(taskId); attachment.setProcessInstanceId(processInstanceId); attachment.setUrl(url); attachment.setCreateTime(ClockUtil.getCurrentTime()); attachment.setRootProcessInstanceId(execution.getRootProcessInstanceId()); attachment.setRootProcessInstanceId(processInstance.getRootProcessInstanceId()); ByteArrayEntity byteArray = new ByteArrayEntity(bytes, ResourceTypes.HISTORY); byteArray.setRootProcessInstanceId(attachment.getRootProcessInstanceId()); byteArray.setRemovalTime(attachment.getRemovalTime()); attachment.setContentId(byteArray.getId());
public Object execute(CommandContext commandContext) { AttachmentEntity attachment = commandContext .getDbEntityManager() .selectById(AttachmentEntity.class, attachmentId); commandContext .getDbEntityManager() .delete(attachment); if (attachment.getContentId() != null) { commandContext .getByteArrayManager() .deleteByteArrayById(attachment.getContentId()); } if (attachment.getTaskId()!=null) { TaskEntity task = commandContext .getTaskManager() .findTaskById(attachment.getTaskId()); PropertyChange propertyChange = new PropertyChange("name", null, attachment.getName()); commandContext.getOperationLogManager() .logAttachmentOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_ATTACHMENT, task, propertyChange); } return null; }
protected void provideRemovalTime(AttachmentEntity attachment) { String rootProcessInstanceId = attachment.getRootProcessInstanceId(); if (rootProcessInstanceId != null) { HistoricProcessInstanceEventEntity historicRootProcessInstance = getHistoricRootProcessInstance(rootProcessInstanceId); if (historicRootProcessInstance != null) { Date removalTime = historicRootProcessInstance.getRemovalTime(); attachment.setRemovalTime(removalTime); } } }
public Object execute(CommandContext commandContext) { AttachmentEntity updateAttachment = commandContext .getDbEntityManager() .selectById(AttachmentEntity.class, attachment.getId()); updateAttachment.setName(attachment.getName()); updateAttachment.setDescription(attachment.getDescription()); return null; } }
public InputStream execute(CommandContext commandContext) { DbEntityManager dbEntityManger = commandContext.getDbEntityManager(); AttachmentEntity attachment = dbEntityManger.selectById(AttachmentEntity.class, attachmentId); String contentId = attachment.getContentId(); if (contentId==null) { return null; } ByteArrayEntity byteArray = dbEntityManger.selectById(ByteArrayEntity.class, contentId); byte[] bytes = byteArray.getBytes(); return new ByteArrayInputStream(bytes); }
public Void execute(CommandContext commandContext) { commandContext.getDbEntityManager() .selectById(AttachmentEntity.class, attachmentId); // cache monitor.sync(); AttachmentEntity changedAttachmentEntity = new AttachmentEntity(); changedAttachmentEntity.setId(attachmentId); taskService.saveAttachment(changedAttachmentEntity); return null; }
public InputStream execute(CommandContext commandContext) { DbEntityManager dbEntityManger = commandContext.getDbEntityManager(); AttachmentEntity attachment = dbEntityManger.selectById(AttachmentEntity.class, attachmentId); String contentId = attachment.getContentId(); if (contentId==null) { return null; } ByteArrayEntity byteArray = dbEntityManger.selectById(ByteArrayEntity.class, contentId); byte[] bytes = byteArray.getBytes(); return new ByteArrayInputStream(bytes); }
public Object execute(CommandContext commandContext) { AttachmentEntity updateAttachment = commandContext .getDbEntityManager() .selectById(AttachmentEntity.class, attachment.getId()); updateAttachment.setName(attachment.getName()); updateAttachment.setDescription(attachment.getDescription()); return null; } }
protected void provideRemovalTime(AttachmentEntity attachment) { String rootProcessInstanceId = attachment.getRootProcessInstanceId(); if (rootProcessInstanceId != null) { HistoricProcessInstanceEventEntity historicRootProcessInstance = getHistoricRootProcessInstance(rootProcessInstanceId); if (historicRootProcessInstance != null) { Date removalTime = historicRootProcessInstance.getRemovalTime(); attachment.setRemovalTime(removalTime); } } }
public Void execute(CommandContext commandContext) { commandContext.getDbEntityManager() .selectById(AttachmentEntity.class, attachmentId); // cache monitor.sync(); AttachmentEntity changedAttachmentEntity = new AttachmentEntity(); changedAttachmentEntity.setId(attachmentId); taskService.saveAttachment(changedAttachmentEntity); return null; }
AttachmentEntity attachment = new AttachmentEntity(); attachment.setName(attachmentName); attachment.setDescription(attachmentDescription); attachment.setType(attachmentType); attachment.setTaskId(taskId); attachment.setProcessInstanceId(processInstanceId); attachment.setUrl(url); attachment.setCreateTime(ClockUtil.getCurrentTime()); attachment.setRootProcessInstanceId(execution.getRootProcessInstanceId()); attachment.setRootProcessInstanceId(processInstance.getRootProcessInstanceId()); ByteArrayEntity byteArray = new ByteArrayEntity(bytes, ResourceTypes.HISTORY); byteArray.setRootProcessInstanceId(attachment.getRootProcessInstanceId()); byteArray.setRemovalTime(attachment.getRemovalTime()); attachment.setContentId(byteArray.getId());
public Object execute(CommandContext commandContext) { AttachmentEntity attachment = commandContext .getDbEntityManager() .selectById(AttachmentEntity.class, attachmentId); commandContext .getDbEntityManager() .delete(attachment); if (attachment.getContentId() != null) { commandContext .getByteArrayManager() .deleteByteArrayById(attachment.getContentId()); } if (attachment.getTaskId()!=null) { TaskEntity task = commandContext .getTaskManager() .findTaskById(attachment.getTaskId()); PropertyChange propertyChange = new PropertyChange("name", null, attachment.getName()); commandContext.getOperationLogManager() .logAttachmentOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_ATTACHMENT, task, propertyChange); } return null; }
private String findAttachmentContentId(List<Attachment> attachments) { assertEquals(1, attachments.size()); return ((AttachmentEntity) attachments.get(0)).getContentId(); }
public Object execute(CommandContext commandContext) { AttachmentEntity updateAttachment = commandContext .getDbEntityManager() .selectById(AttachmentEntity.class, attachment.getId()); updateAttachment.setName(attachment.getName()); updateAttachment.setDescription(attachment.getDescription()); return null; } }
protected void provideRemovalTime(AttachmentEntity attachment) { String rootProcessInstanceId = attachment.getRootProcessInstanceId(); if (rootProcessInstanceId != null) { HistoricProcessInstanceEventEntity historicRootProcessInstance = getHistoricRootProcessInstance(rootProcessInstanceId); if (historicRootProcessInstance != null) { Date removalTime = historicRootProcessInstance.getRemovalTime(); attachment.setRemovalTime(removalTime); } } }
AttachmentEntity attachment = new AttachmentEntity(); attachment.setName(attachmentName); attachment.setDescription(attachmentDescription); attachment.setType(attachmentType); attachment.setTaskId(taskId); attachment.setProcessInstanceId(processInstanceId); attachment.setUrl(url); attachment.setCreateTime(ClockUtil.getCurrentTime()); attachment.setRootProcessInstanceId(execution.getRootProcessInstanceId()); attachment.setRootProcessInstanceId(processInstance.getRootProcessInstanceId()); ByteArrayEntity byteArray = new ByteArrayEntity(bytes, ResourceTypes.HISTORY); byteArray.setRootProcessInstanceId(attachment.getRootProcessInstanceId()); byteArray.setRemovalTime(attachment.getRemovalTime()); attachment.setContentId(byteArray.getId());
public Object execute(CommandContext commandContext) { AttachmentEntity attachment = (AttachmentEntity) commandContext .getAttachmentManager() .findAttachmentByTaskIdAndAttachmentId(taskId, attachmentId); ensureNotNull("No attachment exist for task id '" + taskId + " and attachmentId '" + attachmentId + "'.", "attachment", attachment); commandContext .getDbEntityManager() .delete(attachment); if (attachment.getContentId() != null) { commandContext .getByteArrayManager() .deleteByteArrayById(attachment.getContentId()); } if (attachment.getTaskId() != null) { TaskEntity task = commandContext .getTaskManager() .findTaskById(attachment.getTaskId()); PropertyChange propertyChange = new PropertyChange("name", null, attachment.getName()); commandContext.getOperationLogManager() .logAttachmentOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_ATTACHMENT, task, propertyChange); } return null; }
public InputStream execute(CommandContext commandContext) { AttachmentEntity attachment = (AttachmentEntity) commandContext .getAttachmentManager() .findAttachmentByTaskIdAndAttachmentId(taskId, attachmentId); if (attachment == null) { return null; } String contentId = attachment.getContentId(); if (contentId==null) { return null; } ByteArrayEntity byteArray = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, contentId); byte[] bytes = byteArray.getBytes(); return new ByteArrayInputStream(bytes); }
public Object execute(CommandContext commandContext) { AttachmentEntity attachment = (AttachmentEntity) commandContext .getAttachmentManager() .findAttachmentByTaskIdAndAttachmentId(taskId, attachmentId); ensureNotNull("No attachment exist for task id '" + taskId + " and attachmentId '" + attachmentId + "'.", "attachment", attachment); commandContext .getDbEntityManager() .delete(attachment); if (attachment.getContentId() != null) { commandContext .getByteArrayManager() .deleteByteArrayById(attachment.getContentId()); } if (attachment.getTaskId() != null) { TaskEntity task = commandContext .getTaskManager() .findTaskById(attachment.getTaskId()); PropertyChange propertyChange = new PropertyChange("name", null, attachment.getName()); commandContext.getOperationLogManager() .logAttachmentOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_ATTACHMENT, task, propertyChange); } return null; }
public InputStream execute(CommandContext commandContext) { AttachmentEntity attachment = (AttachmentEntity) commandContext .getAttachmentManager() .findAttachmentByTaskIdAndAttachmentId(taskId, attachmentId); if (attachment == null) { return null; } String contentId = attachment.getContentId(); if (contentId==null) { return null; } ByteArrayEntity byteArray = commandContext .getDbEntityManager() .selectById(ByteArrayEntity.class, contentId); byte[] bytes = byteArray.getBytes(); return new ByteArrayInputStream(bytes); }