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