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 8... Line 8...
8
 
8
 
9
namespace EA_ReqPro
9
namespace EA_ReqPro
10
{
10
{
11
 
11
 
12
	/// <summary>
12
	/// <summary>
-
 
13
   /// ImportReqProDatabase is a specialisation of CopyReqProDatabaseToMemory, designed to copy the 
-
 
14
   /// ReqPro database content into an EA database, discarding the structure of and hierarchy of 
-
 
15
   /// packages, selecting just the requirements found in the ReqPro database for storage into EA,
13
	/// Summary description for ImportReqProDatabase.
16
   /// where they will be used for design traceability purposes.
14
	/// </summary>
17
	/// </summary>
15
	public class ImportReqProDatabase : CopyReqProDatabaseToMemory
18
   public class ImportReqProDatabase : CopyReqProDatabaseToMemory
16
	{
19
   {
17
      private int totalRequirements = 0;
20
      private int totalRequirements = 0;
18
 
21
 
19
      /// <summary>
22
      /// <summary>
20
      /// Constructor logic
23
      /// Constructor logic
21
      /// </summary>
24
      /// </summary>
22
      /// <param name="ea_repository"></param>
25
      /// <param name="ea_repository"></param>
23
      public ImportReqProDatabase(): base()
26
      public ImportReqProDatabase(): base()
24
		{
27
      {
25
         totalRequirements = 0;
28
         totalRequirements = 0;
26
		}
29
      }
27
 
30
 
28
 
31
 
29
      /// <summary>
32
      /// <summary>
30
      /// Method to parse a ReqPro database using the information in a ReqProDB artifact,
33
      /// Method to parse a ReqPro database using the information in a ReqProDB artifact,
31
      /// assumed to be selected in EA's project browser prior to the method call.
34
      /// assumed to be selected in EA's project browser prior to the method call.
32
      /// </summary>
35
      /// </summary>
33
      /// <param name="ea_repository"></param>
36
      /// <param name="ea_repository"></param>
34
      /// <returns></returns>
37
      /// <returns></returns>
35
      public override bool prompt_and_parse(ReqProDB_Artifact.MODE mode)
38
      public override bool prompt_and_parse(ReqProDB_Artifact.MODE mode, out bool cancelled)
36
      {
39
      {
-
 
40
         cancelled = false;
-
 
41
 
37
         try
42
         try
38
         {
43
         {
-
 
44
            base.structure_only = false;
-
 
45
 
-
 
46
            string importDateTime = System.DateTime.Now.ToString();
-
 
47
 
-
 
48
            Main.WriteOutput("EA Requirement import at " + importDateTime, -1 );
-
 
49
            Main.WriteOutput("",-1);
-
 
50
 
39
            if (true == base.prompt_and_parse(mode))
51
            if (true == base.prompt_and_parse(mode, out cancelled))
40
            {
52
            {
41
               if (Main.mustAbort)
53
               if (Main.mustAbort)
42
                  return false;
54
                  return false;
43
 
55
 
44
               Main.EA_Repository.EnsureOutputVisible(Main.GUI_OUTPUT_TAB_NAME);
56
               Main.EA_Repository.EnsureOutputVisible(Main.GUI_OUTPUT_TAB_NAME);
45
 
57
 
46
               // Configure the ReqProDB artifact as a traceability artifact
58
               // Configure the ReqProDB artifact as a traceability artifact
47
               RQ_Artifact.set_traceability_mode(RQ_Element);
59
               RQ_Artifact.set_traceability_mode(RQ_Element);
48
 
60
 
49
               ImportFromReqPro();
61
               ImportFromReqPro(importDateTime);
50
 
62
 
51
               return true;
63
               return true;
52
            }
64
            }
53
         }
65
         }
54
         catch (Exception ex)
66
         catch (Exception ex)
55
         {
67
         {
56
            Main.MessageBoxException(ex, "Exception (parse)");
68
            Main.MessageBoxException(ex, "Exception (parse)");
57
         }      
69
         }      
-
 
70
 
58
         return false;
71
         return false;
59
      }
72
      }
60
 
73
 
61
      /// <summary>
74
      /// <summary>
62
      /// Displays the content of the change log element to the output trace display. This method must
75
      /// Displays the content of the change log element to the output trace display. This method must
Line 79... Line 92...
79
 
92
 
80
         // modify delimiters to : character so that we can extract the parameters for each log entry
93
         // modify delimiters to : character so that we can extract the parameters for each log entry
81
         delimStr = ":";
94
         delimStr = ":";
82
         delim = delimStr.ToCharArray();
95
         delim = delimStr.ToCharArray();
83
 
96
 
84
         Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME,"Displaying Import Change Log", -1);
97
         Main.WriteOutput("Displaying Import Change Log", -1);
85
 
98
 
86
         foreach(string s in log_strings)
99
         foreach(string s in log_strings)
87
         {
100
         {
88
            if (Main.mustAbort)
101
            if (Main.mustAbort)
89
               break;
102
               break;
Line 110... Line 123...
110
 
123
 
111
                  // Now discriminate actions based on the second parameter
124
                  // Now discriminate actions based on the second parameter
112
 
125
 
113
                  if (parameters[1].StartsWith("Created"))
126
                  if (parameters[1].StartsWith("Created"))
114
                  {
127
                  {
115
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME,"  Created : " + ea_req.Name, ea_req.ElementID );
128
                     Main.WriteOutput("  Created : " + ea_req.Name, ea_req.ElementID );
116
                  }
129
                  }
117
                  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
130
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
118
                  else if (parameters[1].StartsWith("Orphaned"))
131
                  else if (parameters[1].StartsWith("Orphaned"))
119
                  {
132
                  {
120
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME,"  Orphaned : " + ea_req.Name, ea_req.ElementID );
133
                     Main.WriteOutput("  Orphaned : " + ea_req.Name, ea_req.ElementID );
121
 
134
 
122
                     foreach (EA.Connector theConnector in ea_req.Connectors)
135
                     foreach (EA.Connector theConnector in ea_req.Connectors)
123
                     {
136
                     {
124
                        EA.Element tgt_ele = (EA.Element)Main.EA_Repository.GetElementByID( theConnector.SupplierID );
137
                        EA.Element tgt_ele = (EA.Element)Main.EA_Repository.GetElementByID( theConnector.SupplierID );
125
                        if (tgt_ele != null)
138
                        if (tgt_ele != null)
126
                        {
139
                        {
127
                           if (!tgt_ele.Type.StartsWith("Requirement"))
140
                           if (!tgt_ele.Type.StartsWith("Requirement"))
128
                           {
141
                           {
129
                              Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     --> " + tgt_ele.Name, tgt_ele.ElementID);
142
                              Main.WriteOutput("     --> " + tgt_ele.Name, tgt_ele.ElementID);
130
                           }
143
                           }
131
                        }
144
                        }
132
                     }
145
                     }
133
                  }
146
                  }
134
                  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
147
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
135
                  else if (parameters[1].StartsWith("Name"))
148
                  else if (parameters[1].StartsWith("Name"))
136
                  {
149
                  {
137
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "  Modified Name: " + ea_req.Name, ea_req.ElementID );
150
                     Main.WriteOutput("  Modified Name: " + ea_req.Name, ea_req.ElementID );
138
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     <<< " + parameters[2], ea_req.ElementID);
151
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
139
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     >>> " + parameters[3], ea_req.ElementID);
152
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
140
                  }
153
                  }
141
                  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
154
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
142
                  else if (parameters[1].StartsWith("Notes"))
155
                  else if (parameters[1].StartsWith("Notes"))
143
                  {
156
                  {
144
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "  Modified Description: " + ea_req.Name, ea_req.ElementID );
157
                     Main.WriteOutput("  Modified Description: " + ea_req.Name, ea_req.ElementID );
145
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     <<< " + parameters[2], ea_req.ElementID);
158
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
146
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     >>> " + parameters[3], ea_req.ElementID);
159
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
147
                  }
160
                  }
148
                  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
161
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
149
                  else if (parameters[1].StartsWith("Difficulty"))
162
                  else if (parameters[1].StartsWith("Difficulty"))
150
                  {
163
                  {
151
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "  Modified Difficulty: " + ea_req.Name, ea_req.ElementID );
164
                     Main.WriteOutput("  Modified Difficulty: " + ea_req.Name, ea_req.ElementID );
152
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     <<< " + parameters[2], ea_req.ElementID);
165
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
153
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     >>> " + parameters[3], ea_req.ElementID);
166
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
154
                  }
167
                  }
155
                  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
168
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
156
                  else if (parameters[1].StartsWith("Priority"))
169
                  else if (parameters[1].StartsWith("Priority"))
157
                  {
170
                  {
158
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "  Modified Priority: " + ea_req.Name, ea_req.ElementID );
171
                     Main.WriteOutput("  Modified Priority: " + ea_req.Name, ea_req.ElementID );
159
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     <<< " + parameters[2], ea_req.ElementID);
172
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
160
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     >>> " + parameters[3], ea_req.ElementID);
173
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
161
                  }
174
                  }
162
                  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
175
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
163
                  else if (parameters[1].StartsWith("Version"))
176
                  else if (parameters[1].StartsWith("Version"))
164
                  {
177
                  {
165
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "  Modified Version: " + ea_req.Name, ea_req.ElementID );
178
                     Main.WriteOutput("  Modified Version: " + ea_req.Name, ea_req.ElementID );
166
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     <<< " + parameters[2], ea_req.ElementID);
179
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
167
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     >>> " + parameters[3], ea_req.ElementID);
180
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
168
                  }
181
                  }
169
                  /////////////////////////////////////////////////////////////////////////////////////////////////////////////
182
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
170
                  else if (parameters[1].StartsWith("Status"))
183
                  else if (parameters[1].StartsWith("Status"))
171
                  {
184
                  {
172
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "  Modified Status: " + ea_req.Name, ea_req.ElementID );
185
                     Main.WriteOutput("  Modified Status: " + ea_req.Name, ea_req.ElementID );
-
 
186
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
-
 
187
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
-
 
188
                  }
-
 
189
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
 
190
                  else if (parameters[1].StartsWith("Subsystem"))
-
 
191
                  {
-
 
192
                     Main.WriteOutput("  Modified Subsystem: " + ea_req.Name, ea_req.ElementID );
-
 
193
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
-
 
194
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
-
 
195
                  }
-
 
196
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
 
197
                  else if (parameters[1].StartsWith("Stability"))
-
 
198
                  {
-
 
199
                     Main.WriteOutput("  Modified Stability: " + ea_req.Name, ea_req.ElementID );
-
 
200
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
-
 
201
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
-
 
202
                  }
-
 
203
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
 
204
                  else if (parameters[1].StartsWith("ReqType"))
-
 
205
                  {
-
 
206
                     Main.WriteOutput("  Modified Type: " + ea_req.Name, ea_req.ElementID );
-
 
207
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
-
 
208
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
-
 
209
                  }
-
 
210
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
 
211
                  else if (parameters[1].StartsWith("SourceVersion"))
-
 
212
                  {
-
 
213
                     Main.WriteOutput("  Modified Type: " + ea_req.Name, ea_req.ElementID );
-
 
214
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
-
 
215
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
-
 
216
                  }
-
 
217
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
 
218
                  else if (parameters[1].StartsWith("SourceSection"))
-
 
219
                  {
-
 
220
                     Main.WriteOutput("  Modified Type: " + ea_req.Name, ea_req.ElementID );
-
 
221
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
-
 
222
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
-
 
223
                  }
-
 
224
                     /////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
 
225
                  else if (parameters[1].StartsWith("Source"))
-
 
226
                  {
-
 
227
                     Main.WriteOutput("  Modified Type: " + ea_req.Name, ea_req.ElementID );
173
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     <<< " + parameters[2], ea_req.ElementID);
228
                     Main.WriteOutput("     <<< " + parameters[2], ea_req.ElementID);
174
                     Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "     >>> " + parameters[3], ea_req.ElementID);
229
                     Main.WriteOutput("     >>> " + parameters[3], ea_req.ElementID);
175
                  }
230
                  }
176
 
231
 
177
                  // accumulate good item into the newList
232
                  // accumulate good item into the newList
178
                  newList += trimmed_s + "\r\n";
233
                  newList += trimmed_s + "\r\n";
179
               }
234
               }
Line 204... Line 259...
204
         sc = sc.Replace('\n' , ' ');
259
         sc = sc.Replace('\n' , ' ');
205
         
260
         
206
         return sc;
261
         return sc;
207
      }
262
      }
208
 
263
 
-
 
264
      /// <summary>
-
 
265
      /// Get a new import package in which to store change log and new requirements from the import.
-
 
266
      /// </summary>
-
 
267
      /// <param name="parentPackage"></param>
-
 
268
      /// <param name="importDateTime"></param>
-
 
269
      /// <returns></returns>
-
 
270
      private EA.Package createImportPackage(EA.Package parentPackage, string importDateTime)
-
 
271
      {
-
 
272
         EA.Package importPackage = null;
-
 
273
         string importSubDir = EA_TaggedValues.Read(base.RQ_Element, Constants.TAG_IMPORT_SUB_DIR, "");
-
 
274
         if (importSubDir != null && importSubDir.Length > 0)
-
 
275
         {
-
 
276
            importPackage = (EA.Package)parentPackage.Packages.GetByName(importSubDir);
-
 
277
            if (importPackage != null)
-
 
278
            {
-
 
279
               parentPackage = importPackage;
-
 
280
            }
-
 
281
            else
-
 
282
            {
-
 
283
               // create a subdir and use it as the parent
-
 
284
               parentPackage = (EA.Package )parentPackage.Packages.AddNew( importSubDir, "Package");
-
 
285
               parentPackage.Update();
-
 
286
            }
-
 
287
         }
-
 
288
 
-
 
289
         // create the import dir in the parent
-
 
290
         importPackage = (EA.Package )parentPackage.Packages.AddNew( "import " + importDateTime, "Package");
-
 
291
         importPackage.Update();
-
 
292
 
-
 
293
         return importPackage;
-
 
294
      }
-
 
295
 
-
 
296
 
209
 
297
 
210
      /// <summary>
298
      /// <summary>
211
      /// A method that imports requirements from a ReqPro database into EA for the purpose
299
      /// A method that imports requirements from a ReqPro database into EA for the purpose
212
      /// of supporting requirement-to-design traceability.
300
      /// of supporting requirement-to-design traceability.
213
      /// </summary>
301
      /// </summary>
214
      /// <param name="repository"></param>
302
      /// <param name="repository"></param>
215
      private void ImportFromReqPro()
303
      private void ImportFromReqPro(string importDateTime)
216
      {
304
      {
217
         try
305
         try
218
         {
306
         {
219
            //IFormatProvider cultureInfo = new CultureInfo("en-US", true);
-
 
220
 
-
 
221
            string importDateTime = System.TimeZone.CurrentTimeZone.ToUniversalTime( System.DateTime.Now ).ToString();
-
 
222
 
-
 
223
            Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "EA Requirement import at " + importDateTime, -1 );
-
 
224
 
-
 
225
            // Get a list of EA requirements and their associated ReqPro GUIDs
307
            // Get a list of EA requirements and their associated ReqPro GUIDs
226
            ArrayList ea_reqs;
308
            ArrayList ea_reqs;
227
            ArrayList ea_GUIDs = new ArrayList();
309
            ArrayList ea_GUIDs = new ArrayList();
228
            ArrayList ea_req_matched = new ArrayList();
310
            ArrayList ea_req_matched = new ArrayList();
229
 
311
 
Line 233... Line 315...
233
 
315
 
234
            ArrayList allowedElementTypes = new ArrayList();
316
            ArrayList allowedElementTypes = new ArrayList();
235
            allowedElementTypes.Add("Requirement");
317
            allowedElementTypes.Add("Requirement");
236
            allowedElementTypes.Add("UseCase");
318
            allowedElementTypes.Add("UseCase");
237
 
319
 
238
            Main.EA_Repository.WriteOutput(Main.GUI_OUTPUT_TAB_NAME, "", -1);
-
 
239
            Main.EA_Repository.WriteOutput(Main.GUI_OUTPUT_TAB_NAME, "Acquiring list of elements already in EA", -1);
320
            Main.WriteOutput("Acquiring list of elements already in EA", -1);
240
            ElementAccumulator reqLister = new ElementAccumulator(allowedElementTypes);
321
            ElementAccumulator reqLister = new ElementAccumulator(allowedElementTypes);
241
            EA_Utilities.findAndProcessPackageElements( parentPackage, reqLister, true );
322
            EA_Utilities.findAndProcessPackageElements( parentPackage, reqLister, true );
242
 
323
 
243
            if (Main.mustAbort)
324
            if (Main.mustAbort)
244
               return;
325
               return;
245
 
326
 
246
            ea_reqs = reqLister.Elements; 
327
            ea_reqs = reqLister.Elements; 
247
            foreach (EA.Element ea_req in ea_reqs)
328
            foreach (EA.Element ea_req in ea_reqs)
248
            {
329
            {
249
               string GUID = EA_Utilities.ReadTag(ea_req, "GUID");
330
               string GUID = EA_TaggedValues.Read(ea_req, Constants.TAG_GUID);
250
               ea_GUIDs.Add(GUID);
331
               ea_GUIDs.Add(GUID);
251
               ea_req_matched.Add(false);
332
               ea_req_matched.Add(false);
252
            }
333
            }
253
 
334
 
254
            if (Main.mustAbort)
335
            if (Main.mustAbort)
255
               return;
336
               return;
256
 
337
 
257
            EA.Package importPackage = (EA.Package )parentPackage.Packages.AddNew( "import " + importDateTime, "Package");
338
            // Create an import package to store new requirements and the change log
258
            importPackage.Update();
339
            EA.Package importPackage = createImportPackage(parentPackage, importDateTime);
259
 
340
 
-
 
341
            // Create the change log element in the import package
260
            EA.Element changeLog = (EA.Element)importPackage.Elements.AddNew("Change Log","InformationItem");
342
            EA.Element changeLog = (EA.Element)importPackage.Elements.AddNew("Change Log","InformationItem");
261
            changeLog.Update();
343
            changeLog.Update();
262
 
344
 
263
            // Get a flattened list of requirements from the hierarchical data the user has filtered
345
            // Get a flattened list of requirements from the hierarchical data the user has filtered
264
            ArrayList rq_req_collection = new ArrayList();
346
            ArrayList rq_req_collection = new ArrayList();
Line 268... Line 350...
268
            int modifiedRequirementCount = 0;
350
            int modifiedRequirementCount = 0;
269
            int statusUpdatedRequirementCount = 0;
351
            int statusUpdatedRequirementCount = 0;
270
            int orphanedCount = 0;
352
            int orphanedCount = 0;
271
 
353
 
272
 
354
 
273
            Main.EA_Repository.WriteOutput(Main.GUI_OUTPUT_TAB_NAME, "Merging ReqPro content to EA", -1);
355
            Main.WriteOutput("Merging ReqPro content to EA", -1);
274
            // loop through all of the ReqPro requirements
356
            // loop through all of the ReqPro requirements
275
            foreach(ReqPro_object rq_obj in rq_req_collection)
357
            foreach(ReqPro_object rq_obj in rq_req_collection)
276
            {
358
            {
277
               if (Main.mustAbort)
359
               if (Main.mustAbort)
278
                  break;
360
                  break;
Line 290... Line 372...
290
 
372
 
291
                     EA.Element ea_req = ((EA.Element)ea_reqs[i_ea_req]);
373
                     EA.Element ea_req = ((EA.Element)ea_reqs[i_ea_req]);
292
 
374
 
293
                     rq_obj.ea_element_ID = ea_req.ElementID;
375
                     rq_obj.ea_element_ID = ea_req.ElementID;
294
 
376
 
-
 
377
                     // Only update the requirement if it was not mastered in EA, or
-
 
378
                     // unrestricted imports have been enabled
-
 
379
                     if (  (false == EA_TaggedValues.Read(ea_req, Constants.TAG_CREATED_IN_EA, Constants.DEFAULT_CREATED_IN_EA))
-
 
380
                        || (true == EA_TaggedValues.Read(ea_req, Constants.TAG_UNRESTRICTED_IMPORTS, Constants.DEFAULT_UNRESTRICTED_IMPORTS)) )
-
 
381
                     {
295
                     // This ReqPro requirement already has a counterpart in EA, so we must simply
382
                        // This ReqPro requirement already has a counterpart in EA, so we must simply
296
                     // update the counterpart. But, to aid the designer, we need to try to tell them
383
                        // update the counterpart. But, to aid the designer, we need to try to tell them
297
                     // how the requirement has changed, which could ofcoarse change the meaning 
384
                        // how the requirement has changed, which could ofcoarse change the meaning 
298
                     // of the requirement and require design changes to be done.
385
                        // of the requirement and require design changes to be done.
299
 
386
 
300
                     bool meaningMayHaveChanged = false;
387
                        bool meaningMayHaveChanged = false;
301
                     bool statusMayHaveChanged = false;
388
                        bool statusMayHaveChanged = false;
302
                     
389
                     
303
                     string ea_req_name = rq_obj.tag + " " + rq_obj.name;
390
                        string ea_req_name = rq_obj.tag + " " + rq_obj.name;
304
 
391
 
305
                     Main.EA_Repository.WriteOutput(Main.GUI_OUTPUT_TAB_NAME, "Updating: " + ea_req_name, rq_obj.ea_element_ID);
392
                        Main.WriteOutput("Updating: " + ea_req_name, rq_obj.ea_element_ID);
306
 
393
 
307
                     if ( ea_req.Name.CompareTo(ea_req_name) != 0 )
-
 
308
                     {
-
 
309
                        changeLog.Notes += ea_req.ElementGUID + ":Name:" + NO_COLONS(ea_req.Name) + ":" + NO_COLONS(ea_req_name) + "\r\n";
394
                        ea_req.Name       = updated_property_value_if_changed(changeLog, ea_req, ea_req.Name, "Name", ea_req_name, ref meaningMayHaveChanged);
310
                        changeLog.Update();
-
 
311
                        meaningMayHaveChanged = true;
-
 
312
                        ea_req.Name  = ea_req_name;
-
 
313
                     }
-
 
314
 
395
 
315
                     if ( ea_req.Notes.CompareTo(rq_obj.text) != 0 )
-
 
316
                     {
-
 
317
                        changeLog.Notes += ea_req.ElementGUID + ":Notes:" + NO_COLONS(ea_req.Notes) + ":" + NO_COLONS(rq_obj.text) + "\r\n";
396
                        ea_req.Notes      = updated_property_value_if_changed(changeLog, ea_req, ea_req.Notes, "Notes", rq_obj.text, ref meaningMayHaveChanged);
318
                        changeLog.Update();
-
 
319
                        meaningMayHaveChanged = true;
-
 
320
                        ea_req.Notes = rq_obj.text;
-
 
321
                     }
-
 
322
 
397
 
323
                     if (ea_req.Difficulty != rq_obj.difficulty)
-
 
324
                     {
-
 
325
                        changeLog.Notes += ea_req.ElementGUID + ":Difficulty:" + ea_req.Difficulty + ":" + rq_obj.difficulty + "\r\n";
398
                        ea_req.Difficulty = updated_property_value_if_changed(changeLog, ea_req, ea_req.Difficulty, "Difficulty", rq_obj.difficulty, ref statusMayHaveChanged);
326
                        changeLog.Update();
-
 
327
                        statusMayHaveChanged = true;
-
 
328
                        ea_req.Difficulty    = rq_obj.difficulty;
-
 
329
                     }
-
 
330
                     if (ea_req.Priority != rq_obj.priority)
-
 
331
                     {
-
 
332
                        changeLog.Notes += ea_req.ElementGUID + ":Priority:" + ea_req.Priority + ":" + rq_obj.priority + "\r\n";
-
 
333
                        changeLog.Update();
-
 
334
                        statusMayHaveChanged = true;
-
 
335
                        ea_req.Priority      = rq_obj.priority;
-
 
336
                     }
-
 
337
                     if (ea_req.Version != rq_obj.version)
-
 
338
                     {
-
 
339
                        changeLog.Notes += ea_req.ElementGUID + ":Version:" + ea_req.Version + ":" + rq_obj.version + "\r\n";
-
 
340
                        changeLog.Update();
-
 
341
                        statusMayHaveChanged = true;
-
 
342
                        ea_req.Version       = rq_obj.version;
-
 
343
                     }
-
 
344
                     if (ea_req.Status != rq_obj.status)
-
 
345
                     {
-
 
346
                        changeLog.Notes += ea_req.ElementGUID + ":Status:" + ea_req.Status + ":" + rq_obj.status + "\r\n";
-
 
347
                        changeLog.Update();
-
 
348
                        statusMayHaveChanged = true;
-
 
349
                        ea_req.Status        = rq_obj.status;
-
 
350
                     }
-
 
351
 
399
 
352
                     ea_req.Update();
400
                        ea_req.Priority   = updated_property_value_if_changed(changeLog, ea_req, ea_req.Priority, "Priority", rq_obj.priority, ref statusMayHaveChanged);
353
 
401
 
-
 
402
                        ea_req.Status     = updated_property_value_if_changed(changeLog, ea_req, ea_req.Status, "Status", rq_obj.status, ref statusMayHaveChanged);
-
 
403
 
-
 
404
                        if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_SOURCE, "Source", rq_obj.source, ref statusMayHaveChanged);
-
 
405
 
-
 
406
                        if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_SOURCE_VERSION, "SourceVersion", rq_obj.sourceVersion, ref statusMayHaveChanged);
-
 
407
 
-
 
408
                        if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_SOURCE_SECTION, "SourceSection", rq_obj.sourceSection, ref statusMayHaveChanged);
-
 
409
 
-
 
410
                        if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_SUBSYSTEM, "Subsystem", rq_obj.subsystem, ref statusMayHaveChanged);
-
 
411
 
-
 
412
                        if_tagged_value_changed_update_it(changeLog, ea_req, Constants.TAG_STABILITY, "Stability", rq_obj.stability, ref statusMayHaveChanged);
-
 
413
 
-
 
414
                        // Requirement Types are actually implemented using ordinary EA element stereotypes.
-
 
415
                        // Use StereotypeEx field to see if the type already exists, since that field can be a comma
-
 
416
                        // seperated list of more than one stereotype, just in case user has added additional stereotypes
-
 
417
                        // to the item.
-
 
418
                        if (0 > ea_req.StereotypeEx.IndexOf(rq_obj.type))
-
 
419
                        {
-
 
420
                           changeLog.Notes += ea_req.ElementGUID + ":ReqType:" + ea_req.Stereotype + ":" + rq_obj.type + "\r\n";
-
 
421
                           changeLog.Update();
-
 
422
                           statusMayHaveChanged = true;
-
 
423
                           if (ea_req.StereotypeEx.Length > 0)
-
 
424
                              ea_req.StereotypeEx = rq_obj.type + "," + ea_req.StereotypeEx;
-
 
425
                           else
-
 
426
                              ea_req.StereotypeEx = rq_obj.type;
-
 
427
                        }
-
 
428
                        if (ea_req.Stereotype.Length == 0)
-
 
429
                        {
-
 
430
                           ea_req.Stereotype = ea_req.StereotypeEx.Split(",".ToCharArray())[0];
-
 
431
                        }
-
 
432
 
-
 
433
                        ea_req.Update();
-
 
434
 
354
                     if (meaningMayHaveChanged)
435
                        if (meaningMayHaveChanged)
355
                     {
436
                        {
356
                        modifiedRequirementCount++;
437
                           modifiedRequirementCount++;
357
                     }
438
                        }
358
                     
439
                     
359
                     if (statusMayHaveChanged)
440
                        if (statusMayHaveChanged)
360
                     {
441
                        {
361
                        statusUpdatedRequirementCount++;
442
                           statusUpdatedRequirementCount++;
362
                     }
443
                        }
363
 
444
 
364
                     totalRequirements++;
445
                        totalRequirements++;
-
 
446
                     }
365
 
447
 
366
                  }
448
                  }
367
                  else
449
                  else
368
                  {
450
                  {
369
                     totalRequirements++;
451
                     totalRequirements++;
Line 372... Line 454...
372
                     // a new one.
454
                     // a new one.
373
                     newRequirementCount++;
455
                     newRequirementCount++;
374
 
456
 
375
                     // create the new EA requirement in the import package
457
                     // create the new EA requirement in the import package
376
                     EA.Element ea_req = (EA.Element)importPackage.Elements.AddNew( rq_obj.tag + " " + rq_obj.name, "Requirement");
458
                     EA.Element ea_req = (EA.Element)importPackage.Elements.AddNew( rq_obj.tag + " " + rq_obj.name, "Requirement");
377
                     ea_req.Notes = rq_obj.text;
-
 
378
 
459
 
379
                     rq_obj.ea_element_ID = ea_req.ElementID;
460
                     rq_obj.ea_element_ID = ea_req.ElementID;
380
 
461
 
381
                     ea_req.Difficulty = rq_obj.difficulty;
-
 
382
                     ea_req.Priority   = rq_obj.priority;
462
                     CopyReqProDatabase.copyReq(ea_req, rq_obj);
383
                     ea_req.Version    = rq_obj.version;
-
 
384
                     ea_req.Status     = rq_obj.status;
-
 
385
 
463
 
386
                     EA_Utilities.WriteTag(ea_req, "GUID", rq_obj.guid);
-
 
387
                     EA_Utilities.WriteTag(ea_req, "TAG", rq_obj.tag);
-
 
388
                     ea_req.Update();
464
                     ea_req.Notes = rq_obj.text;
389
 
465
 
390
                     // Connect the new requirement to the ea_rq_artifact
466
                     ea_req.Update();
391
                     //base.RQ_Artifact.add_connection(ea_repository, base.RQ_Element, ea_req);
-
 
392
 
467
 
393
                     changeLog.Notes += ea_req.ElementGUID + ":Created:" + ea_req.Name + "\r\n";
468
                     changeLog.Notes += ea_req.ElementGUID + ":Created:" + ea_req.Name + "\r\n";
394
                     changeLog.Update();
469
                     changeLog.Update();
395
 
470
 
396
                     Main.EA_Repository.WriteOutput(Main.GUI_OUTPUT_TAB_NAME, "Created: " + ea_req.Name, ea_req.ElementID);
471
                     Main.WriteOutput("Created: " + ea_req.Name, ea_req.ElementID);
397
                  }
472
                  }
398
                  
473
                  
399
               }
474
               }
400
               catch (Exception ex)
475
               catch (Exception ex)
401
               {
476
               {
402
                  Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Exception (ImportFromReqPro), " + ex.Message + ", " + rq_obj.name, -1);
477
                  Main.WriteOutput("Exception (ImportFromReqPro), " + ex.Message + ", " + rq_obj.name, -1);
403
               }
478
               }
404
            }
479
            }
405
 
480
 
406
            if (Main.mustAbort)
481
            if (Main.mustAbort)
407
               return;
482
               return;
408
 
483
 
409
            Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Checking for orphaned requirements", -1);
484
            Main.WriteOutput("Checking for orphaned requirements", -1);
410
            // Now check for orphaned EA requirements
485
            // Now check for orphaned EA requirements
411
            for (int i = 0; i < ea_GUIDs.Count; i++)
486
            for (int i = 0; i < ea_GUIDs.Count; i++)
412
            {
487
            {
413
               if (Main.mustAbort)
488
               if (Main.mustAbort)
414
                  break;
489
                  break;
Line 426... Line 501...
426
                     changeLog.Update();
501
                     changeLog.Update();
427
                  }
502
                  }
428
               }
503
               }
429
            }
504
            }
430
 
505
 
-
 
506
            bool changeLogDeleted = false;
-
 
507
            if (changeLog.Notes != null && changeLog.Notes.Length > 0)
-
 
508
            {
431
            DialogResult dlgres = MessageBoxEx.Show("Display Change Log?", "Change Log", MessageBoxButtons.YesNo);
509
               DialogResult dlgres = MessageBoxEx.Show("Display Change Log?", "Change Log", MessageBoxButtons.YesNo);
432
            if (dlgres == DialogResult.Yes)
510
               if (dlgres == DialogResult.Yes)
433
               displayChangeLog(changeLog);
511
                  displayChangeLog(changeLog);
-
 
512
            }
-
 
513
            else
-
 
514
            {
-
 
515
               importPackage.Elements.Refresh();
-
 
516
               if (importPackage.Elements.Count == 1)
-
 
517
               {
-
 
518
                  EA_Utilities.deletePackage(importPackage);
-
 
519
                  changeLogDeleted = true;
-
 
520
               }
-
 
521
            }
434
 
522
 
435
            Main.EA_Repository.RefreshModelView(parentPackage.PackageID);
523
            Main.EA_Repository.RefreshModelView(parentPackage.PackageID);
436
 
524
 
437
            // Setup the internal requirement to requirement connectivity. This is seperate from the browser
525
            // Setup the internal requirement to requirement connectivity. This is seperate from the browser
438
            // organisation of elements in EA, but since in ReqPro, that organisation tells part of the story
526
            // organisation of elements in EA, but since in ReqPro, that organisation tells part of the story
Line 445... Line 533...
445
            write_traces(totalRequirements);
533
            write_traces(totalRequirements);
446
 
534
 
447
            if (Main.mustAbort)
535
            if (Main.mustAbort)
448
               return;
536
               return;
449
 
537
 
-
 
538
            writeDelayedMessages();
-
 
539
            
450
            // display summary stats
540
            // display summary stats
451
            Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, newRequirementCount.ToString() + " new requirements", -1);
541
            Main.WriteOutput(newRequirementCount.ToString() + " new requirements", -1);
452
            Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, modifiedRequirementCount.ToString() + " requirements modified", -1);
542
            Main.WriteOutput(modifiedRequirementCount.ToString() + " requirements modified", -1);
453
            Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, statusUpdatedRequirementCount.ToString() + " requirements had status changes", -1);
543
            Main.WriteOutput(statusUpdatedRequirementCount.ToString() + " requirements had status changes", -1);
454
            Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, orphanedCount.ToString() + " requirements were orphaned", -1);
544
            Main.WriteOutput(orphanedCount.ToString() + " requirements were orphaned", -1);
455
 
545
 
456
            writeDelayedMessages();
546
            if (changeLogDeleted)
-
 
547
            {
-
 
548
               Main.WriteOutput("NOTE: import package and change log deleted, since nothing changed in this import", -1);
-
 
549
            }
457
 
550
 
458
            Main.EA_Repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Import Completed", -1);
551
            Main.WriteOutput("Import Completed", -1);
459
            MessageBoxEx.Show("Import Completed", MessageBoxButtons.OK);
552
            MessageBoxEx.Show("Import Completed");
460
         }
553
         }
461
         catch (Exception ex)
554
         catch (Exception ex)
462
         {
555
         {
463
            Main.MessageBoxException(ex, "Exception (ImportFromReqPro)");
556
            Main.MessageBoxException(ex, "Exception (ImportFromReqPro)");
464
         }
557
         }
465
      }
558
      }
466
 
559
 
-
 
560
      private string updated_property_value_if_changed(EA.Element changeLog, 
-
 
561
         EA.Element ea_req, 
-
 
562
         string dest_value, 
-
 
563
         string changeLogName, 
-
 
564
         string source_value,
-
 
565
         ref bool mayHaveChanged)
-
 
566
      {
-
 
567
         if (dest_value.CompareTo(source_value) != 0 )
-
 
568
         {
-
 
569
            changeLog.Notes += ea_req.ElementGUID + ":" + changeLogName+ ":" + NO_COLONS(dest_value) + ":" + NO_COLONS(source_value) + "\r\n";
-
 
570
            changeLog.Update();
-
 
571
            mayHaveChanged = true;
-
 
572
            return source_value;
-
 
573
         }
-
 
574
         return dest_value;
-
 
575
      }
-
 
576
 
-
 
577
      private void if_tagged_value_changed_update_it(EA.Element changeLog, 
-
 
578
         EA.Element ea_req, 
-
 
579
         string tagname, 
-
 
580
         string changeLogName, 
-
 
581
         string source_value,
-
 
582
         ref bool statusMayHaveChanged)
-
 
583
      {
-
 
584
         string value = EA_TaggedValues.Read(ea_req, tagname, "");
-
 
585
         if ((source_value != null) && (false == source_value.Equals(value)))
-
 
586
         {
-
 
587
            changeLog.Notes += ea_req.ElementGUID + ":" + changeLogName + ":" + value + ":" + source_value + "\r\n";
-
 
588
            changeLog.Update();
-
 
589
            EA_TaggedValues.Write(ea_req, tagname, source_value);
-
 
590
            statusMayHaveChanged = true;
-
 
591
         }
-
 
592
      }
-
 
593
 
467
 
594
 
468
 
595
 
469
 
596
 
470
      /// <summary>
597
      /// <summary>
471
      /// This method (along with its sibling overload) obtains a flattened view of the 
598
      /// This method (along with its sibling overload) obtains a flattened view of the