Esempio n. 1
0
        /// <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);
        }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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();
 }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
0
        /// <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));
                }
            }
        }
Esempio n. 6
0
        /// <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);
            }
        }
Esempio n. 7
0
 internal virtual void Undelete(ITabularObjectCollection collection)
 {
 }
Esempio n. 8
0
 public UndoClearAction(ITabularObjectCollection collection, TabularNamedObject[] content)
 {
     _collection = collection;
     _objs       = content;
 }
Esempio n. 9
0
 internal override void AfterRemoval(ITabularObjectCollection collection)
 {
     (collection as LevelCollection).Hierarchy.CompactLevelOrdinals();
     base.AfterRemoval(collection);
 }
Esempio n. 10
0
 internal virtual void Undelete(ITabularObjectCollection collection, Type tomObjectType, string tomJson)
 {
 }
Esempio n. 11
0
 public UndoAddRemoveReferenceAction(ITabularObjectCollection collection, TabularNamedObject obj, UndoAddRemoveActionType actionType)
 {
     _collection = collection;
     _obj        = obj;
     _actionType = actionType;
 }