Exemple #1
0
        private IContentClassFolder GetSharedFrom()
        {
            const string LOAD_FOLDER = @"<PROJECT><FOLDER action=""load"" guid=""{0}""/></PROJECT>";
            var          xmlDoc      = Project.ExecuteRQL(LOAD_FOLDER.RQLFormat(this));

            XmlElement = xmlDoc.GetSingleElement("FOLDER");
            Guid sharedProjectGuid, sharedFolderGuid;

            if (XmlElement.TryGetGuid("linkedprojectguid", out sharedProjectGuid) &&
                XmlElement.TryGetGuid("linkedfolderguid", out sharedFolderGuid))
            {
                if (IsBroken)
                {
                    throw new BrokenContentClassFolderSharingException(Session.ServerLogin, this, sharedProjectGuid,
                                                                       sharedFolderGuid);
                }
                if (Session.CurrentUser.ModuleAssignment.IsServerManager)
                {
                    IProject project = Session.ServerManager.Projects.GetByGuid(sharedProjectGuid);
                    return(GetSharedFromFolder(project, sharedFolderGuid));
                }
                if (Session.ServerManager.Projects.ForCurrentUser.ContainsGuid(sharedProjectGuid))
                {
                    IProject project = Session.ServerManager.Projects.ForCurrentUser.GetByGuid(sharedProjectGuid);
                    return(GetSharedFromFolder(project, sharedFolderGuid));
                }
                var sharedProject = new Project(Session, sharedProjectGuid);
                return(new ContentClassFolder(sharedProject, sharedFolderGuid));
            }
            return(null);
        }
        protected override XmlElement RetrieveWholeObject()
        {
            const string LOAD_FOLDER = @"<PROJECT><FOLDER action=""load"" guid=""{0}""/></PROJECT>";

            return(Project.ExecuteRQL(LOAD_FOLDER.RQLFormat(this)).GetSingleElement("FOLDER"));
        }