本文整理汇总了Java中org.activiti.engine.impl.db.DbSqlSession.insert方法的典型用法代码示例。如果您正苦于以下问题:Java DbSqlSession.insert方法的具体用法?Java DbSqlSession.insert怎么用?Java DbSqlSession.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.db.DbSqlSession
的用法示例。
在下文中一共展示了DbSqlSession.insert方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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));
}
}
示例2: 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;
}
示例3: 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;
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: execute
import org.activiti.engine.impl.db.DbSqlSession; //导入方法依赖的package包/类
public Object execute(CommandContext commandContext) {
if(taskId == null) {
throw new ActivitiException("taskId is null");
}
TaskEntity task = Context
.getCommandContext()
.getTaskManager()
.findTaskById(taskId);
if (task == null) {
throw new ActivitiException("Cannot find task with id " + taskId);
}
int historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
ExecutionEntity execution = task.getExecution();
if (historyLevel>=ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT && execution != null) {
DbSqlSession dbSqlSession = commandContext.getSession(DbSqlSession.class);
for (String propertyId: properties.keySet()) {
String propertyValue = properties.get(propertyId);
HistoricFormPropertyEntity historicFormProperty = new HistoricFormPropertyEntity(execution, propertyId, propertyValue, taskId);
dbSqlSession.insert(historicFormProperty);
}
}
TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();
taskFormHandler.submitFormProperties(properties, task.getExecution());
task.complete();
return null;
}
示例7: execute
import org.activiti.engine.impl.db.DbSqlSession; //导入方法依赖的package包/类
public ProcessInstance execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiException("No process definition found for id = '" + processDefinitionId + "'");
}
ExecutionEntity processInstance = null;
if (businessKey != null) {
processInstance = processDefinition.createProcessInstance(businessKey);
} else {
processInstance = processDefinition.createProcessInstance();
}
int historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
if (historyLevel>=ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
DbSqlSession dbSqlSession = commandContext.getSession(DbSqlSession.class);
if (historyLevel>=ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
for (String propertyId: properties.keySet()) {
String propertyValue = properties.get(propertyId);
HistoricFormPropertyEntity historicFormProperty = new HistoricFormPropertyEntity(processInstance, propertyId, propertyValue);
dbSqlSession.insert(historicFormProperty);
}
}
}
StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
startFormHandler.submitFormProperties(properties, processInstance);
processInstance.start();
return processInstance;
}
示例8: execute
import org.activiti.engine.impl.db.DbSqlSession; //导入方法依赖的package包/类
public Attachment execute(CommandContext 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 = new ByteArrayEntity(bytes);
dbSqlSession.insert(byteArray);
attachment.setContentId(byteArray.getId());
}
CommentManager commentManager = commandContext.getCommentManager();
if (commentManager.isHistoryEnabled()) {
String userId = Authentication.getAuthenticatedUserId();
CommentEntity comment = new CommentEntity();
comment.setUserId(userId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(ClockUtil.getCurrentTime());
comment.setTaskId(taskId);
comment.setProcessInstanceId(processInstanceId);
comment.setAction(Event.ACTION_ADD_ATTACHMENT);
comment.setMessage(attachmentName);
commentManager.insert(comment);
}
return attachment;
}
示例9: 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);
if(execution != null) {
execution.addTask(this);
}
commandContext.getHistoryManager().recordTaskCreated(this, execution);
}
示例10: execute
import org.activiti.engine.impl.db.DbSqlSession; //导入方法依赖的package包/类
@Override
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());
attachment.setTime(commandContext.getProcessEngineConfiguration().getClock().getCurrentTime());
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());
attachment.setContent(byteArray);
}
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();
}
}
commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_CREATED, attachment, processInstanceId, processInstanceId, processDefinitionId));
commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_INITIALIZED, attachment, processInstanceId, processInstanceId, processDefinitionId));
}
return attachment;
}
示例11: execute
import org.activiti.engine.impl.db.DbSqlSession; //导入方法依赖的package包/类
public void execute(DbSqlSession dbSqlSession) throws Exception {
int historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
PropertyEntity property = new PropertyEntity("historyLevel", Integer.toString(historyLevel));
dbSqlSession.insert(property);
}