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; }
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; }
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 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 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; }
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; }