Subversion Repositories DevTools

Rev

Rev 2147 | Rev 2151 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2147 Rev 2149
Line 410... Line 410...
410
      }
410
      }
411
      
411
      
412
      #endregion
412
      #endregion
413
 
413
 
414
 
414
 
-
 
415
      /// <summary>
-
 
416
      /// Finds and returns the ReqPro_object instance that contains the specified GUID. The
-
 
417
      /// GUID is that of the originating ReqPro requirement, which is copied into a ReqPro_object
-
 
418
      /// instance when it is created. This find operation supports the ability to resolve object to
-
 
419
      /// object trace relationships mirrored from the ReqPro database during the construction
-
 
420
      /// of the ReqPro_object hierarchy.
-
 
421
      /// </summary>
-
 
422
      /// <param name="rq_obj"></param>
-
 
423
      /// <param name="ReqProGUID"></param>
-
 
424
      /// <returns></returns>
-
 
425
      protected ReqPro_object findReqPro_object_byReqProGUID(ReqPro_object rq_obj, string ReqProGUID)
-
 
426
      {
-
 
427
         if (rq_obj.guid.CompareTo(ReqProGUID) == 0)
-
 
428
         {
-
 
429
            return rq_obj;
-
 
430
         }
-
 
431
 
-
 
432
         foreach (ReqPro_object sub_rq_obj in rq_obj.ReqPro_objects)
-
 
433
         {
-
 
434
            ReqPro_object tgt_obj = findReqPro_object_byReqProGUID(sub_rq_obj, ReqProGUID);
-
 
435
            if (tgt_obj != null)
-
 
436
               return tgt_obj;
-
 
437
         }
-
 
438
 
-
 
439
         return null;
-
 
440
      }
415
 
441
 
416
      /// <summary>
442
      /// <summary>
-
 
443
      /// This method examines all of the ReqPro_object trace relationships and mirrors them in 
-
 
444
      /// the EA requirement elements that have been formed from each un-filtered ReqPro_objects.
-
 
445
      /// </summary>
-
 
446
      /// <param name="ea_repository"></param>
-
 
447
      /// <param name="rq_obj"></param>
-
 
448
      protected void write_traces(EA.Repository ea_repository, ReqPro_object rq_obj)
-
 
449
      {
-
 
450
         if (rq_obj.isRequirement)
-
 
451
         {
-
 
452
            // if this object had an EA element made for it during the write_ea_database() process...
-
 
453
            if (rq_obj.ea_element_ID != -1)
-
 
454
            {
-
 
455
               EA.Element ea_rq_obj = ea_repository.GetElementByID(rq_obj.ea_element_ID);
-
 
456
               if (ea_rq_obj != null)
-
 
457
               {
-
 
458
                  foreach(string s in rq_obj.ReqPro_traces)
-
 
459
                  {
-
 
460
                     ReqPro_object tgt_obj = findReqPro_object_byReqProGUID(rq_root_package,s);
-
 
461
                     if (tgt_obj != null)
-
 
462
                     {
-
 
463
                        if (tgt_obj.ea_element_ID != -1)
-
 
464
                        {
-
 
465
                           EA.Element ea_tgt_obj = ea_repository.GetElementByID(tgt_obj.ea_element_ID);
-
 
466
                           if (ea_tgt_obj != null)
-
 
467
                           {
-
 
468
                              add_connection(ea_repository, ea_rq_obj, ea_tgt_obj);
-
 
469
                           }
-
 
470
                        }
-
 
471
                     }
-
 
472
                  }
-
 
473
               }
-
 
474
            }
-
 
475
         }
-
 
476
 
-
 
477
         // recurse to ensure we examine the entire hiearchy
-
 
478
         foreach(ReqPro_object sub_obj in rq_obj.ReqPro_objects)
-
 
479
         {
-
 
480
            write_traces(ea_repository, sub_obj);
-
 
481
         }
-
 
482
      }
-
 
483
 
-
 
484
      /// <summary>
-
 
485
      /// Adds a connection between one EA element and another
-
 
486
      /// </summary>
-
 
487
      /// <param name="repository"></param>
-
 
488
      /// <param name="rq_artifact"></param>
-
 
489
      /// <param name="ea_req"></param>
-
 
490
      protected void add_connection(EA.Repository ea_repository, EA.Element src_element, EA.Element dest_element)
-
 
491
      {
-
 
492
         // Add the new requirement to the src_element
-
 
493
         EA.Connector c = (EA.Connector)src_element.Connectors.AddNew("", "Relationship");
-
 
494
         c.SupplierID = dest_element.ElementID;
-
 
495
         //c.Stereotype = "trace";
-
 
496
         c.Direction = "Source -> Destination";
-
 
497
         if (false == c.Update())
-
 
498
         {
-
 
499
            ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "New Connector Error : " + c.GetLastError(), dest_element.ElementID );
-
 
500
         }
-
 
501
         src_element.Connectors.Refresh();
-
 
502
      }
-
 
503
      
-
 
504
      /// <summary>
417
      /// A method to contain common pre-parsing steps.
505
      /// A method to contain common pre-parsing steps.
418
      /// </summary>
506
      /// </summary>
419
      private void pre_parsing()
507
      private void pre_parsing()
420
      {
508
      {
421
         // create an object to represent the root of the database so that we can collect
509
         // create an object to represent the root of the database so that we can collect