2017-03-31 10:50:25.683 +0200 SEVERE: org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork THREAD_ID=3042 | HOSTNAME=ASWFILESTORE | TENANT_ID=1 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException : "PROCESS_DEFINITION_ID=8069098858181670315 | PROCESS_NAME=Attività Pre-Apertura | PROCESS_VERSION=2.0 | PROCESS_INSTANCE_ID=3061 | ROOT_PROCESS_INSTANCE_ID=3060 | FLOW_NODE_DEFINITION_ID=7989273653481810811 | FLOW_NODE_INSTANCE_ID=60105 | FLOW_NODE_NAME=Contrattazione locali | CONNECTOR_IMPLEMENTATION_CLASS_NAME=Email | CONNECTOR_INSTANCE_ID=20002 | Groovy script throws an exception of type class org.bonitasoft.engine.identity.UserNotFoundException with message = org.bonitasoft.engine.identity.SUserNotFoundException:
Expression : SExpressionImpl [name=to(), content=import org.bonitasoft.engine.api.ProcessRuntimeAPI;
import java.util.logging.Logger;
import java.lang.StringBuilder;
import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.identity.ContactData;
int dI = 0;
boolean debug = true;
StringBuilder logWrite = new StringBuilder();
Logger logger = Logger.getLogger(“org.bonitasoft”);
ProcessRuntimeAPI processRuntimeAPI = apiAccessor.getProcessAPI();
logWrite.append(“\n\n”);
//set the name of the routine
logWrite.append("Process Name: "+ processRuntimeAPI.getProcessInstance(processInstanceId).getName());
logWrite.append(“\n\t” + dI++ + “Trace Start”);
//TODO - Code goes in here - START
String bonUser = “walter.bates”;
String toEmails = “”;
def identityAPI = apiAccessor.getIdentityAPI();
def theUser = apiAccessor.getIdentityAPI().getUserByUserName(bonUser.toLowerCase());
if(theUser!=null){
logWrite.append(“\n\t” + dI++ + “contact found”);
// To have professional email
ContactData professionalData = identityAPI.getUserContactData(theUser.getId(), false);
String professionalEmail = professionalData.getEmail();
if (professionalEmail != null && !professionalEmail.isEmpty()) {
logWrite.append(“\n\t” + dI++ + "professionalEmail: "+professionalEmail);
toEmails = professionalEmail;
logWrite.append(“\n\t” + dI++ + toEmails);
}
else{
logWrite.append(“\n\t” + dI++ + “contact NOT found”);
return “contact NOT found”;
}
}
logWrite.append(“\n\t” + dI++ + “Trace End”);
logWrite.append(“\n\n”);
if(debug){logger.severe(logWrite.toString())}
return toEmails;, returnType=java.lang.String, dependencies=[SExpressionImpl [name=processInstanceId, content=processInstanceId, returnType=java.lang.Long, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_ENGINE_CONSTANT]], SExpressionImpl [name=apiAccessor, content=apiAccessor, returnType=org.bonitasoft.engine.api.APIAccessor, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_ENGINE_CONSTANT]]], expressionKind=ExpressionKind [interpreter=GROOVY, type=TYPE_READ_ONLY_SCRIPT]]"
org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: PROCESS_DEFINITION_ID=8069098858181670315 | PROCESS_NAME=Attività Pre-Apertura | PROCESS_VERSION=2.0 | PROCESS_INSTANCE_ID=3061 | ROOT_PROCESS_INSTANCE_ID=3060 | FLOW_NODE_DEFINITION_ID=7989273653481810811 | FLOW_NODE_INSTANCE_ID=60105 | FLOW_NODE_NAME=Contrattazione locali | CONNECTOR_IMPLEMENTATION_CLASS_NAME=Email | CONNECTOR_INSTANCE_ID=20002 | Groovy script throws an exception of type class org.bonitasoft.engine.identity.UserNotFoundException with message = org.bonitasoft.engine.identity.SUserNotFoundException:
Expression : SExpressionImpl [name=to(), content=import org.bonitasoft.engine.api.ProcessRuntimeAPI;
import java.util.logging.Logger;
import java.lang.StringBuilder;
import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.identity.ContactData;
int dI = 0;
boolean debug = true;
StringBuilder logWrite = new StringBuilder();
Logger logger = Logger.getLogger(“org.bonitasoft”);
ProcessRuntimeAPI processRuntimeAPI = apiAccessor.getProcessAPI();
logWrite.append(“\n\n”);
//set the name of the routine
logWrite.append("Process Name: "+ processRuntimeAPI.getProcessInstance(processInstanceId).getName());
logWrite.append(“\n\t” + dI++ + “Trace Start”);
//TODO - Code goes in here - START
String bonUser = “walter.bates”;
String toEmails = “”;
def identityAPI = apiAccessor.getIdentityAPI();
def theUser = apiAccessor.getIdentityAPI().getUserByUserName(bonUser.toLowerCase());
if(theUser!=null){
logWrite.append(“\n\t” + dI++ + “contact found”);
// To have professional email
ContactData professionalData = identityAPI.getUserContactData(theUser.getId(), false);
String professionalEmail = professionalData.getEmail();
if (professionalEmail != null && !professionalEmail.isEmpty()) {
logWrite.append(“\n\t” + dI++ + "professionalEmail: "+professionalEmail);
toEmails = professionalEmail;
logWrite.append(“\n\t” + dI++ + toEmails);
}
else{
logWrite.append(“\n\t” + dI++ + “contact NOT found”);
return “contact NOT found”;
}
}
logWrite.append(“\n\t” + dI++ + “Trace End”);
logWrite.append(“\n\n”);
if(debug){logger.severe(logWrite.toString())}
return toEmails;, returnType=java.lang.String, dependencies=[SExpressionImpl [name=processInstanceId, content=processInstanceId, returnType=java.lang.Long, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_ENGINE_CONSTANT]], SExpressionImpl [name=apiAccessor, content=apiAccessor, returnType=org.bonitasoft.engine.api.APIAccessor, dependencies=, expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_ENGINE_CONSTANT]]], expressionKind=ExpressionKind [interpreter=GROOVY, type=TYPE_READ_ONLY_SCRIPT]]
at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:160)
at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:86)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(ExpressionResolverServiceImpl.java:213)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:120)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.evaluateInputParameters(ConnectorServiceImpl.java:295)
at org.bonitasoft.engine.connector.ConnectorServiceDecorator.evaluateInputParameters(ConnectorServiceDecorator.java:102)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork$EvaluateParameterAndGetConnectorInstance.call(ExecuteConnectorWork.java:223)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork$EvaluateParameterAndGetConnectorInstance.call(ExecuteConnectorWork.java:182)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.work(ExecuteConnectorWork.java:134)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
at org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork.work(FailureHandlingBonitaWork.java:66)
at org.bonitasoft.engine.work.BonitaWork.run(BonitaWork.java:56)
at org.bonitasoft.engine.work.SequenceRunnableExecutor.innerRun(SequenceRunnableExecutor.java:47)
at org.bonitasoft.engine.work.BonitaRunnable.run(BonitaRunnable.java:35)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.bonitasoft.engine.identity.UserNotFoundException: org.bonitasoft.engine.identity.SUserNotFoundException:
at org.bonitasoft.engine.api.impl.IdentityAPIImpl.getUserByUserName(IdentityAPIImpl.java:459)
at org.bonitasoft.engine.api.UserAPI$getUserByUserName.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at BScript30.run(BScript30.groovy:53)
at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:141)
… 21 more
Caused by: org.bonitasoft.engine.identity.SUserNotFoundException:
at org.bonitasoft.engine.identity.impl.IdentityServiceImpl.getUserByUserName(IdentityServiceImpl.java:1050)
at org.bonitasoft.engine.api.impl.transaction.identity.GetSUser.execute(GetSUser.java:50)
at org.bonitasoft.engine.api.impl.IdentityAPIImpl.getUserByUserName(IdentityAPIImpl.java:456)
… 27 more