| 2141 |
ghuddy |
1 |
using System;
|
|
|
2 |
using System.Text;
|
|
|
3 |
using System.Globalization;
|
|
|
4 |
using System.Collections;
|
|
|
5 |
using System.Windows.Forms;
|
|
|
6 |
using ReqPro40;
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
namespace EA_ReqPro
|
|
|
10 |
{
|
|
|
11 |
|
|
|
12 |
/// <summary>
|
|
|
13 |
/// Summary description for ImportReqProDatabase.
|
|
|
14 |
/// </summary>
|
|
|
15 |
public class ImportReqProDatabase : CopyReqProDatabaseToMemory
|
|
|
16 |
{
|
|
|
17 |
/// <summary>
|
|
|
18 |
/// Constructor logic
|
|
|
19 |
/// </summary>
|
|
|
20 |
/// <param name="ea_repository"></param>
|
|
|
21 |
public ImportReqProDatabase(EA.Repository ea_repository): base(ea_repository)
|
|
|
22 |
{
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
/// <summary>
|
|
|
27 |
/// Method to parse a ReqPro database using the information in a ReqProDB artifact,
|
|
|
28 |
/// assumed to be selected in EA's project browser prior to the method call.
|
|
|
29 |
/// </summary>
|
|
|
30 |
/// <param name="ea_repository"></param>
|
|
|
31 |
/// <returns></returns>
|
| 2145 |
ghuddy |
32 |
public override bool prompt_and_parse(EA.Repository ea_repository, ReqProDB_Artifact.MODE mode)
|
| 2141 |
ghuddy |
33 |
{
|
|
|
34 |
try
|
|
|
35 |
{
|
| 2145 |
ghuddy |
36 |
if (true == base.prompt_and_parse(ea_repository, mode))
|
| 2141 |
ghuddy |
37 |
{
|
|
|
38 |
ea_repository.EnsureOutputVisible(Main.GUI_OUTPUT_TAB_NAME);
|
|
|
39 |
ImportFromReqPro(ea_repository);
|
| 2145 |
ghuddy |
40 |
|
|
|
41 |
// Configure the ReqProDB artifact as a traceability artifact
|
|
|
42 |
RQ_Artifact.set_traceability_mode(ea_repository, RQ_Element);
|
|
|
43 |
|
| 2141 |
ghuddy |
44 |
return true;
|
|
|
45 |
}
|
|
|
46 |
}
|
|
|
47 |
catch (Exception ex)
|
|
|
48 |
{
|
|
|
49 |
MessageBox.Show(ex.Message, "Error (ImportReqProDatabase::parse)", MessageBoxButtons.OK);
|
|
|
50 |
}
|
|
|
51 |
return false;
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
/// <summary>
|
|
|
55 |
/// Displays the content of the change log element to the output trace display. This method must
|
|
|
56 |
/// be kept in sync with the ImportFromReqPro method, obviously.
|
|
|
57 |
/// </summary>
|
|
|
58 |
/// <param name="ea_repository"></param>
|
|
|
59 |
/// <param name="changeLog"></param>
|
|
|
60 |
public void displayChangeLog(EA.Repository ea_repository, EA.Element changeLog)
|
|
|
61 |
{
|
|
|
62 |
// The change log element contains all the log in its notes section. Break it up into
|
|
|
63 |
// lines, because each line is a single log entry, so that we can process them one at
|
|
|
64 |
// a time.
|
|
|
65 |
string delimStr = "\n";
|
|
|
66 |
char [] delim = delimStr.ToCharArray();
|
|
|
67 |
string[] log_strings = changeLog.Notes.Split(delim,2000);
|
|
|
68 |
|
|
|
69 |
// Prepare a string to form an updated change log (needed to support the activity of orphaned
|
|
|
70 |
// requirement deletion).
|
|
|
71 |
string newList = "";
|
|
|
72 |
|
|
|
73 |
// modify delimiters to : character so that we can extract the parameters for each log entry
|
|
|
74 |
delimStr = ":";
|
|
|
75 |
delim = delimStr.ToCharArray();
|
|
|
76 |
|
|
|
77 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME,"Displaying Import Change Log", -1);
|
|
|
78 |
|
|
|
79 |
foreach(string s in log_strings)
|
|
|
80 |
{
|
|
|
81 |
// over time, users may delete the orphaned requirements from the EA database, but their
|
|
|
82 |
// GUIDs will still exist in the change log. Use of such a GUID will cause
|
|
|
83 |
// an exception in the GetElementByGuid() function. What should we do? We can attempt
|
|
|
84 |
// to remove those GUIDs from the list. We can do this by accumulating a new list of GUIDs
|
|
|
85 |
// that is formed from the old list, where only good items from the old list find their
|
|
|
86 |
// way into the new list. Gradually, the list is wittled away as EA users delete orphaned
|
|
|
87 |
// requirements having first dealt with the design change impacts that resulted from their
|
|
|
88 |
// orphanage.
|
|
|
89 |
try
|
|
|
90 |
{
|
|
|
91 |
if (s.StartsWith("{"))
|
|
|
92 |
{
|
|
|
93 |
string trimmed_s = s.Trim();
|
|
|
94 |
|
|
|
95 |
// Get log entry;s parameters.
|
|
|
96 |
string[] parameters = trimmed_s.Split(delim, 10);
|
|
|
97 |
|
|
|
98 |
// The first parameter is the GUID so use it to get the requirement element
|
|
|
99 |
EA.Element ea_req = ea_repository.GetElementByGuid(parameters[0]);
|
|
|
100 |
|
|
|
101 |
// Now discriminate actions based on the second parameter
|
|
|
102 |
|
|
|
103 |
if (parameters[1].StartsWith("Created"))
|
|
|
104 |
{
|
|
|
105 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME," Created : " + ea_req.Name, ea_req.ElementID );
|
|
|
106 |
}
|
|
|
107 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
108 |
else if (parameters[1].StartsWith("Orphaned"))
|
|
|
109 |
{
|
|
|
110 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME," Orphaned : " + ea_req.Name, ea_req.ElementID );
|
|
|
111 |
|
|
|
112 |
foreach (EA.Connector theConnector in ea_req.Connectors)
|
|
|
113 |
{
|
|
|
114 |
EA.Element tgt_ele = (EA.Element)ea_repository.GetElementByID( theConnector.SupplierID );
|
|
|
115 |
if (tgt_ele != null)
|
|
|
116 |
{
|
|
|
117 |
if (!tgt_ele.Type.StartsWith("Requirement"))
|
|
|
118 |
{
|
|
|
119 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " --> " + tgt_ele.Name, tgt_ele.ElementID);
|
|
|
120 |
}
|
|
|
121 |
}
|
|
|
122 |
}
|
|
|
123 |
}
|
|
|
124 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
125 |
else if (parameters[1].StartsWith("Name"))
|
|
|
126 |
{
|
|
|
127 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " Modified Name: " + ea_req.Name, ea_req.ElementID );
|
|
|
128 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " <<< " + parameters[2], ea_req.ElementID);
|
|
|
129 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " >>> " + parameters[3], ea_req.ElementID);
|
|
|
130 |
}
|
|
|
131 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
132 |
else if (parameters[1].StartsWith("Notes"))
|
|
|
133 |
{
|
|
|
134 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " Modified Description: " + ea_req.Name, ea_req.ElementID );
|
|
|
135 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " <<< " + parameters[2], ea_req.ElementID);
|
|
|
136 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " >>> " + parameters[3], ea_req.ElementID);
|
|
|
137 |
}
|
|
|
138 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
139 |
else if (parameters[1].StartsWith("Difficulty"))
|
|
|
140 |
{
|
|
|
141 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " Modified Difficulty: " + ea_req.Name, ea_req.ElementID );
|
|
|
142 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " <<< " + parameters[2], ea_req.ElementID);
|
|
|
143 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " >>> " + parameters[3], ea_req.ElementID);
|
|
|
144 |
}
|
|
|
145 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
146 |
else if (parameters[1].StartsWith("Priority"))
|
|
|
147 |
{
|
|
|
148 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " Modified Priority: " + ea_req.Name, ea_req.ElementID );
|
|
|
149 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " <<< " + parameters[2], ea_req.ElementID);
|
|
|
150 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " >>> " + parameters[3], ea_req.ElementID);
|
|
|
151 |
}
|
|
|
152 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
153 |
else if (parameters[1].StartsWith("Version"))
|
|
|
154 |
{
|
|
|
155 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " Modified Version: " + ea_req.Name, ea_req.ElementID );
|
|
|
156 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " <<< " + parameters[2], ea_req.ElementID);
|
|
|
157 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " >>> " + parameters[3], ea_req.ElementID);
|
|
|
158 |
}
|
|
|
159 |
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
160 |
else if (parameters[1].StartsWith("Status"))
|
|
|
161 |
{
|
|
|
162 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " Modified Status: " + ea_req.Name, ea_req.ElementID );
|
|
|
163 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " <<< " + parameters[2], ea_req.ElementID);
|
|
|
164 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, " >>> " + parameters[3], ea_req.ElementID);
|
|
|
165 |
}
|
|
|
166 |
|
|
|
167 |
// accumulate good item into the newList
|
|
|
168 |
newList += trimmed_s + "\r\n";
|
|
|
169 |
}
|
|
|
170 |
}
|
|
|
171 |
catch
|
|
|
172 |
{
|
|
|
173 |
// do nothing - the newList accumulator will not have the GUID that caused the exception
|
|
|
174 |
// so the next time a display operation is attempted, the exception wont happen.
|
|
|
175 |
}
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
// Update the change log
|
|
|
179 |
changeLog.Notes = newList;
|
|
|
180 |
changeLog.Update();
|
|
|
181 |
}
|
|
|
182 |
|
| 2147 |
ghuddy |
183 |
|
|
|
184 |
/// <summary>
|
|
|
185 |
/// Rid a string of any : char because we use that as a delimiter in the change log and so we
|
|
|
186 |
/// do not want a users use of the character to confuse the change log display mechanism.
|
|
|
187 |
/// </summary>
|
|
|
188 |
/// <param name="s"></param>
|
|
|
189 |
/// <returns></returns>
|
|
|
190 |
private string NO_COLONS(string s)
|
|
|
191 |
{
|
|
|
192 |
string sc = s.Replace(':', ' ');
|
|
|
193 |
sc = sc.Replace('\r' , ' ');
|
|
|
194 |
sc = sc.Replace('\n' , ' ');
|
|
|
195 |
|
|
|
196 |
return sc;
|
|
|
197 |
}
|
| 2141 |
ghuddy |
198 |
|
|
|
199 |
|
|
|
200 |
/// <summary>
|
|
|
201 |
/// A method that imports requirements from a ReqPro database into EA for the purpose
|
|
|
202 |
/// of supporting requirement-to-design traceability.
|
|
|
203 |
/// </summary>
|
|
|
204 |
/// <param name="repository"></param>
|
|
|
205 |
private void ImportFromReqPro(EA.Repository ea_repository)
|
|
|
206 |
{
|
|
|
207 |
try
|
|
|
208 |
{
|
|
|
209 |
//IFormatProvider cultureInfo = new CultureInfo("en-US", true);
|
|
|
210 |
|
|
|
211 |
string importDateTime = System.TimeZone.CurrentTimeZone.ToUniversalTime( System.DateTime.Now ).ToString();
|
|
|
212 |
|
|
|
213 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "EA Requirement import at " + importDateTime, -1 );
|
|
|
214 |
|
|
|
215 |
// Update the ReqProDB stereotypes element with all the EA requirements in the package
|
| 2145 |
ghuddy |
216 |
base.RQ_Artifact.UpdatePackageToReqProDatabaseAssociation(ea_repository, base.RQ_Element);
|
| 2141 |
ghuddy |
217 |
|
|
|
218 |
// Get a list of EA requirements and their associated ReqPro GUIDs
|
|
|
219 |
ArrayList ea_reqs = new ArrayList();
|
|
|
220 |
ArrayList ea_GUIDs = new ArrayList();
|
|
|
221 |
ArrayList ea_req_matched = new ArrayList();
|
| 2145 |
ghuddy |
222 |
foreach (EA.Connector connector in base.RQ_Element.Connectors)
|
| 2141 |
ghuddy |
223 |
{
|
|
|
224 |
EA.Element ea_req = ea_repository.GetElementByID( connector.SupplierID );
|
|
|
225 |
if (ea_req != null)
|
|
|
226 |
{
|
|
|
227 |
ea_reqs.Add(ea_req);
|
|
|
228 |
string GUID = EA_Utils.ReadTag(ea_req, "GUID");
|
|
|
229 |
ea_GUIDs.Add(GUID);
|
|
|
230 |
ea_req_matched.Add(false);
|
|
|
231 |
}
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
// Obtain the EA parent package so that we can create under it an import package
|
|
|
235 |
// if need be.
|
| 2145 |
ghuddy |
236 |
EA.Package parentPackage = ea_repository.GetPackageByID( base.RQ_Element.PackageID );
|
| 2141 |
ghuddy |
237 |
|
|
|
238 |
EA.Package importPackage = (EA.Package )parentPackage.Packages.AddNew( "import " + importDateTime, "Package");
|
|
|
239 |
importPackage.Update();
|
|
|
240 |
|
|
|
241 |
EA.Element changeLog = (EA.Element)importPackage.Elements.AddNew("Change Log","InformationItem");
|
|
|
242 |
changeLog.Update();
|
|
|
243 |
|
|
|
244 |
// Get a flattened list of requirements from the hierarchical data the user has filtered
|
|
|
245 |
ArrayList rq_req_collection = new ArrayList();
|
|
|
246 |
get_rq_req_collection(ea_repository, ref rq_req_collection);
|
|
|
247 |
|
|
|
248 |
int newRequirementCount = 0;
|
|
|
249 |
int modifiedRequirementCount = 0;
|
|
|
250 |
int statusUpdatedRequirementCount = 0;
|
|
|
251 |
int orphanedCount = 0;
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
// loop through all of the ReqPro requirements
|
|
|
255 |
foreach(ReqPro_object rq_obj in rq_req_collection)
|
|
|
256 |
{
|
|
|
257 |
try
|
|
|
258 |
{
|
|
|
259 |
// Find which EA requirement element refers to the current ReqPro GUID
|
|
|
260 |
int i_ea_req;
|
|
|
261 |
i_ea_req = ea_GUIDs.IndexOf( rq_obj.guid );
|
|
|
262 |
|
|
|
263 |
// If EA element was found
|
|
|
264 |
if (0 <= i_ea_req)
|
|
|
265 |
{
|
|
|
266 |
ea_req_matched[i_ea_req] = true;
|
|
|
267 |
|
|
|
268 |
EA.Element ea_req = ((EA.Element)ea_reqs[i_ea_req]);
|
|
|
269 |
|
| 2149 |
ghuddy |
270 |
rq_obj.ea_element_ID = ea_req.ElementID;
|
|
|
271 |
|
| 2141 |
ghuddy |
272 |
// This ReqPro requirement already has a counterpart in EA, so we must simply
|
|
|
273 |
// update the counterpart. But, to aid the designer, we need to try to tell them
|
| 2145 |
ghuddy |
274 |
// how the requirement has changed, which could ofcoarse change the meaning
|
|
|
275 |
// of the requirement and require design changes to be done.
|
| 2141 |
ghuddy |
276 |
|
|
|
277 |
bool meaningMayHaveChanged = false;
|
|
|
278 |
bool statusMayHaveChanged = false;
|
|
|
279 |
|
|
|
280 |
string ea_req_name = rq_obj.tag + " " + rq_obj.name;
|
|
|
281 |
|
|
|
282 |
if ( ea_req.Name.CompareTo(ea_req_name) != 0 )
|
|
|
283 |
{
|
| 2147 |
ghuddy |
284 |
changeLog.Notes += ea_req.ElementGUID + ":Name:" + NO_COLONS(ea_req.Name) + ":" + NO_COLONS(ea_req_name) + "\r\n";
|
| 2141 |
ghuddy |
285 |
changeLog.Update();
|
|
|
286 |
meaningMayHaveChanged = true;
|
|
|
287 |
ea_req.Name = ea_req_name;
|
|
|
288 |
}
|
|
|
289 |
|
|
|
290 |
if ( ea_req.Notes.CompareTo(rq_obj.text) != 0 )
|
|
|
291 |
{
|
| 2147 |
ghuddy |
292 |
changeLog.Notes += ea_req.ElementGUID + ":Notes:" + NO_COLONS(ea_req.Notes) + ":" + NO_COLONS(rq_obj.text) + "\r\n";
|
| 2141 |
ghuddy |
293 |
changeLog.Update();
|
|
|
294 |
meaningMayHaveChanged = true;
|
|
|
295 |
ea_req.Notes = rq_obj.text;
|
|
|
296 |
}
|
|
|
297 |
|
|
|
298 |
if (ea_req.Difficulty != rq_obj.difficulty)
|
|
|
299 |
{
|
|
|
300 |
changeLog.Notes += ea_req.ElementGUID + ":Difficulty:" + ea_req.Difficulty + ":" + rq_obj.difficulty + "\r\n";
|
|
|
301 |
changeLog.Update();
|
|
|
302 |
statusMayHaveChanged = true;
|
|
|
303 |
ea_req.Difficulty = rq_obj.difficulty;
|
|
|
304 |
}
|
|
|
305 |
if (ea_req.Priority != rq_obj.priority)
|
|
|
306 |
{
|
|
|
307 |
changeLog.Notes += ea_req.ElementGUID + ":Priority:" + ea_req.Priority + ":" + rq_obj.priority + "\r\n";
|
|
|
308 |
changeLog.Update();
|
|
|
309 |
statusMayHaveChanged = true;
|
|
|
310 |
ea_req.Priority = rq_obj.priority;
|
|
|
311 |
}
|
|
|
312 |
if (ea_req.Version != rq_obj.version)
|
|
|
313 |
{
|
|
|
314 |
changeLog.Notes += ea_req.ElementGUID + ":Version:" + ea_req.Version + ":" + rq_obj.version + "\r\n";
|
|
|
315 |
changeLog.Update();
|
|
|
316 |
statusMayHaveChanged = true;
|
|
|
317 |
ea_req.Version = rq_obj.version;
|
|
|
318 |
}
|
|
|
319 |
if (ea_req.Status != rq_obj.status)
|
|
|
320 |
{
|
|
|
321 |
changeLog.Notes += ea_req.ElementGUID + ":Status:" + ea_req.Status + ":" + rq_obj.status + "\r\n";
|
|
|
322 |
changeLog.Update();
|
|
|
323 |
statusMayHaveChanged = true;
|
|
|
324 |
ea_req.Status = rq_obj.status;
|
|
|
325 |
}
|
|
|
326 |
|
|
|
327 |
ea_req.Update();
|
|
|
328 |
|
|
|
329 |
if (meaningMayHaveChanged)
|
|
|
330 |
{
|
|
|
331 |
modifiedRequirementCount++;
|
|
|
332 |
}
|
|
|
333 |
|
|
|
334 |
if (statusMayHaveChanged)
|
|
|
335 |
{
|
|
|
336 |
statusUpdatedRequirementCount++;
|
|
|
337 |
}
|
|
|
338 |
}
|
|
|
339 |
else
|
|
|
340 |
{
|
|
|
341 |
// This ReqPro requirement does not have a counterpart in EA, so we must create
|
|
|
342 |
// a new one.
|
|
|
343 |
newRequirementCount++;
|
|
|
344 |
|
|
|
345 |
// create the new EA requirement in the import package
|
|
|
346 |
EA.Element ea_req = (EA.Element)importPackage.Elements.AddNew( rq_obj.tag + " " + rq_obj.name, "Requirement");
|
|
|
347 |
ea_req.Notes = rq_obj.text;
|
|
|
348 |
|
| 2149 |
ghuddy |
349 |
rq_obj.ea_element_ID = ea_req.ElementID;
|
|
|
350 |
|
| 2141 |
ghuddy |
351 |
ea_req.Difficulty = rq_obj.difficulty;
|
|
|
352 |
ea_req.Priority = rq_obj.priority;
|
|
|
353 |
ea_req.Version = rq_obj.version;
|
|
|
354 |
ea_req.Status = rq_obj.status;
|
|
|
355 |
|
|
|
356 |
EA_Utils.WriteTag(ea_req, "GUID", rq_obj.guid);
|
|
|
357 |
EA_Utils.WriteTag(ea_req, "TAG", rq_obj.tag);
|
|
|
358 |
ea_req.Update();
|
|
|
359 |
|
|
|
360 |
// Connect the new requirement to the ea_rq_artifact
|
| 2145 |
ghuddy |
361 |
base.RQ_Artifact.add_connection(ea_repository, base.RQ_Element, ea_req);
|
| 2141 |
ghuddy |
362 |
|
|
|
363 |
changeLog.Notes += ea_req.ElementGUID + ":Created:" + ea_req.Name + "\r\n";
|
|
|
364 |
changeLog.Update();
|
|
|
365 |
}
|
|
|
366 |
|
|
|
367 |
}
|
|
|
368 |
catch (Exception ex)
|
|
|
369 |
{
|
|
|
370 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Exception (ImportFromReqPro), " + ex.Message + ", " + rq_obj.name, -1);
|
|
|
371 |
}
|
|
|
372 |
}
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
// Now check for orphaned EA requirements
|
|
|
376 |
for (int i = 0; i < ea_GUIDs.Count; i++)
|
|
|
377 |
{
|
|
|
378 |
string rq_GUID = (string)ea_GUIDs[i];
|
|
|
379 |
if (rq_GUID != "")
|
|
|
380 |
{
|
|
|
381 |
if ((bool)ea_req_matched[i] == false)
|
|
|
382 |
{
|
|
|
383 |
EA.Element ea_req = (EA.Element)ea_reqs[i];
|
|
|
384 |
|
|
|
385 |
orphanedCount++;
|
|
|
386 |
|
|
|
387 |
changeLog.Notes += ea_req.ElementGUID + ":Orphaned:" + ea_req.Name + "\r\n";
|
|
|
388 |
changeLog.Update();
|
|
|
389 |
}
|
|
|
390 |
}
|
|
|
391 |
}
|
|
|
392 |
|
|
|
393 |
displayChangeLog(ea_repository, changeLog);
|
|
|
394 |
|
|
|
395 |
ea_repository.RefreshModelView(parentPackage.PackageID);
|
|
|
396 |
|
| 2149 |
ghuddy |
397 |
// Setup the internal requirement to requirement connectivity. This is seperate from the browser
|
|
|
398 |
// organisation of elements in EA, but since in ReqPro, that organisation tells part of the story
|
|
|
399 |
// of requirement to requirement connectivity, it is mirrored in the internal connectivity, along
|
|
|
400 |
// with explicit trace relationships setup in ReqPro.
|
|
|
401 |
// The purpose of this internal connectivity is to support relationship matrix tables in documentation
|
|
|
402 |
// generated by EA_DocGen, or to support diagrammatic representations of the requirements in EA,
|
|
|
403 |
// where the connectivity will become apparent through links ajoining the requirement elements in the
|
|
|
404 |
// diagram.
|
|
|
405 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Writing Trace Information", -1);
|
|
|
406 |
foreach( ReqPro_object sub_obj in rq_root_package.ReqPro_objects )
|
|
|
407 |
{
|
|
|
408 |
write_traces(ea_repository, sub_obj);
|
|
|
409 |
}
|
|
|
410 |
|
| 2145 |
ghuddy |
411 |
// display summary stats
|
| 2141 |
ghuddy |
412 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, newRequirementCount.ToString() + " new requirements", -1);
|
|
|
413 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, modifiedRequirementCount.ToString() + " requirements modified", -1);
|
|
|
414 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, statusUpdatedRequirementCount.ToString() + " requirements had status changes", -1);
|
|
|
415 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, orphanedCount.ToString() + " requirements were orphaned", -1);
|
|
|
416 |
|
|
|
417 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Completed import", -1);
|
|
|
418 |
|
|
|
419 |
MessageBox.Show("Import Completed");
|
|
|
420 |
}
|
|
|
421 |
catch (Exception ex)
|
|
|
422 |
{
|
|
|
423 |
MessageBox.Show(ex.Message, "Error (ImportFromReqPro)", MessageBoxButtons.OK);
|
|
|
424 |
}
|
|
|
425 |
}
|
|
|
426 |
|
|
|
427 |
|
|
|
428 |
|
|
|
429 |
|
|
|
430 |
/// <summary>
|
|
|
431 |
/// This method (along with its sibling overload) obtains a flattened view of the
|
|
|
432 |
/// hierarchical requirements obtained from the ReqPro database. This accumulation
|
|
|
433 |
/// takes account of the users filtering requests.
|
|
|
434 |
/// </summary>
|
|
|
435 |
/// <param name="ea_repository"></param>
|
|
|
436 |
private void get_rq_req_collection(EA.Repository ea_repository, ref ArrayList rq_req_collection)
|
|
|
437 |
{
|
|
|
438 |
foreach( ReqPro_object sub_obj in rq_root_package.ReqPro_objects )
|
|
|
439 |
{
|
|
|
440 |
get_rq_req_collection(ea_repository, ref rq_req_collection, sub_obj);
|
|
|
441 |
}
|
|
|
442 |
}
|
|
|
443 |
|
|
|
444 |
private void get_rq_req_collection(EA.Repository ea_repository,
|
|
|
445 |
ref ArrayList rq_req_collection,
|
|
|
446 |
ReqPro_object rq_obj )
|
|
|
447 |
{
|
|
|
448 |
if (rq_obj.isPackage)
|
|
|
449 |
{
|
| 2147 |
ghuddy |
450 |
// if the package is not filtered, or if we are allowed to dig beneath filtered
|
|
|
451 |
// packages...
|
|
|
452 |
if (rq_obj.filtered == false || base.allowPackageStructureFragments)
|
| 2141 |
ghuddy |
453 |
{
|
|
|
454 |
// Using recursion, scan this objects sub-objects
|
|
|
455 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
|
|
456 |
{
|
| 2147 |
ghuddy |
457 |
// if the sub-object is a package, always recurse to process it, else
|
|
|
458 |
// if the sub-object is a requirement, only recurse if the containing package
|
|
|
459 |
// is not filtered, so that requirements of filtered packages are themselves
|
|
|
460 |
// filtered out by virtue of their parent packages filtering state.
|
|
|
461 |
if ( sub_obj.isPackage
|
|
|
462 |
|| (sub_obj.isRequirement && rq_obj.filtered == false))
|
|
|
463 |
{
|
|
|
464 |
get_rq_req_collection(ea_repository, ref rq_req_collection, sub_obj);
|
|
|
465 |
}
|
| 2141 |
ghuddy |
466 |
}
|
|
|
467 |
}
|
|
|
468 |
}
|
|
|
469 |
else if (rq_obj.isRequirement)
|
|
|
470 |
{
|
|
|
471 |
if ( ! (reqTypeIsFiltered(rq_obj) || reqStatusTypeIsFiltered(rq_obj)) )
|
|
|
472 |
{
|
|
|
473 |
// Add this requirement to the flattened list we are accumulating
|
|
|
474 |
rq_req_collection.Add(rq_obj);
|
|
|
475 |
|
| 2149 |
ghuddy |
476 |
// In ReqPro, a requirement can be related to another requirement in several ways:
|
|
|
477 |
// 1. By virtue of its position relative to another in the browser display. That is,
|
|
|
478 |
// if you place a requirement beneath a parent requirement, you are establishing a
|
|
|
479 |
// parent-child relationship.
|
|
|
480 |
// 2. By virtue of a specific TraceTo relationship being made via the Traceability menu
|
|
|
481 |
// option.
|
|
|
482 |
// Interestingly, ReqPro prevents you creating a relationship of one of the above types,
|
|
|
483 |
// if a relationship of the other type already exists. This implies that the relationship
|
|
|
484 |
// between a parent and child requirement must be singular and is important regardless
|
|
|
485 |
// of the manner in which it was created or represented.
|
|
|
486 |
// The CopyReqProDatabaseToMemory base class will already have taken care of recording
|
|
|
487 |
// relationships detected from ReqPro made using method 2 above. What we need to do here is
|
|
|
488 |
// take care of those apparent from the browser based hierarchical organisation (ie. made
|
|
|
489 |
// in ReqPro using method 1).
|
|
|
490 |
// All we need to do is grab the parent object (if any) and add the GUID of the child to
|
|
|
491 |
// its list of trace-to's. Later on, the write_traces() class method will turn these into
|
|
|
492 |
// EA based connection objects that belong to the parent requirement elements.
|
|
|
493 |
if (rq_obj.parent != null)
|
|
|
494 |
{
|
|
|
495 |
rq_obj.parent.ReqPro_traces.Add(rq_obj.guid);
|
|
|
496 |
}
|
|
|
497 |
|
| 2147 |
ghuddy |
498 |
// Using recursion, scan this objects sub-objects, which in practise will all
|
|
|
499 |
// be requirement objects. At this time requirement objects cannot have packages
|
|
|
500 |
// as children.
|
| 2141 |
ghuddy |
501 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
|
|
502 |
{
|
|
|
503 |
get_rq_req_collection(ea_repository, ref rq_req_collection, sub_obj);
|
|
|
504 |
}
|
|
|
505 |
}
|
|
|
506 |
}
|
|
|
507 |
}
|
|
|
508 |
|
|
|
509 |
|
|
|
510 |
}
|
|
|
511 |
}
|