public ComplexDataQueryImpl(string datasetId, 
								TextSearch datasetIdOperator, 
								ISet<IDataProvider> dataProviders, 
								IDataStructureObject dataStructure, 
								IDataflowObject dataFlow,
								IProvisionAgreementObject provisionAgreement,  
								IList<ITimeRange> lastUpdatedDate, 
								int? maxObs, 
								int? defaultLimit, 
								bool orderAsc, 
								ObservationAction obsAction, 
								string dimensionAtObservation,
								bool hasExplicitMeasures, 
								DataQueryDetail queryDetail, 
								ICollection<IComplexDataQuerySelectionGroup> complexDataQuerySelectionGroup)
        {

		    this._datasetId = datasetId;

		    if (datasetIdOperator != null)
			    this._datasetIdOperator = datasetIdOperator;
		    else
			    this._datasetIdOperator = TextSearch.GetFromEnum(TextSearchEnumType.Equal);
		
            if (dataProviders != null) 
            {
			    this._dataProviders = new HashSet<IDataProvider>(dataProviders);
		    }

		    base.DataStructure = dataStructure;
		    base.Dataflow = dataFlow;
		    this._provisionAgreement = provisionAgreement;

		    if(lastUpdatedDate != null) 
            {
			    this._lastUpdatedDate = new List<ITimeRange>(lastUpdatedDate);
		    }

		    if (orderAsc) 
			    base.FirstNObservations = maxObs;
		    else 
			    base.LastNObservations = maxObs;

		    this._defaultLimit = defaultLimit;

		    if (obsAction!=null)
			    this._obsAction = obsAction;
		    else 
			    this._obsAction = ObservationAction.GetFromEnum(ObservationActionEnumType.Active);

		    this.DimensionAtObservation = dimensionAtObservation;

		    if (dimensionAtObservation != null)
            {
			    //the values: 'AllDimensions' and 'TIME_PERIOD' are valid values.
			    if (dimensionAtObservation.Equals(_allDimensions) || dimensionAtObservation.Equals(DimensionAtObservationEnumType.Time.ToString()))
				    this.DimensionAtObservation = dimensionAtObservation;
			    else //check if the value is a dimension Value
				    CheckDimensionExistence(dimensionAtObservation, dataStructure);
		    }
            else
            {
			    this.DimensionAtObservation = GetDimensionAtObservationLevel(dataStructure);
		    }

		    this._hasExplicitMeasures = hasExplicitMeasures;

		    if (queryDetail != null)
			    this._queryDetail = queryDetail;
		    else
			    this._queryDetail = DataQueryDetail.GetFromEnum(DataQueryDetailEnumType.Full);

		    if (complexDataQuerySelectionGroup != null) 
            {
			    foreach (IComplexDataQuerySelectionGroup cdqsg in complexDataQuerySelectionGroup) 
                {
				    if (cdqsg != null) 
                    {
					    this._complexDataQuerySelectionGroups.Add(cdqsg);
				    }
			    }
		    }

		    //perform validation 	
		    ValidateQuery();
		    ValidateProvisionAgreement();
	    }
	    public ComplexDataQueryImpl(string datasetId, TextSearch datasetIdOperator, 
                                    ISet<IDataProvider> dataProviders, 
			                        IDataStructureObject dataStructure, IDataflowObject dataFlow,
			                        IProvisionAgreementObject provisionAgreement, 
                                    IList<ITimeRange> lastUpdatedDate,  
			                        int? firstNObs, int? lastNObs, int? defaultLimit, 
                                    ObservationAction obsAction, string dimensionAtObservation,
			                        bool hasExplicitMeasures, DataQueryDetail queryDetail, 
                                    ISet<IComplexDataQuerySelection> complexSelections, 
			                        DateTime dateFrom, OrderedOperator dateFromOperator, 
                                    DateTime dateTo,  OrderedOperator dateToOperator,
                                    ISet<IComplexComponentValue> primaryMeasureValues)
        {
		    this._datasetId = datasetId;
		    if (datasetIdOperator != null)
			    this._datasetIdOperator = datasetIdOperator;
		    else
			    this._datasetIdOperator = TextSearch.GetFromEnum(TextSearchEnumType.Equal);

		    this._dataProviders = dataProviders;
		    base.DataStructure = dataStructure;
		    base.Dataflow = dataFlow;
		    this._provisionAgreement = provisionAgreement;
		    this._lastUpdatedDate = lastUpdatedDate;
		    base.FirstNObservations = firstNObs;
		    base.LastNObservations = lastNObs;
		    this._defaultLimit = defaultLimit;

		    if (obsAction != null)
			    this._obsAction = obsAction;
		    else 
			    this._obsAction = ObservationAction.GetFromEnum(ObservationActionEnumType.Active);

		    this.DimensionAtObservation = dimensionAtObservation;
		    if (dimensionAtObservation != null)
            {
			    //the values: 'AllDimensions' and 'TIME_PERIOD' are valid values.
			    if (dimensionAtObservation.Equals(_allDimensions) || dimensionAtObservation.Equals(DimensionAtObservationEnumType.Time.ToString()))
				    this.DimensionAtObservation = dimensionAtObservation;
			    else//check if the value is a dimension Value
				    CheckDimensionExistence(dimensionAtObservation, dataStructure);
		    }
            else
            {
			    this.DimensionAtObservation = GetDimensionAtObservationLevel(dataStructure);
		    }
		
		    this._hasExplicitMeasures = hasExplicitMeasures;
		    if (queryDetail != null)
			    this._queryDetail = queryDetail;
		    else
			    this._queryDetail = DataQueryDetail.GetFromEnum(DataQueryDetailEnumType.Full);

		    if(ObjectUtil.ValidCollection(complexSelections) || dateFrom != null || dateTo != null) 
            {
			    ISdmxDate sdmxDateFrom = null;
			    if(dateFrom != null) 
                {
				    sdmxDateFrom = new SdmxDateCore(dateFrom, TimeFormatEnumType.Date);
			    }
			    ISdmxDate sdmxDateTo = null;
			    if(dateFrom != null) {
				    sdmxDateTo = new SdmxDateCore(dateTo, TimeFormatEnumType.Date);
			    }
			    this._complexDataQuerySelectionGroups.Add(new ComplexDataQuerySelectionGroupImpl(complexSelections, sdmxDateFrom, dateFromOperator, sdmxDateTo,  dateToOperator, primaryMeasureValues));
		    }

		    //perform validation 	
		    ValidateQuery();
		    ValidateProvisionAgreement();
	    }