• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DbSqlSession类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: insert

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void insert(ExecutionEntity execution) {
  CommandContext commandContext = Context.getCommandContext();
  DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
  dbSqlSession.insert(this);
  
  int historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
  if (historyLevel>=ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    HistoricTaskInstanceEntity historicTaskInstance = new HistoricTaskInstanceEntity(this, execution);
    dbSqlSession.insert(historicTaskInstance);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:12,代码来源:TaskEntity.java


示例17: delete

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

  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
    getByteArrayValue();
    Context
      .getCommandContext()
      .getSession(DbSqlSession.class)
      .delete(ByteArrayEntity.class, byteArrayValueId);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:15,代码来源:HistoricVariableUpdateEntity.java


示例18: delete

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

  dbSqlSession.delete(HistoricDetailEntity.class, id);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:8,代码来源:HistoricDetailEntity.java


示例19: delete

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

  dbSqlSession.delete(JobEntity.class, id);

  // Also delete the job's exception byte array
  if (exceptionByteArrayId != null) {
    dbSqlSession.delete(ByteArrayEntity.class, exceptionByteArrayId);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:13,代码来源:JobEntity.java


示例20: createTask

import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void createTask(CommandContext commandContext, DbSqlSession dbSqlSession, MailTransformer mailTransformer) throws MessagingException {
  // distill the task description from the mail body content (without the html tags)
  String taskDescription = mailTransformer.getHtml();
  taskDescription = taskDescription.replaceAll("\\<.*?\\>", "");
  taskDescription = taskDescription.replaceAll("\\s", " ");
  taskDescription = taskDescription.trim();
  if (taskDescription.length()>120) {
    taskDescription = taskDescription.substring(0, 117)+"...";
  }

  // create and insert the task
  TaskEntity task = new TaskEntity();
  task.setAssignee(userId);
  task.setName(mailTransformer.getMessage().getSubject());
  task.setDescription(taskDescription);
  dbSqlSession.insert(task);
  String taskId = task.getId();
  
  // add identity links for all the recipients
  for (String recipientEmailAddress: mailTransformer.getRecipients()) {
    User recipient = new UserQueryImpl(commandContext)
      .userEmail(recipientEmailAddress)
      .singleResult();
    if (recipient!=null) {
      task.addUserIdentityLink(recipient.getId(), "Recipient");
    }
  }
  
  // attach the mail and other attachments to the task
  List<AttachmentEntity> attachments = mailTransformer.getAttachments();
  for (AttachmentEntity attachment: attachments) {
    // insert the bytes as content
    ByteArrayEntity content = attachment.getContent();
    dbSqlSession.insert(content);
    // insert the attachment
    attachment.setContentId(content.getId());
    attachment.setTaskId(taskId);
    dbSqlSession.insert(attachment);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:41,代码来源:MailScanCmd.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LabelLayer类代码示例发布时间:2022-05-22
下一篇:
Java SqlUpdate类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap