Ejemplo n.º 1
0
        /// <summary>
        /// Get the next list of attributes to compare to each other.
        /// If an attribute is not present, a null pointer is returned in the AttributeCollection.
        /// If all attributes have been compared, null is returned.
        /// </summary>
        /// <returns>The attributes to compare.</returns>



        public AttributeList GetNextAttributes()
        {
            AttributeList nextAttributes = null;

            if (this.compareRulesIndex >= this.compareRules.Count)
            {
                nextAttributes = null;
            }
            else
            {
                nextAttributes = new AttributeList();

                CompareRule compareRule = this.compareRules[this.compareRulesIndex] as CompareRule;

                nextAttributes.CompareRule = compareRule;

                // Use the attributeCollectionsIndex to iterate through both the attributeCollections and compareRule.
                for (int validationRuleListIndex = 0; validationRuleListIndex < compareRule.Count; validationRuleListIndex++)
                {
                    ValidationRuleBase validationRule = compareRule[validationRuleListIndex];

                    if (validationRule is ValidationRuleDicomAttribute)
                    {
                        ValidationRuleDicomAttribute validationRuleDicomAttribute = validationRule as ValidationRuleDicomAttribute;
                        DicomAttributeCollection     dicomAttributeCollection     = this.attributeCollections[validationRuleListIndex] as DicomAttributeCollection;

                        DicomAttribute dicomAttribute = null;

                        if (validationRuleDicomAttribute == null)
                        // If nothing needs to be validated.
                        {
                            dicomAttribute = null;
                        }
                        else
                        {
                            DvtkHighLevelInterface.Dicom.Other.Attribute dicomAttributeOnly = null;

                            if (dicomAttributeCollection.AttributeSetOnly.Exists(validationRuleDicomAttribute.TagSequenceString))
                            {
                                dicomAttributeOnly = dicomAttributeCollection.AttributeSetOnly[validationRuleDicomAttribute.TagSequenceString];
                            }
                            else
                            {
                                dicomAttributeOnly = new InvalidAttribute();
                            }

                            // Merge the validation flags from the validation rule and the attribute collection.
                            ValidationRuleDicomAttribute mergedValidationRuleDicomAttribute = new ValidationRuleDicomAttribute(validationRuleDicomAttribute.TagSequenceString, validationRuleDicomAttribute.Flags | dicomAttributeCollection.Flags);

                            dicomAttribute = new DicomAttribute(dicomAttributeOnly, mergedValidationRuleDicomAttribute);

                            dicomAttribute.DisplayFullTagSequence = true;
                        }

                        nextAttributes.Add(dicomAttribute);
                    }
                    else if (validationRule is ValidationRuleHl7Attribute)
                    {
                        ValidationRuleHl7Attribute validationRuleHl7Attribute = validationRule as ValidationRuleHl7Attribute;
                        Hl7AttributeCollection     hl7AttributeCollection     = this.attributeCollections[validationRuleListIndex] as Hl7AttributeCollection;

                        Hl7Attribute hl7Attribute = null;

                        if (validationRuleHl7Attribute == null)
                        // If nothing needs to be validated.
                        {
                            hl7Attribute = null;
                        }
                        else
                        {
                            // Merge the validation flags from the validation rule and the attribute collection.
                            ValidationRuleHl7Attribute mergedValidationRuleHl7Attribute = new ValidationRuleHl7Attribute(validationRuleHl7Attribute.Hl7Tag, validationRuleHl7Attribute.Flags | hl7AttributeCollection.Flags);

                            hl7Attribute = new Hl7Attribute(hl7AttributeCollection.Hl7MessageOnly.Value(validationRuleHl7Attribute.Hl7Tag), mergedValidationRuleHl7Attribute);
                        }

                        nextAttributes.Add(hl7Attribute);
                    }
                    else
                    {
                        nextAttributes.Add(null);
                    }
                }

                this.compareRulesIndex++;
            }

            return(nextAttributes);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add an HL7 message with specified flags to this collection.
        /// </summary>
        /// <param name="hl7Message">The HL7 message.</param>
        /// <param name="flags">The flags.</param>
        public void Add(Hl7Message hl7Message, FlagsHl7Attribute flags)
        {
            Hl7AttributeCollection hl7AttributeCollection = new Hl7AttributeCollection(hl7Message, flags);

            Add(hl7AttributeCollection);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add an HL7 message with specified flags to this collection.
        /// </summary>
        /// <param name="hl7Message">The HL7 message.</param>
        /// <param name="flags">The flags.</param>
        public void Add(Hl7Message hl7Message, FlagsHl7Attribute flags)
        {
            Hl7AttributeCollection hl7AttributeCollection = new Hl7AttributeCollection(hl7Message, flags);

            Add(hl7AttributeCollection);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Add a HL7 message to this collection.
        /// </summary>
        /// <param name="hl7Message">The HL7 message.</param>
        public void Add(Hl7Message hl7Message)
        {
            Hl7AttributeCollection hl7AttributeCollection = new Hl7AttributeCollection(hl7Message);

            Add(hl7AttributeCollection);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Add a HL7 message to this collection.
        /// </summary>
        /// <param name="hl7Message">The HL7 message.</param>
        public void Add(Hl7Message hl7Message)
        {
            Hl7AttributeCollection hl7AttributeCollection = new Hl7AttributeCollection(hl7Message);

            Add(hl7AttributeCollection);
        }