Package org.activiti.engine.impl.persistence.entity

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


    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

 
  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

  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

  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

  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

    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

TOP

Related Classes of org.activiti.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.