APPBUILDER2Standard AppBuilder Class
APPBUILDER2Standard AppBuilder Class
APPBUILDER2Standard AppBuilder Class
2006
Section 1
Introduction to AppBuilder
What is AppBuilder?
Development tools
Window design, report design, code editor
Testing tools
PC & mainframe based debugging
Code Generator
From a single source input AppBuilder can generate Java, J2EE, C & Cobol
Mainframe
CICS IMS Batch
Servers
MS Windows Unix Java Virtual Machine Web Server App Server
Java
EJB
Web Services
Clients
MS Windows Java Virtual Machine Browser
Java
HTML
Repository Based
Every source object created using AppBuilder is stored in its own repository (internal database).
When objects interact, relationships are formed and stored.
Types of Repository
Personal
Fits on a PC Only you can see whats in it Needs to be synchronized with Enterprise Repository
Freeway
Needs a Server Accessed by many developers Normally synchronized with Enterprise Repository
Enterprise
Lives on a mainframe Central to most AppBuilder environments
8
Repository Topologies
Workgroup Personal & Enterprise
10
11
Section 2
Objects, Relationships & Attributes
12
What is an Object?
13
What is an Object?
Keywords
14
Properties of an Object
Each object has different set of properties Refer to documentation for full list
15
System Id
System Generated Unique to your environment You cant change it Used by AppBuilder internally e.g. ZABRT6H
16
Enter Text for Fields Views Sets Windows Rules Keywords used to allow for faster searching in the repository
17
What is a Relationship?
18
Attributes of a Relationship
No System Id No Name Identified using
Name of Parent + Name of Child
Sequence Number
Indicates position in sibling list
19
Repository Security
User Group Project
Objects (and relationships) are kept secure in Projects which can only be updated by certain Groups of Users.
20
What is a Project?
Logical container for objects & relationships Every object & relationship exists in one (and only one) Project Objects in different Projects can be related
Project A
Project B
21
Audit Information
Where? Who? When?
22
23
Section 3
Construction Workbench & Hierarchy Diagrammer
24
Starting AppBuilder
1.
2.
25
Integrated Development
Hierarchy space
Preparation results
26
Hierarchy Diagrammer
Critical in AppBuilder development Way of viewing objects in the repository Way of creating new objects in the repository Press F4 to open the Hierarchy Diagrammer
27
Parts of a Hierarchy
Expand /Contract
Parent object Child object
Relationship Siblings
Object Type
28
Building a Hierarchy 1
Type in name of new object. No spaces or - Use _ Press Insert to place in Hierarchy
29
Building a Hierarchy 2
Do not use in Query Can use %% Use Shift or CTRL to choose multiples Press Insert to place in Hierarchy
30
Example Relationships
View Field View View Window View Window Set
Rollback
Repository
32
F8
CTRL + Enter
34
35
Show Impact
36
Removing a relationship
x 1. Highlight the child object
2.
Right Click on it Choose Delete Relationship Confirm or reject
or
2.
Press CTRL + Backspace Confirm or reject
x
1. Highlight the object
2.
Right Click on it Choose Delete Object Confirm or reject
or
2.
Press CTRL + Delete Confirm or reject
Completely deletes the chosen object from the Repository Only do this if youre ABSOLUTELY SURE! 38
39
Section 4
AppBuilder Objects
40
41
Mandatory properties o Name o Format o Length Optional properties o Literal values o Ranges Implementation Name = Column name in Table
Only possible parent is a View
42
Mandatory properties
o
Name
Example View
43
In order to display data, a Window MUST have only one child View (normally suffixed _W)
Mandatory properties
o
Name
44
45
46
47
Section 5
Painting Windows
48
Window Hierarchy
Window object MUST only have 1 View attached to it.
Named same as Window + _W
49
50
Window Attributes
51
Window Attributes
52
Do not delete
53
54
55
Do not delete
56
Chart
Square
Select
Centre Vertically
Distribute Horizontally
Distribute Vertically
Centre Horizontally
57
Do not delete
58
Do not delete
59
Do not delete
60
The LINK
Link
No LINK, no data
61
62
63
64
Accelerator Keys
Menu Items
Push Buttons
65
Position the window relative to the screen. Note the screen sizes. Window position can be changed at runtime. 66
Verify Alt + F7
67
68
69
CTRL
CTRL + Enter
70
71
Produces
ID
FIRST_NAME
LAST_NAME
Append statement
ID FIRST_NAME LAST_NAME
produces..
72
73
74
HTML
Browser
http://myserver/Customer_Details_DisSvlt
75
WFD allows you test & simulate the window flow without writing code 76
77
Window Flows
Nested Flow
Normal Flow
Detached Flow
78
79
Section 6
AppBuilder Rules & Rules Language
80
Written in AppBuilder Rules Language Simple Easy to learn Does 85% of what you want very easily Procedural, not OO
81
82
Right Click
83
84
85
dcl
L_FIELD1 L_FIELD2 L_FIELD3 L_FIELD4 L_FIELD5 char(17); integer; Boolean; pic 9999; date;
enddcl
87
Referencing Variables
Whilst coding this Rule You want to reference this Field
A_VIEW.A_DATA_VIEW.FIELD1
88
89
The IF Statement
IF condition statements [ELSE] statements ENDIF
if HPS_EVENT_VIEW.EVENT_SOURCE = OK use rule CUSTOMER_DETAILS_DIS else return endif
90
The DO Statement
DO [from n to n [index variable] ] statements [WHILE] statements ENDDO
do from 1 to 10 index L_COUNTER
set CUSTOMER_DATA.FIRST_NAME(L_COUNTER) := Mike
enddo
92
93
Displaying Windows
All code in a Window display Rule MUST be written in a Procedure There can be many Procedures in a Rule The Window is displayed automatically when the Rule starts Window events are handled by event procedures
94
Event Procedures
A Procedure which is automatically executed when an event occurs on a Window.
Name of Procedure Event Type Object on which to listen
proc ReturnClick for Click object RETURN_PB ( e object type ClickEvent ) code endproc
Reference to the object which triggered the event
95
PushButton
Click FocusGained FocusLost
EditField
Click DoubleClick FieldError FieldValidation FocusGained FocusLost
96
When is it executed?
When the window triggers the initialise event 1. After pre-loop 2. Each time the window triggers the converse event
Post-converse
Post-loop
97
99
4
5
Return
100
proc CancelClick for Click object CANCEL_PB ( e object type ClickEvent ) code endproc
101
102
CUSTOMER_LIST.terminate
proc return endif while skipDisp enddo endproc
proc PushButtonClick for Click object SELECT_PB ( e object type ClickEvent ) use rule CUSTOMER_DETAILS_DIS nest proc return endproc
103
Multiple Input / Output Views Invalid Map Statements Spelling mistakes No EndIf, EndCase, EndDo etc Invalid syntax
Alt+F7 to Verify
Checks hierarchy Checks code
104
Section 7
Views & Fields
105
Views are attached to Rules like this Views attached to Rules rarely contain Fields, they usually contain child Views, which then contain Fields.
107
Types of View
View Type Description
Window (_W) Attached to a Window, data is only accessible by the parent Rule of the Window Work (_K) Attached to a Rule. Fields are private to the Rule and can only accessed by the Rule Input (_I) Attached to a Rule. Fields can be accessed by the Rule and its parent Rules. Output (_O) Attached to a Rule. Fields can be accessed by the Rule and its parent Rules. Global (_G) Attached to many Rules. Fields can be accessed by any Rules to which the Global View is attached. Data Attached to other Views. A data view contains Fields, whilst most of the above Views do not.
108
Work Views
A Work View is private to the Rule which owns it Rules can have many Work Views Normally suffixed _K
109
Global Views
A Global View is shared between Rules which own it Many Rules can share a single Global View A Rule can have many Global Views
110
Input Views
An Input View is shared between a Parent and Child Rule It is used to pass data FROM the parent TO the child It must be a child of the child Rule A Rule can only have one Input View
111
Output Views
An Output View is shared between a Parent and Child It is used to pass data from the child back to the parent It must be a child of the child Rule A Rule can only have one Output View
112
113
Q. What data is passed back FROM the Rule? A. Output View structure
114
115
116
Qualification of Data
117
Copying View-to-View
Set View2 := View1
118
119
AppBuilder Set-up
120
L W W E E L L E E E
L L W E E L L E E E
L L L E E L L E E E
E E E L L E L E E E
E E E L L E L E E E
L L L E E L L E E E
W W W E E W L E E E
E E E E E E E L E E
E E E E E E E E L E
E E E E E E E E E L
L=Legal
W=War ning
E=Er r or
121
overlay to
CUSTOMER_RECORD CUSTOMER_DATA
06373 Tom Jones Mr M 230643 Entertainer
122
Data Initialisation
Local variables (DCL), Work views (_K) and Output views (_O) are initialised every time a rule is called and before any code is executed The input view of a Rule is initialised by the parent Rule
124
Section 8
AppBuilder Functions
125
CLEAR Statement
Sets a variable (Field) or a collection of variables (View) to spaces or zeros
Clear Fieldname
or
Clear Viewname
e.g. Clear CAR_DATA of T0_CAR_LIST_W Corresponding function ISCLEAR Checks if a variable is set to its initial value or whether it has changed
126
Operators
+ / * **
DIV MOD
Add Subtract Exact Division Multiply Exponential Integer Division Provides Modulus Equals Greater Than Less Than Not Equal Less Than or Equals Greater Than or Equals
NOT AND OR
Order of Precedence
127
AppBuilder Functions
INT Converts to Integer DECIMAL Converts to Decimal CEIL Returns next highest number FLOOR Returns next lowest number ROUND Rounds up or down TRUNC Truncates significant digits ++ RTRIM STRLEN UPPER LOWER STRPOS VERIFY SUBSTR CHAR Concatenate 2 strings Truncate a string What is the length of a string? Convert string to upper case Convert string to lower case Searches for string & returns start position Compare 2 strings Copy out a substring from a string Converts to character
128
129
Date Functions
Date Char Int
Returns current date Converts date field to character Converts date field to integer
Day Returns day of the month from given date MonthReturns month from given date Year Returns year from given date Day_of_Year Day_of_Week
Returns Julian day Returns number between 1 & 7
130
Time Functions
Time
Char Int Hours Minutes Seconds
Returns current time
Converts time field to character Converts time field to integer Returns the hour from given time Returns the minute past the hour from given time Returns the number of seconds elapsed in the current minute from given time
Seconds_of_Day Seconds elapsed since midnight Minutes_of_Day Minutes elapsed since midnight
131
132
133
View APPEND
ID FIRST_NAME LAST_NAME ID FIRST_NAME LAST_NAME
+
ID FIRST_NAME LAST_NAME
134
Replace (3)
ID FIRST_NAME LAST_NAME
ID
FIRST_NAME
Insert (3)
ID FIRST_NAME LAST_NAME
135
136
Section 9
Writing SQL in Rules
137
Default DBMS usage = Not Applicable Change to DB2 for SQL Rules
138
Rule Hierarchy
140
141
File Objects
Alt + Enter
Name of Table
Alt + Enter
142
SQL Builder
Choose Tables (Files) & Choose Columns (Fields)
If this is blank, then you havent got any File objects attached to the Rule
143
SQL Builder
Choose any Group By or Order By clauses. To make a Fetch, fill in the Cursor name field
144
Section 10
AppBuilder Set Objects
145
Sets
Collection of values Each value has a meaning in the Set
-818
Set of SQL Codes
Pink
Set of Colours
146
Sets
Each value has a meaning in the Set
The same value might appear in multiple Sets, but have different meaning
18
6 3 9 15 30
10
21 24 12
20
25
Multiples of 5
147
27
Multiples of 3
Why Sets?
Domains for Combo Boxes Domains for MCLB cells Use in Rules code instead of hard coding values
Sets are closely associated with Fields, hence they have a Data Format & a Length
148
Set Properties
Name of Set
149
Set Styles
Values Define LookUp Error
Older style Set. It has a hierarchy of Value objects beneath it. Simplest Set. Two columns Define and Encoding. Used for Combo-box and MCLB cell domains. Has extra Display column. Like LookUp Set, has extra Display column, but used for standardising error messages in an application.
150
Values Sets
Alt + Enter CTRL+ Enter
151
Define Sets
Double-Click
LookUp Sets
Double-Click
Error Sets
Double-Click
155
156
Using Sets
Use in Rules code instead of hard coding values
SQLCA.SQLCODE := 0 SQLCA.SQLCODE := Success in SQLCODES
157
Set Functions
SetEncoding
Returns the Encoding value given a Define value
set DAY_NUMBER := SetEncoding(DAYS_OF_WEEK, MON)
SetDisplay
Returns the Define value given an Encoding value
set DAY_NAME := SetDisplay(DAYS_OF_WEEK, 1)
158
Section 11
Rules Language ObjectSpeak
159
What is ObjectSpeak?
A set of Java-like functions within the AppBuilder Rules language. Methods and properties are available for all these object types
Accelerator CheckBox Color Column ComboBox Constants Dimension EditField Ellipse Font Format GlobalEvent GroupBox GuiObject Label ListBox Locale Menu MenuBar MenuItem MessageBox MultiLineEdit PasswordField Point PopupMenu PushButton RadioButton Rectangle Rule Table Timer
160
Supporting Objects
These objects are used with other objects.
e.g. BackgroundColor is an attribute of an EditField, but is set using an instance of the Color object.
Accelerator Formats (Derived) Color GlobalEvent Constants Locale Dimension Point Font
161
Object Properties
Each object has a set of properties Properties are referenced as objectname.propertyname (objectname = HPS ID)
To set a property SelectPB.Visible(True) or set SelectPB.Visible := True
162
Object Methods
Each object has a set of methods Methods are referenced as objectname.methodname( [parameters])
(where objectname = HPS ID) Some common Methods
Window EditField PushButton
setLocation(Point)
setAltered(Boolean) clearAltered( ) clearWindowChanges( )
setEnabled(Boolean)
setFormat(Format) setShortHelp(String) setFocus( )
setEnabled(Boolean)
setIgnoreValidation(Boolean)
terminate( )
setAltered(Boolean)
163
setShortHelp Method
Provides pop-up help for an object based on cursor position otherwise known as tool tips
Objectname.setShortHelp(This is the title field, right click to see valid values)
or
Set TitleHelp := This is the title field, right click to see valid values
Objectname.setShortHelp(TitleHelp)
164
Object Events
Objects trigger events when they are used
Generic
proc PushButtonClick for Click type PushButton ( e object type ClickEvent ) statements endproc proc PushButtonClick for Click object EXIT_PB ( e object type ClickEvent ) statements endproc
Specific
165
Generic
166
Generic
167
ObjectSpeak Examples
dcl myRed as object type Color; enddcl set myRed := new Color(255,23,23) CustIdFld.setBackGround(myRed) dcl OpenAccelerator as object type Accelerator; enddcl set OpenAccelerator := new Accelerator(O, Accelerator.CTRL) OpenMenuItem.SetAccelerator(OpenAccelerator) proc MaleClick for Click object MaleCheckBox (e object type ClickEvent) if MaleCheckBox.Selected = True set FemaleCheckBox.Enabled := False else set FemaleCheckBox.Enabled := True endif endproc
168
169
170
171
172
173
Create messagebox Set type of message Set push button combination Set text of message Set any arguments in text Display messagebox
174
Create pop-up menu Build it (MenuItems) Allocate it to an Object Write code to handle items
175
176
177
getWindow( ) Returns an object reference to the window displayed by the Rule getActiveWindow( ) Returns an object reference to the nondetached window most recently opened by a rule or its parents.
178
Section 12
Components
179
Types of Component
User
You write them Java, Cobol, C, PL1, Assembler
System
Written by BluePhoenix Supplied as objects in repository and as classes in AppBuilder.JAR
180
1. 2. 3. 4.
Include in Hierarchy Populate Input View Call Component Either check RETURN_CODE or use the data returned in Output View
181
Component Examples 1
182
Component Examples 2
183
Component Examples 3
184
Do not delete
185
Do not delete
186
Section 13
Preparation & Partition Manager
187
Object Preparation
Right-Click
188
Object Preparation
AppBuilder CodeGen
Compiler
189
Preparation Steps
1. 2. 3. 4. 5. 6. Verify Hierarchy Create Bindfile Verify Source Code Generate Code Compile Move class to runtime directory
190
Open shows you job output. Restart submits prepare job again. Keep this panel tidy! o See Delete Successful Jobs option.
191
192
193
Configuration Projects
Provide way of dynamically configuring applications Must be used for Servlet, EJB and remote preparations Do not confuse with security Projects No Project open
194
1. Tools Workbench Options 2. Preparation tab 3. Choose options 4. All Rules assume same options Not very flexible
195
Very flexible
196
Configuration Objects
Defines configuration of an application An Application Configuration can include many Partitions Each Partition will need to be prepared on a specific Machine A Partition may include a Database If the Partition is a client Partition, it will have a child Process Rules to be prepared as client Rules are shown like this Rules to be prepared as server Rules are shown like this If the Partition is defined as a Server, it will have a child Server
This is interface Rule you only see these if you use Gateway Partitions
197
Partition Object
Dictates HOW a group of Rules will be prepared
Partition Type Client Server Gateway Language Java Default Package - Not covering Host Properties in this class -
198
Server Partitions
Used to prepare server portions of an application
Partition Type Server Server Interface RMI WebService EJB Language Java
199
Server Partitions
CUSTOMER_SQL_SEL generated as an a WebService Remote EJB Service (RMI)
Import Statements in Customer_Sql_Sel_R.java
import import import import com.level8.appbuilder.server.*; com.level8.appbuilder.servlet.*; com.level8.appbuilder.*; com.level8.appbuilder.systemviews.*; com.level8.appbuilder.util.*;
200
Cust_Ejb.JAR
Cust _Rmi.JAR
Cust _Webservices.WAR
201
Client Partitions
Used to prepare client portions of an application
Partition Type Client Client Type EventDriven HTML Language Java
202
Client Partitions
CUSTOMER_DETAILS_DIS generated as HTML Java
ImportStatements Import Statements inin Customer_Details_Dis_R.java Customer_Details_Dis_R.java
import ABVIEW.Customer_Details_W_V; import com.level8.appbuilder.servlet.*; com.level8.appbuilder.gui.*; import com.level8.appbuilder.*; import com.level8.appbuilder.systemviews.*; import com.level8.appbuilder.util.*; public final class Customer_Details_Dis_R extends HpsServletRule HpsGuiRule
203
204
Partitioning an Application
Create a new Application Configuration Add child Client Partition to the AppCfg Add child Process to the Partition (query) Add child Machine to the Partition (create / query) Add child Database to the Partition (create / query)
Note: This is optional (create)
(create)
Add child Machine to the Partition (create / query) Add child Database to the Partition (create / query)
Note: This is optional
Add child Server to the Partition (create / query) Add child Rule(s) to the Server
(query)
205
&
Rule will be prepared as part of Client Partition Rule will be prepared as part of Server Partition
206
Section 14
Executing AppBuilder Java Applications
207
AppBuilder.INI Font.INI
208
209
210
211
212
213
214
Setting a Breakpoint
215
Changing Data
Double click on icons to expand View structures Single click in Value to change data
216
217
AppBuilder Exceptions
218
Section 15
Useful things to know
219
221
Scripting Tools
TurboScripter
New API to AppBuilder repository VBScript or JScript
TurboCycler
Old API to AppBuilder repository Proprietary language
222
Using TurboScripter
223
Using TurboCycler
224
Cloning Objects I
2. Highlight Cloner template, click Add
3. Click on Generate
225
Cloning Objects II
CUSTOMER CLIENT
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
Enter replacement strings Click on Add Set Cloning options Set Text & Keyword options Choose objects to clone Choose objects to reuse Save Verify Review Verify results Restart Cloner Clone
226
Cloning Objects II
CUSTOMER CLIENT
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
Enter replacement strings Click on Add Set Cloning options Set Text & Keyword options Choose objects to clone Choose objects to reuse Save Verify Review Verify results Restart Cloner Clone
227
228
Section 16
AppBuilder COBOL generation
229
Classic COBOL
Requires AppBuilder runtime environment Uses SYSTEM Ids, not Long Names Unreadable Not maintainable outside AppBuilder Can only be generated on mainframe Can only be executed on mainframe (CICS / IMS or Batch)
230
OpenCOBOL
NO AppBuilder runtime environment Uses Long Names Readable Potentially maintainable outside AppBuilder Can be generated on mainframe or PC Can be executed on mainframe (CICS / IMS or Batch) Can be executed in non-mainframe environments (MicroFocus)
231
232
233
On job completion
234
+
Listener
On job completion
235
236
237