Ejemplo n.º 1
0
		public void readStructures(String structureFile, SdmxSchemaEnumType schema) {
			IReadableDataLocation rdl = new FileReadableDataLocation(structureFile);
			spm = new StructureParsingManager(SdmxSchemaEnumType.VersionTwoPointOne);
			
			IStructureWorkspace workspace = spm.ParseStructures(rdl);
			
			ISdmxObjects sdmxObjects = workspace.GetStructureObjects(false);
			
			ISet<IMaintainableObject> maintainables =  sdmxObjects.GetAllMaintainables();
			foreach (IMaintainableObject m in maintainables) {
				Console.WriteLine(m.Urn);
				Console.WriteLine(m.StructureType.StructureType + " - " + m.Name);
				Console.WriteLine(" --- ");
			}
		}
        public void Init()
        {
            IStructureWorkspace structureWorkspace;
            IDataflowObject dataflowObject;
            IDataStructureObject dataStructureObject;

            dataQueryParseManager = new DataQueryParseManager(SdmxSchemaEnumType.Null);
            parsingManager = new StructureParsingManager();
            beanRetrivalManager = new Mock<ISdmxObjectRetrievalManager>();

            using (var fileDataFlowReadableDataLocation = new FileReadableDataLocation(FileDataFlow))
            {
                structureWorkspace = parsingManager.ParseStructures(fileDataFlowReadableDataLocation);
                ISdmxObjects structureBeans = structureWorkspace.GetStructureObjects(false);
                dataflowObject = structureBeans.Dataflows.First();
                Assert.IsNotNull(dataflowObject);
            }

            using (var fileKeybeanReadableDataLocation = new FileReadableDataLocation(FilekeyBean))
            {
                structureWorkspace = parsingManager.ParseStructures(fileKeybeanReadableDataLocation);
                ISdmxObjects structureBeans = structureWorkspace.GetStructureObjects(false);
                dataStructureObject = structureBeans.DataStructures.First();
                Assert.IsNotNull(dataStructureObject);
            }

            beanRetrivalManager.Setup(m => m.GetMaintainableObject<IDataflowObject>(It.IsAny<IMaintainableRefObject>())).Returns(dataflowObject);
            beanRetrivalManager.Setup(m => m.GetMaintainableObject<IDataStructureObject>(It.IsAny<IMaintainableRefObject>())).Returns(dataStructureObject);
        }
 /// <summary>
 /// Gets the SDMX objects.
 /// </summary>
 /// <param name="dataLocation">The data location.</param>
 /// <param name="parsingManager">The parsing manager.</param>
 /// <returns>The <see cref="ISdmxObjects"/>.</returns>
 public static ISdmxObjects GetSdmxObjects(this IReadableDataLocation dataLocation, IStructureParsingManager parsingManager)
 {
     IStructureWorkspace structureWorkspace = parsingManager.ParseStructures(dataLocation);
     return structureWorkspace.GetStructureObjects(false);
 }