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

Doc - update create model api sample code

    XMLWordPrintable

    Details

      Description

      In https://docs.camunda.org/manual/latest/user-guide/model-api/bpmn-model-api/create-a-model/, the createElement() is using modelInstance object which is not visible inside this method. Instead it should use passed parameter i.e. parentElement to retrieve the Model Instance.

      Existing Sample code to create an element:

      protected <T extends BpmnModelElementInstance> T createElement(BpmnModelElementInstance parentElement, String id, Class<T> elementClass) {
      		T element = modelInstance.newInstance(elementClass);
      		element.setAttributeValue("id", id, true);
      		parentElement.addChildElement(element);
      		return element;
      	}
       

      Updated code should look like:

      protected static <T extends BpmnModelElementInstance> T createElement(BpmnModelElementInstance parentElement, String id, Class<T> elementClass) {
      		T element = parentElement.getModelInstance().newInstance(elementClass);
      		element.setAttributeValue("id", id, true);
      		parentElement.addChildElement(element);
      		return element;
      	}
       

        mgm-controller-panel

        This is the controller panel for Smart Panels app

          Attachments

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              garima.yadav Garima Yadav
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: