/// <summary>
        /// Gets the meta information for a given component
        /// </summary>
        /// <param name="componentUri"></param>
        /// <returns>ComponentMeta object holding the meta information</returns>
        public IComponentMeta GetComponentMeta(string componentUri)
        {
            ComponentMeta compMeta = new ComponentMeta();

            using (Com.Tridion.Util.TCMURI uri = new Com.Tridion.Util.TCMURI(componentUri))
            {
                using (Com.Tridion.Meta.ComponentMetaFactory fac = new Com.Tridion.Meta.ComponentMetaFactory(PublicationId))
                {
                    Com.Tridion.Meta.ComponentMeta componentMeta = fac.GetMeta(uri.GetItemId());
                    //Convert Java.Util.Date to System.Date //TODO: check if correct
                    string creationDate     = componentMeta.GetCreationDate().ToString();
                    string modificationDate = componentMeta.GetModificationDate().ToString();

                    compMeta.CreationDate     = Convert.ToDateTime(creationDate, System.Globalization.CultureInfo.InvariantCulture);
                    compMeta.ModificationDate = Convert.ToDateTime(modificationDate, System.Globalization.CultureInfo.InvariantCulture);

                    return(compMeta);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the raw string (xml) from the broker db by URI
        /// </summary>
        /// <param name="Url">TCM URI of the page</param>
        /// <returns>String with page xml or empty string if no page was found</returns>
        private string GetStringContentFromBrokerByUri(string TcmUri)
        {
            string retVal = string.Empty;

            //Get the publication ID an the itemID from the TcmUri
            using (var tcmUri = new Com.Tridion.Util.TCMURI(TcmUri))
            {
                int publicationID = tcmUri.GetPublicationId();
                int pageID        = tcmUri.GetItemId();

                using (var pageHome = new Com.Tridion.Broker.Pages.SQLPageHome())
                {
                    var data = pageHome.FindByPrimaryKey(publicationID, pageID);

                    retVal = data.GetString();
                }
            }

            return(retVal);
        }
コード例 #3
0
        /// <summary>
        /// Gets the meta information for a given component
        /// </summary>
        /// <param name="componentUri"></param>
        /// <returns>ComponentMeta object holding the meta information</returns>
        public IComponentMeta GetComponentMeta(string componentUri)
        {
            ComponentMeta compMeta = new ComponentMeta();
            using (Com.Tridion.Util.TCMURI uri = new Com.Tridion.Util.TCMURI(componentUri))
            {
                using (Com.Tridion.Meta.ComponentMetaFactory fac = new Com.Tridion.Meta.ComponentMetaFactory(PublicationId))
                {
                    Com.Tridion.Meta.ComponentMeta componentMeta = fac.GetMeta(uri.GetItemId());
                    //Convert Java.Util.Date to System.Date //TODO: check if correct
                    string creationDate = componentMeta.GetCreationDate().ToString();
                    string modificationDate = componentMeta.GetModificationDate().ToString();

                    compMeta.CreationDate = Convert.ToDateTime(creationDate, System.Globalization.CultureInfo.InvariantCulture);
                    compMeta.ModificationDate = Convert.ToDateTime(modificationDate, System.Globalization.CultureInfo.InvariantCulture);

                    return compMeta;
                }
            }
        }