Subversion Repositories DevTools

Rev

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

Rev 2153 Rev 2155
Line 7... Line 7...
7
using ReqPro40;
7
using ReqPro40;
8
 
8
 
9
namespace EA_ReqPro
9
namespace EA_ReqPro
10
{
10
{
11
	/// <summary>
11
	/// <summary>
12
	/// Summary description for CopyReqProDatabaseToMemory.
12
	/// This class is responsible for constructing a facsimile of the reqpro database, from objects given to it 
-
 
13
	/// by the ReqProParser base class. It then enables the user to select particular filter settings applied
-
 
14
	/// to that data, to control a subsequent import into EA (not performed in this class or it's base class ).
13
	/// </summary>
15
	/// </summary>
14
	public class CopyReqProDatabaseToMemory : ReqProParser
16
	public class CopyReqProDatabaseToMemory : ReqProParser
15
	{
17
	{
-
 
18
      // Flag to allow a client to configure this class to allow package structure fragments to be 
-
 
19
      // captured during an import, ie. package structures that are ticked in the filter form but whose
-
 
20
      // parental structur is not ticked.
16
      protected bool allowPackageStructureFragments = false;
21
      protected bool allowPackageStructureFragments = false;
17
 
22
 
18
      //protected EA_Utilities EA_Utils;
-
 
19
 
-
 
20
      // items setup by base class calling into provideReqProDatabaseInfo()
23
      // items setup by base class calling into provideReqProDatabaseInfo()
21
      protected ReqPro40.Project RQ_project;
-
 
22
      protected ReqPro40.Application RQ_app;
-
 
23
      protected ReqProDB_Artifact RQ_Artifact;
24
      protected ReqProDB_Artifact RQ_Artifact;
24
      protected EA.Element RQ_Element;
25
      protected EA.Element RQ_Element;
25
 
26
 
26
      // Where in an EA database, the copy of the ReqPro database content will be written
27
      // Where in an EA database, the copy of the ReqPro database content will be written
27
      protected EA.Package ea_rootPackage;
28
      protected EA.Package ea_rootPackage;
28
      
29
 
29
      // Hierarchy tracking data for the parsing of a ReqPro database
30
      // Hierarchy tracking data for the parsing of a ReqPro database
30
      protected Stack rq_objs = new Stack();      // Top of stack indicates current parent package
31
      protected Stack rq_objs = new Stack();      // Top of stack indicates current parent package
31
      protected Stack ea_treePos = new Stack();   // Top of stack indicates current tree position reflecting object ordering within the parent package
32
      protected Stack ea_treePos = new Stack();   // Top of stack indicates current tree position reflecting object ordering within the parent package
32
      protected int lastLevel;                    // Allows us to determine if we have gone down/up in the hierarchy
33
      protected int lastLevel;                    // Allows us to determine if we have gone down/up in the hierarchy
33
 
34
 
-
 
35
      private ReqProObject_Dictionary guid_to_obj_dictionary;
-
 
36
 
-
 
37
      private ArrayList trace_log;
-
 
38
 
34
      // Collector for the results of the parsing
39
      // Collector for the results of the parsing
35
      protected ReqPro_object rq_root_package;
40
      protected ReqPro_object rq_root_package;
36
 
41
 
37
      private int writeTracesModulo = 100;
42
      private int writeTracesModulo = 100;
38
 
43
 
Line 40... Line 45...
40
      /// Constructor logic
45
      /// Constructor logic
41
      /// </summary>
46
      /// </summary>
42
      /// <param name="ea_repository"></param>
47
      /// <param name="ea_repository"></param>
43
		public CopyReqProDatabaseToMemory(): base()
48
		public CopyReqProDatabaseToMemory(): base()
44
		{
49
		{
45
         try
-
 
46
         {
-
 
47
            // figure out where in the EA database we will place the results of parsing
50
         // figure out where in the EA database we will place the results of parsing
48
            object o;
-
 
49
            EA.ObjectType type;
-
 
50
            type = Main.EA_Repository.GetTreeSelectedItem(out o);
51
         // NOTE: This just attempts to find a default value for ea_rootPackage.
51
            if (type == EA.ObjectType.otElement)
-
 
52
            {
-
 
53
               ea_rootPackage = Main.EA_Repository.GetPackageByID( ((EA.Element)o).PackageID );
52
         // Its final value may be overriden later in the parsing process, when the 
54
            }
-
 
55
            else if (type == EA.ObjectType.otPackage)
53
         // ReqProDB element is acquired (see in provideReqProDatabaseInfo() method).
56
            {
-
 
57
               ea_rootPackage = (EA.Package)o;
54
         ea_rootPackage = EA_Utilities.get_selected_package();
58
            }
-
 
59
            else
-
 
60
            {
-
 
61
               Exception e = new Exception("No Root Package given");
-
 
62
               throw e;
-
 
63
            }
-
 
64
         }
-
 
65
         catch (Exception ex)
-
 
66
         {
-
 
67
            Main.MessageBoxException(ex, "Exception (CopyReqProDatabaseToMemory)");
-
 
68
         }    
-
 
69
		}
55
		}
70
 
56
 
71
 
57
 
72
 
58
 
73
      #region Requirement Type methods
59
      #region Requirement Type methods
74
      /// <summary>
60
      /// <summary>
75
      /// Recursively set the requirement type enum in each requirement object read
61
      /// Recursively set the requirement type enum in each requirement object read
76
      /// from the ReqPro database. The enum give fast indication of the requirement type.
62
      /// from the ReqPro database. The enum give fast indication of the requirement type.
77
      /// If we didnt do this, each time the requirement type needs to be evaluated, a string 
63
      /// If we didnt do this, each time the requirement type needs to be evaluated, a string
78
      /// compare needs to be done. Here, we do them all up-front so that down the track a simple
64
      /// compare needs to be done. Here, we do them all up-front so that down the track a simple
79
      /// integer access is all that is required.
65
      /// integer access is all that is required.
80
      /// </summary>
66
      /// </summary>
81
      /// <param name="rq_obj"></param>
67
      /// <param name="rq_obj"></param>
82
      private void set_rq_req_types_in_copied_data( ReqPro_object rq_obj )
68
      private void set_rq_req_types_in_copied_data( ReqPro_object rq_obj )
Line 110... Line 96...
110
      /// before opening and parsing it. Once parsed, the user is offered a chance to setup
96
      /// before opening and parsing it. Once parsed, the user is offered a chance to setup
111
      /// the filter controls.
97
      /// the filter controls.
112
      /// </summary>
98
      /// </summary>
113
      /// <param name="ea_repository"></param>
99
      /// <param name="ea_repository"></param>
114
      /// <returns></returns>
100
      /// <returns></returns>
115
      public override bool prompt_and_parse(ReqProDB_Artifact.MODE mode)
101
      public override bool prompt_and_parse(ReqProDB_Artifact.MODE mode, out bool cancelled)
116
      {
102
      {
-
 
103
         cancelled = false;
-
 
104
 
-
 
105
         guid_to_obj_dictionary = new ReqProObject_Dictionary();
-
 
106
 
117
         try
107
         try
118
         {
108
         {
119
 
-
 
120
            pre_parsing();
109
            pre_parsing();
121
            if (true == base.prompt_and_parse(mode))
110
            if (true == base.prompt_and_parse(mode, out cancelled))
122
            {
111
            {
-
 
112
               // update the reqpro root package name from the actual reqpro project that has now been opened
-
 
113
               // and parsed. This may or may not be used depending upon the higher level function being carried 
-
 
114
               // out. For imports, the name is never used. For exports, it may appear as the root name in 
-
 
115
               // a folder view of the reqpro database package content.
-
 
116
               rq_root_package.name = ReqProDatabase.name();
-
 
117
 
123
               // make sure all imported requirements have the correct requirement type enumeration
118
               // make sure all imported requirements have the correct requirement type enumeration
124
               // (converted from the string name of the tag)
119
               // (converted from the string name of the tag)
125
               set_rq_req_types_in_copied_data(rq_root_package);
120
               set_rq_req_types_in_copied_data(rq_root_package);
126
 
121
 
-
 
122
               // Do one thing for imports, and another for exports.
-
 
123
               if (  mode == ReqProDB_Artifact.MODE.DOC_MODEL
-
 
124
                  || mode == ReqProDB_Artifact.MODE.TRACEABILITY )
-
 
125
               {
127
               // bring up the filter dialog to allow user to specify exactly what gets copied
126
                  // bring up the import filter dialog to allow user to specify exactly what gets copied
128
               ReqProFilterForm rq_filter = new ReqProFilterForm(mode == ReqProDB_Artifact.MODE.TRACEABILITY);
127
                  ReqProFilterForm rq_filter = new ReqProFilterForm(mode == ReqProDB_Artifact.MODE.TRACEABILITY);
129
               rq_filter.populate(rq_root_package, rq_req_types, rq_req_status_types);
128
                  rq_filter.populate(rq_root_package, rq_req_types, rq_req_status_types);
130
 
129
 
131
               // Setup the filter based on the saved filter settings in the ReqProDB element (if any)
130
                  // Setup the filter based on the saved filter settings in the ReqProDB element (if any)
132
               if (RQ_Element != null)
131
                  if (RQ_Element != null)
133
               {
132
                  {
134
                  rq_filter.loadFilterSettings(RQ_Element.Notes);
133
                     rq_filter.loadFilterSettings(RQ_Element.Notes);
135
               }
134
                  }
136
 
135
 
137
               DialogResult dlgRes = rq_filter.ShowDialog();
136
                  DialogResult dlgRes = rq_filter.ShowDialog();
138
               if (dlgRes == DialogResult.OK)
137
                  if (dlgRes == DialogResult.OK)
139
               {
138
                  {
140
                  allowPackageStructureFragments = rq_filter.allowPackageStructureFragments;
139
                     allowPackageStructureFragments = rq_filter.allowPackageStructureFragments;
141
                  RQ_project.CloseProject();
140
                     ReqProDatabase.close();
142
 
141
 
143
                  // Save filter settings to the ReqProDB element if it is available
142
                     // Save filter settings to the ReqProDB element if it is available
144
                  if (RQ_Element != null)
143
                     if (RQ_Element != null)
-
 
144
                     {
-
 
145
                        RQ_Element.Notes = rq_filter.saveFilterSettings();
-
 
146
                        RQ_Element.Update();
-
 
147
                     }
-
 
148
 
-
 
149
                     return true;
-
 
150
                  }
-
 
151
                  else
145
                  {
152
                  {
146
                     RQ_Element.Notes = rq_filter.saveFilterSettings();
-
 
147
                     RQ_Element.Update();
153
                     cancelled = true;
148
                  }
154
                  }
-
 
155
               }
-
 
156
               else if (mode == ReqProDB_Artifact.MODE.EXPORT)
-
 
157
               {
-
 
158
                  ExportForm exportForm = new ExportForm();
-
 
159
                  exportForm.populate(rq_root_package, EA_TaggedValues.Read(RQ_Element, Constants.TAG_LAST_EXPORT_GUID, ""),
-
 
160
                     rq_req_types, rq_req_status_types);
-
 
161
                  DialogResult dlgRes = exportForm.ShowDialog();
-
 
162
                  if (dlgRes == DialogResult.OK)
-
 
163
                  {
-
 
164
                     // communicate user selections to the client class that will perform the export.
-
 
165
                     string folderName;
-
 
166
                     bool createFolder = exportForm.user_create_folder_selection(out folderName);
-
 
167
 
-
 
168
                     provideExportDecisionsToClient(exportForm.user_selected_object(), 
-
 
169
                        createFolder, folderName, 
-
 
170
                        exportForm.user_selected_requirement_type(), 
-
 
171
                        exportForm.user_selected_export_extent());
-
 
172
 
149
 
173
 
-
 
174
                     // NOTE: Do not close the reqpro database here. The client class will do that 
-
 
175
                     // after the export completes.
150
                  return true;
176
                     return true;
-
 
177
                  }
-
 
178
                  else
-
 
179
                  {
-
 
180
                     cancelled = true;
-
 
181
                  }
151
               }
182
               }
152
               RQ_project.CloseProject();
183
               ReqProDatabase.close();
153
            }
184
            }
154
         }
185
         }
155
         catch (Exception ex)
186
         catch (Exception ex)
156
         {
187
         {
157
            Main.MessageBoxException(ex, "Exception (parse)");
188
            Main.MessageBoxException(ex, "Exception (parse)");
158
         }      
189
         }
-
 
190
 
159
         return false;
191
         return false;
160
      }
192
      }
-
 
193
 
-
 
194
 
161
 
195
 
-
 
196
      /// <summary>
-
 
197
      /// Function that must be overriden in a client class designed to handle the exporting of
-
 
198
      /// requirements back to ReqPro. The function gives such a class the details of selections made
-
 
199
      /// via the export form.
-
 
200
      /// </summary>
-
 
201
      /// <param name="selectedObject"></param>
-
 
202
      /// <param name="createFolder"></param>
-
 
203
      /// <param name="folderName"></param>
-
 
204
      /// <param name="requirementType"></param>
-
 
205
      /// <param name="requirementStatus"></param>
-
 
206
      protected virtual void provideExportDecisionsToClient(ReqPro_object selectedObject,
-
 
207
         bool createFolder,
-
 
208
         string folderName,
-
 
209
         string requirementType,
-
 
210
         ExportForm.ExportExtent exportExtent)
-
 
211
      {
-
 
212
      }
162
 
213
 
163
 
214
 
164
      /// <summary>
215
      /// <summary>
165
      /// This method will be called by the base class parser when it has obtained a ReqPro
216
      /// This method will be called by the base class parser when it has obtained a ReqPro
166
      /// project object. We capture that object here so we can interrogate the ReqPro database
217
      /// project object. We capture that object here so we can interrogate the ReqPro database
167
      /// ourselves, if we need to. We wont do that for package/requirement reading, but we may
218
      /// ourselves, if we need to. We wont do that for package/requirement reading, but we may
168
      /// do it for meta-data such as requirement types, etc.
219
      /// do it for meta-data such as requirement types, etc.
169
      /// </summary>
220
      /// </summary>
170
      /// <param name="reqpro_project"></param>
221
      /// <param name="reqpro_project"></param>
171
      protected override void provideReqProDatabaseInfo(ReqPro40.Application rq_app, 
222
      protected override void provideReqProDatabaseInfo(
172
         ReqPro40.Project rq_project, 
-
 
173
         ReqProDB_Artifact rq_artifact,
223
         ReqProDB_Artifact rq_artifact,
174
         EA.Element rq_element)
224
         EA.Element rq_element)
175
      {
225
      {
176
         RQ_app = rq_app;
-
 
177
         RQ_project = rq_project;
-
 
178
         RQ_Artifact = rq_artifact;
226
         RQ_Artifact = rq_artifact;
179
         RQ_Element = rq_element;
227
         RQ_Element = rq_element;
-
 
228
 
-
 
229
         // Now we have been given a ReqProDB stereotyped element, we use its parent container package
-
 
230
         // as our root package. This overrides the default setup during the class constructor.
-
 
231
         ea_rootPackage = Main.EA_Repository.GetPackageByID(RQ_Element.PackageID);
180
      }
232
      }
181
 
233
 
-
 
234
 
182
      /// <summary>
235
      /// <summary>
183
      /// This method will be called by the base class parser whenever a package or requirement object
236
      /// This method will be called by the base class parser whenever a package or requirement object
184
      /// is found in the ReqPro database. The method collects important information from the object 
237
      /// is found in the ReqPro database. The method collects important information from the object
185
      /// into a structure that begins with the ea_rootPackage object. The structure is highly dynamic
238
      /// into a structure that begins with the ea_rootPackage object. The structure is highly dynamic
186
      /// with each object able to hold a list of other objects. This naturally allows for the ReqPro
239
      /// with each object able to hold a list of other objects. This naturally allows for the ReqPro
187
      /// database hierarchy to be accurately reflected. The hierarchy tracking data maintained within
240
      /// database hierarchy to be accurately reflected. The hierarchy tracking data maintained within
188
      /// the method allows us to know what object in the structure to hang off any new object derived
241
      /// the method allows us to know what object in the structure to hang off any new object derived
189
      /// from info given to us by the base class parser (ie. what object is the parent object at the
242
      /// from info given to us by the base class parser (ie. what object is the parent object at the
Line 193... Line 246...
193
      /// <param name="ea_repository"></param>
246
      /// <param name="ea_repository"></param>
194
      /// <param name="rq_project"></param>
247
      /// <param name="rq_project"></param>
195
      /// <param name="rq_package"></param>
248
      /// <param name="rq_package"></param>
196
      /// <param name="rq_requirement"></param>
249
      /// <param name="rq_requirement"></param>
197
      protected override void processObject(int level,
250
      protected override void processObject(int level,
198
                                            ReqPro40.Project rq_project, 
-
 
199
                                            ReqPro40.Package rq_package,
251
                                            ReqPro40.Package rq_package,
200
                                            ReqPro40.Requirement rq_requirement)
252
                                            ReqPro40.Requirement rq_requirement)
201
      {
253
      {
202
         // If we are still at the same level as the previous package, then pop the previous object 
254
         // If we are still at the same level as the previous package, then pop the previous object
203
         // in readiness for pushing the one we are now dealing with.
255
         // in readiness for pushing the one we are now dealing with.
204
         if (level == lastLevel)
256
         if (level == lastLevel)
205
         {
257
         {
206
            rq_objs.Pop();
258
            rq_objs.Pop();
207
            ea_treePos.Pop();
259
            ea_treePos.Pop();
208
         }
260
         }
209
            // but if we are beneath the previous level, pop all objects that are above us because
261
         // but if we are beneath the previous level, pop all objects that are above us because
210
            // we no longer need them in our hierarchy reference data.
262
         // we no longer need them in our hierarchy reference data.
211
         else if (level < lastLevel)
263
         else if (level < lastLevel)
212
         {
264
         {
213
            while (lastLevel >= level)
265
            while (lastLevel >= level)
214
            {
266
            {
215
               rq_objs.Pop();
267
               rq_objs.Pop();
Line 222... Line 274...
222
         int treePos = (int)ea_treePos.Pop();
274
         int treePos = (int)ea_treePos.Pop();
223
         treePos++;
275
         treePos++;
224
         ea_treePos.Push(treePos);
276
         ea_treePos.Push(treePos);
225
 
277
 
226
         // create the new requirement or package
278
         // create the new requirement or package
227
         ReqPro_object new_rq_obj = new ReqPro_object();
279
         ReqPro_object new_rq_obj = null;
228
         if (rq_requirement != null)
280
         if (rq_requirement != null)
229
         {
281
         {
-
 
282
            new_rq_obj = new ReqPro_object();
-
 
283
 
230
            new_rq_obj.isRequirement = true;
284
            new_rq_obj.isRequirement = true;
231
            new_rq_obj.name   = rq_requirement.Name;
285
            new_rq_obj.name   = rq_requirement.Name;
232
            new_rq_obj.text   = rq_requirement.Text;
286
            new_rq_obj.text   = rq_requirement.Text;
233
            new_rq_obj.guid   = rq_requirement.GUID;
287
            new_rq_obj.guid   = rq_requirement.GUID;
234
            new_rq_obj.tag    = rq_requirement.get_Tag(ReqPro40.enumTagFormat.eTagFormat_FullTag);
288
            new_rq_obj.tag    = rq_requirement.get_Tag(ReqPro40.enumTagFormat.eTagFormat_FullTag);
235
 
289
 
-
 
290
            guid_to_obj_dictionary.Add(rq_requirement.GUID, new_rq_obj);
-
 
291
 
236
            bool hasStatus = false;
292
            bool hasStatus = false;
237
            bool hasDifficulty = false;
293
            bool hasDifficulty = false;
238
            bool hasPriority = false;
294
            bool hasPriority = false;
239
            bool hasSource = false;
295
            bool hasSource = false;
240
            bool hasSourceVersion = false;
296
            bool hasSourceVersion = false;
241
            bool hasSourceSection = false;
297
            bool hasSourceSection = false;
-
 
298
            bool hasSubsystem = false;
-
 
299
            bool hasStability = false;
-
 
300
            bool hasType = false;
242
 
301
 
-
 
302
            // Acquire attributes from ReqPro.
-
 
303
            // Note the use of firstTokenOnly() on those attributes that are freeform text. Those
-
 
304
            // will most likely be stored in EA tagged values, which have a 256 char size limitation.
-
 
305
            // The intention is to limit the attribute to a single line, which hopefully should get it under the
-
 
306
            // size limit. If it does not, the addin will truncate the string and issue a warning when
-
 
307
            // it writes the tagged value.
243
            if (reqTypeHasOneOrMoreAttrs(new_rq_obj, 
308
            if (reqTypeHasOneOrMoreAttrs(new_rq_obj,
244
               ref hasStatus, ref hasDifficulty, ref hasPriority,
309
               ref hasStatus, ref hasDifficulty, ref hasPriority,
245
               ref hasSource, ref hasSourceVersion, ref hasSourceSection))
310
               ref hasSource, ref hasSourceVersion, ref hasSourceSection,
-
 
311
               ref hasSubsystem, ref hasStability, ref hasType))
246
            {
312
            {
247
               if (hasStatus)
313
               if (hasStatus)
248
               {
314
               {
249
                  new_rq_obj.status = rq_requirement.AttrValues["Status", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text;
315
                  new_rq_obj.status = rq_requirement.AttrValues["Status", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text;
250
               }
316
               }
Line 256... Line 322...
256
               {
322
               {
257
                  new_rq_obj.priority = rq_requirement.AttrValues["Priority", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text;
323
                  new_rq_obj.priority = rq_requirement.AttrValues["Priority", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text;
258
               }
324
               }
259
               if (hasSource)
325
               if (hasSource)
260
               {
326
               {
261
                  new_rq_obj.source = rq_requirement.AttrValues["Source", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text;
327
                  new_rq_obj.source = firstTokenOnly( rq_requirement.AttrValues["Source", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text );
262
               }
328
               }
263
               if (hasSourceVersion)
329
               if (hasSourceVersion)
264
               {
330
               {
265
                  new_rq_obj.sourceVersion = rq_requirement.AttrValues["Source Version", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text;
331
                  new_rq_obj.sourceVersion = firstTokenOnly( rq_requirement.AttrValues["Source Version", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text );
266
               }
332
               }
267
               if (hasSourceSection)
333
               if (hasSourceSection)
268
               {
334
               {
269
                  new_rq_obj.sourceSection = rq_requirement.AttrValues["Source Section", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text;
335
                  new_rq_obj.sourceSection = firstTokenOnly( rq_requirement.AttrValues["Source Section", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text );
-
 
336
               }
-
 
337
               if (hasSubsystem)
-
 
338
               {
-
 
339
                  new_rq_obj.subsystem = firstTokenOnly( rq_requirement.AttrValues["Subsystem", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text );
-
 
340
               }
-
 
341
               if (hasStability)
-
 
342
               {
-
 
343
                  new_rq_obj.stability = firstTokenOnly( rq_requirement.AttrValues["Stability", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text );
-
 
344
               }
-
 
345
               if (hasType)
-
 
346
               {
-
 
347
                  new_rq_obj.type = firstTokenOnly( rq_requirement.AttrValues["Requirement Type", ReqPro40.enumAttrValueLookups.eAttrValueLookup_Label].Text );
270
               }
348
               }
271
            }
349
            }
272
 
350
 
273
            new_rq_obj.version    = rq_requirement.VersionNumber;
351
            new_rq_obj.version = rq_requirement.VersionNumber;
274
            new_rq_obj.versionDateTime = rq_requirement.VersionDateTime;
352
            new_rq_obj.versionDateTime = rq_requirement.VersionDateTime;
-
 
353
            new_rq_obj.iKey = rq_requirement.Key;
275
 
354
 
276
 
355
 
277
            // requirements can trace to other requirements, so we have to find those in order to re-construct
356
            // requirements can trace to other requirements, so we have to find those in order to re-construct
278
            // that traceability later on. Currently, we only process TracesTo relationships from ReqPro.
357
            // that traceability later on. Currently, we only process TracesTo relationships from ReqPro. This
-
 
358
            // seems ok because if a ReqPro user creates a TracesFrom relationship, it shows up as a TracesTo 
-
 
359
            // relationship as well - it just depends on which element (src or dest) you are looking at to see 
-
 
360
            // which type of relationship.
279
            int limit_numberOfTracesTo = 0;
361
            int limit_numberOfTracesTo = 0;
280
            if (true == rq_requirement.get_HasTracesTo(ref limit_numberOfTracesTo))
362
            if (true == rq_requirement.get_HasTracesTo(ref limit_numberOfTracesTo))
281
            {
363
            {
282
               // scan through the TracesTo relationships
364
               // scan through the TracesTo relationships
283
               ReqPro40.Relationships theseRelationships = (ReqPro40.Relationships)rq_requirement.TracesTo;
365
               ReqPro40.Relationships theseRelationships = (ReqPro40.Relationships)rq_requirement.TracesTo;
Line 287... Line 369...
287
               for (i_numberOfTracesTo = 0; i_numberOfTracesTo < limit_numberOfTracesTo; i_numberOfTracesTo++)
369
               for (i_numberOfTracesTo = 0; i_numberOfTracesTo < limit_numberOfTracesTo; i_numberOfTracesTo++)
288
               {
370
               {
289
                  // Obtain the traced-to requirement from the relationship, and parse it
371
                  // Obtain the traced-to requirement from the relationship, and parse it
290
                  ReqPro40.Relationship thisRelationship = theseRelationships.GetCurrentRelationship();
372
                  ReqPro40.Relationship thisRelationship = theseRelationships.GetCurrentRelationship();
291
 
373
 
292
                  ReqPro40.Requirement tracedToRequirement = 
374
                  ReqPro40.Requirement tracedToRequirement =
293
                     thisRelationship.get_DestinationRequirement(ReqPro40.enumRequirementsWeights.eReqWeight_Heavy);
375
                     thisRelationship.get_DestinationRequirement(ReqPro40.enumRequirementsWeights.eReqWeight_Heavy);
294
 
376
 
295
                  if (tracedToRequirement != null)
377
                  if (tracedToRequirement != null)
296
                  {
378
                  {
297
                     // Add the GUID of the traced-to requirement to the relevant list within the
379
                     // Add the GUID of the traced-to requirement to the relevant list within the
Line 300... Line 382...
300
                  }
382
                  }
301
 
383
 
302
                  theseRelationships.MoveNext();
384
                  theseRelationships.MoveNext();
303
               }
385
               }
304
            }
386
            }
305
 
-
 
306
         }
387
         }
307
         else if (rq_package != null)
388
         else if (rq_package != null)
308
         {
389
         {
-
 
390
            
-
 
391
            new_rq_obj = new ReqPro_object();
-
 
392
 
309
            new_rq_obj.isPackage = true;
393
            new_rq_obj.isPackage = true;
310
 
394
 
311
            // Packages in ReqPro may be prefixed by a number to force ReqPro's alphanumeric sorting
395
            // Packages in ReqPro may be prefixed by a number to force ReqPro's alphanumeric sorting
312
            // algorithm to order the packages in the way the user wants, as dictated by the actual 
396
            // algorithm to order the packages in the way the user wants, as dictated by the actual
313
            // numbers used. EA does not have this problem because it uses a tree position number to
397
            // numbers used. EA does not have this problem because it uses a tree position number to
314
            // control a package/element's position in the project browser. So, strip off any leading
398
            // control a package/element's position in the project browser. So, strip off any leading
315
            // numeric from the ReqPro packages.
399
            // numeric from the ReqPro packages.
316
            string trimstring = " 0123456789";
400
            string trimstring = " 0123456789";
317
            char[] trimmer = trimstring.ToCharArray();
401
            char[] trimmer = trimstring.ToCharArray();
318
            string filtered_name = rq_package.Name.TrimStart(trimmer);
402
            string filtered_name = rq_package.Name.TrimStart(trimmer);
319
 
403
 
320
            new_rq_obj.name = filtered_name;
404
            new_rq_obj.name = filtered_name;
321
            new_rq_obj.guid = rq_package.GUID;
405
            new_rq_obj.guid = rq_package.GUID;
-
 
406
            new_rq_obj.iKey = rq_package.Key;
-
 
407
 
-
 
408
            guid_to_obj_dictionary.Add(rq_package.GUID, new_rq_obj);
322
         }
409
         }
323
 
410
 
324
         new_rq_obj.level = level;
411
         if (new_rq_obj != null)
325
         new_rq_obj.treePos = treePos;
412
         {
326
 
413
 
-
 
414
            new_rq_obj.level = level;
-
 
415
            new_rq_obj.treePos = treePos;
-
 
416
 
327
         // attach it to its parent object
417
            // attach it to its parent object
328
         ReqPro_object parent_rq_obj = (ReqPro_object)rq_objs.Peek();
418
            ReqPro_object parent_rq_obj = (ReqPro_object)rq_objs.Peek();
329
         parent_rq_obj.ReqPro_objects.Add( new_rq_obj );
419
            parent_rq_obj.ReqPro_objects.Add( new_rq_obj );
330
         new_rq_obj.parent = parent_rq_obj;
420
            new_rq_obj.parent = parent_rq_obj;
331
 
421
 
332
         // keep a count of the number of requirements the object has beneath it
422
            // keep a count of the number of requirements the object has beneath it
333
         if (true == new_rq_obj.isRequirement)
423
            if (true == new_rq_obj.isRequirement)
334
            parent_rq_obj.numberOfRequirements++;
424
               parent_rq_obj.numberOfRequirements++;
335
 
425
 
336
         // push the new object onto the stack, ready for any sub-objects that may belong to it.
426
            // push the new object onto the stack, ready for any sub-objects that may belong to it.
337
         // If, the next time we enter this method, the level is the same, this will get popped off.
427
            // If, the next time we enter this method, the level is the same, this will get popped off.
338
         // If, the next time we enter this method, the level is lower, this and possibly more will
428
            // If, the next time we enter this method, the level is lower, this and possibly more will
339
         // get popped off.
429
            // get popped off.
340
         rq_objs.Push(new_rq_obj);
430
            rq_objs.Push(new_rq_obj);
341
         ea_treePos.Push(0);
431
            ea_treePos.Push(0);
-
 
432
         }
342
 
433
 
343
         // capture what the hierarchy level is for the object just processed.
434
         // capture what the hierarchy level is for the object just processed.
344
         lastLevel = level;
435
         lastLevel = level;
345
      }
436
      }
346
      
-
 
347
      #endregion
-
 
348
 
437
 
349
 
438
 
350
      /// <summary>
-
 
351
      /// Finds and returns the ReqPro_object instance that contains the specified GUID. The
-
 
352
      /// GUID is that of the originating ReqPro requirement, which is copied into a ReqPro_object
-
 
353
      /// instance when it is created. This find operation supports the ability to resolve object to
-
 
354
      /// object trace relationships mirrored from the ReqPro database during the construction
-
 
355
      /// of the ReqPro_object hierarchy.
439
      private string firstTokenOnly(string s)
356
      /// </summary>
-
 
357
      /// <param name="rq_obj"></param>
-
 
358
      /// <param name="ReqProGUID"></param>
-
 
359
      /// <returns></returns>
-
 
360
      protected ReqPro_object findReqPro_object_byReqProGUID(ReqPro_object rq_obj, string ReqProGUID)
-
 
361
      {
440
      {
362
         if (rq_obj.guid.CompareTo(ReqProGUID) == 0)
441
         if (s != null)
363
         {
442
         {
-
 
443
            char [] delim = {'\r'};
-
 
444
            string [] tokens = s.Split(delim,2);
364
            return rq_obj;
445
            return tokens[0];
365
         }
446
         }
-
 
447
         return s;
-
 
448
      }
366
 
449
 
367
         foreach (ReqPro_object sub_rq_obj in rq_obj.ReqPro_objects)
-
 
368
         {
-
 
369
            ReqPro_object tgt_obj = findReqPro_object_byReqProGUID(sub_rq_obj, ReqProGUID);
-
 
370
            if (tgt_obj != null)
-
 
371
               return tgt_obj;
-
 
372
         }
450
      #endregion
373
 
451
 
374
         return null;
-
 
375
      }
-
 
376
 
452
 
377
      protected int write_traces(int totalRequirements)
453
      protected int write_traces(int totalRequirements)
378
      {
454
      {
-
 
455
         trace_log = new ArrayList();
-
 
456
 
-
 
457
         Main.WriteSeperator();
379
         Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Writing Trace Information", -1);
458
         Main.WriteOutput(string.Format("Writing Trace Information for {0} requirements", totalRequirements), -1);
380
         int numberWritten = 0;
459
         int numberWritten = 0;
381
 
460
 
382
         // adjust modulo for logging purposes so that the number of output messages is restricted
461
         // adjust modulo for logging purposes so that the number of output messages is restricted
383
         // for larger and larger numbers of requirements
462
         // for larger and larger numbers of requirements
384
         if (totalRequirements > 1000)
463
         if (totalRequirements > 1000)
Line 389... Line 468...
389
            writeTracesModulo = 20;
468
            writeTracesModulo = 20;
390
         else if (totalRequirements > 50)
469
         else if (totalRequirements > 50)
391
            writeTracesModulo = 10;
470
            writeTracesModulo = 10;
392
         else if (totalRequirements > 20)
471
         else if (totalRequirements > 20)
393
            writeTracesModulo = 5;
472
            writeTracesModulo = 5;
394
         else // 10 or less 
473
         else // 10 or less
395
            writeTracesModulo = 1;
474
            writeTracesModulo = 1;
396
 
475
 
397
         foreach( ReqPro_object sub_obj in rq_root_package.ReqPro_objects )
476
         foreach( ReqPro_object sub_obj in rq_root_package.ReqPro_objects )
398
         {
477
         {
399
            if (Main.mustAbort)
478
            if (Main.mustAbort)
400
               return numberWritten;
479
               return numberWritten;
401
 
480
 
402
            numberWritten = write_traces(sub_obj, numberWritten, totalRequirements);
481
            numberWritten = write_traces(sub_obj, numberWritten, totalRequirements);
403
         }
482
         }
404
 
483
 
405
         Main.EA_Repository.WriteOutput(Main.GUI_OUTPUT_TAB_NAME, "Traces Completed", -1);
484
         Main.WriteOutput("Traces Completed", -1);
-
 
485
 
-
 
486
         if (trace_log.Count > 0)
-
 
487
         {
-
 
488
            DialogResult dlgRes = MessageBoxEx.Show("Display Log of Trace Connection Changes", "Confirm", MessageBoxButtons.YesNo);
-
 
489
            if (dlgRes == DialogResult.Yes)
-
 
490
            {
-
 
491
               foreach (string s in trace_log)
-
 
492
               {
-
 
493
                  Main.WriteOutput(s, -1);
-
 
494
               }
-
 
495
            }
-
 
496
         }
-
 
497
 
-
 
498
         Main.WriteSeperator();
406
 
499
 
407
         return numberWritten;
500
         return numberWritten;
408
      }
501
      }
409
 
502
 
-
 
503
 
410
      /// <summary>
504
      /// <summary>
411
      /// This method examines all of the ReqPro_object trace relationships and mirrors them in 
505
      /// This method examines all of the ReqPro_object trace relationships and mirrors them in
412
      /// the EA requirement elements that have been formed from each un-filtered ReqPro_objects.
506
      /// the EA requirement elements that have been formed from each un-filtered ReqPro_objects.
413
      /// </summary>
507
      /// </summary>
414
      /// <param name="ea_repository"></param>
508
      /// <param name="ea_repository"></param>
415
      /// <param name="rq_obj"></param>
509
      /// <param name="rq_obj"></param>
416
      private int write_traces(ReqPro_object rq_obj, int numberWritten, int totalRequirements)
510
      private int write_traces(ReqPro_object rq_obj, int numberWritten, int totalRequirements)
Line 421... Line 515...
421
         if (rq_obj.isRequirement)
515
         if (rq_obj.isRequirement)
422
         {
516
         {
423
            // if this object had an EA element made for it during the write_ea_database() process...
517
            // if this object had an EA element made for it during the write_ea_database() process...
424
            if (rq_obj.ea_element_ID != -1)
518
            if (rq_obj.ea_element_ID != -1)
425
            {
519
            {
-
 
520
               // trace output
426
               numberWritten++;
521
               numberWritten++;
427
               if ((numberWritten % writeTracesModulo) == 0)
522
               if ((numberWritten % writeTracesModulo) == 0)
428
               {
523
               {
429
                  Main.EA_Repository.WriteOutput(Main.GUI_OUTPUT_TAB_NAME, string.Format("   {0} of {1}", numberWritten, totalRequirements), -1);
524
                  Main.WriteOutput(string.Format("   {0} of {1}", numberWritten, totalRequirements), -1);
430
               }
525
               }
431
 
526
 
-
 
527
               // Get the EA element the object refers to
432
               EA.Element ea_rq_obj = Main.EA_Repository.GetElementByID(rq_obj.ea_element_ID);
528
               EA.Element ea_req = Main.EA_Repository.GetElementByID(rq_obj.ea_element_ID);
433
               if (ea_rq_obj != null)
529
               if (ea_req != null)
434
               {
530
               {
435
                  foreach(string s in rq_obj.ReqPro_traces)
531
                  if (ea_req.Connectors.Count != 0 || rq_obj.ReqPro_traces.Count != 0)
436
                  {
-
 
437
                     ReqPro_object tgt_obj = findReqPro_object_byReqProGUID(rq_root_package,s);
-
 
438
                     if (tgt_obj != null)
-
 
439
                     {
-
 
440
                        if (tgt_obj.ea_element_ID != -1)
-
 
441
                        {
-
 
442
                           EA.Element ea_tgt_obj = Main.EA_Repository.GetElementByID(tgt_obj.ea_element_ID);
-
 
443
                           if (ea_tgt_obj != null)
-
 
444
                           {
-
 
445
                              add_connection(ea_rq_obj, ea_tgt_obj);
532
                     create_or_update_connections(ea_req, rq_obj.ReqPro_traces);
446
                           }
-
 
447
                        }
-
 
448
                     }
-
 
449
                  }
-
 
450
               }
533
               }
451
            }
534
            }
452
         }
535
         }
453
 
536
 
454
         // recurse to ensure we examine the entire hiearchy
537
         // recurse to ensure we examine the entire hiearchy
Line 460... Line 543...
460
            numberWritten = write_traces(sub_obj, numberWritten, totalRequirements);
543
            numberWritten = write_traces(sub_obj, numberWritten, totalRequirements);
461
         }
544
         }
462
         return numberWritten;
545
         return numberWritten;
463
      }
546
      }
464
 
547
 
-
 
548
 
465
      /// <summary>
549
      /// <summary>
466
      /// Adds a connection between one EA element and another
550
      /// This algorithm is intended to create or delete requirement to requirement relationships
-
 
551
      /// based upon the view of the relationship captured from ReqPro. This function processes
-
 
552
      /// just one element, and so it should be called repeatedly as the facsimile of the ReqPro
-
 
553
      /// database captured in memory as a tree structure, is parsed (see write_traces method).
467
      /// </summary>
554
      /// </summary>
468
      /// <param name="repository"></param>
-
 
469
      /// <param name="rq_artifact"></param>
555
      /// <param name="src_element"></param>
470
      /// <param name="ea_req"></param>
556
      /// <param name="guids"></param>
471
      protected void add_connection(EA.Element src_element, EA.Element dest_element)
557
      protected void create_or_update_connections(EA.Element src_element, ArrayList guids)
472
      {
558
      {
473
         // Add the new requirement to the src_element
559
         bool connectorCollectionNeedsRefreshing = false;
-
 
560
 
474
         EA.Connector c = (EA.Connector)src_element.Connectors.AddNew("", "Dependency");
561
         string src_tag = EA_TaggedValues.Read(src_element, Constants.TAG_TAG);
475
         c.SupplierID = dest_element.ElementID;
562
         string src_guid = EA_TaggedValues.Read(src_element, Constants.TAG_GUID, "");
-
 
563
 
-
 
564
         // Create a list of booleans that will allow us to track which elements in the guids
476
         //c.Stereotype = "trace";
565
         // list are validated.
477
         c.Direction = "Source -> Destination";
566
         ArrayList traceValidated = null;
-
 
567
 
478
         if (false == c.Update())
568
         if (guids.Count > 0)
479
         {
569
         {
-
 
570
            traceValidated = new ArrayList();
-
 
571
            for (int i = 0; i < guids.Count; i++)
-
 
572
            {
480
            Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "New Connector Error : " + c.GetLastError(), dest_element.ElementID );
573
               traceValidated.Add(0);  // initially, none of the guids are validated.
-
 
574
            }
481
         }
575
         }
-
 
576
 
-
 
577
         int i_traceValidated = 0;
-
 
578
 
-
 
579
         int numberOfconnections = src_element.Connectors.Count;
-
 
580
         if (numberOfconnections > 10)
-
 
581
         {
-
 
582
            Main.WriteOutput(string.Format("   ...processing requirement with large number ({0}) of traces", numberOfconnections), src_element.ElementID);
-
 
583
         }
-
 
584
 
-
 
585
         // scan the EA elements connectors
-
 
586
         short i_c = 0;
-
 
587
         foreach(EA.Connector c in src_element.Connectors)
-
 
588
         {
-
 
589
            int destId = -1;
-
 
590
 
-
 
591
            // we dont care about direction of relationship, so test for both
-
 
592
            if (c.ClientID == src_element.ElementID)
-
 
593
               destId = c.SupplierID;
-
 
594
            else if (c.SupplierID == src_element.ElementID)
-
 
595
               destId = c.ClientID;
-
 
596
 
-
 
597
            // and make sure we filter out self-referential connectors
-
 
598
            if (destId != src_element.ElementID)
-
 
599
            {
-
 
600
               // Get the target element and obtain the tagged values that will effectively mark it as
-
 
601
               // being a requirement 
-
 
602
               EA.Element ea_tgt_req = Main.EA_Repository.GetElementByID(destId);
-
 
603
               if (ea_tgt_req != null && ea_tgt_req.Type.Equals("Requirement"))
-
 
604
               {
-
 
605
                  // Get the GUID from the referenced element
-
 
606
                  string rp_tgt_req_guid = EA_TaggedValues.Read(ea_tgt_req, Constants.TAG_GUID, "");
-
 
607
                  string rp_tgt_req_tag = EA_TaggedValues.Read(ea_tgt_req, Constants.TAG_TAG, "");
-
 
608
 
-
 
609
                  if (rp_tgt_req_guid != null && rp_tgt_req_guid.Length > 0 && rp_tgt_req_guid.StartsWith("{")
-
 
610
                     && rp_tgt_req_tag != null && rp_tgt_req_tag.Length > 0)
-
 
611
                  {
-
 
612
                     // looks like an EA element that represents a ReqPro requirement
-
 
613
 
-
 
614
                     // For this source and destination pair, look for evidence that the relationship
-
 
615
                     // is required by examining the guids list passed in as parameter.
-
 
616
                     i_traceValidated = 0;
-
 
617
                     bool validated = false;
-
 
618
                     foreach (string guid in guids)
-
 
619
                     {
-
 
620
                        // Get the target object of the trace relationship
-
 
621
                        ReqPro_object tgt_obj = guid_to_obj_dictionary[guid];
-
 
622
                        if (tgt_obj != null)
-
 
623
                        {
-
 
624
                           if (tgt_obj.ea_element_ID != -1)
-
 
625
                           {
-
 
626
                              if (destId == tgt_obj.ea_element_ID)
-
 
627
                              {
-
 
628
                                 validated = true;
-
 
629
 
-
 
630
                                 traceValidated[i_traceValidated] = (int)traceValidated[i_traceValidated] + 1;
-
 
631
 
-
 
632
                                 if ((int)traceValidated[i_traceValidated] > 1)
-
 
633
                                 {
-
 
634
                                    // this is a duplicate trace relationship, so remove it
-
 
635
                                    src_element.Connectors.DeleteAt(i_c, false);
-
 
636
                                    connectorCollectionNeedsRefreshing = true;
-
 
637
 
-
 
638
                                    trace_log.Add("Deleted duplicate connection between " + src_tag + " and " + rp_tgt_req_tag);
-
 
639
                                 }
-
 
640
                                 break;
-
 
641
                              }
-
 
642
                           }
-
 
643
                        }
-
 
644
                        i_traceValidated++;
-
 
645
                     }
-
 
646
 
-
 
647
                     if (false == validated)
-
 
648
                     {
-
 
649
                        // We did not find evidence that the trace was needed, so remove it
-
 
650
                        // but we have to check that the object at the other end of the relationship does 
-
 
651
                        // not have a trace back to us first. In EA, we dont care about directionality since
-
 
652
                        // regardless of direction, all relationships exist in the same collection, but
-
 
653
                        // this is not so in ReqPro, which has TracesTo and TracesFrom relationships (and
-
 
654
                        // other types too).
-
 
655
                        ReqPro_object tgt_obj = guid_to_obj_dictionary[rp_tgt_req_guid];
-
 
656
                        if (tgt_obj != null)
-
 
657
                        {
-
 
658
                           if (false == tgt_obj.ReqPro_traces.Contains(src_guid))
-
 
659
                           {
-
 
660
                              src_element.Connectors.DeleteAt(i_c, false);
-
 
661
                              connectorCollectionNeedsRefreshing = true;
-
 
662
 
-
 
663
                              trace_log.Add("Deleted connection between " + src_tag + " and " + rp_tgt_req_tag);
-
 
664
                           }
-
 
665
                        }
-
 
666
                     }
-
 
667
                  }
-
 
668
               }
-
 
669
            }
-
 
670
            else
-
 
671
            {
-
 
672
               // Found a self-referential requirement - this is not really allowed, so delete the connection
-
 
673
               src_element.Connectors.DeleteAt(i_c, false);
-
 
674
               trace_log.Add("Deleted self-referential connection in " + src_tag);
-
 
675
               connectorCollectionNeedsRefreshing = true;
-
 
676
            }
-
 
677
 
-
 
678
            i_c++;
-
 
679
 
-
 
680
            if ((i_c % 10) == 0)
-
 
681
            {
-
 
682
               Main.WriteOutput(string.Format("   ...{0} of {1}", (int)i_c, numberOfconnections), src_element.ElementID);
-
 
683
            }
-
 
684
         }
-
 
685
 
-
 
686
         // Now look for all guids that have not been marked as validated. For these, a new connection
-
 
687
         // must be established
-
 
688
         i_traceValidated = 0;
-
 
689
         foreach (string guid in guids)
-
 
690
         {
-
 
691
            if ((int)traceValidated[i_traceValidated] == 0)
-
 
692
            {
-
 
693
               // Get the target object of the trace relationship
-
 
694
               ReqPro_object tgt_obj = guid_to_obj_dictionary[guid];
-
 
695
               if (tgt_obj != null)
-
 
696
               {
-
 
697
                  if (tgt_obj.ea_element_ID != -1)
-
 
698
                  {
-
 
699
                     EA.Element ea_tgt_req = Main.EA_Repository.GetElementByID(tgt_obj.ea_element_ID);
-
 
700
                     if (ea_tgt_req != null && ea_tgt_req.Type.Equals("Requirement"))
-
 
701
                     {
-
 
702
                        string rp_tgt_req_tag = EA_TaggedValues.Read(ea_tgt_req, Constants.TAG_TAG, "");
-
 
703
 
-
 
704
                        // Add the new connection between the src_element and dest_element
-
 
705
                        EA.Connector c = (EA.Connector)src_element.Connectors.AddNew("", "Dependency");
-
 
706
                        c.SupplierID = ea_tgt_req.ElementID;
-
 
707
                        c.Direction = "Source -> Destination";
-
 
708
                        if (false == c.Update())
-
 
709
                        {
-
 
710
                           Main.WriteOutput("New Connector Error : " + c.GetLastError(), ea_tgt_req.ElementID );
-
 
711
                           Main.WriteOutput("...Failed to create connection between " + src_tag + " and " + rp_tgt_req_tag, ea_tgt_req.ElementID);
-
 
712
                           connectorCollectionNeedsRefreshing = true;
-
 
713
                        }
-
 
714
                        else
-
 
715
                        {
-
 
716
                           trace_log.Add("Created connection between " + src_tag + " and " + rp_tgt_req_tag);
-
 
717
                        }
-
 
718
                     }
-
 
719
                  }
-
 
720
               }
-
 
721
            }
-
 
722
 
-
 
723
            i_traceValidated++;
-
 
724
         }
-
 
725
 
-
 
726
         if (connectorCollectionNeedsRefreshing)
482
         src_element.Connectors.Refresh();
727
            src_element.Connectors.Refresh();
483
      }
728
      }
-
 
729
 
484
      
730
 
485
      /// <summary>
731
      /// <summary>
486
      /// A method to contain common pre-parsing steps.
732
      /// A method to contain common pre-parsing steps.
487
      /// </summary>
733
      /// </summary>
488
      private void pre_parsing()
734
      private void pre_parsing()
489
      {
735
      {
490
         // create an object to represent the root of the database so that we can collect
736
         // create an object to represent the root of the database so that we can collect
491
         // sub-objects (packages or requirements) underneath it.
737
         // sub-objects (packages or requirements) underneath it.
492
         rq_root_package = new ReqPro_object();
738
         rq_root_package = new ReqPro_object();
-
 
739
 
493
         rq_root_package.name = "ROOT";
740
         rq_root_package.name = "ROOT"; // may be overriden later
494
 
741
 
495
         // initialise the ReqPro database hierarchy tracking data
742
         // initialise the ReqPro database hierarchy tracking data
496
         rq_objs.Clear();
743
         rq_objs.Clear();
497
         rq_objs.Push(rq_root_package);
744
         rq_objs.Push(rq_root_package);
498
         ea_treePos.Clear();
745
         ea_treePos.Clear();
499
         ea_treePos.Push(0);
746
         ea_treePos.Push(0);
500
         lastLevel = 0;
747
         lastLevel = 0;
501
      }
748
      }
502
 
749
 
503
 
750
 
504
                         
-
 
-
 
751
 
505
 
752
 
506
	}
753
	}
-
 
754
 
-
 
755
 
-
 
756
 
-
 
757
   public class ReqProObject_Dictionary : DictionaryBase
-
 
758
   { 
-
 
759
 
-
 
760
      public ReqPro_object this[string guid]
-
 
761
      {
-
 
762
         get {return (ReqPro_object) this.Dictionary[guid]; }
-
 
763
 
-
 
764
         set { this.Dictionary[guid] = value; } 
-
 
765
      }
-
 
766
 
-
 
767
      public void Add(string guid, ReqPro_object rp_obj) 
-
 
768
      { 
-
 
769
         this.Dictionary.Add(guid, rp_obj); 
-
 
770
      } 
-
 
771
 
-
 
772
      public bool Contains(string guid)
-
 
773
      {
-
 
774
         return this.Dictionary.Contains(guid);
-
 
775
      }
-
 
776
 
-
 
777
 
-
 
778
      public ICollection Keys
-
 
779
      {
-
 
780
         get {return this.Dictionary.Keys;}
-
 
781
      }
-
 
782
   }
507
}
783
}