Package org.camunda.bpm.engine.impl.persistence.entity

Examples of org.camunda.bpm.engine.impl.persistence.entity.AttachmentEntity


  public DeleteAttachmentCmd(String attachmentId) {
    this.attachmentId = attachmentId;
  }

  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);
    }
View Full Code Here


    this.attachmentId = attachmentId;
  }

  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);
View Full Code Here

    this.attachmentId = attachmentId;
    this.taskId = taskId;
  }

  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
View Full Code Here

    task = commandContext
      .getTaskManager()
      .findTaskById(taskId);

    AttachmentEntity attachment = new AttachmentEntity();
    attachment.setName(attachmentName);
    attachment.setDescription(attachmentDescription);
    attachment.setType(attachmentType);
    attachment.setTaskId(taskId);
    attachment.setProcessInstanceId(processInstanceId);
    attachment.setUrl(url);

    DbEntityManager dbEntityManger = commandContext.getDbEntityManager();
    dbEntityManger.insert(attachment);

    if (content != null) {
      byte[] bytes = IoUtil.readInputStream(content, attachmentName);
      ByteArrayEntity byteArray = new ByteArrayEntity(bytes);
      dbEntityManger.insert(byteArray);
      attachment.setContentId(byteArray.getId());
    }

    PropertyChange propertyChange = new PropertyChange("name", null, attachmentName);

    commandContext.getOperationLogManager()
View Full Code Here

    this.attachmentId = attachmentId;
    this.taskId = taskId;
  }

  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);
    }
View Full Code Here

  public SaveAttachmentCmd(Attachment attachment) {
    this.attachment = attachment;
  }

  public Object execute(CommandContext commandContext) {
    AttachmentEntity updateAttachment = commandContext
      .getDbEntityManager()
      .selectById(AttachmentEntity.class, attachment.getId());
   
    updateAttachment.setName(attachment.getName());
    updateAttachment.setDescription(attachment.getDescription());
   
    return null;
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.impl.persistence.entity.AttachmentEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.