| 2088 |
ghuddy |
1 |
using System;
|
|
|
2 |
|
|
|
3 |
namespace EA_DocGen
|
|
|
4 |
{
|
|
|
5 |
/// <summary>
|
|
|
6 |
/// Class containing EA model find/search functions.
|
|
|
7 |
/// </summary>
|
|
|
8 |
public class EA_Finders
|
|
|
9 |
{
|
|
|
10 |
private EA.Repository EA_Repository = null;
|
|
|
11 |
|
|
|
12 |
public EA_Finders()
|
|
|
13 |
{
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
public void accept_EA_RepositoryRef(EA.Repository EA_RepositoryRef)
|
|
|
17 |
{
|
|
|
18 |
EA_Repository = EA_RepositoryRef;
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
// These find functions used to be recursive searches because for some reason I originally
|
|
|
23 |
// found that the repository GetXXXByGUID() functions did not work. However, I now put this
|
|
|
24 |
// down to me passing in the wrong form of GUID string, so now I have reverted back to using
|
|
|
25 |
// the automation interface functions directly and they seem to work and they work a hell of
|
|
|
26 |
// a lot faster than my own search functions. I will leave the wrappers here for now just in
|
|
|
27 |
// case.
|
|
|
28 |
|
|
|
29 |
public EA.Package findPackageInRepositoryByGUID(string theGUID)
|
|
|
30 |
{
|
|
|
31 |
return EA_Repository.GetPackageByGuid(theGUID);
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
public EA.Diagram findDiagramInRepositoryByGUID(string theGUID)
|
|
|
35 |
{
|
|
|
36 |
return (EA.Diagram)EA_Repository.GetDiagramByGuid(theGUID);
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
public EA.Element findElementInRepositoryByGUID(string theGUID)
|
|
|
40 |
{
|
|
|
41 |
return EA_Repository.GetElementByGuid(theGUID);
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
public bool elementNameExistsInPackage(EA.Package parentPackage, string name)
|
|
|
47 |
{
|
|
|
48 |
foreach (EA.Element element in parentPackage.Elements)
|
|
|
49 |
{
|
|
|
50 |
if (element.Name.ToString() == name)
|
|
|
51 |
{
|
|
|
52 |
return true;
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
return false;
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
}
|
|
|
60 |
}
|