예제 #1
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));
            }
        }
예제 #2
0
        private void assertUserTask(string eventName)
        {
            UserTask userTask = ModelExecutionContextTaskListener.userTask;

            assertNotNull(userTask);

            ModelElementInstance taskListener = userTask.ExtensionElements.getUniqueChildElementByNameNs(CAMUNDA_NS, "taskListener");

            assertEquals(eventName, taskListener.getAttributeValueNs(CAMUNDA_NS, "event"));
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
            assertEquals(typeof(ModelExecutionContextTaskListener).FullName, taskListener.getAttributeValueNs(CAMUNDA_NS, "class"));

            BpmnModelInstance modelInstance          = ModelExecutionContextTaskListener.modelInstance;
            ICollection <ModelElementInstance> tasks = modelInstance.getModelElementsByType(modelInstance.Model.getType(typeof(Task)));

            assertTrue(tasks.Contains(userTask));
        }