| Line 69... |
Line 69... |
| 69 |
ea_repository.EnsureOutputVisible(Main.GUI_OUTPUT_TAB_NAME);
|
69 |
ea_repository.EnsureOutputVisible(Main.GUI_OUTPUT_TAB_NAME);
|
| 70 |
|
70 |
|
| 71 |
// write the captured info from reqpro, into the ea database, obeying the filter
|
71 |
// write the captured info from reqpro, into the ea database, obeying the filter
|
| 72 |
// settings the user has specified.
|
72 |
// settings the user has specified.
|
| 73 |
write_ea_database(ea_repository);
|
73 |
write_ea_database(ea_repository);
|
| - |
|
74 |
MessageBox.Show("Import Completed");
|
| 74 |
return true;
|
75 |
return true;
|
| 75 |
}
|
76 |
}
|
| 76 |
}
|
77 |
}
|
| 77 |
catch (Exception ex)
|
78 |
catch (Exception ex)
|
| 78 |
{
|
79 |
{
|
| Line 81... |
Line 82... |
| 81 |
return false;
|
82 |
return false;
|
| 82 |
}
|
83 |
}
|
| 83 |
|
84 |
|
| 84 |
|
85 |
|
| 85 |
|
86 |
|
| - |
|
87 |
/// <summary>
|
| - |
|
88 |
/// Finds and returns the ReqPro_object instance that contains the specified GUID. The
|
| - |
|
89 |
/// GUID is that of the originating ReqPro requirement, which is copied into a ReqPro_object
|
| - |
|
90 |
/// instance when it is created. This find operation supports the ability to resolve object to
|
| - |
|
91 |
/// object trace relationships mirrored from the ReqPro database during the construction
|
| - |
|
92 |
/// of the ReqPro_object hierarchy.
|
| - |
|
93 |
/// </summary>
|
| - |
|
94 |
/// <param name="rq_obj"></param>
|
| - |
|
95 |
/// <param name="ReqProGUID"></param>
|
| - |
|
96 |
/// <returns></returns>
|
| - |
|
97 |
private ReqPro_object findReqPro_object_byReqProGUID(ReqPro_object rq_obj, string ReqProGUID)
|
| - |
|
98 |
{
|
| - |
|
99 |
if (rq_obj.guid.CompareTo(ReqProGUID) == 0)
|
| - |
|
100 |
{
|
| - |
|
101 |
return rq_obj;
|
| - |
|
102 |
}
|
| - |
|
103 |
|
| - |
|
104 |
foreach (ReqPro_object sub_rq_obj in rq_obj.ReqPro_objects)
|
| - |
|
105 |
{
|
| - |
|
106 |
ReqPro_object tgt_obj = findReqPro_object_byReqProGUID(sub_rq_obj, ReqProGUID);
|
| - |
|
107 |
if (tgt_obj != null)
|
| - |
|
108 |
return tgt_obj;
|
| - |
|
109 |
}
|
| 86 |
|
110 |
|
| - |
|
111 |
return null;
|
| - |
|
112 |
}
|
| - |
|
113 |
|
| - |
|
114 |
|
| - |
|
115 |
/// <summary>
|
| - |
|
116 |
/// This method examines all of the ReqPro_object trace relationships and mirrors them in
|
| - |
|
117 |
/// the EA requirement elements that have been formed from each un-filtered ReqPro_objects.
|
| - |
|
118 |
/// </summary>
|
| - |
|
119 |
/// <param name="ea_repository"></param>
|
| - |
|
120 |
/// <param name="rq_obj"></param>
|
| - |
|
121 |
private void write_traces(EA.Repository ea_repository, ReqPro_object rq_obj)
|
| - |
|
122 |
{
|
| - |
|
123 |
if (rq_obj.isRequirement)
|
| - |
|
124 |
{
|
| - |
|
125 |
// if this object had an EA element made for it during the write_ea_database() process...
|
| - |
|
126 |
if (rq_obj.ea_element_ID != -1)
|
| - |
|
127 |
{
|
| - |
|
128 |
EA.Element ea_rq_obj = ea_repository.GetElementByID(rq_obj.ea_element_ID);
|
| - |
|
129 |
if (ea_rq_obj != null)
|
| - |
|
130 |
{
|
| - |
|
131 |
foreach(string s in rq_obj.ReqPro_traces)
|
| - |
|
132 |
{
|
| - |
|
133 |
ReqPro_object tgt_obj = findReqPro_object_byReqProGUID(rq_root_package,s);
|
| - |
|
134 |
if (tgt_obj != null)
|
| - |
|
135 |
{
|
| - |
|
136 |
if (tgt_obj.ea_element_ID != -1)
|
| - |
|
137 |
{
|
| - |
|
138 |
EA.Element ea_tgt_obj = ea_repository.GetElementByID(tgt_obj.ea_element_ID);
|
| - |
|
139 |
if (ea_tgt_obj != null)
|
| - |
|
140 |
{
|
| - |
|
141 |
add_connection(ea_repository, ea_rq_obj, ea_tgt_obj);
|
| - |
|
142 |
}
|
| - |
|
143 |
}
|
| - |
|
144 |
}
|
| - |
|
145 |
}
|
| - |
|
146 |
}
|
| - |
|
147 |
}
|
| - |
|
148 |
}
|
| - |
|
149 |
|
| - |
|
150 |
// recurse to ensure we examine the entire hiearchy
|
| - |
|
151 |
foreach(ReqPro_object sub_obj in rq_obj.ReqPro_objects)
|
| - |
|
152 |
{
|
| - |
|
153 |
write_traces(ea_repository, sub_obj);
|
| - |
|
154 |
}
|
| - |
|
155 |
}
|
| 87 |
|
156 |
|
| - |
|
157 |
/// <summary>
|
| - |
|
158 |
/// Adds a connection between one EA element and another
|
| - |
|
159 |
/// </summary>
|
| - |
|
160 |
/// <param name="repository"></param>
|
| - |
|
161 |
/// <param name="rq_artifact"></param>
|
| - |
|
162 |
/// <param name="ea_req"></param>
|
| - |
|
163 |
private void add_connection(EA.Repository ea_repository, EA.Element src_element, EA.Element dest_element)
|
| - |
|
164 |
{
|
| - |
|
165 |
// Add the new requirement to the src_element
|
| - |
|
166 |
EA.Connector c = (EA.Connector)src_element.Connectors.AddNew("", "Relationship");
|
| - |
|
167 |
c.SupplierID = dest_element.ElementID;
|
| - |
|
168 |
//c.Stereotype = "trace";
|
| - |
|
169 |
c.Direction = "Source -> Destination";
|
| - |
|
170 |
if (false == c.Update())
|
| - |
|
171 |
{
|
| - |
|
172 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "New Connector Error : " + c.GetLastError(), dest_element.ElementID );
|
| - |
|
173 |
}
|
| - |
|
174 |
src_element.Connectors.Refresh();
|
| - |
|
175 |
}
|
| 88 |
|
176 |
|
| 89 |
/// <summary>
|
177 |
/// <summary>
|
| 90 |
/// This method (along with its sibling overloads) perform the copy operation once
|
178 |
/// This method (along with its sibling overloads) perform the copy operation once
|
| 91 |
/// the ReqPro database content has been acquired, and the user has submitted their
|
179 |
/// the ReqPro database content has been acquired, and the user has submitted their
|
| 92 |
/// filtering requirements. This method begins the copy operation, but the real nitty
|
180 |
/// filtering requirements. This method begins the copy operation, but the real nitty
|
| Line 103... |
Line 191... |
| 103 |
}
|
191 |
}
|
| 104 |
|
192 |
|
| 105 |
ea_rootPackage.Packages.Refresh();
|
193 |
ea_rootPackage.Packages.Refresh();
|
| 106 |
// refresh project browser view
|
194 |
// refresh project browser view
|
| 107 |
ea_repository.RefreshModelView(ea_rootPackage.PackageID);
|
195 |
ea_repository.RefreshModelView(ea_rootPackage.PackageID);
|
| - |
|
196 |
|
| - |
|
197 |
// Setup the internal requirement to requirement connectivity. This is seperate from the browser
|
| - |
|
198 |
// organisation of elements in EA, but since in ReqPro, that organisation tells part of the story
|
| - |
|
199 |
// of requirement to requirement connectivity, it is mirrored in the internal connectivity, along
|
| - |
|
200 |
// with explicit trace relationships setup in ReqPro.
|
| - |
|
201 |
// The purpose of this internal connectivity is to support relationship matrix tables in documentation
|
| - |
|
202 |
// generated by EA_DocGen, or to support diagrammatic representations of the requirements in EA,
|
| - |
|
203 |
// where the connectivity will become apparent through links ajoining the requirement elements in the
|
| - |
|
204 |
// diagram.
|
| - |
|
205 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Writing Trace Information", -1);
|
| - |
|
206 |
foreach( ReqPro_object sub_obj in rq_root_package.ReqPro_objects )
|
| - |
|
207 |
{
|
| - |
|
208 |
write_traces(ea_repository, sub_obj);
|
| - |
|
209 |
}
|
| 108 |
}
|
210 |
}
|
| 109 |
|
211 |
|
| 110 |
private void write_ea_database(EA.Repository ea_repository,
|
212 |
private void write_ea_database(EA.Repository ea_repository,
|
| 111 |
EA.Package ea_parent_package,
|
213 |
EA.Package ea_parent_package,
|
| 112 |
EA.Element ea_parent_element,
|
214 |
EA.Element ea_parent_element,
|
| Line 118... |
Line 220... |
| 118 |
{
|
220 |
{
|
| 119 |
if (ea_parent_package != null)
|
221 |
if (ea_parent_package != null)
|
| 120 |
{
|
222 |
{
|
| 121 |
// create a representative package in EA
|
223 |
// create a representative package in EA
|
| 122 |
EA.Package new_ea_package = EA_Utils.createPackage(ea_parent_package, rq_obj.name, rq_obj.treePos);
|
224 |
EA.Package new_ea_package = EA_Utils.createPackage(ea_parent_package, rq_obj.name, rq_obj.treePos);
|
| - |
|
225 |
rq_obj.ea_element_ID = new_ea_package.PackageID;
|
| 123 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Created Package : " + rq_obj.name, new_ea_package.PackageID );
|
226 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Created Package : " + rq_obj.name, new_ea_package.PackageID );
|
| 124 |
|
227 |
|
| 125 |
// Using recursion, scan this objects sub-objects
|
228 |
// Using recursion, scan this objects sub-objects
|
| 126 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
229 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
| 127 |
{
|
230 |
{
|
| 128 |
write_ea_database(ea_repository, new_ea_package, null, sub_obj);
|
231 |
write_ea_database(ea_repository, new_ea_package, null, sub_obj);
|
| 129 |
}
|
232 |
}
|
| 130 |
}
|
233 |
}
|
| 131 |
else
|
234 |
else
|
| 132 |
{
|
235 |
{
|
| - |
|
236 |
// should never get here - I have never seen it happen so far.
|
| 133 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ERROR,write_ea_database, parent package was null", -1);
|
237 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ERROR,write_ea_database, parent package was null", -1);
|
| 134 |
}
|
238 |
}
|
| 135 |
}
|
239 |
}
|
| 136 |
else if (base.allowPackageStructureFragments)
|
240 |
else if (base.allowPackageStructureFragments)
|
| 137 |
{
|
241 |
{
|
| Line 145... |
Line 249... |
| 145 |
}
|
249 |
}
|
| 146 |
else if (rq_obj.isRequirement)
|
250 |
else if (rq_obj.isRequirement)
|
| 147 |
{
|
251 |
{
|
| 148 |
if ( ! (reqTypeIsFiltered(rq_obj) || reqStatusTypeIsFiltered(rq_obj)))
|
252 |
if ( ! (reqTypeIsFiltered(rq_obj) || reqStatusTypeIsFiltered(rq_obj)))
|
| 149 |
{
|
253 |
{
|
| - |
|
254 |
string rq_obj_name = rq_obj.tag + " " + rq_obj.name;
|
| - |
|
255 |
|
| - |
|
256 |
// If needed, create the requirement element as a child of a parent element
|
| 150 |
if (ea_parent_element != null)
|
257 |
if (ea_parent_element != null)
|
| 151 |
{
|
258 |
{
|
| 152 |
// create a representative element in EA
|
259 |
// create a representative element in EA
|
| 153 |
EA.Element new_ea_element = (EA.Element)ea_parent_element.Elements.AddNew(rq_obj.tag + " " + rq_obj.name, "Requirement");
|
260 |
EA.Element new_ea_element = (EA.Element)ea_parent_element.Elements.AddNew(rq_obj_name, "Requirement");
|
| - |
|
261 |
rq_obj.ea_element_ID = new_ea_element.ElementID;
|
| 154 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Created Element : " + rq_obj.name, new_ea_element.ElementID );
|
262 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Created Element : " + rq_obj_name, new_ea_element.ElementID );
|
| - |
|
263 |
|
| - |
|
264 |
// In ReqPro, a requirement can be related to another requirement in several ways:
|
| - |
|
265 |
// 1. By virtue of its position relative to another in the browser display. That is,
|
| - |
|
266 |
// if you place a requirement beneath a parent requirement, you are establishing a
|
| - |
|
267 |
// parent-child relationship.
|
| - |
|
268 |
// 2. By virtue of a specific TraceTo relationship being made via the Traceability menu
|
| - |
|
269 |
// option.
|
| - |
|
270 |
// Interestingly, ReqPro prevents you creating a relationship of one of the above types,
|
| - |
|
271 |
// if a relationship of the other type already exists. This implies that the relationship
|
| - |
|
272 |
// between a parent and child requirement must be singular and is important regardless
|
| - |
|
273 |
// of the manner in which it was created or represented.
|
| - |
|
274 |
// The CopyReqProDatabaseToMemory base class will already have taken care of recording
|
| - |
|
275 |
// relationships detected from ReqPro made using method 2 above. What we need to do here is
|
| - |
|
276 |
// take care of those apparent from the browser based hierarchical organisation (ie. made
|
| - |
|
277 |
// in ReqPro using method 1).
|
| - |
|
278 |
// All we need to do is grab the parent object (if any) and add the GUID of the child to
|
| - |
|
279 |
// its list of trace-to's. Later on, the write_traces() class method will turn these into
|
| - |
|
280 |
// EA based connection objects that belong to the parent requirement elements.
|
| - |
|
281 |
if (rq_obj.parent != null)
|
| - |
|
282 |
{
|
| - |
|
283 |
rq_obj.parent.ReqPro_traces.Add(rq_obj.guid);
|
| - |
|
284 |
}
|
| 155 |
|
285 |
|
| 156 |
// If the ReqPro requirements detailed text is more than what the name already contains (allowing for it
|
286 |
// If the ReqPro requirements detailed text is more than what the name already contains (allowing for it
|
| 157 |
// to have a stop character that the name may not have) then copy it over, otherwise ignore it. This
|
287 |
// to have a stop character that the name may not have) then copy it over, otherwise ignore it. This
|
| 158 |
// prevents the same text appearing twice in any generated document made using EA_DocGen.
|
288 |
// prevents the same text appearing twice in any generated document made using EA_DocGen.
|
| 159 |
if (!rq_obj.text.StartsWith(rq_obj.name) || (rq_obj.text.Length > (rq_obj.name.Length + 1)))
|
289 |
if (!rq_obj.text.StartsWith(rq_obj.name) || (rq_obj.text.Length > (rq_obj.name.Length + 1)))
|
| Line 161... |
Line 291... |
| 161 |
|
291 |
|
| 162 |
new_ea_element.TreePos = rq_obj.treePos;
|
292 |
new_ea_element.TreePos = rq_obj.treePos;
|
| 163 |
new_ea_element.Status = rq_obj.status;
|
293 |
new_ea_element.Status = rq_obj.status;
|
| 164 |
new_ea_element.Update();
|
294 |
new_ea_element.Update();
|
| 165 |
|
295 |
|
| - |
|
296 |
// Write EA tag information exactly as is done for the import for traceability use. This
|
| - |
|
297 |
// opens up the possibility that a document model import could be converted into a traceability
|
| - |
|
298 |
// use model in some future update to EA_ReqPro addin.
|
| - |
|
299 |
EA_Utils.WriteTag(new_ea_element, "GUID", rq_obj.guid);
|
| - |
|
300 |
EA_Utils.WriteTag(new_ea_element, "TAG", rq_obj.tag);
|
| - |
|
301 |
|
| 166 |
// Using recursion, scan this objects sub-objects
|
302 |
// Using recursion, scan this objects sub-objects
|
| 167 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
303 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
| 168 |
{
|
304 |
{
|
| 169 |
write_ea_database(ea_repository, null, new_ea_element, sub_obj);
|
305 |
write_ea_database(ea_repository, null, new_ea_element, sub_obj);
|
| 170 |
}
|
306 |
}
|
| 171 |
}
|
307 |
}
|
| - |
|
308 |
// else create the requirement element as a child of a parent package
|
| 172 |
else if (ea_parent_package != null)
|
309 |
else if (ea_parent_package != null)
|
| 173 |
{
|
310 |
{
|
| 174 |
// create a representative element in EA
|
311 |
// create a representative element in EA
|
| 175 |
EA.Element new_ea_element = (EA.Element)ea_parent_package.Elements.AddNew(rq_obj.tag + " " + rq_obj.name, "Requirement");
|
312 |
EA.Element new_ea_element = (EA.Element)ea_parent_package.Elements.AddNew(rq_obj_name, "Requirement");
|
| - |
|
313 |
rq_obj.ea_element_ID = new_ea_element.ElementID;
|
| 176 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Created Element : " + rq_obj.name, new_ea_element.ElementID );
|
314 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "Created Element : " + rq_obj_name, new_ea_element.ElementID );
|
| 177 |
|
315 |
|
| 178 |
// If the ReqPro requirements detailed text is more than what the name already contains (allowing for it
|
316 |
// If the ReqPro requirements detailed text is more than what the name already contains (allowing for it
|
| 179 |
// to have a stop character that the name may not have) then copy it over, otherwise ignore it. This
|
317 |
// to have a stop character that the name may not have) then copy it over, otherwise ignore it. This
|
| 180 |
// prevents the same text appearing twice in any generated document made using EA_DocGen.
|
318 |
// prevents the same text appearing twice in any generated document made using EA_DocGen.
|
| 181 |
if (!rq_obj.text.StartsWith(rq_obj.name) || (rq_obj.text.Length > (rq_obj.name.Length + 1)))
|
319 |
if (!rq_obj.text.StartsWith(rq_obj.name) || (rq_obj.text.Length > (rq_obj.name.Length + 1)))
|
| Line 183... |
Line 321... |
| 183 |
|
321 |
|
| 184 |
new_ea_element.TreePos = rq_obj.treePos;
|
322 |
new_ea_element.TreePos = rq_obj.treePos;
|
| 185 |
new_ea_element.Status = rq_obj.status;
|
323 |
new_ea_element.Status = rq_obj.status;
|
| 186 |
new_ea_element.Update();
|
324 |
new_ea_element.Update();
|
| 187 |
|
325 |
|
| - |
|
326 |
// Write EA tag information exactly as is done for the import for traceability use. This
|
| - |
|
327 |
// opens up the possibility that a document model import could be converted into a traceability
|
| - |
|
328 |
// use model in some future update to EA_ReqPro addin.
|
| - |
|
329 |
EA_Utils.WriteTag(new_ea_element, "GUID", rq_obj.guid);
|
| - |
|
330 |
EA_Utils.WriteTag(new_ea_element, "TAG", rq_obj.tag);
|
| - |
|
331 |
|
| 188 |
// Using recursion, scan this objects sub-objects
|
332 |
// Using recursion, scan this objects sub-objects
|
| 189 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
333 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
| 190 |
{
|
334 |
{
|
| 191 |
write_ea_database(ea_repository, null, new_ea_element, sub_obj);
|
335 |
write_ea_database(ea_repository, null, new_ea_element, sub_obj);
|
| 192 |
}
|
336 |
}
|
| 193 |
}
|
337 |
}
|
| 194 |
else
|
338 |
else
|
| 195 |
{
|
339 |
{
|
| - |
|
340 |
// should never get here - I have never seen it happen so far.
|
| 196 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ERROR,write_ea_database, parent package was null", -1);
|
341 |
ea_repository.WriteOutput( Main.GUI_OUTPUT_TAB_NAME, "ERROR,write_ea_database, parent package was null", -1);
|
| 197 |
}
|
342 |
}
|
| 198 |
}
|
343 |
}
|
| 199 |
}
|
344 |
}
|
| 200 |
}
|
345 |
}
|