本文整理汇总了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;
}
});
}
示例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));
}
}
示例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));
}
}
示例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());
}
示例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);
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
示例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;
}
示例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));
}
}
示例12: delete
import org.activiti.engine.impl.db.DbSqlSession; //导入依赖的package包/类
public void delete() {
DbSqlSession dbSqlSession = Context
.getCommandContext()
.getDbSqlSession();
dbSqlSession.delete(this);
}
示例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));
}
}
示例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);
}
示例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);
}