View Excerpts
  View Full Text

Access to (almost) any datasource from EA

Scripting EA is a powerful feature. So it is possible to define VBScript, JScript, JavaScript within EA to use the EA capabilities or any other combination of your interest. Scripts are available as Search, Project Browser, Diagram or Workflow Scripts – meaning that they are startable within a short cut in that context.

I just wanted to show a result of a database query from an account-oriented datasource from the administration of Connecting Software – so i implemented a Search Script.

The result is as expected:

image

and here is the source code:

   1:  option explicit
   2:   
   3:  !INC Local Scripts.EAConstants-VBScript
   4:   
   5:  '
   6:  ' Script Name: SearchAccounts
   7:  ' Author: Peter Lieber
   8:  ' Purpose: Demonstration of database access to Connecting Software Administration
   9:  ' Date: 24-04-2013
  10:  '
  11:   
  12:  dim SEARCH_SPECIFICATION 
  13:  SEARCH_SPECIFICATION = "<ReportViewData>" &_
  14:                              "<Fields>" &_
  15:                                  "<Field name=""CLASSGUID""/>" &_
  16:                                  "<Field name=""CLASSTYPE"" />" &_
  17:                                  "<Field name=""ID"" />" &_
  18:                                  "<Field name=""AccountName"" />" &_
  19:                              "</Fields>" &_
  20:                              "<Rows/>" &_
  21:                          "</ReportViewData>"
  22:   
  23:  '
  24:  ' Search Script main function
  25:  ' 
  26:  sub OnSearchAccounts()
  27:   
  28:      ' Create a DOM object to represent the search tree
  29:      dim xmlDOM
  30:      set xmlDOM = CreateObject( "MSXML2.DOMDocument.4.0" )
  31:      xmlDOM.validateOnParse = false
  32:      xmlDOM.async = false
  33:      
  34:      
  35:      ' Load the search template
  36:      if xmlDOM.loadXML( SEARCH_SPECIFICATION ) = true then
  37:      
  38:          dim rowsNode
  39:          set rowsNode = xmlDOM.selectSingleNode( "//ReportViewData//Rows" )
  40:          
  41:          dim myConn
  42:          Set MyConn = CreateObject("ADODB.Connection") 
  43:          dim MdbFilePath
  44:          MdbFilePath = "c:\\temp\\test.mdb"
  45:          MyConn.Open "DRIVER={Media Gateway ODBC Driver};” &_
                  UID=administrator;ACC=ACCOUNT_ADMINISTRATION;” &_
                  IMPL=CORBA;PORT=8087;HOST=localhost;PWD=whatasecret;" 
  46:    
  47:      dim SQL_query
  48:      SQL_query = "select * from Accounts" 
  49:     
  50:      dim RS
  51:      Set RS = MyConn.Execute(SQL_query) 
  52:      WHILE NOT RS.EOF 
  53:      
  54:      AddRow xmlDOM, rowsNode, "", RS("ID"), _
  55:              RS("AccountName")
  56:      RS.MoveNext 
  57:      WEND 
  58:   
  59:          ' Fill the Model Search window with the results
  60:          Repository.RunModelSearch "", "", "", xmlDOM.xml
  61:          
  62:      else
  63:          Session.Prompt "Failed to load search xml", promptOK
  64:      end if
  65:  end sub    
  66:   
  67:  '
  71:  ' Adds an entry to the xml row node 'rowsNode'
  72:  '
  73:  sub AddRow( xmlDOM, rowsNode, elementGUID, elementName, comments )
  74:   
  75:      ' Create a Row node
  76:      dim row
  77:      set row = xmlDOM.createElement( "Row" )
  78:      
  79:      ' Add the Model Search row data to the DOM
  80:      AddField xmlDOM, row, "CLASSGUID", elementGUID
  81:      AddField xmlDOM, row, "CLASSTYPE", "Class"
  82:      AddField xmlDOM, row, "Name", elementName
  83:      AddField xmlDOM, row, "Comments", comments
  84:      
  85:      ' Append the newly created row node to the rows node
  86:      rowsNode.appendChild( row )
  87:   
  88:  end sub
  89:   
  90:  '
  91:  ' Adds an Element to the DOM called Field which makes up the Row data for the Model Search window.
  92:  ' <Field name "" value ""/>
  93:  '
  94:  sub AddField( xmlDOM, row, name, value )
  95:   
  96:      dim fieldNode
  97:      set fieldNode = xmlDOM.createElement( "Field" )
  98:      
  99:      ' Create first attribute for the name
 100:      dim nameAttribute
 101:      set nameAttribute = xmlDOM.createAttribute( "name" )
 102:      nameAttribute.value = name
 103:      fieldNode.attributes.setNamedItem( nameAttribute )
 104:      
 105:      ' Create second attribute for the value
 106:      dim valueAttribute 
 107:      set valueAttribute = xmlDOM.createAttribute( "value" )
 108:      valueAttribute.value = value
 109:      fieldNode.attributes.setNamedItem( valueAttribute )
 110:      
 111:      ' Append the fieldNode
 112:      row.appendChild( fieldNode )
 113:   
 114:  end sub
 115:   
 116:  OnSearchAccounts()

Device Day auf Futurezone

Auf Futurezone.at gibt heute Redakteur David Kotrba einen umfassenden Einblick von seinem Besuch beim LieberLieber Device Day bei Microsoft Österreich, der am 8. April stattfand. Der Text beginnt ja schon sehr vielversprechend: “In den ultramodernen Räumlichkeiten des LieberLieber-Partners Microsoft Österreich wurden deshalb verschiedene Geräte präsentiert, die mit technischen Innovationen aufwarten”….Smiley

Lesen Sie den Bericht vom LieberLieber Device Day unter: http://futurezone.at/future/15235-einblicke-in-die-multitouch-zukunft.php

How to connect from C# to Java Based AForms2Web Services

One of our customers from a major carinthian city is using AForms2Web and a public available webservice http://www.amtsweg.gv.at/amtsweg_apf/services/transfer?wsdl. This Webservice are written in Java and it is sometimes a little bit difficult to access a Java Webservice from C#. First of all you have to use WSDL.EXE to get a corresponding C# class/file. But now the question was – how to add the required security header – and here we go:

[SNIP]
const string ns = 
   "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";

XmlElement xmlUserToken = 
   XDoc.CreateElement("sec", "UsernameToken", ns);

XmlElement username = 
   XDoc.CreateElement("sec", "Username", ns);
username.InnerText = 
   soapUser;
xmlUserToken.AppendChild(username);

XmlElement password = 
   XDoc.CreateElement("sec", "Password", ns);
password.InnerText = 
   soapPwd;
xmlUserToken.AppendChild(password);

request.Headers.RemoveAt(0);
request.Headers.Insert(0, MessageHeader.CreateHeader("Security", ns, xmlUserToken));
 
[SNIP END]

EnArValidationRules: Validate and Auto-Correct your Enterprise Architect Models

LieberLieber is proud to announce a new and free Enterprise Architect plug-in called EnArValidationRules essential for all EA users who want to validate their models with individual and customizable validation rules. In addition, it provides the possibility to auto-correct occurred errors and warnings due to the predefined validation rules.

Key features:

  • Validate your models and diagrams
  • Enable/Disable each validation rule
  • Activate auto-correction for each rule
  • Backup your models automatically

As depicted in the screenshot, we have defined different rules for demonstration purposes. For example, the total account of elements for each package or diagram is limited to a certain number. Furthermore, it is only allowed to use instances of classes within a sequence diagram. And each element has to realize at least one requirement or test case. Of course, these rules can be adopted and extended.

You can download this free plug-in here.

If you are interested in more rules for your modeling projects, do not hesitate to contact sales(at)lieberlieber(dot)com.

aaa

Virtual Conference: Two new webinars

We contributed two webinars to the free ICC Virtual Conference that has its focus on software and tools for embedded systems development. Horst Kargl of Sparx Systems talks about how to introduce modeling into a company. When you think about using models in a broader way in your company you have to consider a few points which will increase the acceptance of this change. First, make it as easy as it could be. Second, don’t start to big and test it before. This webinar gives you insights how to introduce and customize the modeling tool Enterprise Architect.

The second webinar was recorded by Oliver Alt from LieberLieber. He talks about “Enterprise Architect, AUTOSAR and ISO26262” and gives an overview about the possibilities of using Sparx Systems Enterprise Architect in development of automotive systems and software. Furthermore the webinar shows the available extensions and solutions form LieberLieber.

Take a few minutes and have a look: http://www.iccmedia-vcon.com/conference/software-development-rtos

EnAr Power Tools – How to efficiently manage your connectors in Enterprise Architect

The first release of LieberLieber’s EnAr Power Tools provides the possibility to efficiently handle the style of your connectors inside your Enterprise Architect models.

Just right-click a diagram and select [Extensions –> EnAr Power Tools –> EnAr Connection Style Wizard] as depicted in the following screenshot.

image

You can apply different layout styles for all diagram links at the same time – a feature which will save a lot of time when creating models. In addition, you can also select a color to apply on your connectors.

If you only want to apply a style type for a specific diagram link, you can easily select a connector type e.g, association in a class diagram, in a drop-down box.

image

If you like EnAr Power Tools and want to purchase it, please visit our homepage: http://www.lieberlieber.com/model-engineering/enar-power-tools/