本文整理汇总了C#中ISdmxObjects.RemoveMaintainable方法的典型用法代码示例。如果您正苦于以下问题:C# ISdmxObjects.RemoveMaintainable方法的具体用法?C# ISdmxObjects.RemoveMaintainable怎么用?C# ISdmxObjects.RemoveMaintainable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISdmxObjects
的用法示例。
在下文中一共展示了ISdmxObjects.RemoveMaintainable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IncrementVersions
/// <summary>
/// Increments the versions of sdmx objects
/// </summary>
/// <param name="sdmxObjects">
/// The sdmx objects.
/// </param>
public void IncrementVersions(ISdmxObjects sdmxObjects)
{
_log.Info("Update Versions of Structures if existing structures found");
//Store a map of old versions vs the new version
IDictionary<IStructureReference, IStructureReference> oldVsNew =
new Dictionary<IStructureReference, IStructureReference>();
IDictionary<IMaintainableObject, IMaintainableObject> oldMaintVsNew =
new Dictionary<IMaintainableObject, IMaintainableObject>();
ISet<IMaintainableObject> updatedMaintainables = new HashSet<IMaintainableObject>();
ISet<IMaintainableObject> oldMaintainables = new HashSet<IMaintainableObject>();
foreach (IMaintainableObject currentMaint in sdmxObjects.GetAllMaintainables())
{
_log.Debug("Auto Version - check latest version for maintainable: " + currentMaint);
IMaintainableObject persistedMaintainable = this._structureVersionRetrievalManager.GetLatest(currentMaint);
if (persistedMaintainable == null)
{
persistedMaintainable = this._beanRetrievalManager.GetMaintainableObject(currentMaint.AsReference);
}
if (persistedMaintainable != null)
{
if (VersionableUtil.IsHigherVersion(persistedMaintainable.Version, currentMaint.Version))
{
//Modify version of maintainable to be the same as persisted maintainable
IMaintainableMutableObject mutableInstance = currentMaint.MutableInstance;
mutableInstance.Version = persistedMaintainable.Version;
//Remove the Maintainable from the submission - as we've changed the versions
sdmxObjects.RemoveMaintainable(currentMaint);
//currentMaint = mutableInstance.ImmutableInstance;
}
if (persistedMaintainable.Version.Equals(currentMaint.Version))
{
_log.Debug("Latest version is '" + persistedMaintainable.Version + "' perform update checks");
if (!currentMaint.DeepEquals(persistedMaintainable, true))
{
ISet<IIdentifiableObject> allIdentifiables1 = currentMaint.IdentifiableComposites;
ISet<IIdentifiableObject> allIdentifiables2 = persistedMaintainable.IdentifiableComposites;
bool containsAll = allIdentifiables1.ContainsAll(allIdentifiables2)
&& allIdentifiables2.ContainsAll(allIdentifiables1);
if (_log.IsInfoEnabled)
{
string increment = containsAll ? "Minor" : "Major";
_log.Info("Perform " + increment + " Version Increment for structure:" + currentMaint.Urn);
}
//Increment the version number
IMaintainableObject newVersion = this.IncrmentVersion(
currentMaint, persistedMaintainable.Version, !containsAll);
//Remove the Maintainable from the submission
sdmxObjects.RemoveMaintainable(currentMaint);
//Store the newly updated maintainable in a container for further processing
updatedMaintainables.Add(newVersion);
oldMaintainables.Add(currentMaint);
//Store the old version number mappings to the new version number
oldMaintVsNew.Add(currentMaint, newVersion);
oldVsNew.Add(currentMaint.AsReference, newVersion.AsReference);
string oldVersionNumber = currentMaint.Version;
AddOldVsNewReferences(oldVersionNumber, newVersion, oldVsNew);
}
}
}
}
//Create a set of parent sdmxObjects to not update (regardless of version)
ISet<IMaintainableObject> filterSet = new HashSet<IMaintainableObject>(updatedMaintainables);
filterSet.AddAll(sdmxObjects.GetAllMaintainables());
//Get all the referencing structures to reversion them
IEnumerable<IMaintainableObject> referencingStructures = this.RecurseUpTree(oldMaintainables, new HashSet<IMaintainableObject>(), filterSet);
foreach (IMaintainableObject currentReferencingStructure in referencingStructures)
{
_log.Info("Perform Minor Version Increment on referencing structure:" + currentReferencingStructure);
String newVersionNumber;
if (oldMaintVsNew.ContainsKey(currentReferencingStructure))
{
//The old maintainable is also in the submission and has had it's version number incremented, use this version
var tmp = oldMaintVsNew[currentReferencingStructure];
//currentReferencingStructure = oldMaintVsNew[currentReferencingStructure];
updatedMaintainables.Remove(tmp);
newVersionNumber = currentReferencingStructure.Version;
}
else
{
newVersionNumber = VersionableUtil.IncrementVersion(currentReferencingStructure.Version, false);
}
IMaintainableObject updatedMaintainable =
//.........这里部分代码省略.........