예제 #1
0
        /// <summary>
        /// Checks if the dimension at observation is in the dimension references of the component <paramref name="componentMappings"/>
        /// </summary>
        /// <param name="componentValue">
        /// The component value 
        /// </param>
        /// /// <param name="info">
        /// The data retrieval info 
        /// </param>
        private bool IsDimensionObsReference(ComponentValue componentValue, DataRetrievalInfo info)
        {
            IBaseDataQuery baseDataQuery = (IBaseDataQuery)info.ComplexQuery ?? info.Query;

            foreach (IAttributeObject attr in baseDataQuery.DataStructure.AttributeList.Attributes)
            {
                if (attr.Id.Equals(componentValue.Key.Id))
                {
                    if (attr.DimensionReferences.Contains(info.DimensionAtObservation))
                        return true;
                    return false;
                }
            }

            return false;
        }
예제 #2
0
        /// <summary>
        /// Initialize the internal order of the components based on the specified <paramref name="componentMappings"/>
        /// </summary>
        /// <param name="componentMappings">
        /// The component mappings 
        /// </param>
        /// /// <param name="info">
        /// The data retrieval info 
        /// </param>
        private void SetComponentOrder(IEnumerable<IComponentMapping> componentMappings, DataRetrievalInfo info)
        {
            foreach (IComponentMapping componentMapping in componentMappings)
            {
                var componentValue = new ComponentValue(componentMapping.Component);
                this.ComponentValues.Add(componentValue);
                switch (componentMapping.Component.ComponentType)
                {
                    case SdmxComponentType.Dimension:
                        this._dimensionValues.Add(componentValue);
                        if (!componentValue.Key.Id.Equals(info.DimensionAtObservation))
                            this._keyValues.Add(componentValue);
                        break;
                    case SdmxComponentType.Attribute:
                        switch (componentMapping.Component.AttributeAttachmentLevel)
                        {
                            case AttachmentLevel.DataSet:
                                this._attributeDataSetValues.Add(componentValue);
                                break;
                            case AttachmentLevel.Group:
                                // NOTE we expect only the attributes of a specific group to be in _attributeGroupValues
                                this._attributeGroupValues.Add(componentValue);
                                break;
                            case AttachmentLevel.Series:
                                if (IsDimensionObsReference(componentValue, info))
                                    this._attributeObservationValues.Add(componentValue);
                                else
                                    this._attributeSeriesValues.Add(componentValue);
                                break;
                            case AttachmentLevel.Observation:
                                this._attributeObservationValues.Add(componentValue);
                                break;
                        }

                        break;
                    case SdmxComponentType.PrimaryMeasure:
                        this.PrimaryMeasureValue = componentValue;
                        break;
                    case SdmxComponentType.CrossSectionalMeasure:
                        this._xsMeasures.Add(componentValue);
                        break;
                }
            }
        }