Package org.camunda.bpm.model.xml

Examples of org.camunda.bpm.model.xml.ModelException


  public <T extends ModelElementInstance> T newInstance(Class<T> type) {
    ModelElementType modelElementType = model.getType(type);
    if(modelElementType != null) {
      return newInstance(modelElementType);
    } else {
      throw new ModelException("Cannot create instance of ModelType "+type+": no such type registered.");
    }
  }
View Full Code Here


    DomElement rootElement = getRootElement();
    if (rootElement != null) {
      return rootElement.registerNamespace(namespaceUri);
    }
    else {
      throw new ModelException("Unable to define a new namespace without a root document element");
    }
  }
View Full Code Here

    DomElement rootElement = getRootElement();
    if (rootElement != null) {
      rootElement.registerNamespace(prefix, namespaceUri);
    }
    else {
      throw new ModelException("Unable to define a new namespace without a root document element");
    }
  }
View Full Code Here

      for (int i = 0; i < Integer.MAX_VALUE; i++) {
        if (!documentElement.hasAttributeNS(XMLNS_ATTRIBUTE_NS_URI, GENERIC_NS_PREFIX + i)) {
          return GENERIC_NS_PREFIX + i;
        }
      }
      throw new ModelException("Unable to find an unused namespace prefix");
    }
  }
View Full Code Here

    ModelElementInstanceImpl parentElement = (ModelElementInstanceImpl) getParentElement();
    if (parentElement != null) {
      parentElement.replaceChildElement(this, newElement);
    }
    else {
      throw new ModelException("Unable to remove replace without parent");
    }
  }
View Full Code Here

      DomElement referenceTargetElement = document.getElementById(reference);
      if (referenceTargetElement != null) {
        referenceTargetElements.add(referenceTargetElement);
      }
      else {
        throw new ModelException("Unable to find a model element instance for id " + identifier);
      }
    }
    return referenceTargetElements;
  }
View Full Code Here

    Element existingElement = ((DomElementImpl) existingChildDomElement).getElement();
    try {
      element.replaceChild(newElement, existingElement);
    }
    catch (DOMException e) {
      throw new ModelException("Unable to replace child <" + existingElement + "> of element <" + element + "> with element <" + newElement + ">", e);
    }
  }
View Full Code Here

    return new QName(namespaceUri, localName);
  }

  public static void ensureInstanceOf(Object instance, Class<?> type) {
    if(!type.isAssignableFrom(instance.getClass())) {
      throw new ModelException("Object is not instance of type "+type.getName());
    }
  }
View Full Code Here

    }
    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

      // create instance
      Constructor<T> constructor = type.getConstructor(parameterTypes);
      return constructor.newInstance(parameters);

    } catch (Exception e) {
      throw new ModelException("Exception while creating an instance of type "+type, e);
    }
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.model.xml.ModelException

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.