DeserializeVersion() public method

public DeserializeVersion ( N2.Edit.Versioning.ContentVersion version ) : ContentItem
version N2.Edit.Versioning.ContentVersion
return ContentItem
Exemplo n.º 1
0
        public static VersionInfo GetVersionInfo(this ContentVersion version, ContentVersionRepository repository)
        {
            try
            {
                return(new VersionInfo
                {
                    ID = version.Master.ID.Value,
                    ContentFactory = () => repository.DeserializeVersion(version),
                    Expires = version.Expired,
                    Published = version.Published,
                    FuturePublish = version.FuturePublish,
                    SavedBy = version.SavedBy,
                    State = version.State,
                    Title = version.Title,
                    VersionIndex = version.VersionIndex,
                    PartsCount = version.ItemCount - 1
                });
            }
            catch (Exception ex)
            {
                var iv = new InvalidVersionInfo();
                if (version != null)
                {
                    iv.InnerException = ex;
                    iv.Expires        = version.Expired;
                    iv.Published      = version.Published;
                    iv.FuturePublish  = version.FuturePublish;
                    iv.SavedBy        = version.SavedBy;
                    iv.State          = version.State;
                    iv.Title          = version.Title;
                    iv.VersionIndex   = version.VersionIndex;
                    iv.PartsCount     = version.ItemCount - 1;

                    if (version.Master.ID != null)
                    {
                        iv.ID = version.Master.ID.Value;
                    }
                    else
                    {
                        Logger.Error("version.Master.ID is null at VersionInfo::GetVersionInfo(...)");
                    }
                }
                else
                {
                    Logger.Error("version == null at VersionInfo::GetVersionInfo(...)");
                }
                return(iv);
            }
        }
Exemplo n.º 2
0
 public static VersionInfo GetVersionInfo(this ContentVersion version, ContentVersionRepository repository)
 {
     return(new VersionInfo
     {
         ID = version.Master.ID.Value,
         ContentFactory = () => repository.DeserializeVersion(version),
         Expires = version.Expired,
         Published = version.Published,
         FuturePublish = version.FuturePublish,
         SavedBy = version.SavedBy,
         State = version.State,
         Title = version.Title,
         VersionIndex = version.VersionIndex
     });
 }
Exemplo n.º 3
0
        public static VersionInfo GetVersionInfo(this ContentVersion version, ContentVersionRepository repository)
        {
            try
            {
                return new VersionInfo
                {
                    ID = version.Master.ID.Value,
                    ContentFactory = () => repository.DeserializeVersion(version),
                    Expires = version.Expired,
                    Published = version.Published,
                    FuturePublish = version.FuturePublish,
                    SavedBy = version.SavedBy,
                    State = version.State,
                    Title = version.Title,
                    VersionIndex = version.VersionIndex,
                    PartsCount = version.ItemCount - 1
                };
            }
            catch (Exception ex)
            {
                var iv = new InvalidVersionInfo();
                if (version != null)
                {
                    iv.InnerException = ex;
                    iv.Expires = version.Expired;
                    iv.Published = version.Published;
                    iv.FuturePublish = version.FuturePublish;
                    iv.SavedBy = version.SavedBy;
                    iv.State = version.State;
                    iv.Title = version.Title;
                    iv.VersionIndex = version.VersionIndex;
                    iv.PartsCount = version.ItemCount - 1;

                    if (version.Master.ID != null)
                        iv.ID = version.Master.ID.Value;
                    else
                        Logger.Error("version.Master.ID is null at VersionInfo::GetVersionInfo(...)");
                }
                else
                {
                    Logger.Error("version == null at VersionInfo::GetVersionInfo(...)");
                }
                return iv;
            }
        }
Exemplo n.º 4
0
        public static ContentItem GetVersionItem(this ContentVersionRepository repository, ContentItem item, int versionIndex)
        {
            var version = repository.GetVersion(item, versionIndex);

            return(repository.DeserializeVersion(version));
        }
Exemplo n.º 5
0
 public static VersionInfo GetVersionInfo(this ContentVersion version, ContentVersionRepository repository)
 {
     return new VersionInfo
     {
         ID = version.Master.ID.Value,
         ContentFactory = () => repository.DeserializeVersion(version),
         Expires = version.Expired,
         Published = version.Published,
         FuturePublish = version.FuturePublish,
         SavedBy = version.SavedBy,
         State = version.State,
         Title = version.Title,
         VersionIndex = version.VersionIndex
     };
 }