Ejemplo n.º 1
0
        /// <summary>
        /// Builds an <see cref="TableInfo"/> from the specified <paramref name="buildFrom"/>
        /// </summary>
        /// <param name="buildFrom">The type to build from.</param>
        /// <returns>
        /// an <see cref="TableInfo"/> from the specified <paramref name="buildFrom"/>
        /// </returns>
        public TableInfo Build(Type buildFrom)
        {
            var propertyInfo      = buildFrom.GetProperty("ImmutableInstance");
            var returnType        = propertyInfo.GetGetMethod().ReturnType;
            var sdmxStructureType = SdmxStructureType.ParseClass(returnType);

            return(this.Build(sdmxStructureType));
        }
        /// <summary>
        ///     An empty Set will be returned if there are no matches to the query
        /// </summary>
        /// <param name="maintainableReference">
        /// Contains the identifiers of the structures to returns, can include widcarded values (null indicates a wildcard).
        /// </param>
        /// <param name="returnStub">
        /// If true then a stub object will be returned
        /// </param>
        /// /// <param name="returnLatest">
        /// If true then the latest version is returned, regardless of whether version information is supplied
        /// </param>
        /// <returns>
        /// The set of <see cref="IMaintainableObject"/> .
        /// </returns>
        public ISet <T> GetMaintainableObjects <T>(IMaintainableRefObject maintainableReference, bool returnStub, bool returnLatest) where T : IMaintainableObject
        {
            ISet <T> returnSet;

            if (returnLatest)
            {
                maintainableReference = new MaintainableRefObjectImpl(maintainableReference.AgencyId, maintainableReference.MaintainableId, null);
            }

            SdmxStructureType   type = SdmxStructureType.ParseClass(typeof(T));
            IStructureReference sRef = new StructureReferenceImpl(maintainableReference, type);

            switch (sRef.TargetReference.EnumType)
            {
            //case SdmxStructureEnumType.AgencyScheme:
            //    returnSet = new HashSet<T>(base.GetAgencySchemeObjects(maintainableReference, returnStub).Cast<T>());
            //    break;
            //case SdmxStructureEnumType.DataConsumerScheme:
            //    returnSet = new HashSet<T>(this.GetDataConsumerSchemeObjects(maintainableReference, returnStub).Cast<T>());
            //    break;
            //case SdmxStructureEnumType.AttachmentConstraint:
            //    returnSet = new HashSet<T>(this.GetAttachmentConstraints(maintainableReference, returnLatest, returnStub).Cast<T>());
            //    break;
            case SdmxStructureEnumType.ContentConstraint:
                returnSet = new HashSet <T>(this.GetContentConstraints(maintainableReference, returnLatest, returnStub).Cast <T>());
                break;

            //case SdmxStructureEnumType.DataProviderScheme:
            //    returnSet = new HashSet<T>(this.GetDataProviderSchemeObjects(maintainableReference, returnStub).Cast<T>());
            //    break;
            case SdmxStructureEnumType.Categorisation:
                returnSet = new HashSet <T>(this.GetCategorisationObjects(maintainableReference, returnStub).Cast <T>());
                break;

            case SdmxStructureEnumType.CategoryScheme:
                returnSet = new HashSet <T>(this.GetCategorySchemeObjects(maintainableReference, returnLatest, returnStub).Cast <T>());
                break;

            case SdmxStructureEnumType.CodeList:
                returnSet = new HashSet <T>(this.GetCodelistObjects(maintainableReference, returnLatest, returnStub).Cast <T>());
                break;

            case SdmxStructureEnumType.ConceptScheme:
                returnSet = new HashSet <T>(this.GetConceptSchemeObjects(maintainableReference, returnLatest, returnStub).Cast <T>());
                break;

            case SdmxStructureEnumType.Dataflow:
                returnSet = new HashSet <T>(this.GetDataflowObjects(maintainableReference, returnLatest, returnStub).Cast <T>());
                break;

            case SdmxStructureEnumType.HierarchicalCodelist:
                returnSet = new HashSet <T>(this.GetHierarchicCodeListObjects(maintainableReference, returnLatest, returnStub).Cast <T>());
                break;

            case SdmxStructureEnumType.Dsd:
                returnSet = new HashSet <T>(this.GetDataStructureObjects(maintainableReference, returnLatest, returnStub).Cast <T>());
                break;

            //case SdmxStructureEnumType.MetadataFlow:
            //    returnSet = new HashSet<T>(this.GetMetadataflowObjects(maintainableReference, returnLatest, returnStub).Cast<T>());
            //    break;
            //case SdmxStructureEnumType.Msd:
            //    returnSet = new HashSet<T>(this.GetMetadataStructureObjects(maintainableReference, returnLatest, returnStub).Cast<T>());
            //    break;
            //case SdmxStructureEnumType.OrganisationUnitScheme:
            //    returnSet = new HashSet<T>(this.GetOrganisationUnitSchemeObjects(maintainableReference, returnLatest, returnStub).Cast<T>());
            //    break;
            //case SdmxStructureEnumType.Process:
            //    returnSet = new HashSet<T>(this.GetProcessObjects(maintainableReference, returnLatest, returnStub).Cast<T>());
            //    break;
            //case SdmxStructureEnumType.ReportingTaxonomy:
            //    returnSet = new HashSet<T>(this.GetReportingTaxonomyObjects(maintainableReference, returnLatest, returnStub).Cast<T>());
            //    break;
            //case SdmxStructureEnumType.StructureSet:
            //    returnSet = new HashSet<T>(this.GetStructureSetObjects(maintainableReference, returnLatest, returnStub).Cast<T>());
            //    break;
            //case SdmxStructureEnumType.ProvisionAgreement:
            //    returnSet = new HashSet<T>(this.GetProvisionAgreementObjects(maintainableReference, returnLatest, returnStub).Cast<T>());
            //    break;
            default:
                throw new SdmxException(this, FlyExceptionObject.FlyExceptionTypeEnum.RetrivalParsingError, new Exception(sRef.TargetReference.EnumType.ToString()));
            }

            //if (returnStub && _serviceRetrievalManager != null)
            //{
            //    ISet<T> stubSet = new HashSet<T>();
            //    foreach (T returnItm in returnSet)
            //    {
            //        if (returnItm.IsExternalReference.IsTrue)
            //            stubSet.Add(returnItm);
            //        else
            //            stubSet.Add((T)_serviceRetrievalManager.CreateStub(returnItm));
            //    }
            //    returnSet = stubSet;
            //}
            return(returnSet);
        }
        /// <summary>
        /// Gets a set of all MaintainableObjects of type T that match the reference parameters in the IMaintainableRefObject argument.
        /// An empty Set will be returned if there are no matches to the query
        /// </summary>
        /// <typeparam name="T">The type of the maintainable. It is constraint  </typeparam>
        /// <param name="maintainableInterface">The maintainable interface.</param>
        /// <param name="maintainableReference">Contains the identifiers of the structures to returns, can include wild-carded values (null indicates a wild-card).</param>
        /// <returns>
        /// The set of <see cref="IMaintainableObject" /> .
        /// </returns>
        /// <remarks>This method exists only for compatibility reasons with Java implementation of this interface which uses raw types and unchecked generics.</remarks>
        public ISet <T> GetMaintainableObjects <T>(Type maintainableInterface, IMaintainableRefObject maintainableReference) where T : ISdmxObject
        {
            SdmxStructureType type = SdmxStructureType.ParseClass(maintainableInterface);

            return(new HashSet <T>(GetMaintainablesOfType <IMaintainableObject>(type, maintainableReference, false, false).Cast <T>()));
        }