Package org.camunda.bpm.model.xml.type

Examples of org.camunda.bpm.model.xml.type.ModelElementType


  }

  public AttributeAssert hasOwningElementType(ModelElementType owningElementType) {
    isNotNull();

    ModelElementType actualOwningElementType = actual.getOwningElementType();

    if (!owningElementType.equals(actualOwningElementType)) {
      failWithMessage("Expected attribute <%s> to have owning element type <%s> but was <%s>", attributeName, owningElementType, actualOwningElementType);
    }
View Full Code Here


  }

  public ChildElementAssert hasParentElementType(ModelElementType parentElementType) {
    isNotNull();

    ModelElementType actualParentElementType = actual.getParentElementType();

    if (!parentElementType.equals(actualParentElementType)) {
      failWithMessage("Expected child element <%s> to have parent element type <%s> but has <%s>", typeClass, parentElementType.getTypeName(), actualParentElementType.getTypeName());
    }

    return this;
  }
View Full Code Here

  }

  public ModelElementTypeAssert extendsType(ModelElementType baseType) {
    isNotNull();

    ModelElementType actualBaseType = actual.getBaseType();

    if (!actualBaseType.equals(baseType)) {
      failWithMessage("Expected element type <%s> to extend type <%s> but extends <%s>", typeName, actualBaseType.getTypeName(), baseType.getTypeName());
    }

    return this;
  }
View Full Code Here

  }

  public ModelElementTypeAssert extendsNoType() {
    isNotNull();

    ModelElementType actualBaseType = actual.getBaseType();

    if (actualBaseType != null) {
      failWithMessage("Expected element type <%s> to not extend any type but extends <%s>", typeName, actualBaseType.getTypeName());
    }

    return this;
  }
View Full Code Here

   * @param childElementTypes the list to search the type
   * @return the index of the model element type in the list or -1 if it is not found
   */
  public static int getIndexOfElementType(ModelElementInstance modelElement, List<ModelElementType> childElementTypes) {
    for (int index = 0; index < childElementTypes.size(); index++) {
      ModelElementType childElementType = childElementTypes.get(index);
      Class<? extends ModelElementInstance> instanceType = childElementType.getInstanceType();
      if(instanceType.isAssignableFrom(modelElement.getClass())) {
        return index;
      }
    }
    Collection<String> childElementTypeNames = new ArrayList<String>();
    for (ModelElementType childElementType : childElementTypes) {
      childElementTypeNames.add(childElementType.getTypeName());
    }
    throw new ModelException("New child is not a valid child element type: " + modelElement.getElementType().getTypeName() + "; valid types are: " + childElementTypeNames);
  }
View Full Code Here

      try {
        return (FlowElement) modelElementInstance;

      } catch(ClassCastException e) {
        ModelElementType elementType = modelElementInstance.getElementType();
        throw new ProcessEngineException("Cannot cast "+modelElementInstance+" to FlowElement. "
            + "Is of type "+elementType.getTypeName() + " Namespace "
            + elementType.getTypeNamespace(), e);
      }

    } else {
      return null;
    }
View Full Code Here

    if(bpmnModelInstance != null) {
      ModelElementInstance modelElementInstance = bpmnModelInstance.getModelElementById(taskDefinitionKey);
      try {
        return (UserTask) modelElementInstance;
      } catch(ClassCastException e) {
        ModelElementType elementType = modelElementInstance.getElementType();
        throw new ProcessEngineException("Cannot cast "+modelElementInstance+" to UserTask. "
            + "Is of type "+elementType.getTypeName() + " Namespace "
            + elementType.getTypeNamespace(), e);
      }
    } else {
      return null;
    }
  }
View Full Code Here

  public Query<ModelElementInstance> getElementsQuery() {
    return new QueryImpl<ModelElementInstance>(getElements());
  }

  public ModelElementInstance addExtensionElement(String namespaceUri, String localName) {
    ModelElementType extensionElementType = modelInstance.registerGenericType(namespaceUri, localName);
    ModelElementInstance extensionElement = extensionElementType.newInstance(modelInstance);
    getElements().add(extensionElement);
    return extensionElement;
  }
View Full Code Here

  public Query<ModelElementInstance> getElementsQuery() {
    return new QueryImpl<ModelElementInstance>(getElements());
  }

  public ModelElementInstance addExtensionElement(String namespaceUri, String localName) {
    ModelElementType extensionElementType = modelInstance.registerGenericType(namespaceUri, localName);
    ModelElementInstance extensionElement = extensionElementType.newInstance(modelInstance);
    addChildElement(extensionElement);
    return extensionElement;
  }
View Full Code Here

  public Query<ModelElementInstance> getElementsQuery() {
    return new QueryImpl<ModelElementInstance>(getElements());
  }

  public ModelElementInstance addExtensionElement(String namespaceUri, String localName) {
    ModelElementType extensionElementType = modelInstance.registerGenericType(namespaceUri, localName);
    ModelElementInstance extensionElement = extensionElementType.newInstance(modelInstance);
    getElements().add(extensionElement);
    return extensionElement;
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.model.xml.type.ModelElementType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.