cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with generate process diagram

natejh
Champ in-the-making
Champ in-the-making
Hi all,
   I want to generate a process diagram.
   So I use the activiti-modeler to generate a simple process defination xml file.
   It only include  a start component, a end component and a sendTask
   Then I deploy it,but it runs error.

   

Attribute 'operation' is not allowed to appear in element 'sendTask'. |     com/workflow/process/EmailTest.bpmn20.xml | line 21 | column 90
One of the attributes 'type' or 'operation' is mandatory on sendTask.
  
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
I've created a Jira for it, because I suspect a bug: http://jira.codehaus.org/browse/ACT-503

natejh
Champ in-the-making
Champ in-the-making
I've created a Jira for it, because I suspect a bug: http://jira.codehaus.org/browse/ACT-503

Thanks jbarrez!

I checked the source code,and found the issue code which in
  org.activiti.engine.impl.bpmn.parser.BpmnParse.parseSendTask


  public void parseSendTask(Element sendTaskElement, ScopeImpl scope) {
    ActivityImpl activity = parseAndCreateActivityOnScopeElement(sendTaskElement, scope);

    System.out.println(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS);
   
    // for e-mail
    String type = sendTaskElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "type");
//  String type = "mail";
    // for web service
    String implementation = sendTaskElement.attribute("implementation");
    String operationRef = this.resolveName(sendTaskElement.attribute("operationRef"));

    // for e-mail
    if (type != null) {
      if (type.equalsIgnoreCase("mail")) {
        parseEmailServiceTask(activity, sendTaskElement, parseFieldDeclarations(sendTaskElement));
      } else {
        addError("Invalid usage of type attribute: '" + type + "'", sendTaskElement);
      }
   
    // for web service
    } else if (implementation != null && operationRef != null && implementation.equalsIgnoreCase("##WebService")) {
      if (!this.operations.containsKey(operationRef)) {
        addError(operationRef + " does not exist" , sendTaskElement);
      } else {
        Operation operation = this.operations.get(operationRef);
        WebServiceActivityBehavior webServiceActivityBehavior = new WebServiceActivityBehavior(operation);
       
        Element ioSpecificationElement = sendTaskElement.element("ioSpecification");
        if (ioSpecificationElement != null) {
          IOSpecification ioSpecification = this.parseIOSpecification(ioSpecificationElement);
          webServiceActivityBehavior.setIoSpecification(ioSpecification);
        }
       
        for (Element dataAssociationElement : sendTaskElement.elements("dataInputAssociation")) {
          AbstractDataInputAssociation dataAssociation = this.parseDataInputAssociation(dataAssociationElement);
          webServiceActivityBehavior.addDataInputAssociation(dataAssociation);
        }
       
        for (Element dataAssociationElement : sendTaskElement.elements("dataOutputAssociation")) {
          AbstractDataOutputAssociation dataAssociation = this.parseDataOutputAssociation(dataAssociationElement);
          webServiceActivityBehavior.addDataOutputAssociation(dataAssociation);
        }

        activity.setActivityBehavior(webServiceActivityBehavior);
      }
    } else {
      addError("One of the attributes 'type' or 'operation' is mandatory on sendTask.", sendTaskElement);
    }
   
    parseExecutionListenersOnScope(sendTaskElement, activity);

    for (BpmnParseListener parseListener: parseListeners) {
      parseListener.parseSendTask(sendTaskElement, scope, activity);
    }
  }


It seems something wrong for the "type" variable.The result is null,
When I edit it to   String type = "mail" ;
It will run successful.

jbarrez
Star Contributor
Star Contributor
Okay, now I understand. Then the error message is correct: currently Activiti supports using the sendTask for sending an email or calling a webservice. When you don't provide a type, it will default to webservice, where an operation definition is required.