示例#1
0
 void IEventsVisitor.Visit(ObjectCreation objectCreation)
 {
     CreateElement(SC.Elt_ObjectCreation, objectCreation.Trigger,
                   new XAttribute(SC.Attr_ObjectId, objectCreation.ObjectId),
                   MakeNullableAttr(SC.Attr_ObjectType, objectCreation.ObjectType.TypeName),
                   MakeNullableAttr(SC.Attr_CommentPropertyName, objectCreation.ObjectType.CommentPropertyName),
                   MakeNullableAttr(SC.Attr_PrimaryPropertyName, objectCreation.ObjectType.PrimaryPropertyName),
                   objectCreation.ObjectType.IsTimeless ? new XAttribute(SC.Attr_IsTimeless, "1") : null,
                   objectCreation.IsWeak ? new XAttribute(SC.Attr_IsWeak, "1") : null,
                   MakeTagsAttr(objectCreation),
                   MakeNullableAttr(SC.Attr_DisplayNamePropertyName, objectCreation.DisplayName)
                   );
 }
示例#2
0
        public bool TryDeserialize(XElement elt, out Event ret)
        {
            ret = null;
            switch (elt.Name.LocalName)
            {
            case SC.Elt_ObjectCreation:
                ret = new ObjectCreation(
                    MakeTrigger(elt),
                    objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)),
                    objectInfoPool.Intern(new ObjectTypeInfo(
                                              Attr(elt, SC.Attr_ObjectType),
                                              Attr(elt, SC.Attr_CommentPropertyName),
                                              Attr(elt, SC.Attr_PrimaryPropertyName),
                                              (Attr(elt, SC.Attr_IsTimeless) ?? "0") == "1"
                                              )),
                    isWeak: (Attr(elt, SC.Attr_IsWeak) ?? "0") == "1",
                    displayName: Attr(elt, SC.Attr_DisplayNamePropertyName)
                    );
                break;

            case SC.Elt_ObjectDeletion:
                ret = new ObjectDeletion(MakeTrigger(elt), objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)), null);
                break;

            case SC.Elt_PropertyChange:
                ret = new PropertyChange(MakeTrigger(elt),
                                         objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)),
                                         null,
                                         propertyName: propNamesPool.Intern(Attr(elt, SC.Attr_PropertyName)),
                                         value: Attr(elt, SC.Attr_Value),
                                         oldValue: Attr(elt, SC.Attr_OldValue),
                                         valueType: ToValueType(Attr(elt, SC.Attr_ValueType)));
                break;

            case SC.Elt_ParentChildRelationChange:
                ret = new ParentChildRelationChange(
                    MakeTrigger(elt),
                    objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)),
                    null,
                    newParentObjectId: objectIdsPool.Intern(Attr(elt, SC.Attr_NewParentObjectId)),
                    isWeak: (Attr(elt, SC.Attr_IsWeak) ?? "0") == "1");
                break;
            }
            if (ret != null)
            {
                ret.Tags = tagsPool.Intern(
                    new HashSet <string>((Attr(elt, SC.Attr_Tags) ?? "").Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)));
            }
            return(ret != null);
        }
示例#3
0
        void IEventsVisitor.Visit(ObjectCreation objectCreation)
        {
            bool recordEventToObjectHistory;

            if (objectCreation.IsWeak)
            {
                recordEventToObjectHistory = !ObjectExists(objectCreation.ObjectId);
            }
            else
            {
                // ensure any existing object with given id is finalized
                FinalizeExistingObject(objectCreation.ObjectId);
                recordEventToObjectHistory = true;
            }
            var obj = GetObject(objectCreation.ObjectId);

            if (recordEventToObjectHistory)
            {
                obj.SetCreationEvent(currentEvent);
                obj.AddStateChangeEvent(currentEvent);
            }
        }
示例#4
0
 void IEventsVisitor.Visit(ObjectCreation objectCreation)
 {
     Output.AppendFormat("ObjectCreation: {0}", objectCreation.ObjectId);
 }