TWiki
>
WebXEO Web
>
XeoPrimer
>
XeoPrimerJavaAPI
(revision 4) (raw view)
Edit
Attach
Tags:
tag this topic
create new tag
,
view all tags
-- Main.PedroRio - 22 Dec 2010 ---+ XEO Java API The XEO Java API allows direct interaction with a XEO Application (instances of Object Models and Object Model definitions). It can be used in the following situations: * Custom Behavior definition (for Object Model Events, Methods, Attribute Events and Attribute Logic (requirement, validation, etc...) * To create Schedules and Threads that perform background operations on instances of Object Models * Custom developing around a XEO Application (ex. Java Server Pages, Servlets, Java Server Faces) * Creating XEO Modules * Applications sharing the same J2EE server as the XEO application who want to access information in Object Model instances. ---++++ Basic Concepts A XEO application is all about creating instances of Object Models, setting values for their attributes, processing lists of Object Model instances, handling events generated for those instances and executing methods. To be able to reach that step Recall from the Object Behavior chapter the basics for the [[XeoPrimerObjectBehavior#apiIntro][Java API]]. A XEO application has a entry point which is an instance of the _boApplication_. The boApplication instance provides access to most features of the XEO Java API, however most of the the extension points (such as Object Model Behavior) are located inside classes which have direct access to some of classes which are required to use the Java API __VOLTAR AQUI QUE TEM COISAS MAL__ ---++++ boApplication The boApplication class represents the point of entry in a XEO Application and has methods to reach most of the manager classes to deal with boObjects, boObjectLists, Lists of Values and Object Model definition handlers. The list of relevant methods to retrieve the classes mentioned before is the following: | *Method Signature* | *Description* | *Return Type* | *Note* | | getDefaultApplication() | Retrieves the default application instance | boApplication | (static) | | getObjectManager() | Retrieves an instance of the boManagerBean to load/create object instances | boManagerBean | | | getObjectListManager() | Retrieve an instance of ObjectListManager to create boObject lists | ObjectListManager | | | getLovManager() | Retrieve the Lov Manager to load lov instances | LovManager | | | getModelDefinition(String name) | Retrieve the Model definition handler for a specific model | boDefHandler | | | getInterfaceDefinition(String name) | Retrieve the Interface definition handler for a specific model | boDefInterface | | | createContext(boSession session) | Create an EboContext from a session | EboContext | | When creating custom Java code to define behavior for a given Object Mode, as seen in the [[XeoPrimerObjectBehavior][Object Behavior chapter]], ---++++ boSession and EboContext Whenever a user successfully a ---++++ boObject aaa ---++++ boObjectList aaa ---++++ AttributeHandler & BridgeHandler ssss ---++++ boDefHandler aaaa <strong><em>___</em></strong> ---+++ Relations between XEO Java Classes To help understand the relation between the most important Java classes of the XEO API and how to have access them, see the two following figures (separated due to their size) <img width="960" alt="JavaAPI - Part1" src="http://wiki.itds.pt/pub/WebITDS/XeoPrimerJavaAPI/JavaAPI-Part1.png" title="JavaAPI - Part1" height="720" /> __Figure JA.1 - Relations between__ <img width="960" alt="JavaAPI - Part2" src="http://wiki.itds.pt/pub/WebITDS/XeoPrimerJavaAPI/JavaAPI-Part2.png" title="JavaAPI - Part2" height="720" /> __Figure JA.2 - Relations between Java class__ aaa ---+++ Sample Workflow Code - Creating an instance, set attribute values and save the instance The XEO Java API can be used arbitrarily to fit your needs, but to illustrate a situation where one needs to create an instance of Object Model A, set the value of two attributes (att1 and att2) and save the instance see the following code. <verbatim>try{ //Get the application instance boApplication app = boApplication.getDefaultApplication(); //Login a user boSession session = app.boLogin("SYSUSER", "ABC"); //Create a context EboContext ctx = app.createContext(session); //Retrieve the Object Manager boManagerBean objectManager = (boManagerBean) app.getObjectManager(); //Create a new instance object for Class "A" boObject obj = objectManager.createObject(ctx, "A"); //Retrieve attributes and set their value obj.getAttribute("att1").setValueString("my Value"); obj.getAttribute("att2").setValueBoolean(true); //In the end, update the object obj.update(); //Close all resources ctx.close(); session.close(); } catch (boLoginException e) { //Log login error } catch (boRuntimeException e) { //Write to log, or somethin }</verbatim> _ aa <strong><em><br /></em></strong>
Attachments
Attachments
Topic attachments
I
Attachment
Action
Size
Date
Who
Comment
png
JavaAPI-Part1.png
manage
39.3 K
2010-12-29 - 16:45
PedroRio
XEO Java API Relations
png
JavaAPI-Part2.png
manage
30.9 K
2010-12-29 - 16:45
PedroRio
XEO Java API Relations Part2
Edit
|
Attach
|
P
rint version
|
H
istory
:
r14
|
r6
<
r5
<
r4
<
r3
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r4 - 2010-12-29
-
PedroRio
WebXEO
XEO Primer
-
Instalation
-
Introduction
-
Concepts
-
Architecture
-
XEO Library
-
Deploy to EAR
-
PreferenceStore
XEO - Core
-
XEO Model Reference
-
Security
-
Java API
-
BOL
-
XEOQL (BOQL)
-
Administrating
-
Background Tasks
-
boConfig.xml
-
Web.xml
-
Known Issues
-
XEO Flags
XEO - XWC
- Web Components
- Java Samples
- Custom Components
- Component Plugins
- Internationalization
- Viewer Events
- Value Change Listeners
- XUIServlet
- XeoLocalization
- XvwTemplates
Create New Topic
WebXEO Web
No permission to view
TWiki.WebTopBar
No permission to view
TWiki.WebBottomBar