Esempio n. 1
0
 public ModelValidationResultImpl(ModelElementInstance element, ValidationResultType type, int code, string message)
 {
     this.element = element;
     this.type    = type;
     this.code    = code;
     this.message = message;
 }
Esempio n. 2
0
        protected internal static void makeCancelEvent(BpmnModelInstance model, string eventId)
        {
            ModelElementInstance element = model.getModelElementById(eventId);

            CancelEventDefinition eventDefinition = model.newInstance(typeof(CancelEventDefinition));

            element.addChildElement(eventDefinition);
        }
Esempio n. 3
0
        protected internal override void updateReference(ModelElementInstance referenceSourceElement, string oldIdentifier, string newIdentifier)
        {
            string referencingAttributeValue = getReferenceIdentifier(referenceSourceElement);

            if (!string.ReferenceEquals(oldIdentifier, null) && oldIdentifier.Equals(referencingAttributeValue))
            {
                setReferenceIdentifier(referenceSourceElement, newIdentifier);
            }
        }
Esempio n. 4
0
        public override string getReferenceIdentifier(ModelElementInstance referenceSourceElement)
        {
            string identifier = base.getReferenceIdentifier(referenceSourceElement);

            if (!string.ReferenceEquals(identifier, null))
            {
                QName qName = QName.parseQName(identifier);
                return(qName.LocalName);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
        public virtual void formatElement(StringWriter writer, ModelElementInstance element)
        {
            Formatter formatter = new Formatter(writer);

            if (element is FlyingAnimal)
            {
                formatter.format("%s\n", ((FlyingAnimal)element).Id);
            }
            else
            {
                formatter.format("%s\n", element.ElementType.TypeName);
            }

            formatter.flush();
        }
Esempio n. 6
0
        public virtual void setReferenceTargetElement(ModelElementInstanceImpl referenceSourceParentElement, Target referenceTargetElement)
        {
            ModelInstanceImpl    modelInstance   = referenceSourceParentElement.ModelInstance;
            string               identifier      = referenceTargetAttribute.getValue(referenceTargetElement);
            ModelElementInstance existingElement = modelInstance.getModelElementById(identifier);

            if (existingElement == null || !existingElement.Equals(referenceTargetElement))
            {
                throw new ModelReferenceException("Cannot create reference to model element " + referenceTargetElement + ": element is not part of model. Please connect element to the model first.");
            }
            else
            {
                Source referenceSourceElement = modelInstance.newInstance(ReferenceSourceElementType);
                setReferenceSource(referenceSourceParentElement, referenceSourceElement);
                setReferenceIdentifier(referenceSourceElement, identifier);
            }
        }
Esempio n. 7
0
        public override string getReferenceIdentifier(ModelElementInstance referenceSourceElement)
        {
            // TODO: implement something more robust (CAM-4028)
            string identifier = referenceSourceElement.getAttributeValue("href");

            if (!string.ReferenceEquals(identifier, null))
            {
                string[] parts = identifier.Split("#", true);
                if (parts.Length > 1)
                {
                    return(parts[parts.Length - 1]);
                }
                else
                {
                    return(parts[0]);
                }
            }
            else
            {
                return(null);
            }
        }
Esempio n. 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") public Target getReferenceTargetElement(org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl referenceSourceParentElement)
        public virtual Target getReferenceTargetElement(ModelElementInstanceImpl referenceSourceParentElement)
        {
            Source referenceSource = getReferenceSource(referenceSourceParentElement);

            if (referenceSource != null)
            {
                string identifier = getReferenceIdentifier(referenceSource);
                ModelElementInstance referenceTargetElement = referenceSourceParentElement.ModelInstance.getModelElementById(identifier);
                if (referenceTargetElement != null)
                {
                    return((Target)referenceTargetElement);
                }
                else
                {
                    throw new ModelException("Unable to find a model element instance for id " + identifier);
                }
            }
            else
            {
                return(default(Target));
            }
        }
Esempio n. 9
0
 protected internal override void setReferenceIdentifier(ModelElementInstance referenceSourceElement, string referenceIdentifier)
 {
     // TODO: implement something more robust (CAM-4028)
     referenceSourceElement.setAttributeValue("href", "#" + referenceIdentifier);
 }
Esempio n. 10
0
 protected internal override void removeReference(ModelElementInstance referenceSourceElement, ModelElementInstance referenceTargetElement)
 {
     referenceSourceAttribute.removeAttribute(referenceSourceElement);
 }
Esempio n. 11
0
 protected internal override void setReferenceIdentifier(ModelElementInstance referenceSourceElement, string referenceIdentifier)
 {
     referenceSourceAttribute.setValue(referenceSourceElement, referenceIdentifier);
 }
Esempio n. 12
0
 public override string getReferenceIdentifier(ModelElementInstance referenceSourceElement)
 {
     return(referenceSourceAttribute.getValue(referenceSourceElement));
 }
Esempio n. 13
0
 private void setReferenceSource(ModelElementInstance referenceSourceParent, Source referenceSource)
 {
     ReferenceSourceChild.setChild(referenceSourceParent, referenceSource);
 }
Esempio n. 14
0
 public virtual Source getReferenceSource(ModelElementInstance referenceSourceParent)
 {
     return(ReferenceSourceChild.getChild(referenceSourceParent));
 }