Package org.camunda.bpm.engine.impl.db.entitymanager

Examples of org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager


  public GetAttachmentContentCmd(String attachmentId) {
    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);
    byte[] bytes = byteArray.getBytes();
   
    return new ByteArrayInputStream(bytes);
  }
View Full Code Here


    jobHandler.execute(jobHandlerConfiguration, execution, commandContext);
  }

  public void insert() {
    DbEntityManager dbEntityManger = Context
      .getCommandContext()
      .getDbEntityManager();

    dbEntityManger.insert(this);

    // add link to execution and deployment
    if(executionId != null) {
      ExecutionEntity execution = Context.getCommandContext()
        .getExecutionManager()
View Full Code Here

  public void delete() {
    delete(false);
  }

  public void delete(boolean incidentResolved) {
    DbEntityManager dbEntityManger = Context
        .getCommandContext()
        .getDbEntityManager();

    dbEntityManger.delete(this);

    // Also delete the job's exception byte array
    if (exceptionByteArrayId != null) {
      Context.getCommandContext().getByteArrayManager().deleteByteArrayById(exceptionByteArrayId);
    }
View Full Code Here

    } else if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE.equals(databaseSchemaUpdate)) {
      persistenceSession.dbSchemaUpdate();
    }


    DbEntityManager entityManager = commandContext.getSession(DbEntityManager.class);
    checkHistoryLevel(entityManager);
    checkDeploymentLockExists(entityManager);

    return null;
  }
View Full Code Here

  public void insert(ExecutionEntity execution) {
    ensureParentTaskActive();

    CommandContext commandContext = Context.getCommandContext();
    DbEntityManager dbEntityManger = commandContext.getDbEntityManager();
    dbEntityManger.insert(this);

    if(execution != null) {
      execution.addTask(this);
    }
  }
View Full Code Here

  public void update() {
    registerCommandContextCloseListener();

    CommandContext commandContext = Context.getCommandContext();
    DbEntityManager dbEntityManger = commandContext.getDbEntityManager();
    dbEntityManger.merge(this);
  }
View Full Code Here

    return cachedValue;
  }

  public void delete() {

    DbEntityManager dbEntityManger = Context
        .getCommandContext()
        .getDbEntityManager();

    dbEntityManger.delete(this);

    if (byteArrayId != null) {
      // the next apparently useless line is probably to ensure consistency in the DbSqlSession
      // cache, but should be checked and docced here (or removed if it turns out to be unnecessary)
      // @see also HistoricVariableInstanceEntity
View Full Code Here

    }

    CommandContext commandContext = Context.getCommandContext();
    ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();
    DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
    DbEntityManager dbEntityManager = commandContext.getDbEntityManager();
    for (ProcessDefinitionEntity processDefinition : processDefinitions) {

      if (deployment.isNew()) {
        ProcessDefinitionEntity latestProcessDefinition = processDefinitionManager.findLatestProcessDefinitionByKey(processDefinition.getKey());

        processDefinition.setDeploymentId(deployment.getId());
        processDefinition.setVersion(getVersionForNewProcessDefinition(deployment, processDefinition, latestProcessDefinition));
        processDefinition.setId(getProcessDefinitionId(deployment, processDefinition));

        List<JobDeclaration<?>> declarations = jobDeclarations.get(processDefinition.getKey());
        updateJobDeclarations(declarations, processDefinition, deployment.isNew());
        adjustStartEventSubscriptions(processDefinition, latestProcessDefinition);

        dbEntityManager.insert(processDefinition);
        deploymentCache.addProcessDefinition(processDefinition);
        addAuthorizations(processDefinition);

      } else {
View Full Code Here

    public TestCommand(String id) {
      this.id = id;
    }

    public Void execute(CommandContext commandContext) {
      final DbEntityManager dbEntityManger = commandContext.getDbEntityManager();
      final DbEntityManagerFactory dbEntityManagerFactory = new DbEntityManagerFactory(Context.getProcessEngineConfiguration().getIdGenerator());

      HistoricProcessInstanceEventEntity hpi = new HistoricProcessInstanceEventEntity();
      hpi.setId(id);
      hpi.setProcessInstanceId(id);
      hpi.setProcessDefinitionId("someProcDefId");
      hpi.setStartTime(new Date());

      dbEntityManger.insert(hpi);
      dbEntityManger.flush();

      monitor.sync();

      DbEntityManager dbEntityManager = dbEntityManagerFactory.openSession();
      dbEntityManager.createHistoricProcessInstanceQuery().list();

      monitor.sync();

      return null;
    }
View Full Code Here

  public static void createOrUpdateHistoryLevel(final ProcessEngineConfigurationImpl processEngineConfiguration) {
    processEngineConfiguration.getCommandExecutorTxRequired()
      .execute(new Command<Object>() {
       public Object execute(CommandContext commandContext) {
         DbEntityManager dbEntityManager = commandContext.getDbEntityManager();
         PropertyEntity historyLevelProperty = dbEntityManager.selectById(PropertyEntity.class, "historyLevel");
         if (historyLevelProperty != null) {
           if (processEngineConfiguration.getHistoryLevel().getId() != new Integer(historyLevelProperty.getValue())) {
             historyLevelProperty.setValue(Integer.toString(processEngineConfiguration.getHistoryLevel().getId()));
             dbEntityManager.merge(historyLevelProperty);
           }
         } else {
           SchemaOperationsProcessEngineBuild.dbCreateHistoryLevel(dbEntityManager);
         }
         return null;
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager

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.