18 using erminas.SmartAPI.Exceptions;
19 using erminas.SmartAPI.Utils;
21 namespace erminas.SmartAPI.CMS.Project.Publication
30 internal class PublicationFolderSetting : PartialRedDotProjectObject, IPublicationFolderSetting
32 private IPublicationFolder _publicationFolder;
34 public PublicationFolderSetting(IPublicationSetting parent, Guid guid) : base(parent.Project, guid)
36 PublicationSetting = parent;
39 internal PublicationFolderSetting(IPublicationSetting parent, XmlElement element)
40 : base(parent.Project, element)
42 PublicationSetting = parent;
49 const string SAVE_SETTING =
50 @"<PROJECT><EXPORTSETTING action=""save"" guid=""{0}""><FOLDEREXPORTSETTING folderguid=""{1}"" guid=""{2}""/></EXPORTSETTING></PROJECT>";
53 Project.ExecuteRQL(
string.Format(SAVE_SETTING, PublicationSetting.Guid.ToRQLString(),
54 _publicationFolder.Guid.ToRQLString(), Guid.ToRQLString()));
56 if (!xmlDoc.IsContainingOk())
59 string.Format(
"Could not change publication folder setting for {0}",
this));
63 public IPublicationFolder PublicationFolder
65 get {
return LazyLoad(ref _publicationFolder); }
66 set { _publicationFolder = value; }
69 public IPublicationSetting PublicationSetting {
get;
set; }
71 protected override void LoadWholeObject()
76 protected override XmlElement RetrieveWholeObject()
78 const string LOAD_FOLDER_SETTING =
79 @"<PROJECT><EXPORTSETTING guid=""{0}"" action=""load"" ><FOLDEREXPORTSETTING guid=""{1}""/></EXPORTSETTING></PROJECT>";
82 PublicationSetting.PublicationPackage.Project.ExecuteRQL(String.Format(LOAD_FOLDER_SETTING,
83 PublicationSetting.Guid
87 return (XmlElement) xmlDoc.GetElementsByTagName(
"FOLDEREXPORTSETTING")[0];
90 private void LoadXml()
92 const string FOLDER_GUID =
"folderguid";
94 _publicationFolder = _xmlElement.TryGetGuid(FOLDER_GUID, out tmpGuid)
95 ?
new PublicationFolder(PublicationSetting.PublicationPackage.Project, tmpGuid)