Home

News (12/11/08)new

Start Here
Getting Started
Downloads


Documentation

Tutorials (12/07/08)new
Tablets Structure
Deployment
Web Studio
OpenL Basics
Constrainernew

Change Log

References
LGPL License


Motivational Reading

OpenL Apologia



SourceForge.net Logo
Table of Contents

OpenL Tablets Structure and Semantics

Also see Decision Tables , Tutorial

Data Tables

Data Tables provide the ability to enter Java objects in relational format by simply using Excel spreadsheets. It is very intuitive and simple. Each table becomes an array of java objects available to the application through standard Java Bean getter method.

For example, this table contains 4 instances of a class Person1. It can be accessed from java application using the following code:
Person1[] pp1 = wrapper.getPp1()

As you can see the structure of the table is somewhat similar to the structure of the Decision Table.

The first row contains Data Table Header. It has a keyword Data, data type Person1 and data table name pp1

The second row contains Column Headers. They correspond to the Java programmatic names of the Java Bean attributes of the class Person1.

The third row contains Column Display Names. These are human-readable descriptions of the Columns. Using Excel Data Group/Ungroup feature you can hide first two rows and present the table to the business user in the following form:

Object Graphs

The unique feature of Data Tables is it's ability to create complete Java object graphs in compile-time. There are two different ways to do it: using either foreign keys or using object aggregation.

Foreign Keys

Java objects can be cross-referenced in Data Tables using familiar to every programmer foreign keys. Foreign key points to other table primary key, and OpenL Tablets binds it to the Object reference. The following picture demonstrates this process, and as always to get more details we refer you to the OpenL Tablets Tutorial

Aggregation

This approach should be used when Java object "owns" it's reference, for example class Customer has a reference to the class Address. In normalized database you would have 2 different tables customers and addresses and provide link them using foreign key. The inconvenience of this approach is that you have to augment class Address to have an unique id (as a primary key) and provide reference using foreign key. OpenL Data Tables give you a nice workaround: you can enter both objects in the same table. To refer to the street address just put address.street1 in column header. Similarly for Zip Code use address.zip

Fake Primary Keys(since 5.1.1)

This feature comes handy when you create a table based on Java class that does not have a suitable primary key field, but needs to be referred from another table through the foreign key mechanism.In this case you use fake primary key _PK_. The data that you enter for this column will be interpreted as String, the only "limitation" is that it must be unique and match the corresponding value in the foreign key column of the second table.

Summary

The Data Tablets can be viewed as a way of having a compact read-only database with data stored in Excel tables. It can be used for any kind of application data like reference data or storing test case data. The Data Tablets provide automatic binding of foreign keys to link data objects from different tables and ability to enter aggregate data objects (objects made of other objects) within a single table. And you don't have to write a single line of code to make this data available to your application!!!

Also see Decision Tables , Tutorial