/// <summary> /// Creates dataflow and categorisations based on the input dataflow /// </summary> /// <param name="dataflowsType"> /// - if null will not add anything to the sdmxObjects container /// </param> /// <param name="beans"> /// - to add dataflow and categorisations to /// </param> protected internal void ProcessDataflows(DataflowsType dataflowsType, ISdmxObjects beans) { var urns = new HashSet<Uri>(); if (dataflowsType != null && ObjectUtil.ValidCollection(dataflowsType.Dataflow)) { /* foreach */ foreach (DataflowType currentType in dataflowsType.Dataflow) { try { IDataflowObject currentDataflow = new DataflowObjectCore(currentType); this.AddIfNotDuplicateURN(beans, urns, currentDataflow); // CATEGORISATIONS FROM DATAFLOWS if (currentType.CategoryRef != null) { /* foreach */ foreach (CategoryRefType cateogryRefType in currentType.CategoryRef) { // use mutable for now until the following issue is fixed. // http://www.metadatatechnology.com/mantis/view.php?id=1341 ICategorisationMutableObject mutable = new CategorisationMutableCore(); mutable.AgencyId = currentDataflow.AgencyId; mutable.CategoryReference = RefUtil.CreateCategoryRef(cateogryRefType); // TODO create specialized collections for TextTypeWrapperMutable and TextTypeWrapper foreach (ITextTypeWrapper name in currentDataflow.Names) { mutable.Names.Add(new TextTypeWrapperMutableCore(name)); } mutable.StructureReference = currentDataflow.AsReference; mutable.Id = string.Format( CultureInfo.InvariantCulture, "{0}_{1}", mutable.CategoryReference.GetHashCode(), mutable.StructureReference.GetHashCode()); // TODO use MT fix in java when is done. Mantis ticket: // http://www.metadatatechnology.com/mantis/view.php?id=1341 beans.AddCategorisation(new CategorisationObjectCore(mutable)); ////sdmxObjects.AddCategorisation(new CategorisationObjectCore(currentDataflow, cateogryRefType)); } } } catch (Exception th) { throw new MaintainableObjectException( th, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dataflow), currentType.agencyID, currentType.id, currentType.version); } } } }
/// <summary> /// Creates dataflows and categorisations based on the input dataflows /// </summary> /// <param name="dataflowsType"> /// - if null will not add anything to the beans container /// </param> /// <param name="beans"> /// - to add dataflows to beans /// </param> private void ProcessDataflows(DataflowsType dataflowsType, ISdmxObjects beans) { var urns = new HashSet<Uri>(); if (dataflowsType != null && ObjectUtil.ValidCollection(dataflowsType.Dataflow)) { /* foreach */ foreach (DataflowType currentType in dataflowsType.Dataflow) { try { IDataflowObject currentDataflow = new DataflowObjectCore(currentType); this.AddIfNotDuplicateURN(beans, urns, currentDataflow); } catch (Exception th) { throw new MaintainableObjectException( th, SdmxStructureType.GetFromEnum(SdmxStructureEnumType.Dataflow), currentType.agencyID, currentType.id, currentType.version); } } } }