2 Replies Latest reply on Sep 12, 2005 10:46 AM by tom.baeyens

    TaskInstance duedate not being persisted ??

    marcus.junk

      Hey All,

      I have a simple piece of test code that creates a very simple business process with a task that has a duedate attribute.
      I create and start an instance of this ProcessInstance and then save the processInstance.

      The problem is that ....... now when I inspect the database table JBPM_TASKINSTANCE the duedate column has not been populated.

      I have tried debugging this by watching the duedate member on the TaskInstance class and it never gets initialised when the Task gets created.

      Can one of the JBPM "experts" please verify this is a bug or better still tell me what I'm doing wrong and thus how to resolve this issue.

      Thanks in advance, Marcus.

      PS. this is the simple code that I am running, I am using a MS SQL Server database.


       static JbpmSessionFactory jbpmSessionFactory = JbpmSessionFactory.buildJbpmSessionFactory();
      
       public void timerDueNotPersisted(){
       String processDefinitionXml =
       "<process-definition " +
       " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
       " name='SimpleTaskProcess'> " +
       " <start-state name='start'> " +
       " <transition name='toTask' to='task'></transition> " +
       " </start-state> " +
       " <end-state name='end'></end-state> " +
       " <task-node name='task'> " +
       " <task name='SimpleTaskDue' duedate='120 seconds'></task> " +
       " <transition name='toEnd' to='end'></transition> " +
       " </task-node> " +
       "</process-definition>";
      
       ProcessDefinition deployProcessDefinition = ProcessDefinition.parseXmlString(processDefinitionXml);
       ProcessArchiveDeployer.deployProcessDefinition(deployProcessDefinition, jbpmSessionFactory);
      
       JbpmSession jbpmSession = null;
      
       try {
       jbpmSession = jbpmSessionFactory.openJbpmSession();
       jbpmSession.beginTransaction();
       ProcessDefinition processDefinition = jbpmSession.getGraphSession().findLatestProcessDefinition("SimpleTaskProcess");
       ProcessInstance processInstance = new ProcessInstance(processDefinition);
      
       // start bp instance
       processInstance.signal();
      
       // save bp
       jbpmSession.getGraphSession().saveProcessInstance(processInstance);
       jbpmSession.getSession().flush();
       jbpmSession.commitTransaction();
      
       // now in the database table JBPM_TASKINSTANCE the 'duedate' is null.
      
       } finally {
       if (jbpmSession != null){
       jbpmSession.close();
       }
       }
       }
      
      


        • 1. Re: TaskInstance duedate not being persisted ??
          marcus.junk

          I have found the problem myself after continuing to debug the jbpm source.

          The problem is that the code org.jbpm.jpdl.xml.JpdlXmlReader which looks for the attribute in the xml has the incorrect case and thus doesn't find the duedate attribute when attempting to set it in the TaskInstance.

          The "dueDate" should be "duedate" to be consistent with the schema and all other multiple word names in the schema.
          Can somone please fix this or instruct me on how to make this minor correction, althou I think there should be a test case too to prove the fix.

          Thanks, Marcus.

          public Task readTask(Element taskElement, TaskMgmtDefinition taskMgmtDefinition, TaskNode taskNode) {
          
           ......
          
           // description and duration
           task.setDescription(taskElement.attributeValue("description"));
           task.setDueDate(taskElement.attributeValue("dueDate"));
           String priorityText = taskElement.attributeValue("priority");
          
           ......
          }
          


          • 2. Re: TaskInstance duedate not being persisted ??
            tom.baeyens

            fixed in cvs. thanks for reporting ! http://jira.jboss.com/jira/browse/JBPM-337

            regards, tom.