1 Reply Latest reply on Jul 24, 2014 11:37 AM by jmiguel77

    Task info in remote api does not retrieve the latest content

    jmiguel77

      I have found a strange behavior in the bpms business-central / remote API; i am currently testing the 6.0.2.GA distribution

      These are the steps i am taking:

      1. deploy a jar with the attached bpmn file (Solicitud.bpmn)
      2. create a deployment unit for that jar (groupId, artifact, version); the kjar is started successfully and the process definition is also created (it can be seen under Process Management > Process Definitions)
      3. start a new process instance from that process definition
      4. login as a user that can perform the user tasks defined; at this point i can also check the task content with this url: http://localhost:8080/business-central/rest/task/14/content
      5. the result is something like this:
        <content><id>22</id><serializedContent>......</serializedContent></content>
      6. i can also use the remote api of the kie remote client and see content of the task (variables and such) with the same content id (22)
      7. i go to Tasks > Tasks List and claim the task; after that i view the Details and click in the work button, fill the data i want in the Outputs and click the save button; the console displays that the Content id 23 has been created ( this is the exact message: Task Id: 14 State was Saved! ContentId : 23)
      8. after that i can logout the console and when i log back in i see the data that was saved in the task
      9. the problem is that if i go to this url again (http://localhost:8080/business-central/rest/task/14/content) the result is this
        <content><id>22</id><serializedContent>......</serializedContent></content>
      10. i was expecting to see the latest content (Content id 23) but the api is giving me the previous content
      11. this is also happening when i use the remote kie api; this call task.getTaskData().getDocumentContentId() is giving me 22 instead of 23

       

      Is this a bug in the kie internal API ?? how is the business central console obtaining the correct content ??

      thanks for your help

        • 1. Re: Task info in remote api does not retrieve the latest content
          jmiguel77

          i have solved this problem in a api extension i have developed

          using the jpa associated to bpm i am doing this, after adding a new content

           

          public void updateContentIdByTaskId(long taskId, long contentId) {

            TaskImpl taskImpl = em.find(TaskImpl.class, taskId);

            TaskDataImpl taskDataImpl = (TaskDataImpl) taskImpl.getTaskData();

            taskDataImpl.setDocumentContentId(contentId);

          }

           

          this snippet is "manually" setting the documentcontentid of the task to the newly created content, and now the call to this url (http://localhost:8080/business-central/rest/task/14/content) retrieves the correct content id

          1 of 1 people found this helpful