Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-11218

Example on how to start the latest process definition for a version tag is wrong

    XMLWordPrintable

Details

    • Bug Report
    • Resolution: Fixed
    • L3 - Default
    • 7.13.0, 7.13.0-alpha5
    • 7.13.0-alpha1
    • documentation
    • None

    Description

      The following part of the https://docs.camunda.org/manual/latest/user-guide/process-engine/process-versioning/#version-tag documentation provides invalid information.

      The following example shows how to start a process instance of the latest process definition for a version tag:

      ProcessDefinition pd = processEngine.getRepositoryService().createProcessDefinitionQuery()
      .processDefinitionKey("invoice")
      .versionTag("1.5-patch2")
      .latest()
      .singleResult();

      processEngine.getRuntimeService().startProcessInstanceById(pd.getId());

      1. There is no method #latest() in ProcessDefinitionQuery class -> The Method is called #latestVersion()
      2. The code snippet doesn't deliver what the introduction describes.
        • Having a newer deployment of the process definition with the same key and other version tag, the query will deliver a null since the #latestVersion() method doesn't take the version tag under consideration.

      Possible improvements:

      • Adjust code example by showing the following snippet:
        processEngine.getRepositoryService().createProcessDefinitionQuery()
            .processDefinitionKey("invoice")
            .versionTag("1.5-patch2")
            .orderByVersion().
            .desc()
            .listPage(0,1);
        
      • A JUnit test case is created in the code base that covers that scenario
      • Also, please consider to clarify how the query option #latestVersion() is supposed to work in the documentation (not Java API).

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

              nikola.koevski Nikola Koevski
              michal.dytko Michal Dytko
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Salesforce