| Line 8... |
Line 8... |
| 8 |
|
8 |
|
| 9 |
namespace EA_ReqPro
|
9 |
namespace EA_ReqPro
|
| 10 |
{
|
10 |
{
|
| 11 |
|
11 |
|
| 12 |
/// <summary>
|
12 |
/// <summary>
|
| 13 |
/// ImportReqProDatabase is a specialisation of CopyReqProDatabaseToMemory, designed to copy the
|
13 |
/// ImportReqProDatabase is a specialisation of CopyReqProDatabaseToMemory, designed to copy the
|
| 14 |
/// ReqPro database content into an EA database, discarding the structure of and hierarchy of
|
14 |
/// ReqPro database content into an EA database, discarding the structure of and hierarchy of
|
| 15 |
/// packages, selecting just the requirements found in the ReqPro database for storage into EA,
|
15 |
/// packages, selecting just the requirements found in the ReqPro database for storage into EA,
|
| 16 |
/// where they will be used for design traceability purposes.
|
16 |
/// where they will be used for design traceability purposes.
|
| 17 |
/// </summary>
|
17 |
/// </summary>
|
| 18 |
public class ImportReqProDatabase : CopyReqProDatabaseToMemory
|
18 |
public class ImportReqProDatabase : CopyReqProDatabaseToMemory
|
| 19 |
{
|
19 |
{
|
| Line 21... |
Line 21... |
| 21 |
{
|
21 |
{
|
| 22 |
public ArrayList ea_reqs;
|
22 |
public ArrayList ea_reqs;
|
| 23 |
public ArrayList ea_GUIDs;
|
23 |
public ArrayList ea_GUIDs;
|
| 24 |
public ArrayList new_ea_reqs;
|
24 |
public ArrayList new_ea_reqs;
|
| 25 |
public ArrayList new_ea_GUIDs;
|
25 |
public ArrayList new_ea_GUIDs;
|
| - |
|
26 |
public ArrayList orphaned_ea_reqs;
|
| 26 |
};
|
27 |
};
|
| 27 |
|
28 |
|
| 28 |
private req_lists_t req_lists = new req_lists_t();
|
29 |
private req_lists_t gReq_lists = new req_lists_t();
|
| 29 |
|
30 |
|
| 30 |
private int totalRequirements = 0;
|
31 |
private int totalRequirements = 0;
|
| 31 |
|
32 |
|
| 32 |
private EA.Package gCurrentPackage = null;
|
33 |
private EA.Package gCurrentPackage = null;
|
| 33 |
private EA.Package gNewReqProDBPackage = null;
|
34 |
private EA.Package gNewReqProDBPackage = null;
|
| 34 |
private EA.Package gChangeHistoryPackage = null;
|
35 |
private EA.Package gChangeHistoryPackage = null;
|
| 35 |
private EA.Package gOrphansPackage = null;
|
36 |
private EA.Package gOrphansPackage = null;
|
| 36 |
|
37 |
|
| - |
|
38 |
private int gNewRequirementCount = 0;
|
| - |
|
39 |
private int gModifiedRequirementCount = 0;
|
| - |
|
40 |
private int gStatusUpdatedRequirementCount = 0;
|
| - |
|
41 |
private int gOrphanedCount = 0;
|
| - |
|
42 |
|
| - |
|
43 |
private EA.Element gChangeLog = null;
|
| 37 |
|
44 |
|
| 38 |
/// <summary>
|
45 |
/// <summary>
|
| 39 |
/// Constructor logic
|
46 |
/// Constructor logic
|
| 40 |
/// </summary>
|
47 |
/// </summary>
|
| 41 |
/// <param name="ea_repository"></param>
|
48 |
/// <param name="ea_repository"></param>
|
| Line 80... |
Line 87... |
| 80 |
}
|
87 |
}
|
| 81 |
}
|
88 |
}
|
| 82 |
catch (Exception ex)
|
89 |
catch (Exception ex)
|
| 83 |
{
|
90 |
{
|
| 84 |
Main.MessageBoxException(ex, "Exception (parse)");
|
91 |
Main.MessageBoxException(ex, "Exception (parse)");
|
| 85 |
}
|
92 |
}
|
| 86 |
|
93 |
|
| 87 |
return false;
|
94 |
return false;
|
| 88 |
}
|
95 |
}
|
| 89 |
|
96 |
|
| 90 |
|
97 |
|
| Line 109... |
Line 116... |
| 109 |
// a time.
|
116 |
// a time.
|
| 110 |
string delimStr = "\n";
|
117 |
string delimStr = "\n";
|
| 111 |
char [] delim = delimStr.ToCharArray();
|
118 |
char [] delim = delimStr.ToCharArray();
|
| 112 |
string[] log_strings = changeLog.Notes.Split(delim,2000);
|
119 |
string[] log_strings = changeLog.Notes.Split(delim,2000);
|
| 113 |
|
120 |
|
| 114 |
// Prepare a string to form an updated change log (needed to support the activity of orphaned
|
- |
|
| 115 |
// requirement deletion).
|
- |
|
| 116 |
string newList = "";
|
- |
|
| 117 |
|
121 |
|
| 118 |
// modify delimiters to : character so that we can extract the parameters for each log entry
|
122 |
// modify delimiters to : character so that we can extract the parameters for each log entry
|
| 119 |
delimStr = ":";
|
123 |
delimStr = ":";
|
| 120 |
delim = delimStr.ToCharArray();
|
124 |
delim = delimStr.ToCharArray();
|
| 121 |
|
125 |
|
| Line 123... |
Line 127... |
| 123 |
{
|
127 |
{
|
| 124 |
if (Main.mustAbort)
|
128 |
if (Main.mustAbort)
|
| 125 |
break;
|
129 |
break;
|
| 126 |
|
130 |
|
| 127 |
// over time, users may delete the orphaned requirements from the EA database, but their
|
131 |
// over time, users may delete the orphaned requirements from the EA database, but their
|
| 128 |
// GUIDs will still exist in the change log. Use of such a GUID will cause
|
132 |
// GUIDs will still exist in the change log. Use of such a GUID will cause
|
| 129 |
// an exception in the GetElementByGuid() function. What should we do? We can attempt
|
133 |
// an exception in the GetElementByGuid() function. What should we do? We can attempt
|
| 130 |
// to remove those GUIDs from the list. We can do this by accumulating a new list of GUIDs
|
134 |
// to remove those GUIDs from the list. We can do this by accumulating a new list of GUIDs
|
| 131 |
// that is formed from the old list, where only good items from the old list find their
|
135 |
// that is formed from the old list, where only good items from the old list find their
|
| 132 |
// way into the new list. Gradually, the list is wittled away as EA users delete orphaned
|
136 |
// way into the new list. Gradually, the list is wittled away as EA users delete orphaned
|
| 133 |
// requirements having first dealt with the design change impacts that resulted from their
|
137 |
// requirements having first dealt with the design change impacts that resulted from their
|
| 134 |
// orphanage.
|
138 |
// orphanage.
|
| 135 |
try
|
139 |
try
|
| 136 |
{
|
140 |
{
|
| Line 162... |
Line 166... |
| 162 |
// we dont care about direction of relationship, so test for both
|
166 |
// we dont care about direction of relationship, so test for both
|
| 163 |
if (theConnector.ClientID == ea_req.ElementID)
|
167 |
if (theConnector.ClientID == ea_req.ElementID)
|
| 164 |
destId = theConnector.SupplierID;
|
168 |
destId = theConnector.SupplierID;
|
| 165 |
else if (theConnector.SupplierID == ea_req.ElementID)
|
169 |
else if (theConnector.SupplierID == ea_req.ElementID)
|
| 166 |
destId = theConnector.ClientID;
|
170 |
destId = theConnector.ClientID;
|
| 167 |
else
|
171 |
else
|
| 168 |
destId = theConnector.SupplierID;
|
172 |
destId = theConnector.SupplierID;
|
| 169 |
|
173 |
|
| 170 |
// and make sure we filter out self-referential connectors
|
174 |
// and make sure we filter out self-referential connectors
|
| 171 |
if (destId != ea_req.ElementID)
|
175 |
if (destId != ea_req.ElementID)
|
| 172 |
{
|
176 |
{
|
| Line 269... |
Line 273... |
| 269 |
{
|
273 |
{
|
| 270 |
Main.WriteOutput(string.Format(" Modified {0}: {1}", Constants.CHG_LOG_SOURCE, ea_req.Name), ea_req.ElementID );
|
274 |
Main.WriteOutput(string.Format(" Modified {0}: {1}", Constants.CHG_LOG_SOURCE, ea_req.Name), ea_req.ElementID );
|
| 271 |
Main.WriteOutput(" <<< " + parameters[2], ea_req.ElementID);
|
275 |
Main.WriteOutput(" <<< " + parameters[2], ea_req.ElementID);
|
| 272 |
Main.WriteOutput(" >>> " + parameters[3], ea_req.ElementID);
|
276 |
Main.WriteOutput(" >>> " + parameters[3], ea_req.ElementID);
|
| 273 |
}
|
277 |
}
|
| 274 |
|
- |
|
| 275 |
// accumulate good item into the newList
|
- |
|
| 276 |
newList += trimmed_s + "\r\n";
|
- |
|
| 277 |
}
|
278 |
}
|
| 278 |
}
|
279 |
}
|
| 279 |
catch
|
280 |
catch
|
| 280 |
{
|
281 |
{
|
| 281 |
// do nothing - the newList accumulator will not have the GUID that caused the exception
|
- |
|
| 282 |
// so the next time a display operation is attempted, the exception wont happen.
|
- |
|
| 283 |
}
|
282 |
}
|
| 284 |
}
|
283 |
}
|
| 285 |
|
- |
|
| 286 |
// Update the change log
|
- |
|
| 287 |
changeLog.Notes = newList;
|
- |
|
| 288 |
changeLog.Update();
|
- |
|
| 289 |
}
|
284 |
}
|
| 290 |
}
|
285 |
}
|
| 291 |
|
286 |
|
| 292 |
|
287 |
|
| 293 |
/// <summary>
|
288 |
/// <summary>
|
| 294 |
/// Rid a string of any : char because we use that as a delimiter in the change log and so we
|
289 |
/// Rid a string of any : char because we use that as a delimiter in the change log and so we
|
| 295 |
/// do not want a users use of the character to confuse the change log display mechanism.
|
290 |
/// do not want a users use of the character to confuse the change log display mechanism.
|
| 296 |
/// </summary>
|
291 |
/// </summary>
|
| 297 |
/// <param name="s"></param>
|
292 |
/// <param name="s"></param>
|
| 298 |
/// <returns></returns>
|
293 |
/// <returns></returns>
|
| 299 |
private string NO_COLONS(string s)
|
294 |
private string NO_COLONS(string s)
|
| 300 |
{
|
295 |
{
|
| 301 |
string sc = s.Replace(':', ' ');
|
296 |
string sc = s.Replace(':', ' ');
|
| 302 |
sc = sc.Replace('\r' , ' ');
|
297 |
sc = sc.Replace('\r' , ' ');
|
| 303 |
sc = sc.Replace('\n' , ' ');
|
298 |
sc = sc.Replace('\n' , ' ');
|
| 304 |
|
299 |
|
| 305 |
return sc;
|
300 |
return sc;
|
| 306 |
}
|
301 |
}
|
| 307 |
|
302 |
|
| 308 |
|
303 |
|
| 309 |
|
304 |
|
| Line 318... |
Line 313... |
| 318 |
try
|
313 |
try
|
| 319 |
{
|
314 |
{
|
| 320 |
DialogResult dlgres;
|
315 |
DialogResult dlgres;
|
| 321 |
|
316 |
|
| 322 |
// begin to initialise some of our element lists
|
317 |
// begin to initialise some of our element lists
|
| 323 |
req_lists.new_ea_reqs = new ArrayList();
|
318 |
gReq_lists.new_ea_reqs = new ArrayList();
|
| 324 |
req_lists.new_ea_GUIDs = new ArrayList();
|
319 |
gReq_lists.new_ea_GUIDs = new ArrayList();
|
| 325 |
req_lists.ea_GUIDs = new ArrayList();
|
320 |
gReq_lists.ea_GUIDs = new ArrayList();
|
| - |
|
321 |
gReq_lists.orphaned_ea_reqs = new ArrayList();
|
| 326 |
|
322 |
|
| 327 |
ArrayList ea_req_matched = new ArrayList();
|
323 |
ArrayList ea_req_matched = new ArrayList();
|
| 328 |
|
324 |
|
| 329 |
// Obtain the EA parent package so that we can create under it our ReqProDB structure and change history packages
|
325 |
// Obtain the EA parent package so that we can create under it our ReqProDB structure and change history packages
|
| 330 |
EA.Package parentPackage = Main.EA_Repository.GetPackageByID( base.RQ_Element.PackageID );
|
326 |
EA.Package parentPackage = Main.EA_Repository.GetPackageByID( base.RQ_Element.PackageID );
|
| Line 355... |
Line 351... |
| 355 |
|
351 |
|
| 356 |
Main.WriteOutput("Acquiring list of elements already in EA", -1);
|
352 |
Main.WriteOutput("Acquiring list of elements already in EA", -1);
|
| 357 |
EA_ElementAccumulator reqLister = new EA_ElementAccumulator(allowedElementTypes);
|
353 |
EA_ElementAccumulator reqLister = new EA_ElementAccumulator(allowedElementTypes);
|
| 358 |
EA_Parsing.findAndProcessPackageElements( parentPackage, reqLister, true );
|
354 |
EA_Parsing.findAndProcessPackageElements( parentPackage, reqLister, true );
|
| 359 |
|
355 |
|
| 360 |
req_lists.ea_reqs = reqLister.Elements;
|
356 |
gReq_lists.ea_reqs = reqLister.Elements;
|
| 361 |
|
357 |
|
| 362 |
if (Main.mustAbort)
|
358 |
if (Main.mustAbort)
|
| 363 |
return;
|
359 |
return;
|
| 364 |
|
360 |
|
| 365 |
// For the lsit we just found, get an adjacent list of the associated ReqPro GUIDs.
|
361 |
// For the list we just found, get an adjacent list of the associated ReqPro GUIDs.
|
| 366 |
// The two lists will be indexable by the same index.
|
362 |
// The two lists will be indexable by the same index.
|
| 367 |
foreach (EA.Element ea_req in req_lists.ea_reqs)
|
363 |
foreach (EA.Element ea_req in gReq_lists.ea_reqs)
|
| 368 |
{
|
364 |
{
|
| 369 |
string GUID = EA_TaggedValues.Read(ea_req, Constants.TAG_GUID);
|
365 |
string GUID = EA_TaggedValues.Read(ea_req, Constants.TAG_GUID);
|
| 370 |
req_lists.ea_GUIDs.Add(GUID);
|
366 |
gReq_lists.ea_GUIDs.Add(GUID);
|
| 371 |
ea_req_matched.Add(false);
|
367 |
ea_req_matched.Add(false);
|
| 372 |
}
|
368 |
}
|
| 373 |
|
369 |
|
| 374 |
if (Main.mustAbort)
|
370 |
if (Main.mustAbort)
|
| 375 |
return;
|
371 |
return;
|
| 376 |
|
372 |
|
| 377 |
|
373 |
|
| 378 |
// Create the change log element in the change history package
|
374 |
// Create the change log element in the change history package
|
| 379 |
EA.Element changeLog = (EA.Element)gChangeHistoryPackage.Elements.AddNew("Change Log" + " - import " + importDateTime, "InformationItem");
|
375 |
gChangeLog = (EA.Element)gChangeHistoryPackage.Elements.AddNew("Change Log" + " - import " + importDateTime, "InformationItem");
|
| - |
|
376 |
gChangeLog.Notes = "";
|
| 380 |
changeLog.TreePos = gChangeHistoryPackage.Elements.Count - 1;
|
377 |
gChangeLog.TreePos = gChangeHistoryPackage.Elements.Count - 1;
|
| 381 |
changeLog.Update();
|
378 |
gChangeLog.Update();
|
| 382 |
|
379 |
|
| 383 |
// Get a flattened list of requirements from the hierarchical data the user has filtered
|
380 |
// Get a flattened list of requirements from the hierarchical data the user has filtered
|
| 384 |
ArrayList rq_req_collection = new ArrayList();
|
381 |
ArrayList rq_req_collection = new ArrayList();
|
| 385 |
get_rq_req_collection(ref rq_req_collection);
|
382 |
get_rq_req_collection(ref rq_req_collection);
|
| 386 |
|
383 |
|
| 387 |
// initialise some statistical vars
|
384 |
// initialise some statistical vars
|
| 388 |
int newRequirementCount = 0;
|
385 |
gNewRequirementCount = 0;
|
| 389 |
int modifiedRequirementCount = 0;
|
386 |
gModifiedRequirementCount = 0;
|
| 390 |
int statusUpdatedRequirementCount = 0;
|
387 |
gStatusUpdatedRequirementCount = 0;
|
| 391 |
int orphanedCount = 0;
|
388 |
gOrphanedCount = 0;
|
| 392 |
|
389 |
|
| 393 |
|
390 |
|
| 394 |
Main.WriteOutput("Merging ReqPro content to EA", -1);
|
391 |
Main.WriteOutput("Merging ReqPro content to EA", -1);
|
| 395 |
|
392 |
|
| 396 |
// loop through all of the ReqPro requirements we have captured from the ReqPro database
|
393 |
// loop through all of the ReqPro requirements we have captured from the ReqPro database
|
| Line 401... |
Line 398... |
| 401 |
|
398 |
|
| 402 |
try
|
399 |
try
|
| 403 |
{
|
400 |
{
|
| 404 |
// Find which EA requirement element refers to the current ReqPro GUID
|
401 |
// Find which EA requirement element refers to the current ReqPro GUID
|
| 405 |
int i_ea_req;
|
402 |
int i_ea_req;
|
| 406 |
i_ea_req = req_lists.ea_GUIDs.IndexOf( rq_obj.guid );
|
403 |
i_ea_req = gReq_lists.ea_GUIDs.IndexOf( rq_obj.guid );
|
| 407 |
|
404 |
|
| 408 |
// If EA element was found
|
405 |
// If EA element was found
|
| 409 |
if (0 <= i_ea_req)
|
406 |
if (0 <= i_ea_req)
|
| 410 |
{
|
407 |
{
|
| - |
|
408 |
// update orphanage detection data
|
| 411 |
ea_req_matched[i_ea_req] = true;
|
409 |
ea_req_matched[i_ea_req] = true;
|
| - |
|
410 |
rq_obj.matched = true;
|
| 412 |
|
411 |
|
| 413 |
EA.Element ea_req = ((EA.Element)req_lists.ea_reqs[i_ea_req]);
|
412 |
EA.Element ea_req = ((EA.Element)gReq_lists.ea_reqs[i_ea_req]);
|
| 414 |
|
413 |
|
| 415 |
rq_obj.ea_element_ID = ea_req.ElementID;
|
414 |
rq_obj.ea_element_ID = ea_req.ElementID;
|
| 416 |
|
415 |
|
| 417 |
// Only update the requirement if it was not mastered in EA, or
|
416 |
// Only update the requirement if it was not mastered in EA, or
|
| 418 |
// unrestricted imports have been enabled
|
417 |
// unrestricted imports have been enabled
|
| 419 |
if ( (false == EA_TaggedValues.Read(ea_req, Constants.TAG_CREATED_IN_EA, Constants.DEFAULT_CREATED_IN_EA))
|
418 |
if ( (false == EA_TaggedValues.Read(ea_req, Constants.TAG_CREATED_IN_EA, Constants.DEFAULT_CREATED_IN_EA))
|
| 420 |
|| (true == EA_TaggedValues.Read(ea_req, Constants.TAG_UNRESTRICTED_IMPORTS, Constants.DEFAULT_UNRESTRICTED_IMPORTS)) )
|
419 |
|| (true == EA_TaggedValues.Read(ea_req, Constants.TAG_UNRESTRICTED_IMPORTS, Constants.DEFAULT_UNRESTRICTED_IMPORTS)) )
|
| 421 |
{
|
420 |
{
|
| 422 |
// This ReqPro requirement already has a counterpart in EA, so we must simply
|
421 |
// This ReqPro requirement already has a counterpart in EA, so we must simply
|
| 423 |
// update the counterpart. But, to aid the designer, we need to try to tell them
|
422 |
// update the counterpart. But, to aid the designer, we need to try to tell them
|
| 424 |
// how the requirement has changed, which could ofcoarse change the meaning
|
423 |
// how the requirement has changed, which could ofcoarse change the meaning
|
| 425 |
// of the requirement and require design changes to be done.
|
424 |
// of the requirement and require design changes to be done.
|
| 426 |
|
425 |
|
| 427 |
bool meaningMayHaveChanged = false;
|
426 |
bool meaningMayHaveChanged = false;
|
| 428 |
bool statusMayHaveChanged = false;
|
427 |
bool statusMayHaveChanged = false;
|
| 429 |
|
- |
|
| - |
|
428 |
|
| 430 |
string ea_req_name = rq_obj.tag + " " + rq_obj.name;
|
429 |
string ea_req_name = rq_obj.tag + " " + rq_obj.name;
|
| 431 |
|
430 |
|
| 432 |
Main.WriteOutput("Updating: " + ea_req_name, rq_obj.ea_element_ID);
|
431 |
Main.WriteOutput("Updating: " + ea_req_name, rq_obj.ea_element_ID);
|
| 433 |
|
432 |
|
| 434 |
ea_req.Name = updated_property_value_if_changed(changeLog, ea_req, ea_req.Name, Constants.CHG_LOG_NAME, ea_req_name, ref meaningMayHaveChanged);
|
433 |
ea_req.Name = updated_property_value_if_changed(gChangeLog, ea_req, ea_req.Name, Constants.CHG_LOG_NAME, ea_req_name, ref meaningMayHaveChanged);
|
| 435 |
|
434 |
|
| 436 |
ea_req.Notes = updated_property_value_if_changed(changeLog, ea_req, ea_req.Notes, Constants.CHG_LOG_NOTES, rq_obj.text, ref meaningMayHaveChanged);
|
435 |
ea_req.Notes = updated_property_value_if_changed(gChangeLog, ea_req, ea_req.Notes, Constants.CHG_LOG_NOTES, rq_obj.text, ref meaningMayHaveChanged);
|
| 437 |
|
436 |
|
| 438 |
ea_req.Difficulty = updated_property_value_if_changed(changeLog, ea_req, ea_req.Difficulty, Constants.CHG_LOG_DIFFICULTY, rq_obj.difficulty, ref statusMayHaveChanged);
|
437 |
ea_req.Difficulty = updated_property_value_if_changed(gChangeLog, ea_req, ea_req.Difficulty, Constants.CHG_LOG_DIFFICULTY, rq_obj.difficulty, ref statusMayHaveChanged);
|
| 439 |
|
438 |
|
| 440 |
ea_req.Priority = updated_property_value_if_changed(changeLog, ea_req, ea_req.Priority, Constants.CHG_LOG_PRIORITY, rq_obj.priority, ref statusMayHaveChanged);
|
439 |
ea_req.Priority = updated_property_value_if_changed(gChangeLog, ea_req, ea_req.Priority, Constants.CHG_LOG_PRIORITY, rq_obj.priority, ref statusMayHaveChanged);
|
| 441 |
|
440 |
|
| 442 |
ea_req.Status = updated_property_value_if_changed(changeLog, ea_req, ea_req.Status, Constants.CHG_LOG_STATUS, rq_obj.status, ref statusMayHaveChanged);
|
441 |
ea_req.Status = updated_property_value_if_changed(gChangeLog, ea_req, ea_req.Status, Constants.CHG_LOG_STATUS, rq_obj.status, ref statusMayHaveChanged);
|
| 443 |
|
442 |
|
| 444 |
if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_SOURCE, Constants.CHG_LOG_SOURCE, rq_obj.source, ref statusMayHaveChanged);
|
443 |
if_tagged_value_changed_update_it(gChangeLog, ea_req, Constants.TAG_SOURCE, Constants.CHG_LOG_SOURCE, rq_obj.source, ref statusMayHaveChanged);
|
| 445 |
|
444 |
|
| 446 |
if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_SOURCE_VERSION, Constants.CHG_LOG_SOURCE_VERSION, rq_obj.sourceVersion, ref statusMayHaveChanged);
|
445 |
if_tagged_value_changed_update_it(gChangeLog, ea_req, Constants.TAG_SOURCE_VERSION, Constants.CHG_LOG_SOURCE_VERSION, rq_obj.sourceVersion, ref statusMayHaveChanged);
|
| 447 |
|
446 |
|
| 448 |
if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_SOURCE_SECTION, Constants.CHG_LOG_SOURCE_SECTION, rq_obj.sourceSection, ref statusMayHaveChanged);
|
447 |
if_tagged_value_changed_update_it(gChangeLog, ea_req, Constants.TAG_SOURCE_SECTION, Constants.CHG_LOG_SOURCE_SECTION, rq_obj.sourceSection, ref statusMayHaveChanged);
|
| 449 |
|
448 |
|
| 450 |
if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_SUBSYSTEM, Constants.CHG_LOG_SUBSYSTEM_TYPE, rq_obj.subsystem, ref statusMayHaveChanged);
|
449 |
if_tagged_value_changed_update_it(gChangeLog, ea_req, Constants.TAG_SUBSYSTEM, Constants.CHG_LOG_SUBSYSTEM_TYPE, rq_obj.subsystem, ref statusMayHaveChanged);
|
| 451 |
|
450 |
|
| 452 |
if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_STABILITY, Constants.CHG_LOG_STABILITY, rq_obj.stability, ref statusMayHaveChanged);
|
451 |
if_tagged_value_changed_update_it(gChangeLog, ea_req, Constants.TAG_STABILITY, Constants.CHG_LOG_STABILITY, rq_obj.stability, ref statusMayHaveChanged);
|
| 453 |
|
452 |
|
| 454 |
// Requirement Types are actually implemented using ordinary EA element stereotypes.
|
453 |
// Requirement Types are actually implemented using ordinary EA element stereotypes.
|
| 455 |
string[] sar = ea_req.StereotypeEx.Split(",".ToCharArray());
|
454 |
string[] sar = ea_req.StereotypeEx.Split(",".ToCharArray());
|
| 456 |
|
455 |
|
| 457 |
// if we didnt get a requirement type from the ReqPro database, set it to an empty string so that it can
|
456 |
// if we didnt get a requirement type from the ReqPro database, set it to an empty string so that it can
|
| Line 465... |
Line 464... |
| 465 |
// thinks is assigned to the requirement element, so check against that for changes
|
464 |
// thinks is assigned to the requirement element, so check against that for changes
|
| 466 |
string sar0 = sar[0].Trim();
|
465 |
string sar0 = sar[0].Trim();
|
| 467 |
|
466 |
|
| 468 |
if (!sar0.Equals(rq_obj.type))
|
467 |
if (!sar0.Equals(rq_obj.type))
|
| 469 |
{
|
468 |
{
|
| 470 |
changeLog.Notes += ea_req.ElementGUID + ":" + Constants.CHG_LOG_REQ_TYPE + ":" + sar0 + ":" + rq_obj.type + "\r\n";
|
469 |
gChangeLog.Notes += ea_req.ElementGUID + ":" + Constants.CHG_LOG_REQ_TYPE + ":" + sar0 + ":" + rq_obj.type + "\r\n";
|
| 471 |
changeLog.Update();
|
470 |
gChangeLog.Update();
|
| 472 |
statusMayHaveChanged = true;
|
471 |
statusMayHaveChanged = true;
|
| 473 |
ea_req.StereotypeEx = rq_obj.type;
|
472 |
ea_req.StereotypeEx = rq_obj.type;
|
| 474 |
ea_req.Stereotype = rq_obj.type;
|
473 |
ea_req.Stereotype = rq_obj.type;
|
| 475 |
}
|
474 |
}
|
| 476 |
}
|
475 |
}
|
| 477 |
else if (!ea_req.Stereotype.Equals(rq_obj.type))
|
476 |
else if (!ea_req.Stereotype.Equals(rq_obj.type))
|
| 478 |
{
|
477 |
{
|
| 479 |
changeLog.Notes += ea_req.ElementGUID + ":" + Constants.CHG_LOG_REQ_TYPE + ":" + ea_req.Stereotype + ":" + rq_obj.type + "\r\n";
|
478 |
gChangeLog.Notes += ea_req.ElementGUID + ":" + Constants.CHG_LOG_REQ_TYPE + ":" + ea_req.Stereotype + ":" + rq_obj.type + "\r\n";
|
| 480 |
changeLog.Update();
|
479 |
gChangeLog.Update();
|
| 481 |
statusMayHaveChanged = true;
|
480 |
statusMayHaveChanged = true;
|
| 482 |
ea_req.StereotypeEx = rq_obj.type;
|
481 |
ea_req.StereotypeEx = rq_obj.type;
|
| 483 |
ea_req.Stereotype = rq_obj.type;
|
482 |
ea_req.Stereotype = rq_obj.type;
|
| 484 |
}
|
483 |
}
|
| 485 |
|
484 |
|
| 486 |
ea_req.Update();
|
485 |
ea_req.Update();
|
| 487 |
|
486 |
|
| 488 |
if (meaningMayHaveChanged)
|
487 |
if (meaningMayHaveChanged)
|
| 489 |
{
|
488 |
{
|
| 490 |
modifiedRequirementCount++;
|
489 |
gModifiedRequirementCount++;
|
| 491 |
}
|
490 |
}
|
| 492 |
|
- |
|
| - |
|
491 |
|
| 493 |
if (statusMayHaveChanged)
|
492 |
if (statusMayHaveChanged)
|
| 494 |
{
|
493 |
{
|
| 495 |
statusUpdatedRequirementCount++;
|
494 |
gStatusUpdatedRequirementCount++;
|
| 496 |
}
|
495 |
}
|
| 497 |
|
496 |
|
| 498 |
totalRequirements++;
|
497 |
totalRequirements++;
|
| 499 |
}
|
498 |
}
|
| 500 |
|
- |
|
| 501 |
}
|
499 |
}
|
| 502 |
else
|
500 |
else
|
| 503 |
{
|
501 |
{
|
| - |
|
502 |
// update orphanage detection data
|
| - |
|
503 |
rq_obj.matched = true;
|
| - |
|
504 |
|
| 504 |
totalRequirements++;
|
505 |
totalRequirements++;
|
| 505 |
|
506 |
|
| 506 |
// This ReqPro requirement does not have a counterpart in EA, so we must create
|
507 |
// This ReqPro requirement does not have a counterpart in EA, so we must create
|
| 507 |
// a new one.
|
508 |
// a new one.
|
| 508 |
newRequirementCount++;
|
509 |
gNewRequirementCount++;
|
| 509 |
|
510 |
|
| 510 |
// create the new EA requirement in the import package
|
511 |
// create the new EA requirement in the import package
|
| 511 |
EA.Element ea_req = (EA.Element)gChangeHistoryPackage.Elements.AddNew( rq_obj.tag + " " + rq_obj.name, "Requirement");
|
512 |
EA.Element ea_req = (EA.Element)gChangeHistoryPackage.Elements.AddNew( rq_obj.tag + " " + rq_obj.name, "Requirement");
|
| 512 |
|
513 |
|
| 513 |
rq_obj.ea_element_ID = ea_req.ElementID;
|
514 |
rq_obj.ea_element_ID = ea_req.ElementID;
|
| Line 517... |
Line 518... |
| 517 |
ea_req.Notes = rq_obj.text;
|
518 |
ea_req.Notes = rq_obj.text;
|
| 518 |
|
519 |
|
| 519 |
ea_req.Update();
|
520 |
ea_req.Update();
|
| 520 |
|
521 |
|
| 521 |
// add the new requirement to our list for later processing
|
522 |
// add the new requirement to our list for later processing
|
| 522 |
req_lists.new_ea_reqs.Add(ea_req);
|
523 |
gReq_lists.new_ea_reqs.Add(ea_req);
|
| 523 |
req_lists.new_ea_GUIDs.Add(rq_obj.guid);
|
524 |
gReq_lists.new_ea_GUIDs.Add(rq_obj.guid);
|
| 524 |
|
525 |
|
| 525 |
changeLog.Notes += ea_req.ElementGUID + ":Created:" + ea_req.Name + "\r\n";
|
526 |
gChangeLog.Notes += ea_req.ElementGUID + ":Created:" + ea_req.Name + "\r\n";
|
| 526 |
changeLog.Update();
|
527 |
gChangeLog.Update();
|
| 527 |
|
528 |
|
| 528 |
Main.WriteOutput("Created: " + ea_req.Name, ea_req.ElementID);
|
529 |
Main.WriteOutput("Created: " + ea_req.Name, ea_req.ElementID);
|
| 529 |
}
|
530 |
}
|
| 530 |
|
- |
|
| - |
|
531 |
|
| 531 |
}
|
532 |
}
|
| 532 |
catch (Exception ex)
|
533 |
catch (Exception ex)
|
| 533 |
{
|
534 |
{
|
| 534 |
Main.WriteOutput("Exception (ImportFromReqPro), " + ex.Message + ", " + rq_obj.name, -1);
|
535 |
Main.WriteOutput("Exception (ImportFromReqPro), " + ex.Message + ", " + rq_obj.name, -1);
|
| 535 |
}
|
536 |
}
|
| Line 538... |
Line 539... |
| 538 |
if (Main.mustAbort)
|
539 |
if (Main.mustAbort)
|
| 539 |
return;
|
540 |
return;
|
| 540 |
|
541 |
|
| 541 |
Main.WriteOutput("Checking for orphaned requirements", -1);
|
542 |
Main.WriteOutput("Checking for orphaned requirements", -1);
|
| 542 |
|
543 |
|
| 543 |
// Now check for orphaned EA requirements
|
544 |
// Now do initial check for orphaned EA requirements
|
| 544 |
for (int i = 0; i < req_lists.ea_GUIDs.Count; i++)
|
545 |
for (int i = 0; i < gReq_lists.ea_GUIDs.Count; i++)
|
| 545 |
{
|
546 |
{
|
| 546 |
if (Main.mustAbort)
|
547 |
if (Main.mustAbort)
|
| 547 |
break;
|
548 |
break;
|
| 548 |
|
549 |
|
| 549 |
string rq_GUID = (string)req_lists.ea_GUIDs[i];
|
550 |
string rq_GUID = (string)gReq_lists.ea_GUIDs[i];
|
| 550 |
if (rq_GUID != "")
|
551 |
if (rq_GUID != "")
|
| 551 |
{
|
552 |
{
|
| 552 |
if ((bool)ea_req_matched[i] == false)
|
553 |
if ((bool)ea_req_matched[i] == false)
|
| 553 |
{
|
554 |
{
|
| 554 |
EA.Element ea_req = (EA.Element)req_lists.ea_reqs[i];
|
555 |
EA.Element ea_req = (EA.Element)gReq_lists.ea_reqs[i];
|
| 555 |
|
- |
|
| 556 |
orphanedCount++;
|
- |
|
| 557 |
|
556 |
|
| 558 |
changeLog.Notes += ea_req.ElementGUID + ":Orphaned:" + ea_req.Name + "\r\n";
|
- |
|
| 559 |
changeLog.Update();
|
557 |
add_to_orphan_list(ref ea_req);
|
| 560 |
}
|
558 |
}
|
| 561 |
}
|
559 |
}
|
| 562 |
}
|
560 |
}
|
| 563 |
|
561 |
|
| 564 |
// If there is any change to report, ask user if they want to see it now, and if so, display it
|
- |
|
| 565 |
if (changeLog.Notes != null && changeLog.Notes.Length > 0)
|
- |
|
| 566 |
{
|
- |
|
| 567 |
dlgres = MessageBoxEx.Show("Display Change Log?", "Change Log", MessageBoxButtons.YesNo);
|
- |
|
| 568 |
if (dlgres == DialogResult.Yes)
|
- |
|
| 569 |
displayChangeLog(changeLog);
|
- |
|
| 570 |
}
|
- |
|
| 571 |
|
- |
|
| 572 |
if (Main.mustAbort)
|
- |
|
| 573 |
return;
|
- |
|
| 574 |
|
- |
|
| 575 |
// Now we import the ReqPro database package structure and migrate all of our existing or
|
562 |
// Now we import the ReqPro database package structure and migrate all of our existing or
|
| 576 |
// new requirements into it. We only create the structure we need, ie. empty package structure
|
563 |
// new requirements into it. We only create the structure we need, ie. empty package structure
|
| 577 |
// will not be created unecessarily.
|
564 |
// will not be created unecessarily.
|
| 578 |
Main.WriteOutput("Importing latest ReqPro database package structure", -1);
|
565 |
Main.WriteOutput("Importing latest ReqPro database package structure", -1);
|
| 579 |
populate_latest_reqprodb_structure_package(rq_root_package);
|
566 |
populate_latest_reqprodb_structure_package(rq_root_package);
|
| 580 |
gNewReqProDBPackage.Packages.Refresh();
|
567 |
gNewReqProDBPackage.Packages.Refresh();
|
| Line 583... |
Line 570... |
| 583 |
Main.EA_Repository.RefreshModelView(parentPackage.PackageID);
|
570 |
Main.EA_Repository.RefreshModelView(parentPackage.PackageID);
|
| 584 |
|
571 |
|
| 585 |
if (Main.mustAbort)
|
572 |
if (Main.mustAbort)
|
| 586 |
return;
|
573 |
return;
|
| 587 |
|
574 |
|
| - |
|
575 |
// If there is any change to report, ask user if they want to see it now, and if so, display it
|
| - |
|
576 |
if (gChangeLog.Notes != null && gChangeLog.Notes.Length > 0)
|
| - |
|
577 |
{
|
| - |
|
578 |
dlgres = MessageBoxEx.Show("Display Change Log?", "Change Log", MessageBoxButtons.YesNo);
|
| - |
|
579 |
if (dlgres == DialogResult.Yes)
|
| - |
|
580 |
displayChangeLog(gChangeLog);
|
| - |
|
581 |
}
|
| - |
|
582 |
|
| - |
|
583 |
if (Main.mustAbort)
|
| - |
|
584 |
return;
|
| - |
|
585 |
|
| - |
|
586 |
|
| - |
|
587 |
// Take care of orphaned packages that have been orphaned due to a reduction in the scope of import.
|
| - |
|
588 |
//Main.WriteOutput("Re-locating orphaned requirements (if any)", -1);
|
| - |
|
589 |
//foreach (EA.Element ea_req_orphaned in ea_reqs_orphaned)
|
| - |
|
590 |
//{
|
| - |
|
591 |
// ea_req_orphaned.PackageID = gOrphansPackage.PackageID;
|
| - |
|
592 |
// ea_req_orphaned.Update();
|
| - |
|
593 |
//}
|
| - |
|
594 |
|
| 588 |
// Remove the old superseded facsimile of the ReqPro database package structure. At this point,
|
595 |
// Remove the old superseded facsimile of the ReqPro database package structure. At this point,
|
| 589 |
// orphaned requirements left in these will be moved to the Orphaned package, before the old
|
596 |
// orphaned requirements left in these will be moved to the Orphaned package, before the old
|
| 590 |
// structure package is removed.
|
597 |
// structure package is removed.
|
| 591 |
Main.WriteOutput("Removing old ReqPro database package structures", -1);
|
598 |
Main.WriteOutput("Removing old ReqPro database package structures", -1);
|
| 592 |
|
- |
|
| 593 |
remove_old_empty_structures(parentPackage, gNewReqProDBPackage);
|
599 |
remove_old_empty_structures(parentPackage, gNewReqProDBPackage);
|
| 594 |
|
600 |
|
| 595 |
if (Main.mustAbort)
|
601 |
if (Main.mustAbort)
|
| 596 |
return;
|
602 |
return;
|
| 597 |
|
603 |
|
| Line 618... |
Line 624... |
| 618 |
return;
|
624 |
return;
|
| 619 |
|
625 |
|
| 620 |
// Output any messages the underlying parser may have collected as a result of observations it has made
|
626 |
// Output any messages the underlying parser may have collected as a result of observations it has made
|
| 621 |
// regarding the data it has read from the ReqPro database.
|
627 |
// regarding the data it has read from the ReqPro database.
|
| 622 |
writeDelayedMessages();
|
628 |
writeDelayedMessages();
|
| 623 |
|
629 |
|
| 624 |
// display summary stats
|
630 |
// display summary stats
|
| 625 |
Main.WriteOutput(newRequirementCount.ToString() + " new requirements", -1);
|
631 |
Main.WriteOutput(gNewRequirementCount.ToString() + " new requirements", -1);
|
| 626 |
Main.WriteOutput(modifiedRequirementCount.ToString() + " requirements modified", -1);
|
632 |
Main.WriteOutput(gModifiedRequirementCount.ToString() + " requirements modified", -1);
|
| 627 |
Main.WriteOutput(statusUpdatedRequirementCount.ToString() + " requirements had status changes", -1);
|
633 |
Main.WriteOutput(gStatusUpdatedRequirementCount.ToString() + " requirements had status changes", -1);
|
| 628 |
Main.WriteOutput(orphanedCount.ToString() + " requirements were orphaned", -1);
|
634 |
Main.WriteOutput(gOrphanedCount.ToString() + " requirements were orphaned", -1);
|
| 629 |
|
635 |
|
| 630 |
Main.WriteOutput("Import Completed", -1);
|
636 |
Main.WriteOutput("Import Completed", -1);
|
| 631 |
MessageBoxEx.Show("Import Completed");
|
637 |
MessageBoxEx.Show("Import Completed");
|
| - |
|
638 |
|
| 632 |
}
|
639 |
}
|
| 633 |
catch (Exception ex)
|
640 |
catch (Exception ex)
|
| 634 |
{
|
641 |
{
|
| 635 |
Main.MessageBoxException(ex, "Exception (ImportFromReqPro)");
|
642 |
Main.MessageBoxException(ex, "Exception (ImportFromReqPro)");
|
| 636 |
}
|
643 |
}
|
| 637 |
}
|
644 |
}
|
| 638 |
|
645 |
|
| 639 |
private string updated_property_value_if_changed(EA.Element changeLog,
|
646 |
private string updated_property_value_if_changed(EA.Element changeLog,
|
| 640 |
EA.Element ea_req,
|
647 |
EA.Element ea_req,
|
| 641 |
string dest_value,
|
648 |
string dest_value,
|
| 642 |
string changeLogName,
|
649 |
string changeLogName,
|
| 643 |
string source_value,
|
650 |
string source_value,
|
| 644 |
ref bool mayHaveChanged)
|
651 |
ref bool mayHaveChanged)
|
| 645 |
{
|
652 |
{
|
| 646 |
if (dest_value.CompareTo(source_value) != 0 )
|
653 |
if (dest_value.CompareTo(source_value) != 0 )
|
| 647 |
{
|
654 |
{
|
| Line 652... |
Line 659... |
| 652 |
}
|
659 |
}
|
| 653 |
return dest_value;
|
660 |
return dest_value;
|
| 654 |
}
|
661 |
}
|
| 655 |
|
662 |
|
| 656 |
|
663 |
|
| 657 |
private void if_tagged_value_changed_update_it(EA.Element changeLog,
|
664 |
private void if_tagged_value_changed_update_it(EA.Element changeLog,
|
| 658 |
EA.Element ea_req,
|
665 |
EA.Element ea_req,
|
| 659 |
string tagname,
|
666 |
string tagname,
|
| 660 |
string changeLogName,
|
667 |
string changeLogName,
|
| 661 |
string source_value,
|
668 |
string source_value,
|
| 662 |
ref bool statusMayHaveChanged)
|
669 |
ref bool statusMayHaveChanged)
|
| 663 |
{
|
670 |
{
|
| 664 |
string value = EA_TaggedValues.Read(ea_req, tagname, "");
|
671 |
string value = EA_TaggedValues.Read(ea_req, tagname, "");
|
| 665 |
if ((source_value != null) && (false == source_value.Equals(value)))
|
672 |
if ((source_value != null) && (false == source_value.Equals(value)))
|
| Line 672... |
Line 679... |
| 672 |
}
|
679 |
}
|
| 673 |
|
680 |
|
| 674 |
|
681 |
|
| 675 |
|
682 |
|
| 676 |
/// <summary>
|
683 |
/// <summary>
|
| 677 |
/// This method (along with its sibling overload) obtains a flattened view of the
|
684 |
/// This method (along with its sibling overload) obtains a flattened view of the
|
| 678 |
/// hierarchical requirements obtained from the ReqPro database. This accumulation
|
685 |
/// hierarchical requirements obtained from the ReqPro database. This accumulation
|
| 679 |
/// takes account of the users filtering requests.
|
686 |
/// takes account of the users filtering requests.
|
| 680 |
/// </summary>
|
687 |
/// </summary>
|
| 681 |
/// <param name="ea_repository"></param>
|
688 |
/// <param name="ea_repository"></param>
|
| 682 |
private void get_rq_req_collection(ref ArrayList rq_req_collection)
|
689 |
private void get_rq_req_collection(ref ArrayList rq_req_collection)
|
| Line 718... |
Line 725... |
| 718 |
{
|
725 |
{
|
| 719 |
// Add this requirement to the flattened list we are accumulating
|
726 |
// Add this requirement to the flattened list we are accumulating
|
| 720 |
rq_req_collection.Add(rq_obj);
|
727 |
rq_req_collection.Add(rq_obj);
|
| 721 |
|
728 |
|
| 722 |
// In ReqPro, a requirement can be related to another requirement in several ways:
|
729 |
// In ReqPro, a requirement can be related to another requirement in several ways:
|
| 723 |
// 1. By virtue of its position relative to another in the browser display. That is,
|
730 |
// 1. By virtue of its position relative to another in the browser display. That is,
|
| 724 |
// if you place a requirement beneath a parent requirement, you are establishing a
|
731 |
// if you place a requirement beneath a parent requirement, you are establishing a
|
| 725 |
// parent-child relationship.
|
732 |
// parent-child relationship.
|
| 726 |
// 2. By virtue of a specific TraceTo relationship being made via the Traceability menu
|
733 |
// 2. By virtue of a specific TraceTo relationship being made via the Traceability menu
|
| 727 |
// option.
|
734 |
// option.
|
| 728 |
// Interestingly, ReqPro prevents you creating a relationship of one of the above types,
|
735 |
// Interestingly, ReqPro prevents you creating a relationship of one of the above types,
|
| 729 |
// if a relationship of the other type already exists. This implies that the relationship
|
736 |
// if a relationship of the other type already exists. This implies that the relationship
|
| 730 |
// between a parent and child requirement must be singular and is important regardless
|
737 |
// between a parent and child requirement must be singular and is important regardless
|
| 731 |
// of the manner in which it was created or represented.
|
738 |
// of the manner in which it was created or represented.
|
| 732 |
// The CopyReqProDatabaseToMemory base class will already have taken care of recording
|
739 |
// The CopyReqProDatabaseToMemory base class will already have taken care of recording
|
| 733 |
// relationships detected from ReqPro made using method 2 above. What we need to do here is
|
740 |
// relationships detected from ReqPro made using method 2 above. What we need to do here is
|
| 734 |
// take care of those apparent from the browser based hierarchical organisation (ie. made
|
741 |
// take care of those apparent from the browser based hierarchical organisation (ie. made
|
| 735 |
// in ReqPro using method 1).
|
742 |
// in ReqPro using method 1).
|
| 736 |
// All we need to do is grab the parent object (if any) and add the GUID of the child to
|
743 |
// All we need to do is grab the parent object (if any) and add the GUID of the child to
|
| 737 |
// its list of trace-to's. Later on, the write_traces() class method will turn these into
|
744 |
// its list of trace-to's. Later on, the write_traces() class method will turn these into
|
| 738 |
// EA based connection objects that belong to the parent requirement elements.
|
745 |
// EA based connection objects that belong to the parent requirement elements.
|
| 739 |
if (rq_obj.parent != null)
|
746 |
if (rq_obj.parent != null)
|
| 740 |
{
|
747 |
{
|
| 741 |
rq_obj.parent.ReqPro_traces.Add(rq_obj.guid);
|
748 |
rq_obj.parent.ReqPro_traces.Add(rq_obj.guid);
|
| 742 |
}
|
749 |
}
|
| 743 |
|
750 |
|
| 744 |
// Using recursion, scan this objects sub-objects, which in practise will all
|
751 |
// Using recursion, scan this objects sub-objects, which in practise will all
|
| 745 |
// be requirement objects. At this time requirement objects cannot have packages
|
752 |
// be requirement objects. At this time requirement objects cannot have packages
|
| 746 |
// as children.
|
753 |
// as children.
|
| 747 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
754 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
| 748 |
{
|
755 |
{
|
| 749 |
get_rq_req_collection(ref rq_req_collection, sub_obj);
|
756 |
get_rq_req_collection(ref rq_req_collection, sub_obj);
|
| 750 |
}
|
757 |
}
|
| Line 756... |
Line 763... |
| 756 |
|
763 |
|
| 757 |
|
764 |
|
| 758 |
|
765 |
|
| 759 |
|
766 |
|
| 760 |
/// <summary>
|
767 |
/// <summary>
|
| 761 |
/// Populates a ReqProDB structure package to be used as a home for the requirements within the
|
768 |
/// Populates a ReqProDB structure package to be used as a home for the requirements within the
|
| 762 |
/// overall import container, and re-locate requirements into it from wherever they may be elsewhere
|
769 |
/// overall import container, and re-locate requirements into it from wherever they may be elsewhere
|
| 763 |
/// within and under the import container.
|
770 |
/// within and under the import container.
|
| 764 |
/// </summary>
|
771 |
/// </summary>
|
| 765 |
/// <param name="rq_obj"></param>
|
772 |
/// <param name="rq_obj"></param>
|
| 766 |
private void populate_latest_reqprodb_structure_package(ReqPro_object rq_obj)
|
773 |
private void populate_latest_reqprodb_structure_package(ReqPro_object rq_obj)
|
| Line 781... |
Line 788... |
| 781 |
// Examine all of our requirement lists to try and re-locate the requirements from
|
788 |
// Examine all of our requirement lists to try and re-locate the requirements from
|
| 782 |
// the old structure(s) to the new one.
|
789 |
// the old structure(s) to the new one.
|
| 783 |
|
790 |
|
| 784 |
// re-locate existing requirements updated during this import
|
791 |
// re-locate existing requirements updated during this import
|
| 785 |
int i_ea_req;
|
792 |
int i_ea_req;
|
| 786 |
i_ea_req = req_lists.ea_GUIDs.IndexOf( sub_obj.guid );
|
793 |
i_ea_req = gReq_lists.ea_GUIDs.IndexOf( sub_obj.guid );
|
| 787 |
if (0 <= i_ea_req)
|
794 |
if (0 <= i_ea_req)
|
| 788 |
{
|
795 |
{
|
| 789 |
ea_req = ((EA.Element)req_lists.ea_reqs[i_ea_req]);
|
796 |
ea_req = ((EA.Element)gReq_lists.ea_reqs[i_ea_req]);
|
| 790 |
|
797 |
|
| 791 |
EA.Package pkg = get_or_create_latest_structure(sub_obj);
|
798 |
EA.Package pkg = get_or_create_latest_structure(sub_obj);
|
| 792 |
|
799 |
|
| - |
|
800 |
if (sub_obj.matched == false)
|
| - |
|
801 |
{
|
| - |
|
802 |
add_to_orphan_list(ref ea_req);
|
| - |
|
803 |
|
| - |
|
804 |
ea_req.PackageID = gOrphansPackage.PackageID; // re-locate
|
| - |
|
805 |
ea_req.Update();
|
| - |
|
806 |
}
|
| - |
|
807 |
else if (sub_obj.filtered == false)
|
| - |
|
808 |
{
|
| 793 |
ea_req.PackageID = pkg.PackageID; // re-locate
|
809 |
ea_req.PackageID = pkg.PackageID; // re-locate
|
| 794 |
ea_req.TreePos = sub_obj.treePos;
|
810 |
ea_req.TreePos = sub_obj.treePos;
|
| 795 |
ea_req.Update();
|
811 |
ea_req.Update();
|
| - |
|
812 |
}
|
| - |
|
813 |
else
|
| - |
|
814 |
{
|
| - |
|
815 |
// QUESTION: So what if it is filtered? What happens to it then?
|
| - |
|
816 |
// Will it stay in the same place or be relocated as an orphan?
|
| - |
|
817 |
// ANSWER: relocate_elements_to_orphans_package() does this, called later
|
| - |
|
818 |
// in the import sequence.
|
| - |
|
819 |
}
|
| 796 |
}
|
820 |
}
|
| 797 |
else
|
821 |
else
|
| 798 |
{
|
822 |
{
|
| 799 |
// re-locate new requirements that have come in for the first time on this import.
|
823 |
// re-locate new requirements that have come in for the first time on this import.
|
| 800 |
i_ea_req = req_lists.new_ea_GUIDs.IndexOf( sub_obj.guid );
|
824 |
i_ea_req = gReq_lists.new_ea_GUIDs.IndexOf( sub_obj.guid );
|
| 801 |
if (0 <= i_ea_req)
|
825 |
if (0 <= i_ea_req)
|
| 802 |
{
|
826 |
{
|
| 803 |
ea_req = ((EA.Element)req_lists.new_ea_reqs[i_ea_req]);
|
827 |
ea_req = ((EA.Element)gReq_lists.new_ea_reqs[i_ea_req]);
|
| 804 |
|
828 |
|
| 805 |
EA.Package pkg = get_or_create_latest_structure(sub_obj);
|
829 |
EA.Package pkg = get_or_create_latest_structure(sub_obj);
|
| 806 |
|
- |
|
| - |
|
830 |
|
| 807 |
ea_req.PackageID = pkg.PackageID; // re-locate
|
831 |
ea_req.PackageID = pkg.PackageID; // re-locate
|
| 808 |
ea_req.TreePos = sub_obj.treePos;
|
832 |
ea_req.TreePos = sub_obj.treePos;
|
| 809 |
ea_req.Update();
|
833 |
ea_req.Update();
|
| 810 |
}
|
834 |
}
|
| 811 |
}
|
835 |
}
|
| 812 |
|
836 |
|
| 813 |
// Re-locate requirement under its parent requirement, if such a relationship exists.
|
837 |
// Re-locate requirement under its parent requirement, if such a relationship exists.
|
| 814 |
if (ea_req != null && sub_obj.parent.isRequirement)
|
838 |
if (ea_req != null && sub_obj.parent.isRequirement)
|
| 815 |
{
|
839 |
{
|
| 816 |
// Only do this if the parent requirement has not been orphaned
|
840 |
// Only do this if the parent requirement has not been orphaned or filtered out of the import
|
| 817 |
if (sub_obj.parent.ea_element_ID != -1)
|
841 |
if (sub_obj.parent.ea_element_ID != -1)
|
| 818 |
{
|
842 |
{
|
| 819 |
EA.Element parent_ea_req = Main.EA_Repository.GetElementByID(sub_obj.parent.ea_element_ID);
|
843 |
EA.Element parent_ea_req = Main.EA_Repository.GetElementByID(sub_obj.parent.ea_element_ID);
|
| 820 |
if (parent_ea_req != null)
|
844 |
if (parent_ea_req != null)
|
| 821 |
{
|
845 |
{
|
| - |
|
846 |
// make sure we only assign ele-to-ele relationship if both elements are in the same
|
| - |
|
847 |
// package
|
| - |
|
848 |
if (ea_req.PackageID == parent_ea_req.PackageID)
|
| - |
|
849 |
{
|
| 822 |
ea_req.ParentID = parent_ea_req.ElementID; // re-locate
|
850 |
ea_req.ParentID = parent_ea_req.ElementID; // re-locate
|
| 823 |
ea_req.TreePos = sub_obj.treePos;
|
851 |
ea_req.TreePos = sub_obj.treePos;
|
| 824 |
ea_req.Update();
|
852 |
ea_req.Update();
|
| - |
|
853 |
}
|
| 825 |
}
|
854 |
}
|
| 826 |
}
|
855 |
}
|
| 827 |
else
|
856 |
else
|
| 828 |
{
|
857 |
{
|
| 829 |
// TODO: what if the parent requirement has been orphaned, but the child as represented by
|
858 |
// TODO: what if the parent requirement has been orphaned, but the child as represented by
|
| Line 839... |
Line 868... |
| 839 |
}
|
868 |
}
|
| 840 |
|
869 |
|
| 841 |
|
870 |
|
| 842 |
/// <summary>
|
871 |
/// <summary>
|
| 843 |
/// This is a helper for the populate_latest_reqprodb_structure_package() function. It allows on-the-fly
|
872 |
/// This is a helper for the populate_latest_reqprodb_structure_package() function. It allows on-the-fly
|
| 844 |
/// EA package path construction, triggered whenever we find we have a requirement to
|
873 |
/// EA package path construction, triggered whenever we find we have a requirement to
|
| 845 |
/// re-locate into the latest facsimile of the ReqPro database structure.
|
874 |
/// re-locate into the latest facsimile of the ReqPro database structure.
|
| 846 |
/// </summary>
|
875 |
/// </summary>
|
| 847 |
/// <param name="rq_obj"></param>
|
876 |
/// <param name="rq_obj"></param>
|
| 848 |
/// <returns></returns>
|
877 |
/// <returns></returns>
|
| 849 |
private EA.Package get_or_create_latest_structure(ReqPro_object rq_obj)
|
878 |
private EA.Package get_or_create_latest_structure(ReqPro_object rq_obj)
|
| Line 899... |
Line 928... |
| 899 |
// to here.
|
928 |
// to here.
|
| 900 |
return Main.EA_Repository.GetPackageByID(rq_root_package.ea_element_ID);
|
929 |
return Main.EA_Repository.GetPackageByID(rq_root_package.ea_element_ID);
|
| 901 |
}
|
930 |
}
|
| 902 |
|
931 |
|
| 903 |
/// <summary>
|
932 |
/// <summary>
|
| 904 |
/// Remove the old ReqProDB structure packages if they are now empty of requirements. IF some
|
933 |
/// Remove the old ReqProDB structure packages if they are now empty of requirements. IF some
|
| 905 |
/// requirements remain in them, they are moved to the orphaned package so that the old ReqProDB
|
934 |
/// requirements remain in them, they are moved to the orphaned package so that the old ReqProDB
|
| 906 |
/// packages can be removed.
|
935 |
/// packages can be removed.
|
| 907 |
/// </summary>
|
936 |
/// </summary>
|
| 908 |
/// <param name="parentPackage"></param>
|
937 |
/// <param name="parentPackage"></param>
|
| 909 |
/// <param name="new_structure_pkg"></param>
|
938 |
/// <param name="new_structure_pkg"></param>
|
| Line 931... |
Line 960... |
| 931 |
relocate_elements_to_orphans_package(gCurrentPackage);
|
960 |
relocate_elements_to_orphans_package(gCurrentPackage);
|
| 932 |
|
961 |
|
| 933 |
// Now delete the old ReqProDB structure package
|
962 |
// Now delete the old ReqProDB structure package
|
| 934 |
parentPackage.Packages.DeleteAt(i, false);
|
963 |
parentPackage.Packages.DeleteAt(i, false);
|
| 935 |
}
|
964 |
}
|
| 936 |
|
965 |
|
| 937 |
parentPackage.Packages.Refresh();
|
966 |
parentPackage.Packages.Refresh();
|
| 938 |
Main.EA_Repository.RefreshModelView(parentPackage.PackageID);
|
967 |
Main.EA_Repository.RefreshModelView(parentPackage.PackageID);
|
| 939 |
}
|
968 |
}
|
| 940 |
|
969 |
|
| 941 |
|
970 |
|
| 942 |
/// <summary>
|
971 |
/// <summary>
|
| 943 |
/// Re-locate all requirements that remain under a ReqProDB structure package, to its
|
972 |
/// Re-locate all requirements that remain under a ReqProDB structure package, to its
|
| 944 |
/// top level, so that later on, the package hierarchy within it can be removed.
|
973 |
/// top level, so that later on, the package hierarchy within it can be removed.
|
| 945 |
/// </summary>
|
974 |
/// </summary>
|
| 946 |
/// <param name="parentPackage"></param>
|
975 |
/// <param name="parentPackage"></param>
|
| 947 |
private void relocate_elements_to_orphans_package(EA.Package parentPackage)
|
976 |
private void relocate_elements_to_orphans_package(EA.Package parentPackage)
|
| 948 |
{
|
977 |
{
|
| Line 1006... |
Line 1035... |
| 1006 |
}
|
1035 |
}
|
| 1007 |
}
|
1036 |
}
|
| 1008 |
|
1037 |
|
| 1009 |
/// <summary>
|
1038 |
/// <summary>
|
| 1010 |
/// Moves all elements out of an old-style import package, and into the new ReqProDB structure package.
|
1039 |
/// Moves all elements out of an old-style import package, and into the new ReqProDB structure package.
|
| 1011 |
/// Change Log elements are handled in a special way such that they are renamed from plain "Change Log"
|
1040 |
/// Change Log elements are handled in a special way such that they are renamed from plain "Change Log"
|
| 1012 |
/// to the new style "Change Log - import <date> <time>" format, and are moved into the new "Change History"
|
1041 |
/// to the new style "Change Log - import <date> <time>" format, and are moved into the new "Change History"
|
| 1013 |
/// package.
|
1042 |
/// package.
|
| 1014 |
/// </summary>
|
1043 |
/// </summary>
|
| 1015 |
/// <param name="parentPackage"></param>
|
1044 |
/// <param name="parentPackage"></param>
|
| 1016 |
private void migrate_old_import_packages_to_change_history_package_recurser(EA.Package parentPackage)
|
1045 |
private void migrate_old_import_packages_to_change_history_package_recurser(EA.Package parentPackage)
|
| Line 1070... |
Line 1099... |
| 1070 |
return pkg;
|
1099 |
return pkg;
|
| 1071 |
}
|
1100 |
}
|
| 1072 |
|
1101 |
|
| 1073 |
|
1102 |
|
| 1074 |
/// <summary>
|
1103 |
/// <summary>
|
| 1075 |
/// This function removes any empty packages it can find in the ReqPro import area. This is
|
1104 |
/// This function removes any empty packages it can find in the ReqPro import area. This is
|
| 1076 |
/// a tidying up operation.
|
1105 |
/// a tidying up operation.
|
| 1077 |
/// </summary>
|
1106 |
/// </summary>
|
| 1078 |
/// <param name="parentPackage"></param>
|
1107 |
/// <param name="parentPackage"></param>
|
| 1079 |
/// <returns></returns>
|
1108 |
/// <returns></returns>
|
| 1080 |
private bool prune_empty_packages(EA.Package parentPackage)
|
1109 |
private bool prune_empty_packages(EA.Package parentPackage)
|
| Line 1096... |
Line 1125... |
| 1096 |
if (needRefresh)
|
1125 |
if (needRefresh)
|
| 1097 |
{
|
1126 |
{
|
| 1098 |
parentPackage.Packages.Refresh();
|
1127 |
parentPackage.Packages.Refresh();
|
| 1099 |
}
|
1128 |
}
|
| 1100 |
|
1129 |
|
| 1101 |
if (parentPackage.Packages.Count == 0
|
1130 |
if (parentPackage.Packages.Count == 0
|
| 1102 |
&& parentPackage.Elements.Count == 0
|
1131 |
&& parentPackage.Elements.Count == 0
|
| 1103 |
&& parentPackage.Diagrams.Count == 0)
|
1132 |
&& parentPackage.Diagrams.Count == 0)
|
| 1104 |
{
|
1133 |
{
|
| 1105 |
retVal = true;
|
1134 |
retVal = true;
|
| 1106 |
}
|
1135 |
}
|
| 1107 |
|
1136 |
|
| 1108 |
return retVal;
|
1137 |
return retVal;
|
| 1109 |
}
|
1138 |
}
|
| - |
|
1139 |
|
| - |
|
1140 |
private void add_to_orphan_list(ref EA.Element ea_req)
|
| - |
|
1141 |
{
|
| - |
|
1142 |
if (!gReq_lists.orphaned_ea_reqs.Contains(ea_req.ElementID))
|
| - |
|
1143 |
{
|
| - |
|
1144 |
gReq_lists.orphaned_ea_reqs.Add(ea_req.ElementID);
|
| - |
|
1145 |
|
| - |
|
1146 |
gOrphanedCount++;
|
| - |
|
1147 |
gChangeLog.Notes += ea_req.ElementGUID + ":Orphaned:" + ea_req.Name + "\r\n";
|
| - |
|
1148 |
gChangeLog.Update();
|
| - |
|
1149 |
}
|
| - |
|
1150 |
}
|
| - |
|
1151 |
|
| 1110 |
}
|
1152 |
}
|
| - |
|
1153 |
|
| - |
|
1154 |
|
| 1111 |
}
|
1155 |
}
|