コード例 #1
0
ファイル: MappedValues.cs プロジェクト: alcardac/SDMXRI_WS_OF
        /// <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>
        private void SetComponentOrder(IEnumerable<IComponentMapping> componentMappings)
        {
            foreach (IComponentMapping componentMapping in componentMappings)
            {
                var componentValue = new ComponentValue(componentMapping.Component);
                this.ComponentValues.Add(componentValue);
                CrossSectionalLevels attachmentLevel = componentMapping.Component.EffectiveCrossSectionalAttachmentLevel;
                attachmentLevel = attachmentLevel == CrossSectionalLevels.None
                                  && componentMapping.Component.FrequencyDimension
                                      ? CrossSectionalLevels.Group
                                      : attachmentLevel;
                int index = GetIndex(attachmentLevel);

                switch (componentMapping.Component.ComponentType)
                {
                    case SdmxComponentType.Dimension:
                        if (!componentMapping.Component.MeasureDimension)
                        {
                            this._keyValues[index].Add(componentValue);
                            this._dimensionValues[index].Add(componentValue);
                        }
                        else
                        {
                            this.MeasureDimensionValue = componentValue;
                        }

                        break;
                    case SdmxComponentType.Attribute:
                        this._attributeValues[index].Add(componentValue);
                        break;
                    case SdmxComponentType.PrimaryMeasure:
                        this.PrimaryMeasureValue = componentValue;
                        break;
                    case SdmxComponentType.CrossSectionalMeasure:
                        this._xsMeasureValues.Add(componentValue);
                        break;
                }
            }
        }
コード例 #3
0
ファイル: MappedValues.cs プロジェクト: alcardac/SDMXRI_WS_OF
        /// <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;
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Handle Time Dimension components
 /// </summary>
 /// <param name="keyedValue">
 /// The time dimension <see cref="ComponentValue"/> 
 /// </param>
 private void HandleTimeDimension(ComponentValue keyedValue)
 {
     CrossSectionalLevels level = keyedValue.Key.EffectiveCrossSectionalAttachmentLevel
                                  == CrossSectionalLevels.None
                                      ? CrossSectionalLevels.Group
                                      : keyedValue.Key.EffectiveCrossSectionalAttachmentLevel;
     int index = GetIndex(level);
     this._keyValues[index].Add(keyedValue);
     this._dimensionValues[index].Add(keyedValue);
 }