return ret;
}
public VariableInfoDocument setVariable(final String scopeId, final String varName, final XmlObject value) throws ManagementException {
VariableInfoDocument ret = VariableInfoDocument.Factory.newInstance();
final TVariableInfo vinf = ret.addNewVariableInfo();
final TVariableRef sref = vinf.addNewSelf();
dbexec(new BpelDatabase.Callable<Object>() {
public Object run(BpelDAOConnection session) throws Exception {
ScopeDAO scope = session.getScope(new Long(scopeId));
if (scope == null) {
throw new InvalidRequestException("ScopeNotFound:" + scopeId);
}
sref.setSiid(scopeId);
sref.setIid(scope.getProcessInstance().getInstanceId().toString());
sref.setName(varName);
XmlDataDAO var = scope.getVariable(varName);
if (var == null) {
throw new InvalidRequestException("VarNotFound:" + varName);
}
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
value.save(out, new XmlOptions().setSaveOuter());
Node value2 = DOMUtils.getFirstChildElement(DOMUtils.stringToDOM(out.toString()));
var.set(value2);
}
Node nval = var.get();
if (nval != null) {
TVariableInfo.Value val = vinf.addNewValue();
val.getDomNode().appendChild(val.getDomNode().getOwnerDocument().importNode(nval, true));
}
return null;
}
});