Subversion Repositories DevTools

Rev

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

Rev 2145 Rev 2149
Line 99... Line 99...
99
         return false;
99
         return false;
100
      }
100
      }
101
 
101
 
102
 
102
 
103
   
103
   
104
      /// <summary>
-
 
105
      /// Finds and returns the ReqPro_object instance that contains the specified GUID. The
-
 
106
      /// GUID is that of the originating ReqPro requirement, which is copied into a ReqPro_object
-
 
107
      /// instance when it is created. This find operation supports the ability to resolve object to
-
 
108
      /// object trace relationships mirrored from the ReqPro database during the construction
-
 
109
      /// of the ReqPro_object hierarchy.
-
 
110
      /// </summary>
-
 
111
      /// <param name="rq_obj"></param>
-
 
112
      /// <param name="ReqProGUID"></param>
-
 
113
      /// <returns></returns>
-
 
114
      private ReqPro_object findReqPro_object_byReqProGUID(ReqPro_object rq_obj, string ReqProGUID)
-
 
115
      {
-
 
116
         if (rq_obj.guid.CompareTo(ReqProGUID) == 0)
-
 
117
         {
-
 
118
            return rq_obj;
-
 
119
         }
-
 
120
 
104
 
121
         foreach (ReqPro_object sub_rq_obj in rq_obj.ReqPro_objects)
-
 
122
         {
-
 
123
            ReqPro_object tgt_obj = findReqPro_object_byReqProGUID(sub_rq_obj, ReqProGUID);
-
 
124
            if (tgt_obj != null)
-
 
125
               return tgt_obj;
-
 
126
         }
-
 
127
 
-
 
128
         return null;
-
 
129
      }
-
 
130
 
105
 
-
 
106
 
131
 
107
 
132
      /// <summary>
-
 
133
      /// This method examines all of the ReqPro_object trace relationships and mirrors them in 
-
 
134
      /// the EA requirement elements that have been formed from each un-filtered ReqPro_objects.
-
 
135
      /// </summary>
-
 
136
      /// <param name="ea_repository"></param>
-
 
137
      /// <param name="rq_obj"></param>
-
 
138
      private void write_traces(EA.Repository ea_repository, ReqPro_object rq_obj)
-
 
139
      {
-
 
140
         if (rq_obj.isRequirement)
-
 
141
         {
-
 
142
            // if this object had an EA element made for it during the write_ea_database() process...
-
 
143
            if (rq_obj.ea_element_ID != -1)
-
 
144
            {
-
 
145
               EA.Element ea_rq_obj = ea_repository.GetElementByID(rq_obj.ea_element_ID);
-
 
146
               if (ea_rq_obj != null)
-
 
147
               {
-
 
148
                  foreach(string s in rq_obj.ReqPro_traces)
-
 
149
                  {
-
 
150
                     ReqPro_object tgt_obj = findReqPro_object_byReqProGUID(rq_root_package,s);
-
 
151
                     if (tgt_obj != null)
-
 
152
                     {
-
 
153
                        if (tgt_obj.ea_element_ID != -1)
-
 
154
                        {
-
 
155
                           EA.Element ea_tgt_obj = ea_repository.GetElementByID(tgt_obj.ea_element_ID);
-
 
156
                           if (ea_tgt_obj != null)
-
 
157
                           {
-
 
158
                              add_connection(ea_repository, ea_rq_obj, ea_tgt_obj);
-
 
159
                           }
-
 
160
                        }
-
 
161
                     }
-
 
162
                  }
-
 
163
               }
-
 
164
            }
-
 
165
         }
-
 
166
 
-
 
167
         // recurse to ensure we examine the entire hiearchy
-
 
168
         foreach(ReqPro_object sub_obj in rq_obj.ReqPro_objects)
-
 
169
         {
-
 
170
            write_traces(ea_repository, sub_obj);
-
 
171
         }
-
 
172
      }
-
 
173
 
108
 
174
      /// <summary>
-
 
175
      /// Adds a connection between one EA element and another
-
 
176
      /// </summary>
-
 
177
      /// <param name="repository"></param>
-
 
178
      /// <param name="rq_artifact"></param>
-
 
179
      /// <param name="ea_req"></param>
-
 
180
      private void add_connection(EA.Repository ea_repository, EA.Element src_element, EA.Element dest_element)
-
 
181
      {
-
 
182
         // Add the new requirement to the src_element
-
 
183
         EA.Connector c = (EA.Connector)src_element.Connectors.AddNew("", "Relationship");
-
 
184
         c.SupplierID = dest_element.ElementID;
-
 
185
         //c.Stereotype = "trace";
-
 
186
         c.Direction = "Source -> Destination";
-
 
187
         if (false == c.Update())
-
 
188
         {
-
 
189
            ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "New Connector Error : " + c.GetLastError(), dest_element.ElementID );
-
 
190
         }
-
 
191
         src_element.Connectors.Refresh();
-
 
192
      }
-
 
193
 
109
 
194
      /// <summary>
110
      /// <summary>
195
      /// This method (along with its sibling overloads) perform the copy operation once
111
      /// This method (along with its sibling overloads) perform the copy operation once
196
      /// the ReqPro database content has been acquired, and the user has submitted their
112
      /// the ReqPro database content has been acquired, and the user has submitted their
197
      /// filtering requirements. This method begins the copy operation, but the real nitty
113
      /// filtering requirements. This method begins the copy operation, but the real nitty