Extend IBM InfoSphere Data Architect to meet your specific data modeling and integration requirements, Part 1

Modifying IDA models and customizing properties


Content series:

This content is part # of # in the series: Extend IBM InfoSphere Data Architect to meet your specific data modeling and integration requirements, Part 1

Stay tuned for additional content in this series.

This content is part of the series:Extend IBM InfoSphere Data Architect to meet your specific data modeling and integration requirements, Part 1

Stay tuned for additional content in this series.

IBM InfoSphere Data Architect (IDA) is a comprehensive development environment for data modeling and integration. IDA enables users to discover, model, visualize, and relate diverse and distributed data assets. IDA is an integrated data management offering from IBM and is tightly integrated with the Optim®, Rational, and InfoSphere products built using Eclipse. IDA supports logical, physical, glossary, storage, domain, and integration data modeling. As more enterprise customers use IDA, there is an increasing need to extend IDA to meet their unique data modeling and integration requirements.

As mentioned before, IDA is Eclipse-based and therefore highly extensible by design. In this series, learn more about the extension points, APIs, and factories available with IDA that you can use to extend IDA. See how to extend IDA to:

  • Programmatically traverse and modify IDA models (Part 1)
  • Add new properties and display them in the Properties View (Part 1)
  • Generate customized model reports (Part 2)
  • Add model validation rules (Part 2)

This article assumes you have Eclipse plug-in development experience and the basic knowledge on Eclipse EMF and BIRT projects. The sample code provided in this article is tested on IDA 7.5.1 and 7.5.2 and on Eclipse 3.4.1 and 3.4.2.

Programmatically traverse and modify IDA logical data model and physical data model

If you need to extend IDA, chances are that you'll need to understand its model structure to traverse and modify its model objects. This section shows you how to do this using a physical model and its objects. A similar approach can be used for logical models as well.

SQL model as the meta-model of IDA models

The SQL model, which is part of the Eclipse Model Base Project, provides the foundation for Data Tools Platform (DTP). Built on the Eclipse Modeling Framework (EMF), the SQL model uses industry best practices such as model-driven development with UML, complies with the latest SQL standards, and supports JDBC and other connectivity standards. (See Related topics for more information on DTP and EMF). IDA uses and extends the SQL model as the meta-model for its physical data models.

Programmatically traverse a model

Start by creating a physical data model with a SAMPLE database, creating a SAMP schema, and creating some tables and columns. Then, learn how to write Java™ code to traverse the SAMPLE database and list all its schema, table, and column objects.

Follow these steps to create a SAMPLE data model:

  1. Start IDA and open the Data Perspective if it's not already open.
  2. Create a data design project using File > New > Data Design Project, and type in Data Design as the Project name.
  3. Right-click on the Derby Sample Connection in the Data Source Explorer, and select Connect.
  4. Type in any user name, and click OK in the connection dialog.
  5. Expand the Derby Sample Connection and the SAMP schema.
  6. Select multiple tables under the SAMP schema as shown in Figure 1.
  7. Drag the tables from Data Source Explorer, and drop them in the Data Design project.

You should see the SAMPLE physical model created in the Data Project Explorer.

Figure 1. The SAMPLE physical model

Now you have created the SAMPLE physical model. Because the DTP SQL Model is the base of IDA meta-models, it's important to look at the SQL model to understand the structure of IDA physical models. Figure 2 shows the structure of the SQL model at the schema level.

Figure 2. SQL model schema diagram

From this figure, you can see that databases and schemas are derived from the SQL object, and therefore they have properties, such as name, description, and label. Actually almost all of the objects described in the SQL model are derived from the SQL object, and they automatically have name, description, and label properties. A database object has its special properties, such as vendor and version, as strings. A database object can have zero to many (0..n) schemas, and a schema can have zero to many (0..n) tables, indexes, user-defined types, routines, and so on. You can get all tables and indexes for a schema by calling schema.getTables(), schema.getIndices() and getUserDefinedTypes(), respectively. The sample code to read from a schema and get its tables is shown in Listing 1.

Listing 1. Sample code to traverse a database and schema and to get their properties
	private void TraverseDatabase(Database db) {
		System.out.println("Database: " + db.getName());
		System.out.println("-- Vendor: " + db.getVendor());
		System.out.println("-- Version: "+ db.getVersion());
		// get schemas
		Iterator schemaItor = db.getSchemas().iterator();
		while(schemaItor.hasNext()) {
			Schema aSchema = (Schema);
	private void TraverseSchema(Schema schema) {
		System.out.println("Schema: " + schema.getName());
		// get tables
		Iterator tablesItor = schema.getTables().iterator();
		while(tablesItor.hasNext()) {
			Table aTable = (Table);

Figure 3 presents the SQL Model table objects, where Table is an abstract class and can have one to many columns. A view is a DerivedTable with extra properties, such as query expression and check type. A persistent table or temporary table is derived from BaseTable.

Figure 3. SQL model table diagram

The column structure of the SQL Model is shown in Figure 4. A column is derived from TypedElement, and it has properties, such as nullable and defaultValue. A column can optionally have an identitySpecifier or generateExpression, but not both.

Figure 4. SQL model column diagram

Listing 2 displays sample code to get columns from a table and read their properties.

Listing 2. Sample code to get columns from a table and read their properties
	private void TraverseTable(Table table) {
		System.out.println("Table: " + table.getName());
		// get columns
		Iterator columnsItor = table.getColumns().iterator();
		while(columnsItor.hasNext()) {
			Column aColumn = (Column);
	private void TraverseColumn(Column col) {
		System.out.println("   Column: " + col.getName());
		// get column properties
		DataType dataType = col.getDataType();
		System.out.println("   -- Data type: " + dataType.getName());
		boolean isNullable = col.isNullable();
		System.out.println("   -- Is nullable: " + Boolean.toString(isNullable));
		String defaultValue = col.getDefaultValue();
		System.out.println("   -- Default value: " + defaultValue);

Programmatically modify model objects

Now that you know how to traverse the model, you can write code to modify the model. For example, to add a SSN column for the EMPLOYEE table, change the TraverseTable() method, and call the AddSSNColumn() method, as shown in Listing 3.

Listing 3. Sample code to add a SSN column to the table
	private void AddSSNColumn(Table table) {
		// get database from table
		Database db = table.getSchema().getDatabase();
		// get the database specific model element factory
		DatabaseDefinition dbDef = DataToolsPlugin.getDefault()
						db.getVendor(),	db.getVersion());
		DataModelElementFactory factory = dbDef.getDataModelElementFactory();

		Column col = (Column) factory.create(SQLTablesPackage.eINSTANCE
		CharacterStringDataType cType = (CharacterStringDataType) dbDef
		EStructuralFeature feature = table.eClass().getEStructuralFeature(
		// using IDA CommandFactory to create a add command
		ICommand cmd = CommandFactory.INSTANCE.createAddCommand(
				"Add SSN column", table, feature, col);
		// execute the command using IDA command manager

In the AddSSColumn method, the code gets the registered database definition by passing database vendor and version strings. Then the code uses the registered database definition created in the sample to get the database-specific model element factory. Finally, this method creates a column using the model element factory. It uses the IDA CommandFactory to create a command. The createAddCommand method adds a value object to the owner object using the specified feature. The API reference of the createAddCommand method is:

public IDataToolsCommand createAddCommand(String label, EObject owner, EStructuralFeature feature, Object value)

The returned command extends EMF AbstractTransactionalCommand class. The class can be redo or undo. When you execute the AddSSNColumn method, a SSN column is added to the EMPLOYEE table, as shown in Figure 5.

Figure 5. A SSN column is added to the EMPLOYEE table

Add customer properties and display them in the Properties view

The Properties view is one of the many views that Eclipse workbench provides (see Related topics for more information about the Eclipse Properties view). The Properties view enables you to display or edit the properties of a selected object. Eclipse provides extensions to define a custom user interface for the Properties view. Using Eclipse extensions, you can create tabbed properties views, as shown in Figure 6.

Figure 6. The General tab in the Properties view

IDA extends the tabbed Properties view to display data of model objects. As shown in Figure 6, when you select an EMPLOYEE table in the SAMPLE physical data model from the Data Source Explorer, you see General, Columns, Relationships, Documentation, and Annotation tabs displayed. In each of the tabs, you find one or more sections. For example, under the General tab, notice the sections for Name, Label, and Schema; under the Columns tab, notice sections to list Name, Primary Key, Domain, Data Type, and other properties. Figure 7 shows these various sections.

Figure 7. The Columns tab in the Properties view

IDA provides many built-in property tabs and sections for physical, logical, glossary, and other model objects. When you edit these properties, the changes are persisted in the model.

Customize properties tabs and sections

Because IDA is used by a wide variety of customers, it is not uncommon that customers have their unique requirements on properties associated with certain type of objects. For example, a company might require that the employee's Social Security Number (SSN) be marked as private to be compliant with the personal data privacy policy. The company might require that an employee's salary and bonus be marked as sensitive data that can be viewed only by certain staff members. You can create your own tabs and sections to facilitate these. In the following sections, learn how to add a new tab and sections for column objects, as shown in Figure 8.

Figure 8. Customized privacy tab with private data and masking method sections for columns

Three extension points are used to contribute to the tabbed properties view. Each tabbed Properties view is comprised of a property contributor, which contributes one or more property tabs. Each property tab is comprised of one or more sections. A section is a GUI widget or a composite containing a group of widgets that maps to one or to multiple properties.

Property contributor

The extension point is used to define the unique contributor identifier for your tabs and sections. This identifier usually matches the unique workbench part ID that contributes to the tabbed properties view. A workbench part identifies a single property contributor by implementing the ITabbedPropertySheetPageContributor interface.

As Listing 4 shows, this extension point is used to define as the contributor ID of IDA properties tabs and sections, which is shared by IDA Data Project Explorer, Data Source Explorer, and Diagrams. Also defined with this extension point are a type mapper, a label provider, and property categories. IDA users do not need to do anything with this extension point if they use IDA Data Project Explorer, Data Source Explorer, and Diagrams.

Listing 4. IDA property contributor
<extension point="">
         <propertyCategory category="Core"/> 
         <propertyCategory category="Extended"/> 
         <propertyCategory category="Other"/>
         <propertyCategory category="UserDefined"/>
         <propertyCategory category="Appearance"/>
         <propertyCategory category="rulerGrid"/>
         <propertyCategory category="Advanced"/>

Property tabs

The extension point describes the tabs for a contributor. Each tab belongs to one contributor as identified by its unique contributor identifier. The PropertyTabs extension point can define one or more tabs through the PropertyTab attribute. A PropertyTab defines the following attributes:

  • id—The unique ID for the tab
  • label—The label to be displayed on the tab
  • category—The category from the PropertyContributor extension point used to group tabs
  • afterTab—The tab ID after which this tab is placed
  • image—The optional image to display on the tab
  • indented—The Boolean value to indicate whether the tab is indented

The plugin.xml code in Listing 5 adds a Privacy tab using the extension point as shown in Figure 8.

Listing 5. Using PropertyTabs extension point to add a Privacy tab
<extension point="">
       <propertyTabs contributorId="">

Property sections

The extension point describes the sections for a contributor. Each section belongs to one configuration as identified by its unique contributor identifier. The PropertySections extension point can define one or more sections through the PropertySection attribute. Each section belongs to one tab, as identified by its unique tab identifier.

The attributes that can be defined using this extension point are:

  • id—The unique ID for the section
  • tab—The tab ID in which this section is displayed
  • class—The class that implements the section
  • afterSection—The section id after which this section is placed
  • filter—The class that implements a section filter
  • enablesFor—A value indicating the selection count that must be met to enable the section
  • type—The selected class or interface that will enable the display on the section in the tab

The plugin.xml code in Listing 6 adds a property section to the Privacy tab.

Listing 6. Sample code to add a property section
 <extension point="">
      <propertySections contributorId="">
            <!-- enable for Columns -->
            <input type="org.eclipse.datatools.modelbase.sql.tables.Column"/> 

Property section implementation class

As defined in Listing 6, SamplePropertySection is the class that implements the property section. This class should extend from the class. As shown in Listing 7, the basic functions of the implementation class include:

  • Create GUI widgets to display the privacy properties, including a privacy checkbox and a masking text control (createControls method)
  • Read the property value from the model and display it (setInput and refresh methods)
  • Save the property value when changed by the user (onCheckboxSelected and onLeaveText methods)
  • Persist the properties in the model as EAnnotations (getMaskingProperty and setMaskingProperty methods)

For the sample code that implements the property section, Listing 7 offers the complete code sample in a sidefile.


IDA as a comprehensive modeling and integration tool is very extensible by design. In Part 1 of this two-part series, you learned how to extend IDA to write code to programmatically traverse and modify IDA models and to create customized tabs and sections in the Properties view for model objects.

Part 2 of this series describes how to generate customized model reports using BIRT and how to add validation constraints to enforce business rules.

Downloadable resources

Related topics


Sign in or register to add and subscribe to comments.

Zone=Information Management, Rational
ArticleTitle=Extend IBM InfoSphere Data Architect to meet your specific data modeling and integration requirements, Part 1: Modifying IDA models and customizing properties