当前位置: 首页>>代码示例>>Java>>正文


Java DbSqlSession类代码示例

本文整理汇总了Java中org.activiti.engine.impl.db.DbSqlSession的典型用法代码示例。如果您正苦于以下问题:Java DbSqlSession类的具体用法?Java DbSqlSession怎么用?Java DbSqlSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DbSqlSession类属于org.activiti.engine.impl.db包,在下文中一共展示了DbSqlSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMetaData

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void testMetaData() {
    ProcessEngineConfigurationImpl activiti5ProcessEngineConfig = (ProcessEngineConfigurationImpl) processEngineConfiguration.getFlowable5CompatibilityHandler().getRawProcessConfiguration();
    activiti5ProcessEngineConfig.getCommandExecutor().execute(new Command<Object>() {
        public Object execute(CommandContext commandContext) {
            // PRINT THE TABLE NAMES TO CHECK IF WE CAN USE METADATA INSTEAD
            // THIS IS INTENDED FOR TEST THAT SHOULD RUN ON OUR QA INFRASTRUCTURE TO SEE IF METADATA
            // CAN BE USED INSTEAD OF PERFORMING A QUERY THAT MIGHT FAIL
            try {
                SqlSession sqlSession = commandContext.getSession(DbSqlSession.class).getSqlSession();
                ResultSet tables = sqlSession.getConnection().getMetaData().getTables(null, null, null, null);
                while (tables.next()) {
                    ResultSetMetaData resultSetMetaData = tables.getMetaData();
                    int columnCount = resultSetMetaData.getColumnCount();
                    for (int i = 1; i <= columnCount; i++) {
                        LOGGER.info("result set column {}|{}|{}|{}", i, resultSetMetaData.getColumnName(i), resultSetMetaData.getColumnLabel(i), tables.getString(i));
                    }
                    LOGGER.info("-------------------------------------------------------");
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }
    });
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:26,代码来源:MetaDataTest.java

示例2: insert

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void insert(ExecutionEntity execution, boolean fireEvents) {
    CommandContext commandContext = Context.getCommandContext();
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    dbSqlSession.insert(this);

    // Inherit tenant id (if applicable)
    if (execution != null && execution.getTenantId() != null) {
        setTenantId(execution.getTenantId());
    }

    if (execution != null) {
        execution.addTask(this);
    }

    commandContext.getHistoryManager().recordTaskCreated(this, execution);

    if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled() && fireEvents) {
        commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_CREATED, this));
        commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_INITIALIZED, this));
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:TaskEntity.java

示例3: update

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void update() {
    // Needed to make history work: the setter will also update the historic task
    setOwner(this.getOwner());
    setAssignee(this.getAssignee(), true, false);
    setDelegationState(this.getDelegationState());
    setName(this.getName());
    setDescription(this.getDescription());
    setPriority(this.getPriority());
    setCategory(this.getCategory());
    setCreateTime(this.getCreateTime());
    setDueDate(this.getDueDate());
    setParentTaskId(this.getParentTaskId());
    setFormKey(formKey);

    CommandContext commandContext = Context.getCommandContext();
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    dbSqlSession.update(this);

    if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
        commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, this));
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:TaskEntity.java

示例4: deleteHistoricDetail

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void deleteHistoricDetail(HistoricDetailEntity historicDetail) {
  if (historicDetail instanceof HistoricVariableUpdateEntity) {
    HistoricVariableUpdateEntity historicVariableUpdate = (HistoricVariableUpdateEntity) historicDetail;
    String byteArrayValueId = historicVariableUpdate.getByteArrayValueId();
    if (byteArrayValueId != 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
      historicVariableUpdate.getByteArrayValue();
      Context
        .getCommandContext()
        .getSession(DbSqlSession.class)
        .delete(ByteArrayEntity.class, byteArrayValueId);
    }
  }
  getDbSqlSession().delete(HistoricDetailEntity.class, historicDetail.getId());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:HistoricDetailManager.java

示例5: delete

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void delete() {
  // delete variable
  DbSqlSession dbSqlSession = Context
    .getCommandContext()
    .getDbSqlSession();
  
  dbSqlSession.delete(VariableInstanceEntity.class, id);

  if (byteArrayValueId != 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 HistoricVariableUpdateEntity
    getByteArrayValue();
    dbSqlSession.delete(ByteArrayEntity.class, byteArrayValueId);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:17,代码来源:VariableInstanceEntity.java

示例6: createSubProcessInstance

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public PvmProcessInstance createSubProcessInstance(PvmProcessDefinition processDefinition) {
  ExecutionEntity subProcessInstance = newExecution();
  
  // manage bidirectional super-subprocess relation
  subProcessInstance.setSuperExecution(this);
  this.setSubProcessInstance(subProcessInstance);
  
  // Initialize the new execution
  subProcessInstance.setProcessDefinition((ProcessDefinitionImpl) processDefinition);
  subProcessInstance.setProcessInstance(subProcessInstance);
  
  CommandContext commandContext = Context.getCommandContext();
  int historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
  if (historyLevel>=ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
    DbSqlSession dbSqlSession = commandContext.getSession(DbSqlSession.class);
    HistoricProcessInstanceEntity historicProcessInstance = new HistoricProcessInstanceEntity((ExecutionEntity) subProcessInstance);
    dbSqlSession.insert(historicProcessInstance);
  }

  return subProcessInstance;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:ExecutionEntity.java

示例7: notify

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void notify(DelegateExecution execution) throws Exception {
  String executionId = execution.getId();
  String activityId = ((ExecutionEntity)execution).getActivityId();

  CommandContext commandContext = Context.getCommandContext();
  // search for the historic activity instance in the dbsqlsession cache
  DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
  List<HistoricActivityInstanceEntity> cachedHistoricActivityInstances = dbSqlSession.findInCache(HistoricActivityInstanceEntity.class);
  for (HistoricActivityInstanceEntity cachedHistoricActivityInstance: cachedHistoricActivityInstances) {
    if ( executionId.equals(cachedHistoricActivityInstance.getExecutionId())
         && (activityId.equals(cachedHistoricActivityInstance.getActivityId()))
         && (cachedHistoricActivityInstance.getEndTime()==null)
       ) {
      cachedHistoricActivityInstance.markEnded(null);
      return;
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:StartEventEndHandler.java

示例8: notify

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void notify(DelegateExecution execution) throws Exception {
  String executionId = execution.getId();
  String activityId = ((ExecutionEntity)execution).getActivityId();
  
  // interrupted executions might not have an activityId set.
  if(activityId == null) {
    return;
  }

  CommandContext commandContext = Context.getCommandContext();
  // search for the historic activity instance in the dbsqlsession cache
  DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
  List<HistoricActivityInstanceEntity> cachedHistoricActivityInstances = dbSqlSession.findInCache(HistoricActivityInstanceEntity.class);
  for (HistoricActivityInstanceEntity cachedHistoricActivityInstance: cachedHistoricActivityInstances) {
    if ( executionId.equals(cachedHistoricActivityInstance.getExecutionId())
         && (activityId.equals(cachedHistoricActivityInstance.getActivityId()))
         && (cachedHistoricActivityInstance.getEndTime()==null)
       ) {
      cachedHistoricActivityInstance.markEnded(null);
      return;
    }
  }
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:24,代码来源:StartEventEndHandler.java

示例9: update

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void update() {
  // Needed to make history work: the setter will also update the historic task
  setOwner(this.getOwner());
  setAssignee(this.getAssignee());
  setDelegationState(this.getDelegationState());
  setName(this.getName());
  setDescription(this.getDescription());
  setPriority(this.getPriority());
  setCreateTime(this.getCreateTime());
  setDueDate(this.getDueDate());
  setParentTaskId(this.getParentTaskId());
  
  CommandContext commandContext = Context.getCommandContext();
  DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
  dbSqlSession.update(this);
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:17,代码来源:TaskEntity.java

示例10: execute

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
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);
    
    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);
    
    return attachment;
  }
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:27,代码来源:CreateAttachmentCmd.java

示例11: updateModel

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void updateModel(ModelEntity updatedModel) {
    CommandContext commandContext = Context.getCommandContext();
    updatedModel.setLastUpdateTime(Context.getProcessEngineConfiguration().getClock().getCurrentTime());
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    dbSqlSession.update(updatedModel);

    if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
        Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, updatedModel));
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:ModelEntityManager.java

示例12: delete

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void delete() {
    DbSqlSession dbSqlSession = Context
            .getCommandContext()
            .getDbSqlSession();

    dbSqlSession.delete(this);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:8,代码来源:HistoricDetailEntity.java

示例13: updateProcessDefinitionInfo

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void updateProcessDefinitionInfo(ProcessDefinitionInfoEntity updatedProcessDefinitionInfo) {
    CommandContext commandContext = Context.getCommandContext();
    DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
    dbSqlSession.update(updatedProcessDefinitionInfo);

    if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
        Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, updatedProcessDefinitionInfo));
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:11,代码来源:ProcessDefinitionInfoEntityManager.java

示例14: execute

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
@Override
public void execute(DbSqlSession dbSqlSession) throws Exception {
    // As of 5.11, the history-setting is no longer stored in the database, so inserting it in this upgrade and removing
    // in in a 5.10->5.11 upgrade is useless...

    // int historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
    // PropertyEntity property = new PropertyEntity("historyLevel", Integer.toString(historyLevel));
    // dbSqlSession.insert(property);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:10,代码来源:DbUpgradeStep52To53InsertPropertyHistoryLevel.java

示例15: execute

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
@Override
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);
    byte[] bytes = byteArray.getBytes();

    return new ByteArrayInputStream(bytes);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:16,代码来源:GetAttachmentContentCmd.java


注:本文中的org.activiti.engine.impl.db.DbSqlSession类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。