}
private void changeProcessDefinitionImpl(String instanceId, Object definition) throws RemoteException{
try{
ProcessInstance instance = getInstance(instanceId);
ProcessDefinition processDefinition = null;
if(definition instanceof String){
ByteArrayInputStream is = new ByteArrayInputStream(((String)definition).getBytes("UTF-8"));
processDefinition = (ProcessDefinition) ProcessDefinitionFactory.getActivity(is);
}else{
processDefinition = (ProcessDefinition)definition;
}
if(processDefinition==instance.getProcessDefinition())
throw new UEngineException("Dynamic change exception: Changed definition is the original one so it can't be changed. That means your code didn't clone the definition for changing it. Also It implies the damage of cached definition.");
instance.setProcessDefinition(processDefinition);
}catch(Exception e){
throw new RemoteException("ProcessManagerError:"+e.getMessage(), e);
}
}