本文整理汇总了Java中org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity类的典型用法代码示例。如果您正苦于以下问题:Java VariableInstanceEntity类的具体用法?Java VariableInstanceEntity怎么用?Java VariableInstanceEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VariableInstanceEntity类属于org.camunda.bpm.engine.impl.persistence.entity包,在下文中一共展示了VariableInstanceEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVariableValue
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
private String getVariableValue(VariableInstanceEntity entity){
//TODO - if indexing by objects, byte arrays or long strings is ever required, we can add hashed index.
//This method would have to return hashed value. This will result in some false positives,
//however they will be filtered out when the data is retrieved because we always check that
//the object matches the index when we get data by index. For now just limit indexing to simple cases
String value=null;
if(entity.getLongValue()!=null){
value=entity.getLongValue().toString();
}
if(entity.getDoubleValue()!=null){
value=entity.getDoubleValue().toString();
}
if(entity.getTextValue()!=null){
value=entity.getTextValue();
}
//not bothering with text2
if(value==null){
return null;
}
if(value.length()>LENGTH_LIMIT){
value=value.substring(0, LENGTH_LIMIT);
}
return value;
}
示例2: getValuesByTypedValue
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<String> getValuesByTypedValue(CassandraPersistenceSession cassandraPersistenceSession, String variableName, TypedValue typedValue) {
@SuppressWarnings("rawtypes")
TypedValueSerializer serializer = TypedValueField.getSerializers().findSerializerForValue(typedValue);
if(typedValue instanceof UntypedValueImpl) {
typedValue = serializer.convertToTypedValue((UntypedValueImpl) typedValue);
}
if(typedValue.getType().isPrimitiveValueType() && !(typedValue.getType() instanceof BytesTypeImpl)){
VariableInstanceEntity tempEntity = new VariableInstanceEntity();
serializer.writeValue(typedValue, tempEntity);
return getValues(null,cassandraPersistenceSession, variableName, getVariableValue(tempEntity));
}
return Collections.emptyList();
}
示例3: read
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
public VariableInstanceEntity read(GettableData data) {
VariableInstanceEntity entity = new VariableInstanceEntity();
entity.setId(data.getString("id"));
entity.setSerializerName(data.getString("type"));
entity.setName(data.getString("name"));
entity.setExecutionId(data.getString("execution_id"));
entity.setProcessInstanceId(data.getString("proc_inst_id"));
entity.setCaseExecutionId(data.getString("case_execution_id"));
entity.setCaseInstanceId(data.getString("case_inst_id"));
entity.setTaskId(data.getString("task_id"));
entity.setByteArrayValueId(data.getString("bytearray_id"));
if(!data.isNull("double")){
entity.setDoubleValue(data.getDouble("double"));
}
if(!data.isNull("long")){
entity.setLongValue(data.getLong("long"));
}
entity.setTextValue(data.getString("text"));
entity.setTextValue2(data.getString("text2"));
entity.setSequenceCounter(data.getLong("sequence_counter"));
entity.setConcurrentLocal(data.getBool("is_concurrent_local"));
return entity;
}
示例4: copy
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
public VariableInstanceEntity copy(VariableInstanceEntity data) {
VariableInstanceEntity entity = new VariableInstanceEntity();
entity.setId(data.getId());
entity.setSerializerName(data.getSerializerName());
entity.setName(data.getName());
entity.setExecutionId(data.getExecutionId());
entity.setProcessInstanceId(data.getProcessInstanceId());
entity.setCaseExecutionId(data.getCaseExecutionId());
entity.setCaseInstanceId(data.getCaseInstanceId());
entity.setTaskId(data.getTaskId());
entity.setByteArrayValueId(data.getByteArrayValueId());
entity.setDoubleValue(data.getDoubleValue());
entity.setLongValue(data.getLongValue());
entity.setTextValue(data.getTextValue());
entity.setTextValue2(data.getTextValue2());
entity.setSequenceCounter(data.getSequenceCounter());
entity.setConcurrentLocal(data.isConcurrentLocal());
return entity;
}
示例5: remove
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public void remove() {
super.remove();
for (VariableInstanceEntity variableInstance : variableStore.getVariables()) {
invokeVariableLifecycleListenersDelete(variableInstance, this,
Arrays.<VariableInstanceLifecycleListener<CoreVariableInstance>>asList((VariableInstanceLifecycleListener) VariableInstanceEntityPersistenceListener.INSTANCE));
variableStore.removeVariable(variableInstance.getName());
}
CommandContext commandContext = Context.getCommandContext();
for (CaseSentryPartEntity sentryPart : getCaseSentryParts()) {
commandContext
.getCaseSentryPartManager()
.deleteSentryPart(sentryPart);
}
// finally delete this execution
commandContext
.getCaseExecutionManager()
.deleteCaseExecution(this);
}
示例6: onParseMigratingInstance
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
@Override
public void onParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) {
ExecutionEntity scopeExecution = migratingInstance.resolveRepresentativeExecution();
List<ActivityExecution> concurrentInActiveExecutions =
scopeExecution.findInactiveChildExecutions(getInnerActivity((ActivityImpl) migratingInstance.getSourceScope()));
// variables on ended inner instance executions need not be migrated anywhere
// since they are also not represented in the tree of migrating instances, we remove
// them from the parse context here to avoid a validation exception
for (ActivityExecution execution : concurrentInActiveExecutions) {
for (VariableInstanceEntity variable : ((ExecutionEntity) execution).getVariablesInternal()) {
parseContext.consume(variable);
}
}
}
示例7: onParseMigratingInstance
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
@Override
public void onParseMigratingInstance(MigratingInstanceParseContext parseContext, MigratingActivityInstance migratingInstance) {
ExecutionEntity execution = migratingInstance.resolveRepresentativeExecution();
for (TaskEntity task : execution.getTasks()) {
migratingInstance.addMigratingDependentInstance(new MigratingUserTaskInstance(task, migratingInstance));
parseContext.consume(task);
Collection<VariableInstanceEntity> variables = task.getVariablesInternal();
if (variables != null) {
for (VariableInstanceEntity variable : variables) {
// we don't need to represent task variables in the migrating instance structure because
// they are migrated by the MigratingTaskInstance as well
parseContext.consume(variable);
}
}
}
}
示例8: execute
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
ExecutionEntity execution = commandContext.getExecutionManager()
.findExecutionById(executionId);
// fetch the variable instance but not the value (make sure the byte array is lazily fetched)
VariableInstanceEntity varInstance = (VariableInstanceEntity) execution.getVariableInstanceLocal(varName);
String byteArrayValueId = varInstance.getByteArrayValueId();
assertNotNull("Byte array id is expected to be not null", byteArrayValueId);
CachedDbEntity cachedByteArray = commandContext.getDbEntityManager().getDbEntityCache()
.getCachedEntity(ByteArrayEntity.class, byteArrayValueId);
assertNull("Byte array is expected to be not fetched yet / lazily fetched.", cachedByteArray);
monitor.sync();
// now trigger the fetching of the byte array
Object value = varInstance.getValue();
assertNull("Expecting the value to be null (deleted)", value);
return null;
}
示例9: testCreateAndDeleteVariableInTransaction
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
@Test
public void testCreateAndDeleteVariableInTransaction() throws Exception {
processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<Void>() {
@Override
public Void execute(CommandContext commandContext) {
//create a variable
VariableInstanceEntity variable = VariableInstanceEntity.createAndInsert("aVariable", Variables.byteArrayValue(new byte[0]));
String byteArrayId = variable.getByteArrayValueId();
//delete the variable
variable.delete();
//check if the variable is deleted transient
//-> no insert and delete stmt will be flushed
DbEntityManager dbEntityManager = commandContext.getDbEntityManager();
CachedDbEntity cachedEntity = dbEntityManager.getDbEntityCache().getCachedEntity(ByteArrayEntity.class, byteArrayId);
DbEntityState entityState = cachedEntity.getEntityState();
assertEquals(DbEntityState.DELETED_TRANSIENT, entityState);
return null;
}
});
}
示例10: testNativeQuery
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
public void testNativeQuery() {
String tablePrefix = processEngineConfiguration.getDatabaseTablePrefix();
assertEquals(tablePrefix + "ACT_RU_TASK", managementService.getTableName(Task.class));
assertEquals(tablePrefix + "ACT_RU_TASK", managementService.getTableName(TaskEntity.class));
assertEquals(12, taskService.createNativeTaskQuery().sql("SELECT * FROM " + managementService.getTableName(Task.class)).list().size());
assertEquals(12, taskService.createNativeTaskQuery().sql("SELECT count(*) FROM " + managementService.getTableName(Task.class)).count());
assertEquals(144, taskService.createNativeTaskQuery().sql("SELECT count(*) FROM " + tablePrefix + "ACT_RU_TASK T1, " + tablePrefix + "ACT_RU_TASK T2").count());
// join task and variable instances
assertEquals(1, taskService.createNativeTaskQuery().sql("SELECT count(*) FROM " + managementService.getTableName(Task.class) + " T1, "+managementService.getTableName(VariableInstanceEntity.class)+" V1 WHERE V1.TASK_ID_ = T1.ID_").count());
List<Task> tasks = taskService.createNativeTaskQuery().sql("SELECT T1.* FROM " + managementService.getTableName(Task.class) + " T1, "+managementService.getTableName(VariableInstanceEntity.class)+" V1 WHERE V1.TASK_ID_ = T1.ID_").list();
assertEquals(1, tasks.size());
assertEquals("gonzo_Task", tasks.get(0).getName());
// select with distinct
assertEquals(12, taskService.createNativeTaskQuery().sql("SELECT DISTINCT T1.* FROM " + tablePrefix + "ACT_RU_TASK T1").list().size());
assertEquals(1, taskService.createNativeTaskQuery().sql("SELECT count(*) FROM " + managementService.getTableName(Task.class) + " T WHERE T.NAME_ = 'gonzo_Task'").count());
assertEquals(1, taskService.createNativeTaskQuery().sql("SELECT * FROM " + managementService.getTableName(Task.class) + " T WHERE T.NAME_ = 'gonzo_Task'").list().size());
// use parameters
assertEquals(1, taskService.createNativeTaskQuery().sql("SELECT count(*) FROM " + managementService.getTableName(Task.class) + " T WHERE T.NAME_ = #{taskName}").parameter("taskName", "gonzo_Task").count());
}
示例11: getValue
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
@Override
protected String getValue(VariableInstanceEntity entity) {
if(entity.getProcessInstanceId().equals(entity.getExecutionId())){
return entity.getExecutionId();
}
return null;
}
示例12: reconstructEntityTree
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void reconstructEntityTree(LoadedCompositeEntity compositeEntity) {
ExecutionEntity processInstance = (ExecutionEntity) compositeEntity.getPrimaryEntity();
Map<String, ExecutionEntity> executions = (Map<String, ExecutionEntity>) compositeEntity.getEmbeddedEntities().get(EXECUTIONS);
Map<String, EventSubscriptionEntity> eventSubscriptions = (Map<String, EventSubscriptionEntity>) compositeEntity.getEmbeddedEntities().get(EVENT_SUBSCRIPTIONS);
Map<String, VariableInstanceEntity> variables = (Map<String, VariableInstanceEntity>) compositeEntity.getEmbeddedEntities().get(VARIABLES);
processInstance.restoreProcessInstance(executions.values(),
eventSubscriptions.values(),
variables.values());
}
示例13: insert
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
public void insert(CassandraPersistenceSession session, VariableInstanceEntity entity) {
session.addStatement(createUpdateStatement(session, entity));
for(IndexHandler<VariableInstanceEntity> index:indexHandlers.values()){
session.addStatement(index.getInsertStatement(session,entity));
}
}
示例14: delete
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
public void delete(CassandraPersistenceSession session, VariableInstanceEntity entity) {
session.addStatement(QueryBuilder.delete().mapElt("variables", entity.getId())
.from(ProcessInstanceTableHandler.TABLE_NAME).where(eq("id", entity.getProcessInstanceId())), entity.getProcessInstanceId());
for(IndexHandler<VariableInstanceEntity> index:indexHandlers.values()){
session.addIndexStatement(index.getDeleteStatement(session,getCachedEntity(entity)), entity.getProcessInstanceId());
}
// varValuesCache.remove(entity.getId());
}
示例15: update
import org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity; //导入依赖的package包/类
public void update(CassandraPersistenceSession session, VariableInstanceEntity entity) {
session.addStatement(createUpdateStatement(session, entity), entity.getProcessInstanceId());
VariableInstanceEntity oldEntity = getCachedEntity(entity);
for(IndexHandler<VariableInstanceEntity> index:indexHandlers.values()){
for(Statement st:index.getUpdateStatements(session, entity, oldEntity)){
session.addIndexStatement(st, entity.getProcessInstanceId());
}
}
updateVariableCache(entity);
}