SmartAPI
Open Source .NET RQL library for RedDot CMS / OpenText WSM Management Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
IAsynchronousProcess.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;
17 using System.Xml;
18 using erminas.SmartAPI.CMS.Project;
19 using erminas.SmartAPI.Utils;
20 
21 namespace erminas.SmartAPI.CMS.ServerManagement
22 {
24  {
25  Publication = 0,
26  CleanupLiveServer = 1,
27  EscalationProcedure = 2,
28  XMLExport = 3,
29  XMLImport = 4,
30  Import3To4 = 5,
31  CopyProject = 6,
32  InheritPublicationPackage = 7,
33  CheckURLs = 8,
34  RedDotDatabaseBackup = 9,
35  ContentClassReplacement = 10,
36  UploadMediaElement = 11,
37  CopyTreesegment = 12,
38  PageForwarding = 13,
39  ScheduledJob = 14,
40  PublishingQueue = 15,
41  DeletePagesViaFTP = 16,
42  FTPTransfer = 17,
43  ExportInstances = 18,
44  StartUserdefinedJob = 19,
45  XCMSProjectNotifications = 20,
46  CheckSpelling = 21,
47  ValidatePage = 22,
48  FindAndReplace = 23,
49  ProjectReport = 24,
50  CheckReferencesToOtherProjects = 25,
51  DeletePagesViaFTPInheritPublicationPackage = 26,
52  }
53 
55  {
56  IProject Project { get; }
58  IUser User { get; }
59  }
60 
61  internal class AsynchronousProcess : RedDotObject, IAsynchronousProcess
62  {
63  private AsynchronousProcessType _type;
64 
65  internal AsynchronousProcess(ISession session, XmlElement xmlElement) : base(session, xmlElement)
66  {
67  LoadXml();
68  }
69 
70  public IProject Project { get; private set; }
71 
72  public AsynchronousProcessType Type
73  {
74  get { return _type; }
75  }
76 
77  public IUser User { get; private set; }
78 
79  private void LoadXml()
80  {
81  Guid userGuid;
82  if (_xmlElement.TryGetGuid("user", out userGuid))
83  {
84  User = new User(Session, userGuid) {Name = XmlElement.GetAttributeValue("username")};
85  }
86 
87  Guid projectGuid;
88  if (_xmlElement.TryGetGuid("project", out projectGuid))
89  {
90  Project = new Project.Project(Session, projectGuid) {Name = XmlElement.GetAttributeValue("projectname")};
91  }
92 
93  EnsuredInit(ref _type, "category", s => (AsynchronousProcessType) int.Parse(s));
94  }
95  }
96 }