Subversion Repositories DevTools

Rev

Rev 2106 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

using System;

namespace EA_DocGen
{
   /// <summary>
        /// Class containing EA model find/search functions. 
        /// </summary>
        public class EA_Finders
        {
      private EA.Repository EA_Repository = null;

                public EA_Finders()
                {
                }

      public void accept_EA_RepositoryRef(EA.Repository EA_RepositoryRef)
      {
         EA_Repository = EA_RepositoryRef;
      }


      // These find functions used to be recursive searches because for some reason I originally 
      // found that the repository GetXXXByGUID() functions did not work. However, I now put this
      // down to me passing in the wrong form of GUID string, so now I have reverted back to using
      // the automation interface functions directly and they seem to work and they work a hell of
      // a lot faster than my own search functions. I will leave the wrappers here for now just in
      // case.

      public EA.Package findPackageInRepositoryByGUID(string theGUID)
      {
         return EA_Repository.GetPackageByGuid(theGUID);
      }

      public EA.Diagram findDiagramInRepositoryByGUID(string theGUID)
      {
         return (EA.Diagram)EA_Repository.GetDiagramByGuid(theGUID);
      }
  
      public EA.Element findElementInRepositoryByGUID(string theGUID)
      {
         return EA_Repository.GetElementByGuid(theGUID);
      }
      


      public bool elementNameExistsInPackage(EA.Package parentPackage, string name)
      {
         foreach (EA.Element element in parentPackage.Elements)
         {
            if (element.Name.ToString() == name)
            {
               return true;
            }
         }
         return false;
      }


        }
}