This content has been marked as final.
Show 3 replies
-
1. Re: Bug in Mail.java
lmichenaud Oct 19, 2007 6:25 AM (in response to lmichenaud)Sorry, after a second though, i think the code is correct.
'To' attribute should be used for hard email input.
and 'actors' attribute should be used for email(s) to resolve.
So, i think the error is in the documentation :<mail to='#{initiator}' subject='websale' text='your websale of #{quantity} #{item} was approved' />
to='#{initiator}' will never work. -
2. Re: Bug in Mail.java
fady.matar Oct 22, 2007 8:54 AM (in response to lmichenaud)Very true.
The attribute 'to' does not resolve EL expressions, use the attribute 'actor' instead.
The documentation needs to be updated -
3. Re: Bug in Mail.java
kukeltje Dec 12, 2007 6:39 PM (in response to lmichenaud)Not true (from what I see in the code)
evaluate(to) is implemented as:String evaluate(String expression) { if (expression==null) { return null; } VariableResolver variableResolver = JbpmExpressionEvaluator.getUsedVariableResolver(); if (variableResolver!=null) { variableResolver = new MailVariableResolver(templateVariables, variableResolver); } return (String) JbpmExpressionEvaluator.evaluate(expression, executionContext, variableResolver, null); }
There are even a unittestpublic void testToVariableExpression() { ProcessDefinition processDefinition = ProcessDefinition.parseXmlString( "<process-definition>" + " <start-state>" + " <transition to='end'>" + " <mail name='send email' to='#{user.email}' subject='s' text='t' />" + " </transition>" + " </start-state>" + " <end-state name='end' />" + "</process-definition>" ); User mrNobody = new User("hucklebuck@example.domain"); ProcessInstance processInstance = new ProcessInstance(processDefinition); processInstance.getContextInstance().setVariable("user", mrNobody); processInstance.signal(); assertEquals(1, server.getReceivedEmailSize()); Iterator emailIter = server.getReceivedEmail(); SmtpMessage email = (SmtpMessage) emailIter.next(); assertEquals("hucklebuck@example.domain", email.getHeaderValue("To")); }
So I'm inclined to close http://jira.jboss.com/jira/browse/JBPM-1073 as 'worksforme'