Strange error when trying to processAPI.startProcess(processId, operations, null);

Hi there,

I’m getting a strange error in trying to do a processAPI.startProcess(processId, operations, null);

It’s telling me there is an exception but the error message doesn’t exist in javadoc (startProcess)

Basically what I’m trying to do is start a process (B) and set the variable “user” to string “Sean”.

Can anyone help?

Many thanks in advance,
regards
Seán

SEVERE: startTheNextProcess: before operation:
2014-11-18 13:10:37 org.bonitasoft
SEVERE: startTheNextProcess: Exception e9: java.lang.UnsupportedOperationException
2014-11-18 13:10:37 org.bonitasoft
SEVERE: startTheNextProcess: after operations.add:
2014-11-18 13:10:37 org.bonitasoft
SEVERE: startTheNextProcess: after operation:

import java.util.ArrayList;

import org.bonitasoft.engine.expression.Expression;
import org.bonitasoft.engine.expression.ExpressionBuilder;
import org.bonitasoft.engine.expression.ExpressionType;

import org.bonitasoft.engine.operation.LeftOperandBuilder;
import org.bonitasoft.engine.operation.LeftOperand;
import org.bonitasoft.engine.operation.OperationBuilder;
import org.bonitasoft.engine.operation.Operation;
import org.bonitasoft.engine.operation.OperatorType;

and other code

				logger.severe(thisTrace+"before operation: ");
				try{
					Expression dataValue = new ExpressionBuilder().createConstantStringExpression("Sean");
					Operation stringOperationUser = new OperationBuilder().createNewInstance()
						.setLeftOperand(new LeftOperandBuilder().createNewInstance().setName("user").setExternal(true).done()).setType(OperatorType.ASSIGNMENT)
						.setOperator("=").setRightOperand(dataValue).done();

						try{
							List<Operation> operations = new ArrayList<Operation>();
							operations.add(stringOperationUser);

							try{
								ProcessInstance processInstance = processAPI.startProcess(processId, operations, null); //v01.01
								logger.severe(thisTrace+"after processInstance = processAPI.startProcess(processId, operations, null);: "+processInstance);
							}
							catch(Exception e9){
								logger.severe(thisTrace+"Exception e9: "+e9.toString());
							}

						}
						catch(Exception e11){
							logger.severe(thisTrace+"Exception e11: "+e11.toString());
						}
						logger.severe(thisTrace+"after operations.add: ");

				}
				catch(Exception e10){
					logger.severe(thisTrace+"Exception e10: "+e10.toString());
				}
				logger.severe(thisTrace+"after operation: ");

I’m not very familiar with operation so I would not be able to help on this topic.

Anyway, to instantiate a process with setting some variables, I would recommend to use the following version of startProcess method that is much more simpler to use: http://documentation.bonitasoft.com/javadoc/api/6.3/org/bonitasoft/engine/api/ProcessRuntimeAPI.html#startProcess(long, java.util.Map)

Many thanks that worked, regards
Seán