Jump to: navigation, search

Difference between revisions of "EDT:How to move RBD app to EDT"

(Modify EGL code)
(Modify EGL code)
Line 118: Line 118:
 
t timestamp("yyyyMMddHHmm");
 
t timestamp("yyyyMMddHHmm");
 
</source>  
 
</source>  
| time is replaced with timestamp.  
+
| '''time''' is replaced with '''timestamp'''.  
 
For more changes in Date and Time types, check the EDT online help
 
For more changes in Date and Time types, check the EDT online help
 
|-
 
|-
Line 126: Line 126:
 
| <source lang="java">
 
| <source lang="java">
 
</source>  
 
</source>  
| interval not supported
+
| '''interval''' not supported
 
|-
 
|-
 
| <source lang="java">
 
| <source lang="java">
Line 161: Line 161:
 
s.toUpperCase(); //strlib still supported  
 
s.toUpperCase(); //strlib still supported  
 
</source>  
 
</source>  
| Many operations become part of the type (timestamp, date, string). Check out the online help. Or you can type . after the variable name to let Content Assist tell you what's available. String and Date has more operations available then in RBD.
+
| Many operations become part of the type ('''timestamp''', '''date''', '''string'''). Check out the online help. Or you can type . after the variable name to let Content Assist tell you what's available. String and Date has more operations available then in RBD.
 +
|-
 +
| <source lang="java">
 +
var money(8,2);
 +
var num(8,2);
 +
var bin(9);
 +
</source>
 +
| <source lang="java">
 +
var decimal(8,2);
 +
var decimal(8,2);
 +
var decimal(9);
 +
</source>
 +
| '''money''', '''num''' & '''bin''' are not supported, use '''decimal''' instead. Check '''EGL numeric types''' in online help for more details.  
 
|}
 
|}
  

Revision as of 02:44, 1 December 2011

An EDT project has a different layout than an RBD project. The best way to make RBD code work in EDT is to create a new EDT project and copy the code to it. There have also been some changes to the EGL language that may require you to change your RBD-developed code to be modified prior to running on EDT. 

Move code to an EDT project

  1. Create a new EDT project.
    1. If the application contains RUI Handlers, choose either Web2.0 client application or Web 2.0 client application with service depending on whether the application contains services.
    2. If the application contains only Programs and common code, choose Basic.
  2. Copy EGL files and packages from the RBD project to the EDT project.
  3. Configure the EGL Compiler and generators. The Compiler setting is a new feature in EDT which allows specifying generators for each package or file.
    1. Select JavaScript Generator for Rich UI Handlers, Widgets and any common parts (Record, Library) which are referenced by Rich UI Handlers or Widgets.
    2. Select Java Generator for Services, Programs and any common parts referenced by Services or Programs.
    3. Common parts that require both JavaScript Generator and Java Generator should be put into a separate package configured with both Generators.
    4. The compiler setting of a parent resource is inherited by the children, so setting at the package level is usually good enough.
    5. Refactoring packages and code is sometimes necessary.

Modify EGL code

  1. Use Organize Imports (Ctrl+Shift+O) to let EDT import the correct widgets and system parts. This is needed for almost all EGL files because of the package name changes.
  2. Below is a handy list of things to modify. It is recorded when we moved RBD samples and test apps to EDT. See the EGL Language conversion page for more information about updates to EGL. The Code snippets page is also a good place to find code.
RBD EDT Comments
myInt INT?;
myInt Int[]?;
To indicate that a type is nullable, add a question mark to the end of the type name. See Nullability.
employeeList Employee[0];
employeeList Employee[];
Dimension is not allowed on an Array declaration, change to [ ].
myService1 MyService {@DedicatedService};
myService1 MyService?{@DedicatedService};
Service-access variable has to be defined as nullable with a ?
myService1 MyService {@bindService{bindingKey = "abc"}};
myService1 MyService?{@Resource {bindingKey = "abc"}};
 
or 
 
myService1 MyService?;
myService1 = SysLib.getResource("abc");
The @Resource annotation is new in EDT. For details, search the Help for "resource annotation".
writeStderr("hello world!");
Syslib.writeStderr("hello world!");
System libraries (sysLib, dataTimeLib, serviceLib, etc.) need to be fully qualified with a library name.
program MyProgram type BasicProgram {}
library MyLibrary type BasicLibrary {}
record recordName type BasicRecord
program MyProgram
record recordName
library MyLibrary
Basic stereotypes including BasicLibrary, BasicProgram, BasicRecord are removed. A part without a stereotype is the basic type.
Record Attendee {
XMLStructure = XMLStructureKind.simpleContent}
 
ExternalType BrowserUtils ... {
javaScriptName = "BrowserUtils" ...}	
 
target String{@JavaScriptProperty {}};
Record Attendee {@XMLValue {
kind = XMLStructureKind.simpleContent}}
 
ExternalType BrowserUtils ... {
externalName= "BrowserUtils" ...}
 
target String{@Property {}};
See the EGL Language conversion page for more annotation changes.
egl.defineWidget('utils', 'QueryUtils', 
'egl.ui.rui', 'Widget',
egl.defineWidget('utils', 'QueryUtils', 
'eglx.ui.rui', 'Widget',
EGL Widget package changed from egl.ui.rui to eglx.ui.rui, make corresponding changes when defining custom widgets with JS.
t time;
t timestamp("yyyyMMddHHmm");
time is replaced with timestamp.

For more changes in Date and Time types, check the EDT online help

diff interval("ddhhmmss");
 
interval not supported
DateTimeLib.currentDate();
DateTimeLib.currentTime();
DateTimeLib.currentTimeStamp();
DateTimeLib.timeOf();
DateTimeLib.timeValue();
 
not supported
DateTimeLib.dayOf(cTimeStamp);
DateTimeLib.weekdayOf(cTimeStamp);
DateTimeLib.monthOf(cTimeStamp);
DateTimeLib.yearOf(cTimeStamp);
DateTimeLib.dateOf(cTimeStamp);
Strlib.indexOf(s,"a");
Strlib.clip(s);
Strlib.lowerCase(s);
Strlib.upperCase(s);
cTimeStamp.dayOf();
cTimeStamp.weekdayOf();
cTimeStamp.monthOf();
cTimeStamp.yearOf();
cTimeStamp.dateOf();
s.indexOf("a"); //strlib still supported
s.clip(); //strlib still supported
s.toLowerCase(); //strlib still supported
s.toUpperCase(); //strlib still supported
Many operations become part of the type (timestamp, date, string). Check out the online help. Or you can type . after the variable name to let Content Assist tell you what's available. String and Date has more operations available then in RBD.
var money(8,2);
var num(8,2);
var bin(9);
var decimal(8,2);
var decimal(8,2);
var decimal(9);
money, num & bin are not supported, use decimal instead. Check EGL numeric types in online help for more details.


Language elements not supported in EDT

Called program, DataItem, Datatable, Structured Record, Form, FormGroup, currentTime, DataTimeLib.currentTime, DateTimeLib.timeOf, DataTimeLib.timeValue, Move, maxSize, validValues, interval, RuntimeException