Examples of AttachmentEntity


Examples of org.activiti.engine.impl.persistence.entity.AttachmentEntity

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

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

Examples of org.activiti.engine.impl.persistence.entity.AttachmentEntity

    this.url = url;
  }
 
  @Override
  protected Attachment execute(CommandContext commandContext, TaskEntity task) {
    AttachmentEntity attachment = new AttachmentEntity();
    attachment.setName(attachmentName);
    attachment.setDescription(attachmentDescription);
    attachment.setType(attachmentType);
    attachment.setTaskId(taskId);
    attachment.setProcessInstanceId(processInstanceId);
    attachment.setUrl(url);
   
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    dbSqlSession.insert(attachment);
   
    if (content!=null) {
      byte[] bytes = IoUtil.readInputStream(content, attachmentName);
      ByteArrayEntity byteArray = new ByteArrayEntity(bytes);
      dbSqlSession.insert(byteArray);
      attachment.setContentId(byteArray.getId());
    }

    commandContext.getHistoryManager()
     .createAttachmentComment(taskId, processInstanceId, attachmentName, true);
   
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.AttachmentEntity

 
  public Attachment execute(CommandContext commandContext) {

    verifyParameters(commandContext);
   
    AttachmentEntity attachment = new AttachmentEntity();
    attachment.setName(attachmentName);
    attachment.setDescription(attachmentDescription);
    attachment.setType(attachmentType);
    attachment.setTaskId(taskId);
    attachment.setProcessInstanceId(processInstanceId);
    attachment.setUrl(url);
    attachment.setUserId(Authentication.getAuthenticatedUserId());
   
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    dbSqlSession.insert(attachment);
   
    if (content != null) {
      byte[] bytes = IoUtil.readInputStream(content, attachmentName);
      ByteArrayEntity byteArray = ByteArrayEntity.createAndInsert(bytes);
      attachment.setContentId(byteArray.getId());
    }

    commandContext.getHistoryManager()
      .createAttachmentComment(taskId, processInstanceId, attachmentName, true);
   
    if(commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
      // Forced to fetch the process-instance to associate the right process definition
      String processDefinitionId = null;
      if(attachment.getProcessInstanceId() != null) {
        ExecutionEntity process = commandContext.getExecutionEntityManager().findExecutionById(processInstanceId);
        if(process != null) {
          processDefinitionId = process.getProcessDefinitionId();
        }
      }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.AttachmentEntity

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

  public Object execute(CommandContext commandContext) {
    AttachmentEntity updateAttachment = commandContext
      .getDbSqlSession()
      .selectById(AttachmentEntity.class, attachment.getId());
   
    updateAttachment.setName(attachment.getName());
    updateAttachment.setDescription(attachment.getDescription());
   
    if(commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
      // Forced to fetch the process-instance to associate the right process definition
      String processDefinitionId = null;
      String processInstanceId = updateAttachment.getProcessInstanceId();
      if(updateAttachment.getProcessInstanceId() != null) {
        ExecutionEntity process = commandContext.getExecutionEntityManager().findExecutionById(processInstanceId);
        if(process != null) {
          processDefinitionId = process.getProcessDefinitionId();
        }
      }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.AttachmentEntity

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

  public Object execute(CommandContext commandContext) {
    AttachmentEntity attachment = commandContext
      .getDbSqlSession()
      .selectById(AttachmentEntity.class, attachmentId);

    commandContext
      .getDbSqlSession()
      .delete(attachment);
   
    if (attachment.getContentId() != null) {
      commandContext
        .getByteArrayEntityManager()
        .deleteByteArrayById(attachment.getContentId());
    }
   
    if (attachment.getTaskId()!=null) {
      commandContext.getHistoryManager()
        .createAttachmentComment(attachment.getTaskId(), attachment.getProcessInstanceId(), attachment.getName(), false);
    }
   
    if(commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
      // Forced to fetch the process-instance to associate the right process definition
      String processDefinitionId = null;
      String processInstanceId = attachment.getProcessInstanceId();
      if(attachment.getProcessInstanceId() != null) {
        ExecutionEntity process = commandContext.getExecutionEntityManager().findExecutionById(processInstanceId);
        if(process != null) {
          processDefinitionId = process.getProcessDefinitionId();
        }
      }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.AttachmentEntity

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

  public Object execute(CommandContext commandContext) {
    AttachmentEntity attachment = commandContext
      .getDbSqlSession()
      .selectById(AttachmentEntity.class, attachmentId);

    commandContext
      .getDbSqlSession()
      .delete(attachment);
   
    if (attachment.getContentId() != null) {
      commandContext
        .getByteArrayManager()
        .deleteByteArrayById(attachment.getContentId());
    }
   
    if (attachment.getTaskId()!=null) {
      commandContext.getHistoryManager()
        .createAttachmentComment(attachment.getTaskId(), attachment.getProcessInstanceId(), attachment.getName(), false);
    }

    return null;
  }
View Full Code Here

Examples of org.activiti.engine.impl.persistence.entity.AttachmentEntity

    this.attachmentId = attachmentId;
  }

  public InputStream execute(CommandContext commandContext) {
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    AttachmentEntity attachment = dbSqlSession.selectById(AttachmentEntity.class, attachmentId);
   
    String contentId = attachment.getContentId();
    if (contentId==null) {
      return null;
    }
   
    ByteArrayEntity byteArray = dbSqlSession.selectById(ByteArrayEntity.class, contentId);
View Full Code Here

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

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

    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

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

    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
TOP
Copyright © 2018 www.massapi.com. 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.