-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPublicationPackage.cs
105 lines (93 loc) · 3.66 KB
/
PublicationPackage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace RustyLogic.RedDotNet
{
public class PublicationPackage : RedDotObject
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
protected PublicationPackage(XmlNode xmlNode) : base(xmlNode) { }
protected PublicationPackage(Guid guid) : base(guid) { }
protected override void LoadBasics(XmlNode xmlNode)
{
_name = xmlNode.Attributes.GetNamedItem("name").Value;
}
protected override XmlNode LoadXml()
{
string rqlStatement =
"<IODATA>" +
"<PROJECT>" +
"<EXPORTPACKET action=\"load\" guid=\"" + GuidString + "\"/>" +
"</PROJECT>" +
"</IODATA>";
xmlDoc.LoadXml(Session.Execute(rqlStatement));
return xmlDoc.GetElementsByTagName("EXPORTPACKET")[0];
}
protected static XmlNode LoadXmlFromLink(Link link)
{
string rqlStatement =
"<IODATA>" +
"<PROJECT>" +
"<EXPORTPACKET action=\"load\" linkguid=\"" + link.GuidString + "\"/>" +
"</PROJECT>" +
"</IODATA>";
xmlDoc.LoadXml(Session.Execute(rqlStatement));
return xmlDoc.GetElementsByTagName("EXPORTPACKET")[0];
}
internal static PublicationPackage Get(Link link)
{
XmlNode xmlNode = LoadXmlFromLink(link);
return new PublicationPackage(new Guid(xmlNode.Attributes.GetNamedItem("guid").Value));
}
public static List<PublicationPackage> List()
{
List<PublicationPackage> packages = new List<PublicationPackage>();
string rqlStatement =
"<IODATA>" +
"<PROJECT>" +
"<EXPORTPACKET action=\"list\" />" +
"</PROJECT>" +
"</IODATA>";
xmlDoc.LoadXml(Session.Execute(rqlStatement));
XmlNodeList xmlNodes = xmlDoc.GetElementsByTagName("EXPORTPACKET");
foreach (XmlNode xmlNode in xmlNodes)
{
packages.Add(new PublicationPackage(xmlNode));
}
return packages;
}
// THIS NEEDS TO MOVE TO STRUCTURAL ELEMENT CLASS
// inheritToSubstructures = true does not work!!
public void Assign(Link link, bool inheritToSubstructures) // STRUCTURAL ELEMENT ONLY
{
string rqlStatement =
"<IODATA>" +
"<PROJECT>" +
"<EXPORTPACKET action=\"save\" guid=\"" + GuidString + "\" " +
"inherit=\"" + (inheritToSubstructures ? 1 : 0) + "\" " +
"linkguid=\"" + link.GuidString + "\"/>" +
"</PROJECT>" +
"</IODATA>";
xmlDoc.LoadXml(Session.Execute(rqlStatement));
}
public void Unassign(Link link, bool inheritToSubstructures) // STRUCTURAL ELEMENT ONLY
{
string rqlStatement =
"<IODATA>" +
"<PROJECT>" +
"<EXPORTPACKET action=\"unlink\" guid=\"" + GuidString + "\" " +
"inherit=\"" + (inheritToSubstructures ? 1 : 0) + "\" " +
"linkguid=\"" + link.GuidString + "\"/>" +
"</PROJECT>" +
"</IODATA>";
xmlDoc.LoadXml(Session.Execute(rqlStatement));
}
// List<Elements> ReferenceList()
}
}