Ejemplo n.º 1
0
 public ListItem(XmlElement element)
 {
     if (element.HasAttribute("ID"))
     {
         _id = new Tridion.ContentManager.TcmUri(element.GetAttribute("ID"));
     }
     if (element.HasAttribute("ParentOrgItemID"))
     {
         _parentId = new Tridion.ContentManager.TcmUri(element.GetAttribute("ParentOrgItemID"));
     }
     if (element.HasAttribute("Title"))
     {
         _title = element.GetAttribute("Title");
     }
     if (element.HasAttribute("Path"))
     {
         _path = element.GetAttribute("Path");
     }
     if (element.HasAttribute("Modified"))
     {
         _modified = DateTime.Parse(element.GetAttribute("Modified"));
     }
     if (element.HasAttribute("IsShared"))
     {
         _isShared = bool.Parse(element.GetAttribute("IsShared"));
     }
     if (element.HasAttribute("IsLocalized"))
     {
         _isLocalized = bool.Parse(element.GetAttribute("IsLocalized"));
     }
     if (element.HasAttribute("TrusteeID"))
     {
         _trusteeId = new TcmUri(element.GetAttribute("TrusteeID"));
     }
     if (element.HasAttribute("Icon"))
     {
         _icon = element.GetAttribute("Icon");
     }
     if (element.HasAttribute("URL"))
     {
         _url = element.GetAttribute("URL");
     }
 }
        public object GetAllPublishedItems(TcmIds tcmIDs)
        {
            GetPublishedInfo getFinalPublishedInfo = new GetPublishedInfo();
            var         multipleListItems          = new List <ListItems>();
            XmlDocument doc = new XmlDocument();

            try
            {
                foreach (var tcmId in tcmIDs.IDs)
                {
                    TCM.TcmUri iTcmUri = new TCM.TcmUri(tcmId.ToString());
                    XElement   listXml = null;
                    switch (iTcmUri.ItemType.ToString())
                    {
                    case CONSTANTS.PUBLICATION:
                        listXml = Client.GetListXml(tcmId.ToString(), new RepositoryItemsFilterData
                        {
                            ItemTypes   = new[] { ItemType.Component, ItemType.ComponentTemplate, ItemType.Category, ItemType.Page },
                            Recursive   = true,
                            BaseColumns = ListBaseColumns.Extended
                        });
                        break;

                    case CONSTANTS.FOLDER:
                        listXml = Client.GetListXml(tcmId.ToString(), new OrganizationalItemItemsFilterData
                        {
                            ItemTypes   = new[] { ItemType.Component, ItemType.ComponentTemplate },
                            Recursive   = true,
                            BaseColumns = ListBaseColumns.Extended
                        });
                        break;

                    case CONSTANTS.STRUCTUREGROUP:
                        listXml = Client.GetListXml(tcmId.ToString(), new OrganizationalItemItemsFilterData()
                        {
                            ItemTypes   = new[] { ItemType.Page },
                            Recursive   = true,
                            BaseColumns = ListBaseColumns.Extended
                        });
                        break;

                    case CONSTANTS.CATEGORY:
                        listXml = Client.GetListXml(tcmId.ToString(), new RepositoryItemsFilterData
                        {
                            ItemTypes   = new[] { ItemType.Category },
                            Recursive   = true,
                            BaseColumns = ListBaseColumns.Extended
                        });
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                    if (listXml == null)
                    {
                        throw new ArgumentNullException(nameof(listXml));
                    }
                    doc.LoadXml(listXml.ToString());
                    multipleListItems.Add(TransformObjectAndXml.Deserialize <ListItems>(doc));
                }
                return(getFinalPublishedInfo.FilterIsPublishedItem(multipleListItems).SelectMany(publishedItem => publishedItem, (publishedItem, item) => new { publishedItem, item }).Select(@t => new { @t, publishInfo = Client.GetListPublishInfo(@t.item.ID) }).SelectMany(@t => getFinalPublishedInfo.ReturnFinalList(@t.publishInfo, @[email protected])).ToList());
            }
            catch (Exception ex)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }