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); } }
//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)); } }
public virtual void clearReferenceTargetElement(ModelElementInstanceImpl referenceSourceParentElement) { ReferenceSourceChild.removeChild(referenceSourceParentElement); }