Tutorial 20 - Reference Table
Tutorial 20 - Reference Table
20 - Reference Table
Table of contents
1. OBJECTIVE......................................................................................................... 4
2. MODULE CREATION ....................................................................................... 5
2.1. GLOBAL ARCHITECTURE GENERATION, USING SOMWIZARD............................. 5
3. REFERENCE TABLE IMPLEMENTATION ................................................. 6
3.1. SHARED FILES DESCRIPTION ............................................................................ 6
3.1.1. Constants declaration in C_radical file .................................................... 6
3.1.2. Document’s logic representation in D_radical file................................... 7
3.1.3. Abstract document representation in AD_radical file............................... 7
3.2. SERVER FILES DESCRIPTION ........................................................................... 10
3.2.1. S_radical.java file.................................................................................... 10
3.3. CLIENT FILES DESCRIPTION ........................................................................... 11
3.3.1. Visual document ...................................................................................... 11
3.4. CLASS MODULE INFO .................................................................................... 12
4. PROPERTIES FILES........................................................................................ 13
4.1. DATABASE DECLARATION ............................................................................. 13
4.2. BUSINESS UNIT .............................................................................................. 16
4.3. BINDER.......................................................................................................... 16
4.4. DOCUMENT LIBRARY ..................................................................................... 17
4.5. MODULE PROPERTIES FILES ........................................................................... 17
4.5.1. un.asytutorialAdv.properties ................................................................... 17
4.5.2. Un.asytutorialAdv.tutorial20.properties ................................................. 17
Figures
FIGURE1 - THIS IS AN EXAMPLE OF FIGURE........................................................................... 3
FIGURE2 - JOB REFERENCE TABLE ........................................................................................ 5
FIGURE3 - ACTION MENU ..................................................................................................... 8
FIGURE4 - FIND ITEM MENU ................................................................................................. 9
FIGURE5 - FIND DIALOGUE BOX ........................................................................................... 9
Source code
SOURCE 1 - THIS IS AN EXAMPLE OF SOURCE CODE ................................................................ 3
SOURCE 2 - CONSTANTS DECLARATION IN THE C_TUTORIAL20 INTERFACES ........................ 7
SOURCE 3 - DOCUMENT’S LOGIC REPRESENTATION IN THE D_TUTORIAL20 CLASS ................ 7
SOURCE 4 - ABSTRACT DOCUMENT REPRESENTATION IN THE AD_TUTORIAL20 CLASS (1) ... 8
SOURCE 5 - ABSTRACT DOCUMENT REPRESENTATION IN THE AD_TUTORIAL20 CLASS (2) ... 9
SOURCE 6 - ABSTRACT DOCUMENT REPRESENTATION IN THE AD_TUTORIAL20 CLASS (3) . 10
SOURCE 7 - S_TUTORIAL20 CLASS FILE ............................................................................... 10
SOURCE 8 - VISUAL DOCUMENT DECLARATION IN THE VD_TUTORIAL20 CLASS ................. 11
SOURCE 9 - ASYTUTORIALADVDOCUMENTINFO.JAVA CLASS FILE ...................................... 12
SOURCE 10 - INSTALL_SRC.XML DATABASE DECLARATION ................................................... 14
SOURCE 11 - ASYTUTORIALADV_CREATE.XML FILE .............................................................. 14
SOURCE 12 - ASYTUTORIALADV_INSERT.XML FILE ................................................................ 15
SOURCE 13 - PROP.XML MODIFICATIONS ................................................................................ 15
SOURCE 14 - BUSINESS UNIT DECLARATION IN THE INSTALL_SRC.XML FILE .......................... 16
SOURCE 15 - BINDER DECLARATION IN THE INSTALL_SRC.XML FILE ...................................... 16
SOURCE 16 - SHORTCUT DECLARATION IN THE INSTALL_SRC.XML FILE ................................. 17
SOURCE 17 - UN.ASYTUTORIALADV.PROPERTIES ................................................................... 17
SOURCE 18 - UN.ASYTUTORIALADV.TUTORIAL20.PROPERTIES .............................................. 17
Keyword Definition
Source 1 -
This is an example
of source code Source code.
1. Objective
Required element
Knowledge on how to create a new module
The objective of this document is to show how to create a reference table in an independent
module.
It describes the different steps to create a module that contain one or more reference tables.
Referential tables can be visualised in Asycuda client with the shape of a chart, and different
operations can be performed on this data by default: Edit, View.
They can also be used by other modules, in this document we will describe only the reference
tables using by their own, but they can also be used by others module as it is shown in
Tutorial 21 – Binding Reference Table.
The basic sample that is going to be described in this document is a table reference with two
fields for a job list:
• Job code reference
• Job code description
2. Module creation
All the needed files for a module will be installed in the directory of your choice. The
structure of a reference table module is the same of the classic structure.
Refer to Tutorial 1 for more details on module creation.
Referential table e-document depends on so.tes module. Don’t forget to select it in the
dependencies check screen during somwizard execution.
So.tes is the table editor module.
Source 2 -
package un.asytutorialAdv.tutorial20;
Constants
declaration in the import so.kernel.tableseditor.C_AbstractEditor;
C_Tutorial20
Interfaces public interface C_Tutorial20 extends C_AbstractEditor {
Source 3 -
package un.asytutorialAdv.tutorial20;
Document’s logic
representation in import so.kernel.tableseditor.D_AbstractEditor;
the D_Tutorial20
class public class D_Tutorial20 extends D_AbstractEditor implements C_Tutorial20 {
In this file the only code that has to be written to define the document representation is
to declare an AD_radical Class object named description.
Source 4 -
Abstract document package un.asytutorialAdv.tutorial20;
representation in
the AD_Tutorial20 import so.i18n.IntlFormat;
class (1) import so.i18n.IntlObj;
import so.kernel.tableseditor.AbstractDescription;
import so.kernel.tableseditor.AbstractEditorItem;
import so.kernel.tableseditor.AbstractEditorItems;
In this second part of the AD_radical.java file, the formats of the reference table
columns are defined:
UN3 for CODE
X35 for DESCRIPTION
The names description and the dialogue box for the find item menu to use with the
fields are also defined in this part of the file.
Source 5 -
static {
Abstract document AbstractEditorItem item;
representation in
the AD_Tutorial20 String formatId_1 = "UN3";
class (2) item = new AbstractEditorItem(COL1, true, "Ref", "Find Ref",
getConstructorTextColumn(formatId_1),
getParametersTextColumn(formatId_1));
information.add(item);
information.lock();
}
In this third part of the AD_radical.java file the language function are defined.
They are in association with the language properties files in
un\asytutorialAdv\server\src\un\asytutorialAdv\
tutorial20\server\som\lng
un\asytutorialAdv\server\src\un\asytutorialAdv\tutorial20
\server
Source 7 -
package un.asytutorialAdv.tutorial20.server;
S_Tutorial20 class
file import java.sql.Types;
import so.kernel.tableseditor.server.S_AbstractEditor;
import un.asytutorialAdv.tutorial20.AD_Tutorial20;
import un.asytutorialAdv.tutorial20.C_Tutorial20;
un\asytutorialAdv\client\src\un\asytutorialAdv\tutorial20
\client
Source 8 -
package un.asytutorialAdv.tutorial20.client;
Visual document
declaration in the import java.awt.Color;
VD_Tutorial20
class import so.kernel.tableseditor.client.VD_AbstractEditor;
import so.kernel.tableseditor.client.VP_AbstractEditor;
import so.swing.KPanel;
import un.asytutorialAdv.tutorial20.C_Tutorial20;
import un.asytutorialAdv.tutorial20.D_Tutorial20;
public VD_Tutorial20() {
super();
}
vp.setBackgroundImage(so.swing.IconResourcer.getIcon("img/Background.jpg"),
KPanel.TILE);
vp.setBackgroundFilter(new Color(204, 204, 204, 255), false);
vp.setRowMargin(3);
vp.setRowHeight(15);
}
Source 9 -
AsytutorialAdvDoc package un.asytutorialAdv.module;
umentInfo.java
class file
import so.kernel.server.DocumentModuleInfo;
/**
*
*/
public class AsytutorialAdvDocumentInfo extends DocumentModuleInfo {
4. Properties files
We have to prepare all configuration files.
Source 10 -
Install_src.xml …..
database </copy>
declaration
<!--
Properties for DB.
-->
<db manager="${un.asytutorialAdv.drv_manager}" url="${un.asytutorialAdv.url}"
user="${un.asytutorialAdv.user_name}" password="${un.asytutorialAdv.password}">
<create>
<fileset dir="db">
<include name="asytutorialAdv_create.xml"/>
</fileset>
</create>
<insert>
<fileset dir="db">
<include name="asytutorialAdv_insert.xml"/>
</fileset>
</insert>
<appserver dbsource="jdbc/un.asytutorialAdv" name="un.asytutorialAdv">
<pool minPoolSize="1" maxPoolSize="-1" maxIdleTime="5"/>
</appserver>
</db>
<!--
Import into Kernel DB
-->
<system>
……
Notice that we declare two files used for database automatic installation.
• asytutorialAdv_create.xml for the automatic creation of the tables in the
database.
• asytutorialAdv_insert.xml for the automatic insertion of records in the
tables.
These files are located in:
un\asytutorialAdv\server\src\un\asytutorialAdv\server\som\db
Source 11 -
asytutorialAdv_cre <?xml version="1.0" encoding="UTF-8"?>
ate.xml file <!DOCTYPE create SYSTEM "http://strategyobject.com/dtd/create.dtd">
<create>
<table name="refjob">
<column name="JOB_COD" type="VARCHAR"/>
<column name="JOB_DSC" type="VARCHAR"/>
</table>
</create>
Source 12 -
asytutorialAdv_inse <?xml version="1.0" encoding="UTF-8"?>
rt.xml file <!DOCTYPE insert SYSTEM "http://strategyobject.com/dtd/insert.dtd">
<insert>
<table name="refjob">
<row>
<column name="JOB_COD">FIN</column>
<column name="JOB_DSC">Accounting/Finance</column>
</row>
<row>
<column name="JOB_COD">ADV</column>
<column name="JOB_DSC">Advertising/Public Relations</column>
</row>
<row>
<column name="JOB_COD">ART</column>
<column name="JOB_DSC">Arts/Entertainment/Publishing</column>
</row>
<row>
<column name="JOB_COD">BAM</column>
<column name="JOB_DSC">Banking/Mortgage</column>
</row>
<row>
<column name="JOB_COD">ADM</column>
<column name="JOB_DSC">Clerical/Administrative</column>
</row>
….
<row>
<column name="JOB_COD">OTH</column>
<column name="JOB_DSC">Other</column>
</row>
</table>
</insert>
Source 13 -
Prop.xml …
modifications <properties>
<group type="connection">
<property name="un.asytutorialAdv.drv_manager" from="driver" />
<property name="un.asytutorialAdv.url" from="url" default="asytutorialAdv.mod" />
<property name="un.asytutorialAdv.user_name" from="user" />
<property name="un.asytutorialAdv.password" from="password" />
<description><![CDATA[Connection to database Module asytutorialAdv is required.
This database is available. You can create new or use the same database.
Then enter connection properties in this form.]]></description>
</group>
</properties>
Source 14 -
business unit
declaration in the <BU name="BUasytutorialAdv">Advanced tutorial</BU>
install_src.xml file
The Business Units on a document could be defined manually filling this file or using the
ASYCUDA client application. The defined Business Units will be added automatically in
ASYCUDA environment with the appropriated rights if they are defined in the
install_src.xml file.
4.3. Binder
Binder is usually situated after business unit definition within <system> XML tags.
Source 15 -
Binder declaration <binder name="B_TUTORIAL20" status="">
in the <field name="server" value="un.asytutorialAdv.tutorial20.server.S_Tutorial20"/>
install_src.xml file <field name="dom" value="un.asytutorialAdv.tutorial20.D_Tutorial20"/>
<field name="client" value="un.asytutorialAdv.tutorial20.client.DC_Tutorial20"/>
<access bu="BUasytutorialAdv">
<full/>
</access>
</binder>
Source 16 -
Shortcut
declaration in the
install_src.xml file
<DL>
<folder name="Tutorial ADV" icon="">
<access bu="BUasytutorialAdv">
<full/>
</access>
<item name="tutorial 20 – Reference Table" icon="">
<field name="binder" value="B_TUTORIAL20"/>
<field name="skin" value=" un.asytutorialAdv.tutorial20.client.VD_ Tutorial20 "/>
<access bu="BUasytutorialAdv">
<full/>
</access>
</item>
</folder>
</DL>
4.5.1. un.asytutorialAdv.properties
This file is common to all the reference tables of the module.
You will have to add include lines if you use more than one reference table in this
module.
Source 17 -
un.asytutorialAdv.p
roperties @include un.asytutorialAdv.tutorial20.properties
4.5.2. Un.asytutorialAdv.tutorial20.properties
In this file the link to the database table is defined:
Database URL
Database User
Database Login
Reference name to be used by other modules (refname)
Table name
Table fields
Source 18 -
un.asytutorialAdv.t un.asytutorialAdv.tutorial20.server.S_Tutorial20#Table=refjob
utorial20.properties un.asytutorialAdv.tutorial20.server.S_Tutorial20#URL=$[un.asytutorialAdv_URL]
un.asytutorialAdv.tutorial20.server.S_Tutorial20#User=$[un.asytutorialAdv_User]
un.asytutorialAdv.tutorial20.server.S_Tutorial20#Password=$[un.asytutorialAdv_Passwor
d]
un.asytutorialAdv.tutorial20.server.S_Tutorial20#refname=JOB_TAB
########################################
# Define REFJOB reference tables
########################################
Now you can compile and deploy your module with Ant tools.