Represents a content class in RedDot.
Inheritance: PartialRedDotProjectObject, IContentClass
Beispiel #1
0
        /// <summary>
        ///     Copy this content class to another project
        /// </summary>
        /// <param name="project"> The target project to copy the content class to </param>
        /// <param name="targetFolderGuid"> Guid of the target content class folder in the target project </param>
        public void CopyToProject(IProject project, Guid targetFolderGuid)
        {
            ContentClass targetCC = CreateCopyInProject(project, targetFolderGuid);

            CopyProjectVariantAssignmentToCC(targetCC);

            CopyAttributesToCC(targetCC);

            CopyAllElementsToCC(targetCC);

            CopyPreassignedKeywordsToCC(targetCC);
        }
Beispiel #2
0
        private void CopyProjectVariantAssignmentToCC(ContentClass targetCC)
        {
            var x =
                //ProjectVariantAssignments.ToLookup(x=>targetCC.TemplateVariants.GetByName(x.TemplateVariant.Name),
                //x=>targetCC.Project.ProjectVariants.GetByName(x.ProjectVariant.Name));

                ProjectVariantAssignments.ToLookup(
                    assignment => targetCC.TemplateVariants[assignment.TemplateVariant.Name],
                    assignment => new ProjectVariantAssignmentSettings()
            {
                ProjectVariant = targetCC.Project.ProjectVariants[assignment.ProjectVariant.Name], IsPublishing = assignment.IsPublishing, IsNotUsingTidy = assignment.IsNotUsingTidy, TemplateVariant = targetCC.TemplateVariants[assignment.TemplateVariant.Name]
            });

            targetCC.ProjectVariantAssignments.Assign(x);
        }
Beispiel #3
0
        private ContentClass CreateContentClass(IProject project, XmlElement template)
        {
            XmlDocument creationResultNode = project.ExecuteRQL(template.NodeToString());
            XmlNode     guidTextNode       = creationResultNode.FirstChild;
            Guid        newCCGuid;

            if (guidTextNode == null || guidTextNode.NodeType != XmlNodeType.Element || guidTextNode.FirstChild == null ||
                !Guid.TryParse(guidTextNode.FirstChild.Value.Trim(), out newCCGuid))
            {
                throw new SmartAPIException(Session.ServerLogin,
                                            string.Format("Could not create content class '{0}'", Name));
            }

            var targetCC = new ContentClass(project, newCCGuid);

            return(targetCC);
        }
 internal PreassignedKeywords(ContentClass contentClass, Caching caching) : base(caching)
 {
     _contentClass = contentClass;
     RetrieveFunc  = GetPreassignedKeywords;
 }
Beispiel #5
0
        private ContentClass CreateContentClass(IProject project, XmlElement template)
        {
            XmlDocument creationResultNode = project.ExecuteRQL(template.NodeToString());
            XmlNode guidTextNode = creationResultNode.FirstChild;
            Guid newCCGuid;
            if (guidTextNode == null || guidTextNode.NodeType != XmlNodeType.Element || guidTextNode.FirstChild == null ||
                !Guid.TryParse(guidTextNode.FirstChild.Value.Trim(), out newCCGuid))
            {
                throw new SmartAPIException(Session.ServerLogin,
                                            string.Format("Could not create content class '{0}'", Name));
            }

            var targetCC = new ContentClass(project, newCCGuid);
            return targetCC;
        }
Beispiel #6
0
        private void CopyProjectVariantAssignmentToCC(ContentClass targetCC)
        {
            var x =
                //ProjectVariantAssignments.ToLookup(x=>targetCC.TemplateVariants.GetByName(x.TemplateVariant.Name),
                //x=>targetCC.Project.ProjectVariants.GetByName(x.ProjectVariant.Name));

            ProjectVariantAssignments.ToLookup(
                    assignment => targetCC.TemplateVariants[assignment.TemplateVariant.Name],
                    assignment => new ProjectVariantAssignmentSettings() { ProjectVariant = targetCC.Project.ProjectVariants[assignment.ProjectVariant.Name], IsPublishing = assignment.IsPublishing, IsNotUsingTidy = assignment.IsNotUsingTidy, TemplateVariant = targetCC.TemplateVariants[assignment.TemplateVariant.Name] });
            targetCC.ProjectVariantAssignments.Assign(x);
        }
 internal ContentClassElements(ContentClass contentClass, Caching caching) : base(caching)
 {
     _contentClass = contentClass;
     RetrieveFunc  = GetContentClassElements;
 }