/// <summary> /// Derived classes must take care to undelete any objects "owned" by the /// object in question. For example, a Measure must take care of calling /// Undelete on its KPI (if any), a Hierarchy must call Undelete on each /// of its levels, etc. /// </summary> /// <param name="collection"></param> internal override void Undelete(ITabularObjectCollection collection) { RenewMetadataObject(); Collection = collection.GetCurrentCollection(); Collection.Add(this); }
public UndoAddRemoveAction(ITabularObjectCollection collection, TabularNamedObject obj, UndoAddRemoveActionType actionType) { _tomObjectType = obj.MetadataObject.GetType(); _json = Microsoft.AnalysisServices.Tabular.JsonSerializer.SerializeObject(obj.MetadataObject, TabularObject.RenewMetadataOptions); _collection = collection; _obj = obj; _actionType = actionType; }
public UndoClearAction(ITabularObjectCollection collection, TabularNamedObject[] content) { _collection = collection; _objs = content.Select(o => new Tuple <TabularNamedObject, Type, string>( o, o.MetadataObject.GetType(), TOM.JsonSerializer.SerializeObject(o.MetadataObject))).ToArray(); }
/// <summary> /// Derived classes must take care to undelete any objects "owned" by the /// object in question. For example, a Measure must take care of calling /// Undelete on its KPI (if any), a Hierarchy must call Undelete on each /// of its levels, etc. /// </summary> /// <param name="collection"></param> internal override void Undelete(ITabularObjectCollection collection, Type objectType, string json) { Handler.WrapperLookup.Remove(MetadataObject); MetadataObject = Microsoft.AnalysisServices.Tabular.JsonSerializer.DeserializeObject(objectType, json) as NamedMetadataObject; Handler.WrapperLookup.Add(MetadataObject, this); Collection = collection; Collection.Add(this); }
/// <summary> /// This method is called after an object has been removed from a collection. /// Derived classes should override this to perform any cleanup necessary after /// removal. For example, when a level is removed from a hierarchy, the hierachy /// must compact the ordinal numbers of the remaining levels. /// /// The base class will automatically call AfterRemoval on all child objects to /// the object that was removed. /// </summary> /// <param name="collection"></param> internal virtual void AfterRemoval(ITabularObjectCollection collection) { var container = this as ITabularObjectContainer; if (container != null) { foreach (var child in container.GetChildren().OfType <TabularNamedObject>()) { child.AfterRemoval(GetCollectionForChild(child)); } } }
/// <summary> /// Creates a TabularObject representing the provided TOM MetadataObject. /// </summary> /// <param name="metadataObject"></param> protected TabularObject(TOM.MetadataObject metadataObject) { if (metadataObject == null) { throw new ArgumentNullException("metadataObject"); } _metadataObject = metadataObject; Handler = TabularModelHandler.Singleton; Handler.WrapperLookup[metadataObject] = this; // Assign collection based on parent: if (metadataObject.Parent != null) { Collection = (Handler.WrapperLookup[metadataObject.Parent] as TabularObject).GetCollectionForChild(this); } }
internal virtual void Undelete(ITabularObjectCollection collection) { }
public UndoClearAction(ITabularObjectCollection collection, TabularNamedObject[] content) { _collection = collection; _objs = content; }
internal override void AfterRemoval(ITabularObjectCollection collection) { (collection as LevelCollection).Hierarchy.CompactLevelOrdinals(); base.AfterRemoval(collection); }
internal virtual void Undelete(ITabularObjectCollection collection, Type tomObjectType, string tomJson) { }
public UndoAddRemoveReferenceAction(ITabularObjectCollection collection, TabularNamedObject obj, UndoAddRemoveActionType actionType) { _collection = collection; _obj = obj; _actionType = actionType; }