}
@Override
public void setExecution(Execution execution) {
if(execution == null) {
throw new ProcessEngineCdiException("Cannot associate with execution: null");
}
ensureCommandContextNotActive();
ScopedAssociation scopedAssociation = getScopedAssociation();
Execution associatedExecution = scopedAssociation.getExecution();
if(associatedExecution!=null && !associatedExecution.getId().equals(execution.getId())) {
throw new ProcessEngineCdiException("Cannot associate "+execution+", already associated with "+associatedExecution+". Disassociate first!");
}
if (log.isLoggable(Level.FINE)) {
log.fine("Associating "+execution+" (@"
+ scopedAssociation.getClass().getAnnotations()[0].annotationType().getSimpleName() + ")");