C# Class EAAddinFramework.Utils.Model

Mostra file Open project: Helmut-Ortmann/EnterpriseArchitect_hoTools Class Usage Examples

Public Methods

Method Description
ClipboardClear ( ) : void

Expose Clipboard.Clear()

ClipboardGetText ( ) : string

Expose Clipboard.SetText()

ClipboardGetText ( int textDataType ) : string

Exposes ClipboardGetText(TestDataFormat); 0=TextDataFormat.CommaSeparatedValue; 1=TextDataFormat.Html; 2=TextDataFormat.Rtf; 3=TextDataFormat.Text; 4=TextDataFormat.UnicodeText;

ClipboardSetText ( object text ) : void

Expose Clipboard.SetText()

ClipboardSetText ( object text, object textDataType ) : void

Exposes ClipboardSetText(text, TestDataFormat); 0=TextDataFormat.CommaSeparatedValue; 1=TextDataFormat.Html; 2=TextDataFormat.Rtf; 3=TextDataFormat.Text; 4=TextDataFormat.UnicodeText;

EscapeSqlString ( string sqlString ) : string

escapes a literal string so it can be inserted using sql

ExecuteSql ( string sqlString ) : bool

Execute SQL and catch Exception

FormatXPath ( string xpath ) : string

formats an xpath according to the type of database. For Oracle and Firebird it should be ALL CAPS

GetRepositoryType ( ) : RepositoryType

Gets the rep type for this model

Initialize ( EA rep ) : void

Initialize an rep Model object Intended to use from a scripting environment

MakeEaItemListFromQuery ( System.Xml.Linq.XDocument x ) : List

Make EA XML output format from EA SQLQuery XDocument format (LINQ to XML)

MakeEaXmlOutput ( System.Xml.Linq.XDocument x ) : string

Make EA XML output format from EA SQLQuery XDocument format (LINQ to XML). If nothing found or an error has occurred nothing is displayed.

MakeEaXmlOutput ( string x ) : string

Make EA XML output format from EA SQLQuery format (string)

Model ( ) : System

Create a model on the first running EA instance

Model ( EA repository ) : System

Create a Model

SearchRun ( string searchName, string searchTerm ) : void

Runs the search (EA search or hoTools SQL file if it's a *.sql file). It handles the exceptions. It converts wild cards of the <Search Term>.

SqlExecuteNative ( string sqlExecute ) : bool

EA Execute SQL: - formatSQL - runSQL - return SQL string

SqlExecuteWithException ( string sql ) : bool

Run EA SQL Query with Exception handling return null if error, it also displays the error message in MessageBox return "" if nothing found return xml string if ok

SqlQuery ( string sqlQuery ) : XmlDocument

EA SQL Query with: - formatSQL - runSQL - return SQL string as XmlDocument

SqlQueryNative ( string sqlQuery ) : string

EA SQL Query native with: - formatSQL - runSQL - return SQL string

SqlQueryWithException ( string query ) : string

Run EA SQL Query with Exception handling. It deletes the error file and reads it back to detect errors. return null if error, it also displays the error message in MessageBox return "" if nothing found return xml string if ok

SqlRun ( string sql, string searchText ) : void

Run an SQL string and if query output the result in EA Search Window. If update, insert, delete execute SQL. - replacement of macros - run query - format to output

Private Methods

Method Description
EmptyQueryResult ( ) : string

Empty Query Result

FormatSql ( string sqlQuery ) : string

sets the correct wild cards depending on the database type. changes '%' into '*' if on ms access and _ into ? on msAccess

FormatSqlFunctions ( string sqlQuery ) : string

Operation to translate SQL functions in there equivalents in different sql syntaxes supported functions: - lcase -> lower in T-SQL (SqlSvr and Asa)

FormatSqlTop ( string sqlQuery ) : string

limiting the number of results in an sql query is different on different platforms.

This operation will replace the SELECT TOP N by the appropriate sql syntax depending on the repository type

FormatSqldBspecific ( string sql ) : string

Format DB specific by removing unnecessary DB specific string parts.

ReplaceSqlWildCards ( string sqlQuery ) : string

Replace the wild cards in the given sql query string to match either MSAccess or ANSI syntax. It works for: % or * or #WC# Any character _ or ? a single character '^' or '!' a shortcut for XOR

Method Details

ClipboardClear() public method

Expose Clipboard.Clear()
public ClipboardClear ( ) : void
return void

ClipboardGetText() public method

Expose Clipboard.SetText()
public ClipboardGetText ( ) : string
return string

ClipboardGetText() public method

Exposes ClipboardGetText(TestDataFormat); 0=TextDataFormat.CommaSeparatedValue; 1=TextDataFormat.Html; 2=TextDataFormat.Rtf; 3=TextDataFormat.Text; 4=TextDataFormat.UnicodeText;
public ClipboardGetText ( int textDataType ) : string
textDataType int
return string

ClipboardSetText() public method

Expose Clipboard.SetText()
public ClipboardSetText ( object text ) : void
text object
return void

ClipboardSetText() public method

Exposes ClipboardSetText(text, TestDataFormat); 0=TextDataFormat.CommaSeparatedValue; 1=TextDataFormat.Html; 2=TextDataFormat.Rtf; 3=TextDataFormat.Text; 4=TextDataFormat.UnicodeText;
public ClipboardSetText ( object text, object textDataType ) : void
text object
textDataType object
return void

EscapeSqlString() public method

escapes a literal string so it can be inserted using sql
public EscapeSqlString ( string sqlString ) : string
sqlString string the string to be escaped
return string

ExecuteSql() public method

Execute SQL and catch Exception
public ExecuteSql ( string sqlString ) : bool
sqlString string
return bool

FormatXPath() public method

formats an xpath according to the type of database. For Oracle and Firebird it should be ALL CAPS
public FormatXPath ( string xpath ) : string
xpath string the xpath to format
return string

GetRepositoryType() public method

Gets the rep type for this model
public GetRepositoryType ( ) : RepositoryType
return RepositoryType

Initialize() public method

Initialize an rep Model object Intended to use from a scripting environment
public Initialize ( EA rep ) : void
rep EA
return void

MakeEaItemListFromQuery() public method

Make EA XML output format from EA SQLQuery XDocument format (LINQ to XML)
public MakeEaItemListFromQuery ( System.Xml.Linq.XDocument x ) : List
x System.Xml.Linq.XDocument Output from EA SQLQuery
return List

MakeEaXmlOutput() public method

Make EA XML output format from EA SQLQuery XDocument format (LINQ to XML). If nothing found or an error has occurred nothing is displayed.
public MakeEaXmlOutput ( System.Xml.Linq.XDocument x ) : string
x System.Xml.Linq.XDocument Output from EA SQLQuery
return string

MakeEaXmlOutput() public method

Make EA XML output format from EA SQLQuery format (string)
public MakeEaXmlOutput ( string x ) : string
x string
return string

Model() public method

Create a model on the first running EA instance
public Model ( ) : System
return System

Model() public method

Create a Model
public Model ( EA repository ) : System
repository EA
return System

SearchRun() public method

Runs the search (EA search or hoTools SQL file if it's a *.sql file). It handles the exceptions. It converts wild cards of the <Search Term>.
public SearchRun ( string searchName, string searchTerm ) : void
searchName string EA Search name or SQL file name (uses path to find absolute path)
searchTerm string
return void

SqlExecuteNative() public method

EA Execute SQL: - formatSQL - runSQL - return SQL string
public SqlExecuteNative ( string sqlExecute ) : bool
sqlExecute string
return bool

SqlExecuteWithException() public method

Run EA SQL Query with Exception handling return null if error, it also displays the error message in MessageBox return "" if nothing found return xml string if ok
public SqlExecuteWithException ( string sql ) : bool
sql string
return bool

SqlQuery() public method

EA SQL Query with: - formatSQL - runSQL - return SQL string as XmlDocument
public SqlQuery ( string sqlQuery ) : XmlDocument
sqlQuery string
return System.Xml.XmlDocument

SqlQueryNative() public method

EA SQL Query native with: - formatSQL - runSQL - return SQL string
public SqlQueryNative ( string sqlQuery ) : string
sqlQuery string
return string

SqlQueryWithException() public method

Run EA SQL Query with Exception handling. It deletes the error file and reads it back to detect errors. return null if error, it also displays the error message in MessageBox return "" if nothing found return xml string if ok
public SqlQueryWithException ( string query ) : string
query string
return string

SqlRun() public method

Run an SQL string and if query output the result in EA Search Window. If update, insert, delete execute SQL. - replacement of macros - run query - format to output
public SqlRun ( string sql, string searchText ) : void
sql string
searchText string Search Text to replace 'Search Term' macro
return void