示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetUnknownAnimalById()
        public virtual void testGetUnknownAnimalById()
        {
            assertThat(wanda).NotNull;
            assertThat(wanda.getAttributeValue("id")).isEqualTo("wanda");
            assertThat(wanda.getAttributeValue("gender")).isEqualTo("Female");
            assertThat(wanda.getAttributeValue("species")).isEqualTo("fish");

            assertThat(flipper).NotNull;
            assertThat(flipper.getAttributeValue("id")).isEqualTo("flipper");
            assertThat(flipper.getAttributeValue("gender")).isEqualTo("Male");
            assertThat(flipper.getAttributeValue("species")).isEqualTo("dolphin");
        }
示例#2
0
        /// <summary>
        /// returns the value of the attribute.
        /// </summary>
        /// <returns> the value of the attribute. </returns>
        public virtual T getValue(ModelElementInstance modelElement)
        {
            string value;

            if (string.ReferenceEquals(namespaceUri, null))
            {
                value = modelElement.getAttributeValue(attributeName);
            }
            else
            {
                value = modelElement.getAttributeValueNs(namespaceUri, attributeName);
                if (string.ReferenceEquals(value, null))
                {
                    string alternativeNamespace = owningElementType.Model.getAlternativeNamespace(namespaceUri);
                    if (!string.ReferenceEquals(alternativeNamespace, null))
                    {
                        value = modelElement.getAttributeValueNs(alternativeNamespace, attributeName);
                    }
                }
            }

            // default value
            if (string.ReferenceEquals(value, null) && defaultValue != default(T))
            {
                return(defaultValue);
            }
            else
            {
                return(convertXmlValueToModelValue(value));
            }
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") private void updateIncomingReferences(org.camunda.bpm.model.xml.instance.ModelElementInstance oldInstance, org.camunda.bpm.model.xml.instance.ModelElementInstance newInstance)
        private void updateIncomingReferences(ModelElementInstance oldInstance, ModelElementInstance newInstance)
        {
            string oldId = oldInstance.getAttributeValue("id");
            string newId = newInstance.getAttributeValue("id");

            if (string.ReferenceEquals(oldId, null) || string.ReferenceEquals(newId, null))
            {
                return;
            }

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Collection<org.camunda.bpm.model.xml.type.attribute.Attribute<?>> attributes = ((org.camunda.bpm.model.xml.impl.type.ModelElementTypeImpl) oldInstance.getElementType()).getAllAttributes();
            ICollection <Attribute <object> > attributes = ((ModelElementTypeImpl)oldInstance.ElementType).AllAttributes;

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (org.camunda.bpm.model.xml.type.attribute.Attribute<?> attribute : attributes)
            foreach (Attribute <object> attribute in attributes)
            {
                if (attribute.IdAttribute)
                {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (org.camunda.bpm.model.xml.type.reference.Reference<?> incomingReference : attribute.getIncomingReferences())
                    foreach (Reference <object> incomingReference in attribute.IncomingReferences)
                    {
                        ((ReferenceImpl <ModelElementInstance>)incomingReference).referencedElementUpdated(newInstance, oldId, newId);
                    }
                }
            }
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testGetUnknownAnimalByType()
        public virtual void testGetUnknownAnimalByType()
        {
            ModelInstanceImpl            modelInstanceImpl = (ModelInstanceImpl)modelInstance;
            ModelElementType             unknownAnimalType = modelInstanceImpl.registerGenericType(MODEL_NAMESPACE, "unknownAnimal");
            IList <ModelElementInstance> unknownAnimals    = new List <ModelElementInstance>(modelInstance.getModelElementsByType(unknownAnimalType));

            assertThat(unknownAnimals).hasSize(2);

            ModelElementInstance wanda = unknownAnimals[0];

            assertThat(wanda.getAttributeValue("id")).isEqualTo("wanda");
            assertThat(wanda.getAttributeValue("gender")).isEqualTo("Female");
            assertThat(wanda.getAttributeValue("species")).isEqualTo("fish");

            ModelElementInstance flipper = unknownAnimals[1];

            assertThat(flipper.getAttributeValue("id")).isEqualTo("flipper");
            assertThat(flipper.getAttributeValue("gender")).isEqualTo("Male");
            assertThat(flipper.getAttributeValue("species")).isEqualTo("dolphin");
        }