/// <summary>
        /// 
        /// </summary>
        /// <param name="docType"></param>
        /// <param name="templateId"> </param>
        /// <param name="x"></param>
        /// <returns></returns>
        private ContentEditorModel CreateContentNodeFromXml(DocumentTypeEditorModel docType, HiveId templateId, XElement x)
        {
            var parentId = x.Attribute("parentID");
            var contentNode = new ContentEditorModel(HiveId.ConvertIntToGuid((int)x.Attribute("id")))
            {
                Name = (string)x.Attribute("nodeName"),
                DocumentTypeId = docType == null ? HiveId.Empty : docType.Id,
                DocumentTypeName = docType == null ? "" : docType.Name,
                DocumentTypeAlias = docType == null ? "" : docType.Alias,
                ParentId = parentId != null ? HiveId.ConvertIntToGuid((int)parentId) : HiveId.Empty,

                //assign the properties
                Properties = GetNodeProperties(x, templateId)
            };
            return contentNode;
        }
Beispiel #2
0
        private void InitRepository()
        {
            _testRepository = new List<ContentEditorModel>();

            var tabIds = _docTypes.SelectMany(tabs => tabs.DefinedTabs).Select(x => x.Id).ToList();

            var currTab = 0;

            XmlData.Root.Descendants()
                .Where(x => x.Attribute("isDoc") != null)
                .ToList()
                .ForEach(x =>
                {
                    var customProperties = new List<ContentProperty>();
                    //create the model
                    var parentId = x.Attribute("parentID");
                    var publishedScheduledDate = x.Attribute("publishedScheduledDate");
                    var unpublishedScheduledDate = x.Attribute("unPublishedScheduledDate");
                    var publishedDate = x.Attribute("publishedDate");

                    //BUG: We need to change this back once the Hive IO provider is fixed and it get its ProviderMetadata.MappingRoot  set
                    // (APN) - I've changed back
                    //var template = ((string)x.Attribute("template")).IsNullOrWhiteSpace() ? HiveId.Empty : new HiveId((Uri)null, "templates", new HiveIdValue((string)x.Attribute("template")));
                    var template = ((string)x.Attribute("template")).IsNullOrWhiteSpace() ? HiveId.Empty : new HiveId(new Uri("storage://templates"), "templates", new HiveIdValue((string)x.Attribute("template")));

                    var docType = string.IsNullOrEmpty((string)x.Attribute("nodeType"))
                                      ? null
                                      : DocTypes.Where(d => d.Id == HiveId.ConvertIntToGuid((int)x.Attribute("nodeType"))).SingleOrDefault();

                    var contentNode = new ContentEditorModel(HiveId.ConvertIntToGuid((int)x.Attribute("id")))
                        {                            
                            Name = (string)x.Attribute("nodeName"),
                            DocumentTypeId = docType == null ? HiveId.Empty : docType.Id,
                            DocumentTypeName = docType == null ? "" : docType.Name,
                            DocumentTypeAlias = docType == null ? "" : docType.Alias,                                                                                 
                            ParentId = parentId != null ? HiveId.ConvertIntToGuid((int)parentId) : HiveId.Empty,
                            //assign the properties
                            Properties = GetNodeProperties((int)x.Attribute("id"), template)
                        };

                    //add the new model
                    _testRepository.Add(contentNode);

                });
        }