cancel
Showing results for 
Search instead for 
Did you mean: 

FormProperty retrieval of boolean value returns null

sistemasmunicip
Champ in-the-making
Champ in-the-making
Hello, I'm quite new to Activiti and am currently integrating it to a GXT project. I have problems retrieving form properties of boolean type.
The values seem to be recording ok in the data base (the engine stores 1 or 0 to long_ field according to true or false values) but when i want to retrieve the value from the engine, it always returns null. Tried with Postgres and MySql, no difference. I did a web and forum search but couldn't find any post with this problem. The server side language is java.
I'm storing FormProperty values in a HashMap<String, Object> and the boolean values are stored obviously as a Boolean object via setVariables(id, map) method.
I have tested how information is retrieved in client side (GXT Checkbox) and how it reaches the server and it's correct, the map contains boolean values.
All other data types (enum, date, long, string) are stored and retrieved correctly.
The integration with TaskService, IdentityService, HistoryService, etc are also working correctly.
I would appreciate any help or guidance to how to solve this problem because I can't find any explanation to it.
Thanks ind advance
Esteban
6 REPLIES 6

frederikherema1
Star Contributor
Star Contributor
How (with what code) do you retrieve the variable-values when you want to display them?

sistemasmunicip
Champ in-the-making
Champ in-the-making
Hi Frederik, thanks for your reply. Here's the code, reduced to the way I get the values from the engine because I use some class of my own to handle the retrieved data.

This is a basic iteration of the properties collection where I use a sysout  to display it. This code returns null for boolean values.
I'm using formProperty.getValue() as getter.
Can't figure out, what am I doing wrong?


tasks = taskService.createTaskQuery().taskAssignee(this.getUsuario()).list();

if(tasks != null)
{
  for(Task task : tasks)
  {
   // tomo las propiedades del form que definí para el task
   TaskFormData taskFormData = processEngine.getFormService().getTaskFormData(task.getId());
   List<FormProperty> listaFormProperty = taskFormData.getFormProperties();
   // si hay al menos 1 form property en el task
   if(listaFormProperty.size() > 0)
   {
    for(FormProperty formProperty : listaFormProperty)
    {
     LinkedHashMap<String, String> mapaFormProperties = new LinkedHashMap<String, String>();
     FormType tipoForm = formProperty.getType();

     Object information = tipoForm.getInformation("values");
     if(information != null)
     {
      // Si es HashMap va a venir con <String, String>, viene de un ENUM
      if(information instanceof HashMap<?, ?>)
      {
       HashMap<String, String> mapaInformation = (HashMap<String, String>) information;
       mapaFormProperties.putAll(mapaInformation);
      }
     }
    
     System.out.println("id: "+formProperty.getId()+" nombre "+tipoForm.getName()+" value "+formProperty.getValue());
    
    }
   
   }
  }
}

And the XML definition of the task's form properties:

<userTask id="SolDatLicCom" name="Solicitar Datos Licencia Comercial" activiti:candidateGroups="rentas.comercio">
      <extensionElements>
        <activiti:formProperty id="TipoAlta" name="Tipo Alta" type="enum" required="true" readable="true" writable="true">
          <activiti:value id="AltaNormal" name="Alta Normal"></activiti:value>
          <activiti:value id="AltaBajaSimultanea" name="Alta y Baja Simultánea"></activiti:value>
          <activiti:value id="CbioDomi" name="Cambio de Domicilio"></activiti:value>
          <activiti:value id="CbioNomFan" name="Cambio Nombre de Fantasía"></activiti:value>
          <activiti:value id="CbioRub" name="Cambio de Rubro"></activiti:value>
          <activiti:value id="AnexRub" name="Anexión de Rubro"></activiti:value>
          <activiti:value id="RenovLic" name="Renovación de Licencia"></activiti:value>
          <activiti:value id="Otros" name="Otros (especificar en campo Otros)"></activiti:value>
        </activiti:formProperty>
        <activiti:formProperty id="TipoAltaOtros" name="Tipo de Alta - Otros" type="string" required="false" readable="true" writable="true"></activiti:formProperty>
        <activiti:formProperty id="NC" name="Nomenclatura Catastral" type="string" required="true" readable="true" writable="true"></activiti:formProperty>
        <activiti:formProperty id="EsCbioFan" name="Es cambio Nombre de Fantasía?" type="boolean" variable="vEsCbioFan" required="true" readable="true" writable="true"></activiti:formProperty>
        <activiti:formProperty id="NomFan" name="Nombre de Fantasía" type="string" required="true" readable="true" writable="true"></activiti:formProperty>
        <activiti:formProperty id="FecSolicitud" name="Fecha Solicitud" type="date" required="true" readable="true" writable="true"></activiti:formProperty>
        <activiti:formProperty id="ReqInspObPart" name="¿Requiere Inspección de Obras Particulares?" type="boolean" variable="vReqInspObPart" required="true" readable="true" writable="true"></activiti:formProperty>
      </extensionElements>
    </userTask>

Thanks again
Esteban

frederikherema1
Star Contributor
Star Contributor
If I get you correctly, you have a process with a variable named "vReqInspObPart" which is already filled in, prior to you fetching the form-properties?

sistemasmunicip
Champ in-the-making
Champ in-the-making
Frederik: the variable was not filled in, so I guess the null was coming from the process variable? Anyway, I took out the variable binding and the values are returning as they should. Could I have solved it assigning a "default" value to "vReqInspObPart" ?
In any case, the boolean are to use with exclusive gateways on the process and are working ok.
Sorry to waste your time, thanks for your help
Esteban

frederikherema1
Star Contributor
Star Contributor
Yes, adding a default would have helped… Smiley Wink

sistemasmunicip
Champ in-the-making
Champ in-the-making
LOL , learn from mistakes… Anyway, so far the integration is quite easy, I like that  Smiley Very Happy
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.