Subversion Repositories DevTools

Rev

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

Rev 2153 Rev 2155
Line 20... Line 20...
20
      // lists of meta-data in the ReqPro database
20
      // lists of meta-data in the ReqPro database
21
      protected ArrayList rq_req_types;
21
      protected ArrayList rq_req_types;
22
      protected ArrayList rq_req_status_types;
22
      protected ArrayList rq_req_status_types;
23
      protected ArrayList delayedMessages;
23
      protected ArrayList delayedMessages;
24
 
24
 
-
 
25
      // Flag to allow a client to configure this class to import structure only (no requirements -
-
 
26
      // just packages).
-
 
27
      protected bool structure_only = false;
-
 
28
 
-
 
29
 
25
      // constructor
30
      // constructor
26
		public ReqProParser()
31
		public ReqProParser()
27
		{
32
		{
28
         delayedMessages = new ArrayList();
33
         delayedMessages = new ArrayList();
29
		}
34
		}
30
 
35
 
31
      /// <summary>
36
      /// <summary>
32
      /// The parser will call this virtual method when it has opened a ReqPro project
37
      /// The parser will call this virtual method when it has opened a ReqPro project
33
      /// </summary>
38
      /// </summary>
34
      /// <param name="rq_project"></param>
39
      /// <param name="rq_project"></param>
35
      protected virtual void provideReqProDatabaseInfo(ReqPro40.Application rq_app, 
40
      protected virtual void provideReqProDatabaseInfo( 
36
         ReqPro40.Project rq_project, 
-
 
37
         ReqProDB_Artifact rq_artifact,
41
         ReqProDB_Artifact rq_artifact,
38
         EA.Element rq_element)
42
         EA.Element rq_element)
39
      {
43
      {
40
      }
44
      }
41
 
45
 
Line 46... Line 50...
46
      /// <param name="level"></param>
50
      /// <param name="level"></param>
47
      /// <param name="ea_repository"></param>
51
      /// <param name="ea_repository"></param>
48
      /// <param name="rq_project"></param>
52
      /// <param name="rq_project"></param>
49
      /// <param name="rq_Package"></param>
53
      /// <param name="rq_Package"></param>
50
      protected virtual void processPackage(int level,
54
      protected virtual void processPackage(int level,
51
                                            ReqPro40.Project rq_project, 
-
 
52
                                            ReqPro40.Package rq_package)
55
                                            ReqPro40.Package rq_package)
53
      {
56
      {
54
      }
57
      }
55
 
58
 
56
      /// <summary>
59
      /// <summary>
Line 61... Line 64...
61
      /// <param name="ea_repository"></param>
64
      /// <param name="ea_repository"></param>
62
      /// <param name="rq_project"></param>
65
      /// <param name="rq_project"></param>
63
      /// <param name="rq_Package"></param>
66
      /// <param name="rq_Package"></param>
64
      /// <param name="rq_Requirement"></param>
67
      /// <param name="rq_Requirement"></param>
65
      protected virtual void processRequirement(int level,
68
      protected virtual void processRequirement(int level,
66
                                                ReqPro40.Project rq_project, 
-
 
67
                                                ReqPro40.Package rq_package,
69
                                                ReqPro40.Package rq_package,
68
                                                ReqPro40.Requirement rq_requirement)
70
                                                ReqPro40.Requirement rq_requirement)
69
      {
71
      {
70
      }
72
      }
71
 
73
 
Line 77... Line 79...
77
      /// <param name="ea_repository"></param>
79
      /// <param name="ea_repository"></param>
78
      /// <param name="rq_project"></param>
80
      /// <param name="rq_project"></param>
79
      /// <param name="rq_Package"></param>
81
      /// <param name="rq_Package"></param>
80
      /// <param name="rq_Requirement"></param>
82
      /// <param name="rq_Requirement"></param>
81
      protected virtual void processObject(int level,
83
      protected virtual void processObject(int level,
82
                                           ReqPro40.Project rq_project, 
-
 
83
                                           ReqPro40.Package rq_package,
84
                                           ReqPro40.Package rq_package,
84
                                           ReqPro40.Requirement rq_requirement)
85
                                           ReqPro40.Requirement rq_requirement)
85
      {
86
      {
86
      }
87
      }
87
 
88
 
88
      protected void writeDelayedMessages()
89
      protected void writeDelayedMessages()
89
      {
90
      {
90
         foreach(string s in delayedMessages)
91
         if (delayedMessages.Count > 0)
91
         {
92
         {
-
 
93
            foreach(string s in delayedMessages)
-
 
94
            {
92
            Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, s, -1);
95
               Main.WriteOutput(s, -1);
-
 
96
            }
-
 
97
            Main.WriteSeperator();
93
         }
98
         }
94
      }
99
      }
95
 
100
 
96
      #region Requirement Type methods
101
      #region Requirement Type methods
97
 
102
 
98
      /// <summary>
103
      /// <summary>
99
      /// Get the requirement types from the ReqPro database, into a simple list, where each element
104
      /// Get the requirement types from the ReqPro database, into a simple list, where each element
100
      /// describes the requirement type and whether it is filtered or not. This list can be given to 
105
      /// describes the requirement type and whether it is filtered or not. This list can be given to 
101
      /// the ReqProFilterForm to capture the users requirement type filtering decisions. 
106
      /// the ReqProFilterForm to capture the users requirement type filtering decisions. 
102
      /// </summary>
107
      /// </summary>
103
      protected void get_rq_req_types_from_database(ReqPro40.Project RQ_project)
108
      protected void get_rq_req_types_from_database()
104
      {
109
      {
105
         rq_req_types = new ArrayList();
110
         rq_req_types = new ArrayList();
106
 
111
 
107
         ReqPro40.ReqTypes rqtypes = RQ_project.ReqTypes;
112
         ReqPro40.ReqTypes rqtypes = ReqProDatabase.get_requirement_types();
108
         foreach (ReqPro40.ReqType rq_type in rqtypes)
113
         if (rqtypes != null)
109
         {
114
         {
-
 
115
            foreach (ReqPro40.ReqType rq_type in rqtypes)
-
 
116
            {
110
            ReqPro_ReqType new_req_type = new ReqPro_ReqType(rq_type);
117
               ReqPro_ReqType new_req_type = new ReqPro_ReqType(rq_type);
111
            new_req_type.name     = rq_type.Name;
118
               new_req_type.name     = rq_type.Name;
112
            new_req_type.prefix   = rq_type.ReqPrefix;
119
               new_req_type.prefix   = rq_type.ReqPrefix;
113
            rq_req_types.Add(new_req_type);
120
               rq_req_types.Add(new_req_type);
-
 
121
            }
114
         }
122
         }
115
      }
123
      }
116
 
124
 
-
 
125
 
117
      /// <summary>
126
      /// <summary>
118
      /// Examine the requirement type list to see if the requirement type of the specified object
127
      /// Examine the requirement type list to see if the requirement type of the specified object
119
      /// has been filtered or not.
128
      /// has been filtered or not.
120
      /// </summary>
129
      /// </summary>
121
      /// <param name="rq_obj"></param>
130
      /// <param name="rq_obj"></param>
Line 123... Line 132...
123
      protected bool reqTypeIsFiltered(ReqPro_object rq_obj)
132
      protected bool reqTypeIsFiltered(ReqPro_object rq_obj)
124
      {
133
      {
125
         return ((ReqPro_ReqType)rq_req_types[rq_obj.tag_enum]).filtered;
134
         return ((ReqPro_ReqType)rq_req_types[rq_obj.tag_enum]).filtered;
126
      }
135
      }
127
 
136
 
-
 
137
 
128
      protected bool reqTypeHasOneOrMoreAttrs(ReqPro_object rq_obj, 
138
      protected bool reqTypeHasOneOrMoreAttrs(ReqPro_object rq_obj, 
129
         ref bool hasStatus, 
139
         ref bool hasStatus, 
130
         ref bool hasDiff, 
140
         ref bool hasDiff, 
131
         ref bool hasPrio,
141
         ref bool hasPrio,
132
         ref bool hasSource,
142
         ref bool hasSource,
133
         ref bool hasSourceVersion,
143
         ref bool hasSourceVersion,
134
         ref bool hasSourceSection)
144
         ref bool hasSourceSection,
-
 
145
         ref bool hasSubsystem,
-
 
146
         ref bool hasStability,
-
 
147
         ref bool hasType)
135
      {
148
      {
136
         foreach (ReqPro_ReqType rp_rt in rq_req_types)
149
         foreach (ReqPro_ReqType rp_rt in rq_req_types)
137
         {
150
         {
138
            if (rq_obj.tag.StartsWith(rp_rt.prefix))
151
            if (rq_obj.tag.StartsWith(rp_rt.prefix))
139
            {
152
            {
Line 141... Line 154...
141
               hasDiff = rp_rt.hasDifficulty;
154
               hasDiff = rp_rt.hasDifficulty;
142
               hasPrio = rp_rt.hasPriority;
155
               hasPrio = rp_rt.hasPriority;
143
               hasSource = rp_rt.hasSource;
156
               hasSource = rp_rt.hasSource;
144
               hasSourceVersion = rp_rt.hasSourceVersion;
157
               hasSourceVersion = rp_rt.hasSourceVersion;
145
               hasSourceSection = rp_rt.hasSourceSection;
158
               hasSourceSection = rp_rt.hasSourceSection;
-
 
159
               hasSubsystem = rp_rt.hasSubsystem;
-
 
160
               hasStability = rp_rt.hasStability;
-
 
161
               hasType = rp_rt.hasType;
146
 
162
 
147
               return hasStatus | hasDiff | hasPrio | hasSource | hasSourceVersion | hasSourceSection;
163
               return hasStatus | hasDiff | hasPrio | hasSource | hasSourceVersion | hasSourceSection | hasSubsystem | hasStability | hasType;
148
            }
164
            }
149
         }
165
         }
150
 
166
 
151
         return false;
167
         return false;
152
      }
168
      }
153
 
169
 
-
 
170
 
-
 
171
      protected bool reqTypeHasOneOrMoreAttrs(string tag_prefix, 
-
 
172
         ref bool hasStatus, 
-
 
173
         ref bool hasDiff, 
-
 
174
         ref bool hasPrio,
-
 
175
         ref bool hasSource,
-
 
176
         ref bool hasSourceVersion,
-
 
177
         ref bool hasSourceSection,
-
 
178
         ref bool hasSubsystem,
-
 
179
         ref bool hasStability,
-
 
180
         ref bool hasType)
-
 
181
      {
-
 
182
         foreach (ReqPro_ReqType rp_rt in rq_req_types)
-
 
183
         {
-
 
184
            if (tag_prefix.StartsWith(rp_rt.prefix))
-
 
185
            {
-
 
186
               hasStatus = rp_rt.hasStatus;
-
 
187
               hasDiff = rp_rt.hasDifficulty;
-
 
188
               hasPrio = rp_rt.hasPriority;
-
 
189
               hasSource = rp_rt.hasSource;
-
 
190
               hasSourceVersion = rp_rt.hasSourceVersion;
-
 
191
               hasSourceSection = rp_rt.hasSourceSection;
-
 
192
               hasSubsystem = rp_rt.hasSubsystem;
-
 
193
               hasStability = rp_rt.hasStability;
-
 
194
               hasType = rp_rt.hasType;
-
 
195
 
-
 
196
               return hasStatus | hasDiff | hasPrio | hasSource | hasSourceVersion | hasSourceSection | hasSubsystem | hasStability | hasType;
-
 
197
            }
-
 
198
         }
-
 
199
 
-
 
200
         return false;
-
 
201
      }
154
      #endregion
202
      #endregion
155
 
203
 
156
      #region Requirement Status Type methods
204
      #region Requirement Status Type methods
157
 
205
 
158
      /// <summary>
206
      /// <summary>
159
      /// Get the requirement status types from the ReqPro database, into a simple list, where each element
207
      /// Get the requirement status types from the ReqPro database, into a simple list, where each element
160
      /// describes the requirement status type and whether it is filtered or not. This list can be given to 
208
      /// describes the requirement status type and whether it is filtered or not. This list can be given to 
161
      /// the ReqProFilterForm to capture the users requirement status type filtering decisions. 
209
      /// the ReqProFilterForm to capture the users requirement status type filtering decisions. 
162
      /// </summary>
210
      /// </summary>
163
      protected void get_rq_req_status_types_from_database(ReqPro40.Project RQ_project)
211
      protected void get_rq_req_status_types_from_database()
164
      {
212
      {
165
         StringCollection status_values = new StringCollection();
213
         StringCollection status_values = new StringCollection();
166
 
214
 
167
         // Each requirement type can have its own unique list of status attribute values
215
         // Each requirement type can have its own unique list of status attribute values
168
         // so we have to go through each requirement type and find the set of status values
216
         // so we have to go through each requirement type and find the set of status values
Line 186... Line 234...
186
            }
234
            }
187
            catch 
235
            catch 
188
            {
236
            {
189
               delayedMessages.Add( string.Format("WARNING, ReqPro requirement type ({0}) has no Status attribute", rp_rt.prefix) );
237
               delayedMessages.Add( string.Format("WARNING, ReqPro requirement type ({0}) has no Status attribute", rp_rt.prefix) );
190
            }
238
            }
-
 
239
 
-
 
240
            //Main.WriteOutput("REQ_TYPE: " + rp_rt.name, -1);
-
 
241
            //foreach (ReqPro40.Attr a in rp_rt.rq_type.Attrs)
-
 
242
            //{
-
 
243
            //   Main.WriteOutput("   ATTR LABEL: " + a.Label, -1);
-
 
244
            //}
-
 
245
 
191
            // Also check if this requirement type has any of the other attributes we might import. This is
246
            // Also check if this requirement type has any of the other attributes we might import. This is
192
            // a little off topic for this function but this is a convenient place to do this until another
247
            // a little off topic for this function but this is a convenient place to do this until another
193
            // function is written.
248
            // function is written.
194
            try 
249
            try 
195
            {
250
            {
Line 238... Line 293...
238
            }
293
            }
239
            catch 
294
            catch 
240
            {
295
            {
241
               delayedMessages.Add( string.Format("WARNING, ReqPro requirement type ({0}) has no Source Section attribute", rp_rt.prefix) );
296
               delayedMessages.Add( string.Format("WARNING, ReqPro requirement type ({0}) has no Source Section attribute", rp_rt.prefix) );
242
            };
297
            };
-
 
298
 
-
 
299
            try 
-
 
300
            {
-
 
301
               ReqPro40.Attr attr = rp_rt.rq_type.get_Attr("Subsystem", ReqPro40.enumAttrLookups.eAttrLookups_Label);
-
 
302
               rp_rt.hasSubsystem = true;
-
 
303
            }
-
 
304
            catch 
-
 
305
            {
-
 
306
               delayedMessages.Add( string.Format("WARNING, ReqPro requirement type ({0}) has no Subsystem attribute", rp_rt.prefix) );
-
 
307
            };
-
 
308
 
-
 
309
            try 
-
 
310
            {
-
 
311
               ReqPro40.Attr attr = rp_rt.rq_type.get_Attr("Stability", ReqPro40.enumAttrLookups.eAttrLookups_Label);
-
 
312
               rp_rt.hasStability = true;
-
 
313
            }
-
 
314
            catch 
-
 
315
            {
-
 
316
               delayedMessages.Add( string.Format("WARNING, ReqPro requirement type ({0}) has no Stability attribute", rp_rt.prefix) );
-
 
317
            };
-
 
318
 
-
 
319
            try 
-
 
320
            {
-
 
321
               ReqPro40.Attr attr = rp_rt.rq_type.get_Attr("Requirement Type", ReqPro40.enumAttrLookups.eAttrLookups_Label);
-
 
322
               rp_rt.hasType = true;
-
 
323
            }
-
 
324
            catch 
-
 
325
            {
-
 
326
               delayedMessages.Add( string.Format("WARNING, ReqPro requirement type ({0}) has no Requirement Type attribute", rp_rt.prefix) );
-
 
327
            };
243
         }
328
         }
244
 
329
 
245
         // if reqpro had no status values, then add a dummy one
330
         // if reqpro had no status values, then add a dummy one
246
         if (status_values.Count == 0)
331
         if (status_values.Count == 0)
247
         {
332
         {
Line 283... Line 368...
283
      /// <summary>
368
      /// <summary>
284
      /// Initiates a ReqPro database parsing operation using a prompted reqpro database open operation
369
      /// Initiates a ReqPro database parsing operation using a prompted reqpro database open operation
285
      /// </summary>
370
      /// </summary>
286
      /// <param name="ea_repository"></param>
371
      /// <param name="ea_repository"></param>
287
      /// <returns></returns>
372
      /// <returns></returns>
288
      public virtual bool prompt_and_parse(ReqProDB_Artifact.MODE mode)
373
      public virtual bool prompt_and_parse(ReqProDB_Artifact.MODE mode, out bool cancelled)
289
      {
374
      {
290
         ReqPro40.Application rq_app = null;
375
         cancelled = false;
291
         ReqPro40.Project rq_project = null;
-
 
292
 
376
 
293
         try
377
         try
294
         {
378
         {
295
            // If we can find a ReqProDB artifact in the package, use it to logon to the ReqPro database
379
            // If we can find a ReqProDB artifact in the package, use it to logon to the ReqPro database
296
            ReqProDB_Artifact RQ_Artifact = new ReqProDB_Artifact();
380
            ReqProDB_Artifact RQ_Artifact = new ReqProDB_Artifact();
297
            EA.Element RQ_Element = RQ_Artifact.get_rq_artifact();
381
            EA.Element RQ_Element = RQ_Artifact.get_rq_artifact();
298
            if (RQ_Element != null)
382
            if (RQ_Element != null)
299
            {
383
            {
300
               // check to see if the ReqProDB element has the same mode as that specified by parameter
384
               // check to see if the ReqProDB element has the same mode as that specified by parameter
-
 
385
               // however bypass the validation check if the mode of the artifact is undefined or the mode
-
 
386
               // of the current operation is "export".
301
               ReqProDB_Artifact.MODE rq_art_mode = RQ_Artifact.get_mode(RQ_Element);
387
               ReqProDB_Artifact.MODE rq_art_mode = RQ_Artifact.get_mode(RQ_Element);
302
               if (rq_art_mode != ReqProDB_Artifact.MODE.UNDEFINED)
388
               if (rq_art_mode != ReqProDB_Artifact.MODE.UNDEFINED)
303
               {
389
               {
304
                  if (rq_art_mode != mode)
390
                  if (mode != ReqProDB_Artifact.MODE.EXPORT && rq_art_mode != mode)
305
                  {
391
                  {
306
                     DialogResult dlgRes = MessageBoxEx.Show("You are attempting to use a ReqProDB element " +
392
                     MessageBoxEx.Show(
307
                        "for a different purpose than that which was " +
393
                        "You are attempting to use a ReqProDB element\n" +
308
                        "specified when the element was first created. " +
394
                        "and associated EA model area for a different\n" +
309
                        "Continue Anyway?", "Confirm", MessageBoxButtons.YesNo);
395
                        "purpose than that which was specified when the\n" +
310
                     if (dlgRes != DialogResult.Yes)
396
                        "element was first created.",
311
                     {
397
                        "Error");
312
                        return false;
398
                     cancelled = true;
313
                     }
399
                     return false;
314
                  }
400
                  }
315
               }
401
               }
316
 
402
 
317
               if (Main.mustAbort)
403
               if (Main.mustAbort)
318
                  return false;
404
                  return false;
319
 
405
 
320
               rq_project = RQ_Artifact.OpenReqProProject(RQ_Element);
406
               if (false == RQ_Artifact.OpenReqProProject(RQ_Element, out cancelled))
-
 
407
                  return false;
-
 
408
 
321
               if (rq_project != null)
409
               if (cancelled == true)
322
                  rq_app = RQ_Artifact.RQ_app;
410
                  return  false;
323
            }
411
            }
324
            
412
            
325
            if (Main.mustAbort)
413
            if (Main.mustAbort)
326
               return false;
414
               return false;
327
 
415
 
328
            // If no ReqProDB artifact found, prompt user to logon to the ReqPro database
416
            // If no ReqProDB artifact found, prompt user to logon to the ReqPro database
329
            if (rq_project == null)
417
            if (false == ReqProDatabase.opened())
330
            {
418
            {
-
 
419
               DialogResult dlgRes;
-
 
420
 
-
 
421
               // Confirm user wants to create a new reqpro import/export area.
-
 
422
               dlgRes = MessageBoxEx.Show(
-
 
423
                  "The area of EA model structure you have selected,\n" +
-
 
424
                  "does not appear to be part of an existing ReqPro\n" +
-
 
425
                  "import/export area.\n\n" +
-
 
426
                  "Do you wish to configure it for ReqPro import/export?\n\n" +
-
 
427
                  "If you choose YES, you will be asked to select a\n" +
-
 
428
                  "ReqPro database within the filesystem to associate\n" +
-
 
429
                  "with this EA model area.\n" +
-
 
430
                  "Choosing NO will cancel the operation.", 
-
 
431
                  "Confirm", MessageBoxButtons.YesNo);
-
 
432
               if (dlgRes == DialogResult.No)
-
 
433
               {
-
 
434
                  cancelled = true;
-
 
435
                  return false;
-
 
436
               }
-
 
437
 
331
               // let user select the ReqPro database file name
438
               // let user select the ReqPro database file name
332
               OpenFileDialog ofd = new OpenFileDialog();
439
               OpenFileDialog ofd = new OpenFileDialog();
333
               ofd.Title = "Select Requisite Pro project file";
440
               ofd.Title = "Select Requisite Pro project file";
334
               ofd.Filter = "ReqPro files (*.rqs)|*.rqs|All files (*.*)|*.*";
441
               ofd.Filter = "ReqPro files (*.rqs)|*.rqs|All files (*.*)|*.*";
335
               DialogResult dlgRes = ofd.ShowDialog();
442
               dlgRes = ofd.ShowDialog();
336
               if (dlgRes != DialogResult.OK)
443
               if (dlgRes != DialogResult.OK)
337
                  return false;
444
                  return false;
338
 
445
 
339
               if (Main.mustAbort)
446
               if (Main.mustAbort)
340
                  return false;
447
                  return false;
Line 350... Line 457...
350
 
457
 
351
               string username = logon.ebUserName.Text;
458
               string username = logon.ebUserName.Text;
352
               string password = logon.ebPassword.Text;
459
               string password = logon.ebPassword.Text;
353
 
460
 
354
               // Connect to the ReqPro database using the ReqPro extensibility mechanism
461
               // Connect to the ReqPro database using the ReqPro extensibility mechanism
355
               rq_app = new ReqPro40.ApplicationClass();
-
 
356
 
-
 
357
               rq_project = 
-
 
358
                  rq_app.OpenProject(ofd.FileName,
462
               ReqProDatabase.open(ofd.FileName, username, password);
359
                  ReqPro40.enumOpenProjectOptions.eOpenProjOpt_RQSFile,
-
 
360
                  username,
-
 
361
                  password, 
-
 
362
                  enumProjectFlags.eProjFlag_Normal,
-
 
363
                  enumRelatedProjectOptions.eRelatedProjOption_ConnectAsSpecified);
-
 
364
 
463
 
365
               if (Main.mustAbort)
464
               if (Main.mustAbort)
366
                  return false;
465
                  return false;
367
 
466
 
368
               // if we do not currently have a ReqProDB artifact, create one
467
               // if we do not currently have a ReqProDB artifact, create one
369
               if (RQ_Element == null)
468
               if (RQ_Element == null)
370
               {
469
               {
371
                  RQ_Element = RQ_Artifact.create_rq_artifact(
470
                  RQ_Element = RQ_Artifact.create_rq_artifact(
372
                     EA_Utilities.get_selected_package(), 
471
                     EA_Utilities.get_selected_package(), 
373
                     rq_project.Name, 
472
                     ReqProDatabase.name(), 
374
                     rq_project.Description, 
473
                     ReqProDatabase.description(), 
375
                     logon.ebUserName.Text, 
474
                     logon.ebUserName.Text, 
376
                     ofd.FileName, 
475
                     ofd.FileName, 
377
                     rq_project.GUID);
476
                     ReqProDatabase.guid());
378
               }
477
               }
379
               if (Main.mustAbort)
478
               if (Main.mustAbort)
380
                  return false;
479
                  return false;
381
            }
480
            }
382
 
481
 
383
            if (Main.mustAbort)
482
            if (Main.mustAbort)
384
               return false;
483
               return false;
385
 
484
 
386
            // Now do the parsing of the ReqPro database
485
            // Now do the parsing of the ReqPro database
387
            if (rq_project != null)
486
            if (true == ReqProDatabase.opened())
388
            {
487
            {
389
               // give req pro project object to user of this class
488
               // give req pro project object to user of this class
390
               provideReqProDatabaseInfo(rq_app, rq_project, RQ_Artifact, RQ_Element);
489
               provideReqProDatabaseInfo(RQ_Artifact, RQ_Element);
391
 
490
 
392
               // get the requirement types from the req pro project
491
               // get the requirement types from the req pro project
393
               get_rq_req_types_from_database(rq_project);
492
               get_rq_req_types_from_database();
394
 
493
 
395
               get_rq_req_status_types_from_database(rq_project);
494
               get_rq_req_status_types_from_database();
396
 
495
 
397
               // Get the ReqPro root package and parse it
496
               // Get the ReqPro root package and parse it
398
               Main.EA_Repository.WriteOutput(Main.GUI_OUTPUT_TAB_NAME, "Acquiring ReqPro Database", -1);
497
               Main.WriteOutput("Acquiring ReqPro Database", -1);
399
               ReqPro40.RootPackage rq_rootPackage = rq_project.GetRootPackage(true);
-
 
400
 
498
 
401
               parseRootPackage(0, rq_project, rq_rootPackage);
499
               parseRootPackage(0, ReqProDatabase.get_root_package());
-
 
500
 
-
 
501
               Main.WriteSeperator();
402
 
502
 
403
               if (Main.mustAbort)
503
               if (Main.mustAbort)
404
                  return false;
504
                  return false;
405
 
505
 
406
               return true;
506
               return true;
407
            }
507
            }
408
         }
508
         }
409
         catch (Exception ex)
509
         catch (Exception ex)
410
         {
510
         {
411
            Main.MessageBoxException(ex, "Exception (prompt_and_parse)");
511
            Main.MessageBoxException(ex, "Exception (prompt_and_parse)");
412
            if (rq_project != null)
-
 
413
               rq_project.CloseProject();
512
            ReqProDatabase.close();
414
         }  
513
         }  
415
         return false;
514
         return false;
416
      }
515
      }
417
 
516
 
418
      /// <summary>
517
      /// <summary>
Line 425... Line 524...
425
      /// </summary>
524
      /// </summary>
426
      /// <param name="repository"></param>
525
      /// <param name="repository"></param>
427
      /// <param name="rq_project"></param>
526
      /// <param name="rq_project"></param>
428
      /// <param name="thisPackage"></param>
527
      /// <param name="thisPackage"></param>
429
      private void parseRootPackage(int level,
528
      private void parseRootPackage(int level,
430
                                    ReqPro40.Project rq_project, 
-
 
431
                                    ReqPro40.RootPackage thisPackage)
529
                                    ReqPro40.RootPackage thisPackage)
432
      {
530
      {
433
         // Scan through the sub-packages of the root package
531
         // Scan through the sub-packages of the root package
434
         int limit_packageCount = thisPackage.get_Count(ReqPro40.enumElementTypes.eElemType_Package);
532
         int limit_packageCount = thisPackage.get_Count(ReqPro40.enumElementTypes.eElemType_Package);
435
         if (limit_packageCount > 0)
533
         if (limit_packageCount > 0)
Line 441... Line 539...
441
               if (Main.mustAbort)
539
               if (Main.mustAbort)
442
                  break;
540
                  break;
443
 
541
 
444
               // Read the sub-package and parse it
542
               // Read the sub-package and parse it
445
               ReqPro40.Package subPackage = (ReqPro40.Package)thisPackage.GetCurrentElement();
543
               ReqPro40.Package subPackage = (ReqPro40.Package)thisPackage.GetCurrentElement();
446
               parsePackage(level+1, "", rq_project, subPackage);
544
               parsePackage(level+1, "", subPackage);
447
               thisPackage.MoveNext();
545
               thisPackage.MoveNext();
448
            }
546
            }
449
         }
547
         }
450
 
548
 
451
         if (Main.mustAbort)
549
         if (Main.mustAbort)
452
            return;
550
            return;
453
 
551
 
-
 
552
         if (structure_only == false)
-
 
553
         {
454
         // Scan through the requirements directly beneath the root package
554
            // Scan through the requirements directly beneath the root package
455
         int limit_reqCount = thisPackage.get_Count(ReqPro40.enumElementTypes.eElemType_Requirement);
555
            int limit_reqCount = thisPackage.get_Count(ReqPro40.enumElementTypes.eElemType_Requirement);
456
         if (limit_reqCount > 0)
556
            if (limit_reqCount > 0)
457
         {
557
            {
458
            // Obtain the requirement element key list from the root package and scan through each entry
558
               // Obtain the requirement element key list from the root package and scan through each entry
459
            int i_reqCount;
559
               int i_reqCount;
460
            System.Object[,] keyList = (System.Object[,])thisPackage.KeyList(ReqPro40.enumElementTypes.eElemType_Requirement);
560
               System.Object[,] keyList = (System.Object[,])thisPackage.KeyList(ReqPro40.enumElementTypes.eElemType_Requirement);
461
            for (i_reqCount = 0; i_reqCount < limit_reqCount; i_reqCount++)
561
               for (i_reqCount = 0; i_reqCount < limit_reqCount; i_reqCount++)
462
            {
-
 
463
               if (Main.mustAbort)
-
 
464
                  break;
-
 
465
 
-
 
466
               // Obtain the ReqPro requirement from its key, and parse it
-
 
467
               ReqPro40.Requirement thisRequirement = 
-
 
468
                  rq_project.GetRequirement(keyList[0,i_reqCount],
-
 
469
                                            ReqPro40.enumRequirementLookups.eReqLookup_Key,
-
 
470
                                            ReqPro40.enumRequirementsWeights.eReqWeight_Heavy,
-
 
471
                                            ReqPro40.enumRequirementFlags.eReqFlag_RetainHierarchy);
-
 
472
 
-
 
473
               if (thisRequirement != null)
-
 
474
               {
562
               {
-
 
563
                  if (Main.mustAbort)
-
 
564
                     break;
-
 
565
 
-
 
566
                  // Obtain the ReqPro requirement from its key, and parse it
-
 
567
                  ReqPro40.Requirement thisRequirement = ReqProDatabase.get_requirement_by_key(keyList[0,i_reqCount]);
-
 
568
                  if (thisRequirement != null)
-
 
569
                  {
475
                  parseRequirement(level+1, rq_project, null, thisRequirement);                  
570
                     parseRequirement(level+1, null, thisRequirement);                  
-
 
571
                  }
476
               }
572
               }
477
            }
573
            }
478
         }
574
         }
479
      }
575
      }
480
 
576
 
Line 490... Line 586...
490
      /// <param name="repository"></param>
586
      /// <param name="repository"></param>
491
      /// <param name="rq_project"></param>
587
      /// <param name="rq_project"></param>
492
      /// <param name="thisPackage"></param>
588
      /// <param name="thisPackage"></param>
493
      private void parsePackage(int level,
589
      private void parsePackage(int level,
494
                                string prefix,
590
                                string prefix,
495
                                ReqPro40.Project rq_project, 
-
 
496
                                ReqPro40.Package thisPackage)
591
                                ReqPro40.Package thisPackage)
497
      {
592
      {
498
         if (Main.mustAbort)
593
         if (Main.mustAbort)
499
            return;
594
            return;
500
 
595
 
501
         Main.EA_Repository.WriteOutput(Main.GUI_OUTPUT_TAB_NAME, prefix + thisPackage.Name, -1);
596
         Main.WriteOutput(prefix + thisPackage.Name, -1);
502
 
597
 
503
         // call user defined functions
598
         // call user defined functions
504
         processPackage(level, rq_project, thisPackage);
599
         processPackage(level, thisPackage);
505
         processObject(level, rq_project, thisPackage, null);
600
         processObject(level, thisPackage, null);
506
 
601
 
507
         // Scan through the sub-packages of this package
602
         // Scan through the sub-packages of this package
508
         int limit_packageCount = thisPackage.get_Count(ReqPro40.enumElementTypes.eElemType_Package);
603
         int limit_packageCount = thisPackage.get_Count(ReqPro40.enumElementTypes.eElemType_Package);
509
         if (limit_packageCount > 0)
604
         if (limit_packageCount > 0)
510
         {
605
         {
Line 515... Line 610...
515
               if (Main.mustAbort)
610
               if (Main.mustAbort)
516
                  break;
611
                  break;
517
 
612
 
518
               // Read the sub-package and parse it
613
               // Read the sub-package and parse it
519
               ReqPro40.Package subPackage = (ReqPro40.Package)thisPackage.GetCurrentElement();
614
               ReqPro40.Package subPackage = (ReqPro40.Package)thisPackage.GetCurrentElement();
520
               parsePackage(level+1, prefix + "    ", rq_project, subPackage);
615
               parsePackage(level+1, prefix + "    ", subPackage);
521
               thisPackage.MoveNext();
616
               thisPackage.MoveNext();
522
            }
617
            }
523
         }
618
         }
524
 
619
 
525
         if (Main.mustAbort)
620
         if (Main.mustAbort)
526
            return;
621
            return;
527
 
622
 
-
 
623
         if (structure_only == false)
-
 
624
         {
528
         // Scan through the requirements directly beneath this package
625
            // Scan through the requirements directly beneath this package
529
         int limit_reqCount = thisPackage.get_Count(ReqPro40.enumElementTypes.eElemType_Requirement);
626
            int limit_reqCount = thisPackage.get_Count(ReqPro40.enumElementTypes.eElemType_Requirement);
530
         if (limit_reqCount > 0)
627
            if (limit_reqCount > 0)
531
         {
628
            {
532
            // Obtain the requirement element key list from this package and scan through each entry
629
               // Obtain the requirement element key list from this package and scan through each entry
533
            int i_reqCount;
630
               int i_reqCount;
534
            System.Object[,] keyList = (System.Object[,])thisPackage.KeyList(ReqPro40.enumElementTypes.eElemType_Requirement);
631
               System.Object[,] keyList = (System.Object[,])thisPackage.KeyList(ReqPro40.enumElementTypes.eElemType_Requirement);
535
            for (i_reqCount = 0; i_reqCount < limit_reqCount; i_reqCount++)
632
               for (i_reqCount = 0; i_reqCount < limit_reqCount; i_reqCount++)
536
            {
-
 
537
               if (Main.mustAbort)
-
 
538
                  break;
-
 
539
 
-
 
540
               // Obtain the ReqPro requirement from its key, and parse it
-
 
541
               ReqPro40.Requirement thisRequirement = 
-
 
542
                  rq_project.GetRequirement(keyList[0,i_reqCount],
-
 
543
                                            ReqPro40.enumRequirementLookups.eReqLookup_Key,
-
 
544
                                            ReqPro40.enumRequirementsWeights.eReqWeight_Heavy,
-
 
545
                                            ReqPro40.enumRequirementFlags.eReqFlag_RetainHierarchy);
-
 
546
               if (thisRequirement != null)
-
 
547
               {
633
               {
-
 
634
                  if (Main.mustAbort)
-
 
635
                     break;
-
 
636
 
-
 
637
                  // Obtain the ReqPro requirement from its key, and parse it
-
 
638
                  ReqPro40.Requirement thisRequirement = ReqProDatabase.get_requirement_by_key(keyList[0,i_reqCount]);
-
 
639
                  if (thisRequirement != null)
-
 
640
                  {
548
                  parseRequirement(level+1, rq_project, thisPackage, thisRequirement);                  
641
                     parseRequirement(level+1, thisPackage, thisRequirement);                  
-
 
642
                  }
549
               }
643
               }
550
            }
644
            }
551
         }
645
         }
552
      }
646
      }
553
 
647
 
Line 562... Line 656...
562
      /// <param name="repository"></param>
656
      /// <param name="repository"></param>
563
      /// <param name="rq_project"></param>
657
      /// <param name="rq_project"></param>
564
      /// <param name="thisPackage"></param>
658
      /// <param name="thisPackage"></param>
565
      /// <param name="thisRequirement"></param>
659
      /// <param name="thisRequirement"></param>
566
      private void parseRequirement(int level,
660
      private void parseRequirement(int level,
567
                                    ReqPro40.Project rq_project, 
-
 
568
                                    ReqPro40.Package thisPackage, 
661
                                    ReqPro40.Package thisPackage, 
569
                                    ReqPro40.Requirement thisRequirement)
662
                                    ReqPro40.Requirement thisRequirement)
570
      {
663
      {
571
         if (Main.mustAbort)
664
         if (Main.mustAbort)
572
            return;
665
            return;
573
 
666
 
574
         // call user defined functions
667
         // call user defined functions
575
         processRequirement(level, rq_project, thisPackage, thisRequirement);
668
         processRequirement(level, thisPackage, thisRequirement);
576
         processObject(level, rq_project, thisPackage, thisRequirement);
669
         processObject(level, thisPackage, thisRequirement);
577
 
670
 
578
         // requirements can have children that are requirements, so we have to find those
671
         // requirements can have children that are requirements, so we have to find those
579
         int limit_numberOfChildren = 0;
672
         int limit_numberOfChildren = 0;
580
         if (true == thisRequirement.get_HasChildren(ref limit_numberOfChildren))
673
         if (true == thisRequirement.get_HasChildren(ref limit_numberOfChildren))
581
         {
674
         {
Line 595... Line 688...
595
               ReqPro40.Requirement subRequirement = 
688
               ReqPro40.Requirement subRequirement = 
596
                  thisRelationship.get_DestinationRequirement(ReqPro40.enumRequirementsWeights.eReqWeight_Heavy);
689
                  thisRelationship.get_DestinationRequirement(ReqPro40.enumRequirementsWeights.eReqWeight_Heavy);
597
 
690
 
598
               if (subRequirement != null)
691
               if (subRequirement != null)
599
               {
692
               {
600
                  parseRequirement(level+1, rq_project, thisPackage, subRequirement);
693
                  parseRequirement(level+1, thisPackage, subRequirement);
601
               }
694
               }
602
 
695
 
603
               theseRelationships.MoveNext();
696
               theseRelationships.MoveNext();
604
            }
697
            }
605
         }
698
         }
606
      }
699
      }
607
 
700
 
608
	}
701
	}
609
 
702
 
-
 
703
 
-
 
704
 
-
 
705
 
610
}
706
}