| 2088 |
ghuddy |
1 |
using System;
|
|
|
2 |
using System.Collections;
|
|
|
3 |
using System.ComponentModel;
|
|
|
4 |
using System.Windows.Forms;
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
namespace EA_DocGen
|
|
|
8 |
{
|
|
|
9 |
/// <summary>
|
|
|
10 |
/// Summary description for EA_RelationshipMatrix.
|
|
|
11 |
/// </summary>
|
|
|
12 |
public class EA_RelationshipMatrix
|
|
|
13 |
{
|
|
|
14 |
private EA_Utilities EA_Utils = null;
|
|
|
15 |
|
|
|
16 |
// declare option variables
|
|
|
17 |
public string fromIntroText = null; // This one is optional
|
|
|
18 |
public string fromPackageGUID = null;
|
|
|
19 |
public string fromToTableTitle = null; // This one is optional
|
|
|
20 |
public string fromColumnTitle = null;
|
|
|
21 |
public ArrayList fromElementTypes = null;
|
|
|
22 |
public bool fromPackageRecursion = true;
|
|
|
23 |
public EA.Package fromPackage = null;
|
| 2094 |
ghuddy |
24 |
public bool fromPackageTrimming = false;
|
| 2088 |
ghuddy |
25 |
|
|
|
26 |
public string toIntroText = null; // This one is optional
|
|
|
27 |
public string toPackageGUID = null;
|
|
|
28 |
public string toFromTableTitle = null; // This one is optional
|
|
|
29 |
public string toColumnTitle = null;
|
|
|
30 |
public ArrayList toElementTypes = null;
|
|
|
31 |
public bool toPackageRecursion = true;
|
|
|
32 |
public EA.Package toPackage = null;
|
| 2094 |
ghuddy |
33 |
public bool toPackageTrimming = false;
|
| 2088 |
ghuddy |
34 |
|
| 2094 |
ghuddy |
35 |
|
|
|
36 |
|
| 2088 |
ghuddy |
37 |
private string [] options_string = null;
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
public EA_RelationshipMatrix(EA_Utilities EA_UtilsRef)
|
|
|
42 |
{
|
|
|
43 |
EA_Utils = EA_UtilsRef;
|
|
|
44 |
fromElementTypes = new ArrayList();
|
|
|
45 |
toElementTypes = new ArrayList();
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
public void reset()
|
|
|
49 |
{
|
|
|
50 |
fromIntroText = null;
|
|
|
51 |
fromPackageGUID = null;
|
|
|
52 |
fromToTableTitle = null;
|
|
|
53 |
fromColumnTitle = null;
|
|
|
54 |
fromElementTypes.Clear();
|
|
|
55 |
fromPackageRecursion = true;
|
| 2094 |
ghuddy |
56 |
fromPackageTrimming = false;
|
| 2088 |
ghuddy |
57 |
fromPackage = null;
|
|
|
58 |
toIntroText = null;
|
|
|
59 |
toPackageGUID = null;
|
|
|
60 |
toFromTableTitle = null;
|
|
|
61 |
toColumnTitle = null;
|
|
|
62 |
toElementTypes.Clear();
|
|
|
63 |
toPackageRecursion = true;
|
| 2094 |
ghuddy |
64 |
toPackageTrimming = false;
|
| 2088 |
ghuddy |
65 |
toPackage = null;
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
public bool processRelationshipMatrixOptions(EA.Element theElement)
|
|
|
70 |
{
|
|
|
71 |
reset();
|
|
|
72 |
|
|
|
73 |
// Extract the control options from the notes of the element
|
|
|
74 |
|
|
|
75 |
string delimStr = "\n";
|
|
|
76 |
char [] delim = delimStr.ToCharArray();
|
|
|
77 |
options_string = theElement.Notes.ToString().Split(delim,100);
|
|
|
78 |
int i = 0;
|
|
|
79 |
foreach(string s in options_string)
|
|
|
80 |
{
|
|
|
81 |
options_string[i] = s.Trim();
|
|
|
82 |
i++;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
// scan the options string and assign values into the options variables as required
|
|
|
86 |
foreach(string s in options_string)
|
|
|
87 |
{
|
|
|
88 |
if (s.Length > 0 && s != "\n" && s != "\r" && s[0] != '\\')
|
|
|
89 |
{
|
|
|
90 |
// FROM items
|
|
|
91 |
if (s.StartsWith("fromIntroText"))
|
|
|
92 |
{
|
|
|
93 |
fromIntroText = EA_Utils.options.getOptionValue(s, null);
|
|
|
94 |
}
|
|
|
95 |
else if (s.StartsWith("fromToTableTitle"))
|
|
|
96 |
{
|
|
|
97 |
fromToTableTitle = EA_Utils.options.getOptionValue(s, null);
|
|
|
98 |
}
|
|
|
99 |
else if (s.StartsWith("fromColumnTitle"))
|
|
|
100 |
{
|
|
|
101 |
fromColumnTitle = EA_Utils.options.getOptionValue(s, fromColumnTitle);
|
|
|
102 |
}
|
|
|
103 |
else if (s.StartsWith("fromPackageRecursion"))
|
|
|
104 |
{
|
|
|
105 |
fromPackageRecursion = EA_Utils.options.getOptionValue(s, fromPackageRecursion);
|
|
|
106 |
}
|
| 2094 |
ghuddy |
107 |
else if (s.StartsWith("fromPackageTrimming"))
|
|
|
108 |
{
|
|
|
109 |
fromPackageTrimming = EA_Utils.options.getOptionValue(s, fromPackageTrimming);
|
|
|
110 |
}
|
| 2088 |
ghuddy |
111 |
else if (s.StartsWith("fromPackage"))
|
|
|
112 |
{
|
|
|
113 |
fromPackageGUID = EA_Utils.options.getOptionValue(s, fromPackageGUID);
|
|
|
114 |
}
|
|
|
115 |
else if (s.StartsWith("fromElementType"))
|
|
|
116 |
{
|
|
|
117 |
string et = EA_Utils.options.getOptionValue(s,null);
|
|
|
118 |
if (et != null)
|
|
|
119 |
{
|
|
|
120 |
fromElementTypes.Add( et );
|
|
|
121 |
}
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
// TO items
|
|
|
126 |
else if (s.StartsWith("toIntroText"))
|
|
|
127 |
{
|
|
|
128 |
toIntroText = EA_Utils.options.getOptionValue(s, null);
|
|
|
129 |
}
|
|
|
130 |
else if (s.StartsWith("toFromTableTitle"))
|
|
|
131 |
{
|
|
|
132 |
toFromTableTitle = EA_Utils.options.getOptionValue(s, null);
|
|
|
133 |
}
|
|
|
134 |
else if (s.StartsWith("toColumnTitle"))
|
|
|
135 |
{
|
|
|
136 |
toColumnTitle = EA_Utils.options.getOptionValue(s, toColumnTitle);
|
|
|
137 |
}
|
|
|
138 |
else if (s.StartsWith("toPackageRecursion"))
|
|
|
139 |
{
|
|
|
140 |
toPackageRecursion = EA_Utils.options.getOptionValue(s, toPackageRecursion);
|
|
|
141 |
}
|
| 2094 |
ghuddy |
142 |
else if (s.StartsWith("toPackageTrimming"))
|
|
|
143 |
{
|
|
|
144 |
toPackageTrimming = EA_Utils.options.getOptionValue(s, toPackageTrimming);
|
|
|
145 |
}
|
| 2088 |
ghuddy |
146 |
else if (s.StartsWith("toPackage"))
|
|
|
147 |
{
|
|
|
148 |
toPackageGUID = EA_Utils.options.getOptionValue(s, toPackageGUID);
|
|
|
149 |
}
|
|
|
150 |
else if (s.StartsWith("toElementType"))
|
|
|
151 |
{
|
|
|
152 |
string et = EA_Utils.options.getOptionValue(s,null);
|
|
|
153 |
if (et != null)
|
|
|
154 |
{
|
|
|
155 |
toElementTypes.Add( et );
|
|
|
156 |
}
|
|
|
157 |
}
|
|
|
158 |
}
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
// Verify that we have all the necessary compulsory options
|
|
|
162 |
if (fromToTableTitle == null && toFromTableTitle == null)
|
|
|
163 |
{
|
|
|
164 |
MessageBox.Show("Error in EA_DocGenRelationshipMatrix options list\n\n" +
|
|
|
165 |
"Missing option: Must specify at least one table title");
|
|
|
166 |
return false;
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
// FROM items
|
|
|
170 |
if (fromColumnTitle == null)
|
|
|
171 |
{
|
|
|
172 |
MessageBox.Show("Error in EA_DocGenRelationshipMatrix options list\n\n" +
|
|
|
173 |
"Missing option: fromColumnTitle");
|
|
|
174 |
return false;
|
|
|
175 |
}
|
|
|
176 |
if (fromPackageGUID == null)
|
|
|
177 |
{
|
|
|
178 |
MessageBox.Show("Error in EA_DocGenRelationshipMatrix options list\n\n" +
|
|
|
179 |
"Missing option: fromPackageGUID");
|
|
|
180 |
return false;
|
|
|
181 |
}
|
|
|
182 |
if (fromElementTypes.Count == 0)
|
|
|
183 |
{
|
|
|
184 |
MessageBox.Show("Error in EA_DocGenRelationshipMatrix options list\n\n" +
|
|
|
185 |
"Missing option(s): fromElementTypes");
|
|
|
186 |
return false;
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
// TO items
|
|
|
190 |
if (toColumnTitle == null)
|
|
|
191 |
{
|
|
|
192 |
MessageBox.Show("Error in EA_DocGenRelationshipMatrix options list\n\n" +
|
|
|
193 |
"Missing option: toColumnTitle");
|
|
|
194 |
return false;
|
|
|
195 |
}
|
|
|
196 |
if (toPackageGUID == null)
|
|
|
197 |
{
|
|
|
198 |
MessageBox.Show("Error in EA_DocGenRelationshipMatrix options list\n\n" +
|
|
|
199 |
"Missing option: toPackageGUID");
|
|
|
200 |
return false;
|
|
|
201 |
}
|
|
|
202 |
if (toElementTypes.Count == 0)
|
|
|
203 |
{
|
|
|
204 |
MessageBox.Show("Error in EA_DocGenRelationshipMatrix options list\n\n" +
|
|
|
205 |
"Missing option(s): toElementTypes");
|
|
|
206 |
return false;
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
// Find GUID linked packages in the repository
|
|
|
210 |
fromPackage = EA_Utils.EA_Finder.findPackageInRepositoryByGUID( fromPackageGUID );
|
|
|
211 |
if (fromPackage == null)
|
|
|
212 |
{
|
|
|
213 |
MessageBox.Show("Error processing EA_DocGenRelationshipMatrix\n\n" +
|
|
|
214 |
"could not locate fromPackage in Repository");
|
|
|
215 |
return false;
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
toPackage = EA_Utils.EA_Finder.findPackageInRepositoryByGUID( toPackageGUID );
|
|
|
219 |
if (toPackage == null)
|
|
|
220 |
{
|
|
|
221 |
MessageBox.Show("Error processing EA_DocGenRelationshipMatrix\n\n" +
|
|
|
222 |
"could not locate toPackage in Repository");
|
|
|
223 |
return false;
|
|
|
224 |
}
|
|
|
225 |
|
|
|
226 |
return true;
|
|
|
227 |
}
|
|
|
228 |
|
|
|
229 |
|
|
|
230 |
public string optionTemplateForRelationshipMatrix()
|
|
|
231 |
{
|
|
|
232 |
return
|
|
|
233 |
"fromToTableTitle=\r\n"
|
|
|
234 |
+ "fromIntroText=\r\n"
|
|
|
235 |
+ "fromColumnTitle=\r\n"
|
|
|
236 |
+ "fromPackage=\r\n"
|
|
|
237 |
+ "fromElementType=\r\n"
|
|
|
238 |
+ "fromElementType=\r\n"
|
|
|
239 |
+ "fromPackageRecursion=true\r\n"
|
| 2094 |
ghuddy |
240 |
+ "fromPackageTrimming=false\r\n"
|
| 2088 |
ghuddy |
241 |
+ "toFromTableTitle=\r\n"
|
|
|
242 |
+ "toIntroText=\r\n"
|
|
|
243 |
+ "toColumnTitle=\r\n"
|
|
|
244 |
+ "toPackage=\r\n"
|
|
|
245 |
+ "toElementType=\r\n"
|
| 2094 |
ghuddy |
246 |
+ "toPackageRecursion=true\r\n"
|
|
|
247 |
+ "toPackageTrimming=false\r\n";
|
| 2088 |
ghuddy |
248 |
}
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
}
|
|
|
252 |
}
|