Jaffa Logo
 
SourceForge.net
Home Contact Us FAQs Site Map
Source Forge: Homepage Bugs @ Sourceforge Mailing Lists @ Sourceforge Task Manager @ Sourceforge CVS @ Sourceforge
Jaffa Site
Jaffa Runtime
Jaffa RAD
Sub-Projects
Tools / Patterns / Domain

This covers all the tools and patterns that relate to domain object and database access. The primary pattern in this group is the Domain Creator. The Domain View pattern is a variant that can be used to access a database view. If you already have code in the database then the Stored Procedure pattern is a good way to get access to it, but its is not recommended that you use stored procedures if you want to be database agnostic.

Domain Object Patternpatterns.library.domain_creator_*

This pattern generates the files required for persisting a table in the database. The input to the Domain Object Pattern is a domain descriptor file. This file will contain information like the domain object name, package name, database table name, etc. etc. This pattern will generate the following

  • Domain Class - This Java file will contain the getters/setters to be invoked by the Persistence Engine when loading/storing the fields of a database table. It will also have updators and validators for each database field. When viewed in the Netbeans IDE, the generated code will be guarded, i.e. it cannot be changed. However, hooks are provided to add custom code.

  • Meta Class - This Java file holds the meta information for the domain object and its fields. It is used by the JDBC Engine to get the name for a field, while generating SQL. It can also hold static validations. When viewed in the Netbeans IDE, the generated code will be guarded, i.e. it cannot be changed. However, hooks are provided to add custom code.

  • Mapping file - This file will contain the mapping of the Java class to the database table. It is required by the Persistence Engine

  • Resources file - This will contain a property for each field of the domain object. It can be an aid to quickly generate a label set for the domain object. The file may not be used at all.

  • CreateTable scripts - This will contain the DDL for generating the table in the database. The file may not be used at all.

Database Viewpatterns.library.domain_for_view_*

This pattern is very similar to the Domain Creator Pattern. It is used for generating the files required to support a database view. The input to the Domain for View Pattern is a domain descriptor file. This file will contain information like the domain object name, package name, database table name, etc. etc. This pattern will generate the following

  • Domain Class - This Java file will contain the getters/setters to be invoked by the Persistence Engine when loading/storing the fields of a database table. However there will be no updators/validators, since a database view should not be updated. When viewed in the Netbeans IDE, the generated code will be guarded, i.e. it cannot be changed. However, hooks are provided to add custom code.

  • Meta Class - This Java file holds the meta information for the domain object and its fields. It is used by the JDBC Engine to get the name for a field, while generating SQL. When viewed in the Netbeans IDE, the generated code will be guarded, i.e. it cannot be changed. However, hooks are provided to add custom code.

  • Mapping file - This file will contain the mapping of the Java class to the database table. It is required by the Persistence Engine

  • Resources file - This will contain a property for each field of the domain object. It can be an aid to quickly generate a label set for the domain object. The file may not be used at all.

Stored Procedure Patternpatterns.library.stored_procedure_creator_*

This pattern generates the files required for invoking a stored procedure in the database. The input to the Stored Procedure Pattern is a stored procedure descriptor file. This file will contain information like the stored procedure name, package name, etc. etc. This pattern will generate the following

  • Stored Procedure Class - This Java file will mimic a stored procedure. It will have getters, setters, updators, validators for each parameter. When viewed in the Netbeans IDE, the generated code will be guarded, i.e. it cannot be changed. However, hooks are provided to add custom code. To get the stored procedure working, implementations will have to be provided for the 4 methods getParameters(), getParamSqlTypes(), getParamDirections() and prepareCall()

  • Meta Class - This Java file holds the meta information for the stored procedure and its parameters. It is used by the JDBC Engine to get the name for a parameter, while generating SQL. When viewed in the Netbeans IDE, the generated code will be guarded, i.e. it cannot be changed. However, hooks are provided to add custom code.

  • Resources file - This will contain a property for each parameter of the stored procedure. It can be an aid to quickly generate a label set for the stored procedure. The file may not be used at all.

Tools / Patterns / Domain / Unifaceorg.jaffa.tools.domainmeta.uniface

The 'Uniface Domain Tool' is designed to connect to a Uniface 'DICT' repository, read its contents and generate the domain object XML descriptors. These can then be run through the pattern engine to generate full domain objects for use in the Jaffa persistence engine.

To use the tool you need to specify the details of the dictionary to connect to, the 'model' the entities are to be extracted from, as well as a mapping definition to translate a [model].[entity] from uniface to a [package].[class] in Java.

The tool as been designed for continuous use, for environments where you may continue to modify you Uniface Dictionary, and want to repeatedly run the extraction program. Not all of the elements in the domain XML can be inferred from Uniface, and in some cases once you have generated the XML, you may want to tweak it a bit. For re-generation the following rules apply

Non-null values for the following elements will be retained, the next time this file is regenerated, provided the merge option is set in the TableInfo file.

1- Table Level: Description, LabelToken

2- Field Level: Description, LabelToken, Layout, Pattern, CaseType, Ignore

The tool also supports a relationship mapping file, as we support the standard UML based relationships (association, aggregation and composition), by default all Uniface relationships are treated as association, unless a specific definition is found in the mapping file. This allows true UML based models to be generated from Uniface, when the generated code is view in a UML tool like Together Control Center

For more details on this tool read the following How To Guide


File: index.html, Last Modified: Tue Jul 15 2003 at 4:02:03pm. This site has been built using PPWIZARD