cancel
Showing results for 
Search instead for 
Did you mean: 

Modeler - Email Task deployment fails

skay
Champ in-the-making
Champ in-the-making
Hi,

When adding an Email task with the Kis Modeler, the Process deployement fails.
You may reproduce this bug with latest version 5.12 just adding an email task to the demo process :

"
Create of BPMN XML failed

One of the following is mandatory on a field declaration: one of attributes stringValue|expression or one of child elements string|expression | Demo model1.bpmn20.xml | line 35 | column 71 One of the following is mandatory on a field declaration: one of attributes stringValue|expression or one of child elements string|expression | Demo model1.bpmn20.xml | line 35 | column 71 One of the following is mandatory on a field declaration: one of attributes stringValue|expression or one of child elements string|expression | Demo model1.bpmn20.xml | line 35 | column 71
"

Actually, it seems like ALL parameters are 'mandatory' for the Email Task,
So if I fill fields 'TO', 'CC', 'BCC' and 'text', 'html', the deployment is OK.

Any other work-around idea ? / bug resolution ?

BR
7 REPLIES 7

jbarrez
Star Contributor
Star Contributor
Created http://jira.codehaus.org/browse/ACT-1604

I don't believe all parameters are mandatory. Did you try finding the minimal set that works?

skay
Champ in-the-making
Champ in-the-making
:cry: Actually all parameters are mandatory.
I tryed again adding each parameter following this order
1) TO alone
2) TO + FROM alone
3) TO + FROM + SUBJECT
3) TO + FROM + SUBJECT + TEXT
4) TO + FROM + SUBJECT + TEXT + CC
5) TO + FROM + SUBJECT + TEXT + CC + BCC + CHARSET

All these combination are KO.

And then, if I add the latest parameter HTML / whitch is redundant with TEXT Smiley Sad
6) TO + FROM + SUBJECT + TEXT + CC + BCC + CHARSET + HTML

Then this is OK !

If I go just 1 step back, e.g. remove value of CHARSET, I got same exception at deployment, pointing the line of the declaration of the mail task :

org.activiti.engine.ActivitiException: One of the following is mandatory on a fi
eld declaration: one of attributes stringValue|expression or one of child elemen
ts string|expression | Demo model.bpmn20.xml | line 33 | column 85

        at org.activiti.engine.impl.util.xml.Parse.throwActivitiExceptionForErro
rs(Parse.java:186)
        at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java
:242)
        at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeploy
er.java:92)

THis is the resulting XML fragment / after removal of the charset parameter :

<serviceTask id="sid-6FB5241A-FE3E-4148-8DDA-D692C2002910" activiti:type="mail">
      <extensionElements>
        <activiti:field name="to" stringValue="jbarrez@activiti.org"></activiti:field>
        <activiti:field name="from" stringValue="jbarrez@activiti.org"></activiti:field>
        <activiti:field name="subject" stringValue="aaa"></activiti:field>
        <activiti:field name="cc" stringValue="jbarrez@activiti.org"></activiti:field>
        <activiti:field name="bcc" stringValue="jbarrez@activiti.org"></activiti:field>
        <activiti:field name="text" stringValue="aaa"></activiti:field>
        <activiti:field name="html" stringValue="aaa"></activiti:field>
        <activiti:field name="charset"></activiti:field>
      </extensionElements>
    </serviceTask>

So clearly ALL parameters seem to be compulsory here.

I didn't investigate further. Is it the way of how the mail task is designed :

public class MailActivityBehavior extends AbstractBpmnActivityBehavior {

  protected Expression to;
  protected Expression from;
  protected Expression cc;
  protected Expression bcc;
  protected Expression subject;
  protected Expression text;
  protected Expression html;
  protected Expression charset;

  public void execute(ActivityExecution execution) {
    String toStr = getStringFromField(to, execution);
    String fromStr = getStringFromField(from, execution);
    String ccStr = getStringFromField(cc, execution);
    String bccStr = getStringFromField(bcc, execution);
    String subjectStr = getStringFromField(subject, execution);
    String textStr = getStringFromField(text, execution);
    String htmlStr = getStringFromField(html, execution);
    String charSetStr = getStringFromField(charset, execution);

OR is it the
activiti-bpmn-extensions-5.12.xsd
definitions that could be updated in order to resolve this issue ?

BR

jbarrez
Star Contributor
Star Contributor
Thanks for researching that. I'll look at it shortly. Do keep an eye on the Jira issue if you want to be informed of fixes.

skay
Champ in-the-making
Champ in-the-making
I began again from scratch / demo process.

I add an EMail task and just fill the
TO
parameter

Then get back to Activiti explorer workspace and export the bpmn.xml file pproduced through KIS Modeler.

This is the genetated XML fragment :

<serviceTask id="sid-EA7D5296-0C91-46A6-AB05-CE4106BCE406" activiti:type="mail">
      <extensionElements>
        <activiti:field name="to" stringValue="jbarrez@activiti.org"></activiti:field>
        <activiti:field name="from"></activiti:field>
        <activiti:field name="subject"></activiti:field>
        <activiti:field name="cc"></activiti:field>
        <activiti:field name="bcc"></activiti:field>
        <activiti:field name="text"></activiti:field>
        <activiti:field name="html"></activiti:field>
        <activiti:field name="charset"></activiti:field>
      </extensionElements>
    </serviceTask>

I'm not shure about if this is a point / still investigating.

skay
Champ in-the-making
Champ in-the-making
Despite of the XSD definition :


  <element name="field">
    <annotation>
      <documentation>
        Extension Element for Service Tasks to inject values into the fields of
        delegate classes.
      </documentation>
    </annotation>
    <complexType>
      <choice minOccurs="0" maxOccurs="1">
       <element name="string" type="string" />
       <element name="expression" type="tns:tExpression" />
      </choice>
      <attribute name="name" type="string" use="required"/>
      <attribute name="stringValue" type="string" use="optional" />
      <attribute name="expression" type="tns:tExpression" use="optional" />
    </complexType>
  </element>
 
The error is raised from BpmnParse :

  protected FieldDeclaration parseFieldDeclaration(Element serviceTaskElement, Element fieldDeclarationElement) {
    String fieldName = fieldDeclarationElement.attribute("name");

    FieldDeclaration fieldDeclaration = parseStringFieldDeclaration(fieldDeclarationElement, serviceTaskElement, fieldName);
    if (fieldDeclaration == null) {
      fieldDeclaration = parseExpressionFieldDeclaration(fieldDeclarationElement, serviceTaskElement, fieldName);
    }

    if (fieldDeclaration == null) {
      addError("One of the following is mandatory on a field declaration: one of attributes stringValue|expression "
              + "or one of child elements string|expression", serviceTaskElement);
    }
    return fieldDeclaration;
  }

My understanding is that we should allow a null fieldDeclaration…
..And then let the XSD drive the rules of the bpmn20.xml  :?:

BR

jbarrez
Star Contributor
Star Contributor
Thanks for gathering that information. It is indeed a bug. We'll fix it asap.

trademak
Star Contributor
Star Contributor
Hi,

The export of all the empty mail task fields in the Modeler is now fixed.
It should only export the ones that are not empty.
Thanks for reporting the issue.

Best regards,