SmartAPI
Open Source .NET RQL library for RedDot CMS / OpenText WSM Management Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
ISyllables.cs
Go to the documentation of this file.
1 ï»¿// SmartAPI - .Net programmatic access to RedDot servers
2 //
3 // Copyright (C) 2013 erminas GbR
4 //
5 // This program is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free Software Foundation,
7 // either version 3 of the License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 // See the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program.
14 // If not, see <http://www.gnu.org/licenses/>.
15 
16 using System.Collections.Generic;
17 using System.Linq;
18 using System.Xml;
19 using erminas.SmartAPI.Utils.CachedCollections;
20 
21 namespace erminas.SmartAPI.CMS.Project
22 {
23  public interface ISyllables : IIndexedRDList<string, ISyllable>, IProjectObject
24  {
25  }
26 
27  internal class Syllables : NameIndexedRDList<ISyllable>, ISyllables
28  {
29  private readonly IProject _project;
30 
31  internal Syllables(IProject project, Caching caching) : base(caching)
32  {
33  RetrieveFunc = GetSyllables;
34  _project = project;
35  }
36 
37  public IProject Project
38  {
39  get { return _project; }
40  }
41 
42  public ISession Session
43  {
44  get { return _project.Session; }
45  }
46 
47  private List<ISyllable> GetSyllables()
48  {
49  var xmlDoc = Project.ExecuteRQL(@"<SYLLABLES action=""list""/>", RqlType.SessionKeyInProject);
50  var syllablelist = xmlDoc.GetElementsByTagName("SYLLABLE");
51  return (from XmlElement curNode in syllablelist select (ISyllable) new Syllable(Project, curNode)).ToList();
52  }
53  }
54 }