Beispiel #1
0
        public List <string> GenerateInfoForAllSchema()
        {
            List <string> allSchema = new List <string>();

            TcmUri uri = new TcmUri(bbFolderURI);

            SessionAwareCoreServiceClient client = GetCoreServiceClient();

            RepositoryItemsFilterData filter = new RepositoryItemsFilterData();


            filter.ItemTypes   = new[] { Tridion.ContentManager.CoreService.Client.ItemType.Schema };
            filter.Recursive   = true;
            filter.BaseColumns = Tridion.ContentManager.CoreService.Client.ListBaseColumns.Id;

            IdentifiableObjectData[] schemas = client.GetList(bbFolderURI, filter);

            foreach (SchemaData schema in schemas)
            {
                SchemaData sch = (SchemaData)client.Read(schema.Id, null);
                ParseSchema(sch);
                allSchema.Add(formattedSchemaInfo);
            }

            return(allSchema);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _coreServiceEndpoint  = new EndpointAddress(WebConfigurationManager.AppSettings["EndpointAddress"]);
            _vocabulariesAppId    = WebConfigurationManager.AppSettings["VocabulariesAppId"];
            _typeOfAppId          = WebConfigurationManager.AppSettings["TypeOfAppId"];
            _schemaPublicationUri = WebConfigurationManager.AppSettings["SchemaPublicationUri"];

            if (!IsPostBack)
            {
                var client = new SessionAwareCoreServiceClient(_binding, _coreServiceEndpoint);
                client.Impersonate(HttpContext.Current.User.Identity.Name);

                // load vocabularies appdata
                ApplicationData appData = client.ReadApplicationData(null, _vocabulariesAppId);
                if (appData != null)
                {
                    AppData.Text = Encoding.Unicode.GetString(appData.Data);
                }
                else
                {
                    // load default xml
                    AppData.Text = "<vocabularies>\n  <vocabulary prefix=\"s\" name=\"http://schema.org\"/>\n</vocabularies>";
                }

                // load schemas
                var filter = new RepositoryItemsFilterData {
                    ItemTypes = new[] { ItemType.Schema }, Recursive = true
                };
                var schemas = client.GetList(_schemaPublicationUri, filter);
                foreach (var schema in schemas)
                {
                    SchemaList.Items.Add(new ListItem(schema.Title, schema.Id));
                }

                // load appdata for first schema in the list
                appData = client.ReadApplicationData(schemas[0].Id, _typeOfAppId);
                if (appData != null)
                {
                    TypeOf.Text = Encoding.Unicode.GetString(appData.Data);
                }

                Close(client);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _coreServiceEndpoint = new EndpointAddress(WebConfigurationManager.AppSettings["EndpointAddress"]);
            _vocabulariesAppId = WebConfigurationManager.AppSettings["VocabulariesAppId"];
            _typeOfAppId = WebConfigurationManager.AppSettings["TypeOfAppId"];
            _schemaPublicationUri = WebConfigurationManager.AppSettings["SchemaPublicationUri"];

            if (!IsPostBack)
            {
                var client = new SessionAwareCoreServiceClient(_binding, _coreServiceEndpoint);
                client.Impersonate(HttpContext.Current.User.Identity.Name);

                // load vocabularies appdata
                ApplicationData appData = client.ReadApplicationData(null, _vocabulariesAppId);
                if (appData != null)
                {
                    AppData.Text = Encoding.Unicode.GetString(appData.Data);
                }
                else
                {
                    // load default xml
                    AppData.Text = "<vocabularies>\n  <vocabulary prefix=\"s\" name=\"http://schema.org\"/>\n</vocabularies>";
                }

                // load schemas
                var filter = new RepositoryItemsFilterData { ItemTypes = new[] { ItemType.Schema }, Recursive = true };
                var schemas = client.GetList(_schemaPublicationUri, filter);
                foreach (var schema in schemas)
                {
                    SchemaList.Items.Add(new ListItem(schema.Title, schema.Id));
                }

                // load appdata for first schema in the list
                appData = client.ReadApplicationData(schemas[0].Id, _typeOfAppId);
                if (appData != null)
                {
                    TypeOf.Text = Encoding.Unicode.GetString(appData.Data);
                }

                Close(client);
            }
        }
Beispiel #4
0
 public IdentifiableObjectData[] GetList(string id, SubjectRelatedListFilterData filter)
 {
     return(_client.GetList(id, filter));
 }
        /// <summary>
        /// Gets list of CT's along with the associated schema & view
        /// </summary>
        /// <param>none</param>
        /// <returns></returns>
        public static string GetAllItemsInPublication(string pubID)
        {
            RepositoryItemsFilterData filter = SetPageFilterCriterias();
            StringBuilder             sb     = new StringBuilder();

            cs_client = CoreServiceProvider.CreateCoreService();
            try
            {
                IdentifiableObjectData[] pages = cs_client.GetList(pubID, filter);

                foreach (IdentifiableObjectData iod in pages)
                {
                    PageData pageData = cs_client.Read(iod.Id, new ReadOptions()) as PageData;

                    sb.AppendLine("Page: " + pageData.LocationInfo.Path);
                    sb.AppendLine("PT: " + pageData.PageTemplate.Title);
                    sb.AppendLine("PM: " + pageData.MetadataSchema.Title);

                    foreach (ComponentPresentationData cpd in pageData.ComponentPresentations)
                    {
                        sb.AppendLine("");
                        sb.AppendLine("CP: " + cpd.Component.Title);

                        ComponentData cp = (ComponentData)cs_client.Read(cpd.Component.IdRef, new ReadOptions());
                        sb.AppendLine("CS: " + cp.Schema.Title);

                        sb.AppendLine("CT: " + cpd.ComponentTemplate.Title);
                        ComponentTemplateData ct = (ComponentTemplateData)cs_client.Read(cpd.ComponentTemplate.IdRef, new ReadOptions());
                        sb.AppendLine("CM: " + ct.MetadataSchema.Title);

                        // load the schema
                        var schemaFields = cs_client.ReadSchemaFields(cp.Schema.IdRef, true, new ReadOptions());

                        // build a  Fields object from it
                        var fields = Fields.ForContentOf(schemaFields, cp);

                        // let's first quickly list all values of all fields
                        foreach (var field in fields)
                        {
                            if (field.GetType() == typeof(EmbeddedSchemaFieldDefinitionData))
                            {
                            }
                            if (field.GetType() == typeof(ComponentLinkFieldDefinitionData))
                            {
                            }
                            if (field.GetType() == typeof(EmbeddedSchemaFieldDefinitionData))
                            {
                            }
                        }
                    }

                    //blank line for readability
                    sb.AppendLine("");
                    sb.AppendLine("");
                }
            }
            catch (Exception ex)
            {
                // throw ex;
            }
            finally
            {
                cs_client.Close();
            }

            return(sb.ToString());
        }