AnsweredAssumed Answered

Unexpected exception: Invalid value for enum form property..

Question asked by sergiofigueras_4724 on Oct 1, 2012
Latest reply on Oct 3, 2012 by sergiofigueras_4724
Hi everyone!

I'm trying to integrate Activiti BPM (5.10) with our system. So, to do that, I'm rendering the form properties on our client (Primefaces). But, when I've an enum form type property and try to submit that, I don't know what I'm missing, and I've got this error:

4:25:42,030 SEVERE [org.activiti.engine.impl.interceptor.CommandContext] Error while closing command context: org.activiti.engine.ActivitiException: Invalid value for enum form property: Negar
   at org.activiti.engine.impl.form.EnumFormType.validateValue(EnumFormType.java:64) [:5.10]
   at org.activiti.engine.impl.form.EnumFormType.convertFormValueToModelValue(EnumFormType.java:46) [:5.10]
   at org.activiti.engine.impl.form.FormPropertyHandler.submitFormProperty(FormPropertyHandler.java:87) [:5.10]
   at org.activiti.engine.impl.form.DefaultFormHandler.submitFormProperties(DefaultFormHandler.java:131) [:5.10]
   at org.activiti.engine.impl.cmd.SubmitTaskFormCmd.execute(SubmitTaskFormCmd.java:72) [:5.10]
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24) [:5.10]
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42) [:5.10]
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) [:5.10]
   at org.activiti.engine.impl.FormServiceImpl.submitTaskFormData(FormServiceImpl.java:68) [:5.10]

I'm setting the process variables like this:

    public void submitTaskFormData(String taskId, Map<String, String> values) {
        ProcessEngine pe = ProcessEngines.getDefaultProcessEngine();
        pe.getFormService().submitTaskFormData(taskId, values);
    }

And that's my process file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn"
   xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
   xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema"
   expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="www.flexdoc.com.br/bpmn">
   <process id="SolicitacaoCompra" name="Solicitacao de Compras">
      <documentation>Solicitacao de compras de acordo com política interna
         da organização.
      </documentation>
      <startEvent id="startevent1" name="Start"></startEvent>
      <userTask id="usertask1" name="Avaliação de Propostas"
         activiti:candidateGroups="SECRETARIA">
         <documentation>Coletar três propostas de compra para o item
            solicitado.
         </documentation>
         <extensionElements>
            <activiti:formProperty id="Fornecedor1" name="Fornecedor 1"
               required="true" readable="true" writable="true"></activiti:formProperty>
            <activiti:formProperty id="dataEntrega"
               name="Data Entrega (Fornecedor 1)"></activiti:formProperty>
            <activiti:formProperty id="valorFornecedor1"
               name="Valor (Fornecedor 1)" required="true" readable="true"
               writable="true"></activiti:formProperty>
            <activiti:formProperty id="Fornecedor2" name="Fornecedor 2"
               required="true" readable="true" writable="true"></activiti:formProperty>
            <activiti:formProperty id="dataEntrega2"
               name="Data Entrega (Fornecedor 2)"></activiti:formProperty>
            <activiti:formProperty id="valorFornecedor2"
               name="Valor (Fornecedor 2)" required="true" readable="true"
               writable="true"></activiti:formProperty>
         </extensionElements>
      </userTask>
      <userTask id="usertask2" name="Aprovação de Compra"
         activiti:candidateGroups="COMPRAS">
         <documentation>Aprovar ou negar a solicitação de compras de acordo
            com política interna da empresa.
         </documentation>
         <extensionElements>
            <activiti:formProperty id="resultadoAprovacao"
               name="Deseja aprovar a compra?" type="enum" required="true"
               readable="true" writable="true">
               <activiti:value id="Aprovar" name="Aprovar"></activiti:value>
               <activiti:value id="Negar" name="Negar"></activiti:value>
            </activiti:formProperty>
            <activiti:formProperty id="observacao" name="Observação"
               required="false" readable="true" writable="true"></activiti:formProperty>
            <activiti:formProperty id="melhorProposta"
               name="Melhor Proposta" type="enum" required="true" readable="true"
               writable="true">
               <activiti:value id="valor0_aprov" name="Proposta 1"></activiti:value>
               <activiti:value id="valor1_aprov" name="Proposta 2"></activiti:value>
            </activiti:formProperty>
         </extensionElements>
      </userTask>
      <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"
         default="flow5"></exclusiveGateway>
      <userTask id="usertask3" name="Efetuar Compra"
         activiti:candidateGroups="SECRETARIA">
         <documentation>Efetuar a compra do item de acordo com a melhor
            proposta.
         </documentation>
         <extensionElements>
            <activiti:formProperty id="codigoRastreio"
               name="Código de Rastreio" required="true" readable="true" writable="true"></activiti:formProperty>
            <activiti:formProperty id="observacaoCompra"
               name="Observação" readable="true" writable="true"></activiti:formProperty>
         </extensionElements>
      </userTask>
      <endEvent id="endevent1" name="End"></endEvent>
      <endEvent id="endevent2" name="End"></endEvent>
      <sequenceFlow id="flow1" name="" sourceRef="startevent1"
         targetRef="usertask1"></sequenceFlow>
      <sequenceFlow id="flow2" name="" sourceRef="usertask1"
         targetRef="usertask2"></sequenceFlow>
      <sequenceFlow id="flow3" name="" sourceRef="usertask2"
         targetRef="exclusivegateway1"></sequenceFlow>
      <sequenceFlow id="flow4" sourceRef="exclusivegateway1"
         targetRef="usertask3">
         <conditionExpression xsi:type="tFormalExpression"><![CDATA[${resultadoAprovacao == 'Aprovar'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow5" sourceRef="exclusivegateway1"
         targetRef="endevent1">
         <conditionExpression xsi:type="tFormalExpression"><![CDATA[${resultadoAprovacao == 'Negar'}]]></conditionExpression>
      </sequenceFlow>
      <sequenceFlow id="flow6" name="" sourceRef="usertask3"
         targetRef="endevent2"></sequenceFlow>
   </process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_SolicitacaoCompra">
      <bpmndi:BPMNPlane bpmnElement="SolicitacaoCompra"
         id="BPMNPlane_SolicitacaoCompra">
         <bpmndi:BPMNShape bpmnElement="startevent1"
            id="BPMNShape_startevent1">
            <omgdc:Bounds height="35" width="35" x="150" y="160"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
            <omgdc:Bounds height="55" width="105" x="230" y="150"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
            <omgdc:Bounds height="55" width="105" x="390" y="150"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="exclusivegateway1"
            id="BPMNShape_exclusivegateway1">
            <omgdc:Bounds height="40" width="40" x="550" y="157"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="usertask3" id="BPMNShape_usertask3">
            <omgdc:Bounds height="55" width="105" x="630" y="70"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
            <omgdc:Bounds height="35" width="35" x="640" y="204"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
            <omgdc:Bounds height="35" width="35" x="790" y="80"></omgdc:Bounds>
         </bpmndi:BPMNShape>
         <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
            <omgdi:waypoint x="185" y="177"></omgdi:waypoint>
            <omgdi:waypoint x="230" y="177"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
            <omgdi:waypoint x="335" y="177"></omgdi:waypoint>
            <omgdi:waypoint x="390" y="177"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
            <omgdi:waypoint x="495" y="177"></omgdi:waypoint>
            <omgdi:waypoint x="550" y="177"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
            <omgdi:waypoint x="570" y="157"></omgdi:waypoint>
            <omgdi:waypoint x="682" y="125"></omgdi:waypoint>
            <bpmndi:BPMNLabel>
               <omgdc:Bounds height="13" width="100" x="10" y="0"></omgdc:Bounds>
            </bpmndi:BPMNLabel>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
            <omgdi:waypoint x="590" y="177"></omgdi:waypoint>
            <omgdi:waypoint x="657" y="204"></omgdi:waypoint>
            <bpmndi:BPMNLabel>
               <omgdc:Bounds height="13" width="100" x="10" y="0"></omgdc:Bounds>
            </bpmndi:BPMNLabel>
         </bpmndi:BPMNEdge>
         <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
            <omgdi:waypoint x="735" y="97"></omgdi:waypoint>
            <omgdi:waypoint x="790" y="97"></omgdi:waypoint>
         </bpmndi:BPMNEdge>
      </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
</definitions>

Outcomes