List of usage examples for org.springframework.aop.scope ScopedObject getTargetObject
Object getTargetObject();
From source file:org.activiti.spring.components.scope.ProcessScope.java
public Object get(String name, ObjectFactory<?> objectFactory) { ExecutionEntity executionEntity = null; try {/*w w w .j a v a 2 s .c o m*/ logger.debug("returning scoped object having beanName '{}' for conversation ID '{}'.", name, this.getConversationId()); ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance(); executionEntity = (ExecutionEntity) processInstance; Object scopedObject = executionEntity.getVariable(name); if (scopedObject == null) { scopedObject = objectFactory.getObject(); if (scopedObject instanceof ScopedObject) { ScopedObject sc = (ScopedObject) scopedObject; scopedObject = sc.getTargetObject(); logger.debug("de-referencing {}#targetObject before persisting variable", ScopedObject.class.getName()); } persistVariable(name, scopedObject); } return createDirtyCheckingProxy(name, scopedObject); } catch (Throwable th) { logger.warn("couldn't return value from process scope! {}", ExceptionUtils.getFullStackTrace(th)); } finally { if (executionEntity != null) { logger.debug("set variable '{}' on executionEntity#{}", name, executionEntity.getId()); } } return null; }
From source file:org.camunda.bpm.engine.spring.components.scope.ProcessScope.java
public Object get(String name, ObjectFactory<?> objectFactory) { ExecutionEntity executionEntity = null; try {/*from w w w . j av a 2 s. c o m*/ logger.fine("returning scoped object having beanName '" + name + "' for conversation ID '" + this.getConversationId() + "'. "); ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance(); executionEntity = (ExecutionEntity) processInstance; Object scopedObject = executionEntity.getVariable(name); if (scopedObject == null) { scopedObject = objectFactory.getObject(); if (scopedObject instanceof ScopedObject) { ScopedObject sc = (ScopedObject) scopedObject; scopedObject = sc.getTargetObject(); logger.fine("de-referencing " + ScopedObject.class.getName() + "#targetObject before persisting variable"); } persistVariable(name, scopedObject); } return createDirtyCheckingProxy(name, scopedObject); } catch (Throwable th) { logger.warning("couldn't return value from process scope! " + ExceptionUtils.getFullStackTrace(th)); } finally { if (executionEntity != null) { logger.fine("set variable '" + name + "' on executionEntity# " + executionEntity.getId()); } } return null; }