.getVariable());
final VariableInstance rval = _scopeFrame
.resolve(((VariableRef) ocopy.from).getVariable());
Element lvalue = (Element) fetchVariableData(rval, false);
initializeVariable(lval, lvalue);
se = new VariableModificationEvent(lval.declaration.name);
((VariableModificationEvent)se).setNewValue(lvalue);
} else {
// This really should have been cought by the compiler.
__log
.fatal("Message/Non-Message Assignment, should be caught by compiler:"
+ ocopy);
throw new FaultException(
ocopy.getOwner().constants.qnSelectionFailure,
"Message/Non-Message Assignment: " + ocopy);
}
} else {
// Conventional Assignment logic.
Node rvalue = evalRValue(ocopy.from);
Node lvalue = evalLValue(ocopy.to);
if (__log.isDebugEnabled()) {
__log.debug("lvalue after eval " + lvalue);
if (lvalue != null) __log.debug("content " + DOMUtils.domToString(lvalue));
}
// Get a pointer within the lvalue.
Node lvaluePtr = lvalue;
if (ocopy.to instanceof OAssign.DirectRef) {
DirectRef dref = ((DirectRef) ocopy.to);
Element el = DOMUtils.findChildByName((Element)lvalue, dref.elName);
if (el == null) {
el = (Element) ((Element)lvalue).appendChild(lvalue.getOwnerDocument()
.createElementNS(dref.elName.getNamespaceURI(), dref.elName.getLocalPart()));
}
lvaluePtr = el;
} else if (ocopy.to instanceof OAssign.VariableRef) {
VariableRef varRef = ((VariableRef) ocopy.to);
lvaluePtr = evalQuery(
lvalue,
varRef.part,
varRef.location,
new EvaluationContextProxy(varRef.getVariable(), lvalue));
} else if (ocopy.to instanceof OAssign.PropertyRef) {
PropertyRef propRef = ((PropertyRef) ocopy.to);
lvaluePtr = evalQuery(lvalue, propRef.propertyAlias.part,
propRef.propertyAlias.location,
new EvaluationContextProxy(propRef.getVariable(),
lvalue));
} else if (ocopy.to instanceof OAssign.LValueExpression) {
LValueExpression lexpr = (LValueExpression) ocopy.to;
lvaluePtr = evalQuery(lvalue, null, lexpr.expression,
new EvaluationContextProxy(lexpr.getVariable(), lvalue));
if (__log.isDebugEnabled())
__log.debug("lvaluePtr expr res " + lvaluePtr);
}
// For partner link assignmenent, the whole content is assigned.
if (ocopy.to instanceof OAssign.PartnerLinkRef) {
OAssign.PartnerLinkRef pLinkRef = ((OAssign.PartnerLinkRef) ocopy.to);
PartnerLinkInstance plval = _scopeFrame
.resolve(pLinkRef.partnerLink);
replaceEndpointRefence(plval, rvalue);
se = new PartnerLinkModificationEvent(((OAssign.PartnerLinkRef) ocopy.to).partnerLink.getName());
} else {
// Sneakily converting the EPR if it's not the format expected by the lvalue
if (ocopy.from instanceof OAssign.PartnerLinkRef) {
rvalue = getBpelRuntimeContext().convertEndpointReference((Element)rvalue, lvaluePtr);
if (rvalue.getNodeType() == Node.DOCUMENT_NODE)
rvalue = ((Document)rvalue).getDocumentElement();
}
if (rvalue.getNodeType() == Node.ELEMENT_NODE
&& lvaluePtr.getNodeType() == Node.ELEMENT_NODE) {
lvalue = replaceElement((Element)lvalue, (Element) lvaluePtr, (Element) rvalue,
ocopy.keepSrcElementName);
} else {
lvalue = replaceContent(lvalue, lvaluePtr, rvalue
.getTextContent());
}
final VariableInstance lval = _scopeFrame.resolve(ocopy.to.getVariable());
if (__log.isDebugEnabled())
__log.debug("ASSIGN Writing variable '" + lval.declaration.name +
"' value '" + DOMUtils.domToString(lvalue) +"'");
commitChanges(lval, lvalue);
se = new VariableModificationEvent(lval.declaration.name);
((VariableModificationEvent)se).setNewValue(lvalue);
}
}
if (ocopy.debugInfo != null)