本文整理汇总了C#中ISdmxObjects.AddCategorisation方法的典型用法代码示例。如果您正苦于以下问题:C# ISdmxObjects.AddCategorisation方法的具体用法?C# ISdmxObjects.AddCategorisation怎么用?C# ISdmxObjects.AddCategorisation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISdmxObjects
的用法示例。
在下文中一共展示了ISdmxObjects.AddCategorisation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessDataflows
/// <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);
}
}
}
}
示例2: ProcessMetadataFlows
/// <summary>
/// Creates meta-dataflow and categorisations based on the input meta-dataflow
/// </summary>
/// <param name="metadataflowsType">
/// - if null will not add anything to the sdmxObjects container
/// </param>
/// <param name="beans">
/// - to add meta-dataflow and categorisations to
/// </param>
protected internal void ProcessMetadataFlows(MetadataflowsType metadataflowsType, ISdmxObjects beans)
{
var urns = new HashSet<Uri>();
if (metadataflowsType != null && ObjectUtil.ValidCollection(metadataflowsType.Metadataflow))
{
/* foreach */
foreach (MetadataflowType currentType in metadataflowsType.Metadataflow)
{
try
{
IMetadataFlow currentMetadataflow = new MetadataflowObjectCore(currentType);
this.AddIfNotDuplicateURN(beans, urns, currentMetadataflow);
// CATEGORISATIONS FROM METADATAFLOWS
if (currentType.CategoryRef != null)
{
/* foreach */
foreach (CategoryRefType cateogryRefType in currentType.CategoryRef)
{
beans.AddCategorisation(
new CategorisationObjectCore(currentMetadataflow, cateogryRefType));
}
}
}
catch (Exception th)
{
throw new MaintainableObjectException(
th,
SdmxStructureType.GetFromEnum(SdmxStructureEnumType.MetadataFlow),
currentType.agencyID,
currentType.id,
currentType.version);
}
}
}
}
示例3: ProcessCategory
/// <summary>
/// Create Categorisations from Version 2.0 category, adds the categorisation to the sdmxObjects container
/// </summary>
/// <param name="beans">
/// container to add to
/// </param>
/// <param name="categoryType">
/// The category Type.
/// </param>
/// <param name="categoryBean">
/// The category Bean.
/// </param>
protected internal void ProcessCategory(
ISdmxObjects beans, CategoryType categoryType, ICategoryObject categoryBean)
{
if (categoryType.DataflowRef != null)
{
foreach (DataflowRefType dataflowRefType in categoryType.DataflowRef)
{
// 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 = categoryBean.MaintainableParent.AgencyId;
mutable.CategoryReference = categoryBean.AsReference;
// TODO create specialized collections for TextTypeWrapperMutable and TextTypeWrapper
foreach (ITextTypeWrapper name in categoryBean.Names)
{
mutable.Names.Add(new TextTypeWrapperMutableCore(name));
}
mutable.StructureReference = dataflowRefType.URN != null
? new StructureReferenceImpl(dataflowRefType.URN)
: new StructureReferenceImpl(
dataflowRefType.AgencyID,
dataflowRefType.DataflowID,
dataflowRefType.Version,
SdmxStructureEnumType.Dataflow);
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
// sdmxObjects.AddCategorisation(new CategorisationObjectCore(categoryBean, dataflowRefType));
beans.AddCategorisation(new CategorisationObjectCore(mutable));
}
}
if (categoryType.MetadataflowRef != null)
{
foreach (var mdfRef in categoryType.MetadataflowRef)
{
beans.AddCategorisation(new CategorisationObjectCore(categoryBean, mdfRef));
}
}
}