Você está na página 1de 31

Status quo

• With Adobe Flex developers can easily create Rich Internet Frontend
Applications
• LiveCycle Data Services is Adobe’s solution for providing Java based
middleware to access Java Classes directly from Flex Frontends.
• However, Flex Developers still have to program Java to provide backend
services for Flex Applications.
Our mission
• Flex – Developers without or little Java and J2EE knowledge shall be enabled to
develop Java-Backends for Flex Applications
• Beside a persistence store the j2flex Framework also shall offer advanced
features like User-Management with LDAP-Synchroniation,
Rightmanagement, Multilanguage capabilities, versioning and workflow
support
• By using the j2flex Persistence Framework developers shall be able to reduce
development time for backend services up to 65%
The solution: j2flex Framework

Technically j2flex consists of


• A meta database model
• A server-side Java-API providing access to the meta database model
• A client-side Flex-API that accesses j2flex services directly from the Flex Client
Application
• Administration Application for maintaining the meta database model
j2flex Framework – the meta database model
• The meta database model as the technical foundation for j2flex provides
• An object-based database model
• Multi-language fields for database objects
• Versioning of object entities and work-flow support
• A role-based security access system for objects
• Support for defining relations between objects
j2flex Framework – the meta database model

physical database
(Oracle, SQLServer) Meta database model
j2flex
Objectmodel
Using an physical database schema with j2flex

• Each table has to have an integer primary key


• Each table has to have an attribute „Obj_Type“ (Integer)
• Both attributes must have foreign keys to the table „object“
Using an physical database schema with j2flex

• Use the j2flex Administration Application to define objects and their


properties with mapping to physical tables
Using an physical database schema with j2flex

• By creating a new object instance of e.g. „Hersteller“ by using the


updateObject Method a new row automatically is created in the table
„hersteller“ and „object“
j2flex Framework – the core of the meta database model
obj_right

PK,FK1 obj_type
PK,FK1 obj_id obj_int
PK,FK2 mand_type
PK,FK1,FK2 obj_type
PK,FK2 mand_id
PK,FK1 obj_id
PK,FK1 version_id
right_id
PK,FK2 field_id
from_parent
delete_flag
int_value

obj_version obj_date
PK,FK1 obj_type PK,FK1,FK2 obj_type
PK,FK1 obj_id PK,FK1 obj_id
PK version_id PK,FK1 version_id
object_pair object PK,FK2 field_id
date_from
PK,FK2 obj_id1 PK obj_type date_to date_value
PK,FK2,I2 obj_type1 PK obj_id vers_comment
PK,FK1,I2 obj_type2 op_type
PK,FK1,I2 obj_id2 FK1 parent_id
PK,I1 pair_flag FK1 parent_type obj_simpletext
I1 obj_uuid PK,FK1,FK2 obj_type
pair_order obj_f_system PK,FK1 obj_id
obj_f_enabled PK,FK1 version_id
obj_edit_version_id PK,FK2 field_id
obj_version_ready
obj_level text_value
I2 obj_order
obj_order_state
obj_hide_from_search
obj_next_editor obj_systext
obj_workflow_deadline PK,FK1,FK2 obj_type
o_date_created PK,FK1 obj_id
o_date_changed language PK,FK2 field_id
has_child PK,FK3 lang_id
PK,FK1 lang_id
text_value
FK1 obj_type
obj_type default_flag
lang_locale obj_text
PK,FK1 obj_type lang_img type_field
lang_f_used PK,FK1,FK2 obj_type
FK1 obj_type_stub lang_meta PK,FK1 obj_id PK field_id
hierarchy_flag code PK,FK1 version_id PK,FK1 obj_type
versions_flag PK,FK2 field_id
href PK,FK3 lang_id field_name
obj_table field_type
obj_pk text_value meta_flag
inc_pre_save table_flag
inc_post_save field_default
type_img_list obj_blob field_order
obj_min_right field_tag_type
obj_sort_type PK,FK1,FK2 obj_type field_tag_param
obj_sort_dir PK,FK1 obj_id field_visibility
type_name PK,FK1 version_id field_required
obj_icon PK,FK2 field_id field_verity
PK,FK3 lang_id field_min_right
field_multi_language
blob_uuid field_tab
blob_value
Enhanced features of the j2flex Framework

• A complete integrated user and right management system which also can be
synchronised with external LDAP-Systems
• Integrated asset management with up- and download functionality
• Full text retrieval for all assets stored in the asset management system and for
all database objects
Flex Application with RemoteObject Access to j2flex

1. Creation of a physical database model and mapping inside the meta model
2. Destination definition in remoting-config.xml of LC Data Services
3. Using the j2flex API in Flex for accessing the j2flex Persistence Store
Flex Application with RemoteObject Access to j2flex

1. Creation of a physical database model and mapping inside the meta model
2. Destination definition in remoting-config.xml of LC Data Services
3. Using the j2flex API in Flex for accessing the j2flex Persistence Store
Destination definition in remoting-config.xml of LCDS 2.5

<destination id=„j2flex.service">
<security>
<security-constraint ref="j2flex"/>
</security>
<properties>
<source>com.j2flex.Service</source>
<scope>application</scope>
<message-service-id>j2flex.messaging</message-service-id>
</properties>
</destination>

Mapping of a destination to the


j2flex service class
No need for server-side Java
programming!
Flex Application with RemoteObject Access to j2flex

1. Creation of a physical database model and mapping inside the meta model
2. Destination definition in remoting-config.xml of LC Data Services
3. Using the j2flex API in Flex for accessing the j2flex Persistence Store
j2flex API

• Check-In and Check-Out ob objects with workflow


• Get User-Roles (getUserRoles() / isUserInRole() / getUserId())
• Get Domain-Infos ( getDomain() / setDomain / getDomainInfo())
• Get Language Systems (getLangId() / setLangId())
Flex Source with j2flex and Remote Objects
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=http://www.adobe.com/2006/mxml layout="absolute"
creationComplete="init()">
<mx:Script>
<![CDATA[
import com.j2flex.core.J2FlexService;
import com.j2flex.events.J2FlexResultEvent;
import com.j2flex.events.J2FlexEventKind;
import mx.collections.ArrayCollection;
[Bindable]
private var collection:ArrayCollection;
private var service:J2FlexService;
private function init():void
{
collection = new ArrayCollection();
service = new J2FlexService();
service.destination = "J2Flex.service";
service.loginUser("admin", "test");
service.addEventListener(J2FlexEventKind.LOGIN_USER, getData);
}
private function getData(event:J2FlexResultEvent):void
{
service.getObjects("select name, price from products", collection)
}
]]>
</mx:Script>
<mx:DataGrid dataProvider="{collection}"/>
</mx:Application>
j2flex RecordSet
The method getObjects() returns a j2flexRecordSet. j2flexRecordSet is a wrapper for
the returned data. By using methods like hasNext(), getRow(), forward(), back(), etc.
you can access and navigate the resultset

// rs is a J2FlexRecordSet
//
while (rs.hasNext())
{
// jump to next row
rs.next();

// output obj_id
trace("obj_id: " + rs.getColumn("obj_id"));

// get actual row


var row:Object = rs.currentRow;

// access actual row


trace(row["obj_id]);
}
AS3 Typing
By default all returned data is not typed. J2FlexRecordSet only manages objects and no typed
Value Objects / AS3 class instances.
This can by ok in some situations, but the devleoper normally wants to have typed objects like
an ArrayCollection of product instances. That normally means that you have to provide a java
class for every object.

By defining a mapping file j2flex automatically can create server-side ValueObjects for getting
typed objects in AS3:

j2flexmaping.properties:
products=foo.bar.Product
supplier=foo.bar.supplier

On the left side there is the object type name (type_name), NOT the name of the physical
table. On the right side there is the name of the AS3 class which shall be used for the
mapping.

That means: by using that mapping file and sending a SQL-Statement like „select * from
products“ to j2flex you now will get a J2FlexRecordSet with an ArrayCollection of poducts.
Access to the meta database model by using SQL

• Access to the meta database model with SQL by using the j2flex SQL-Parser
• The j2flex SQL-Parser transforms the SQL-Statement for the meta database
model … so it does no matter whether objects are directly mapped to physical
tables or mapped to virtual tables inside the meta database model
• j2flex returns a result set which automatically includes only objects with
correct language properties based on the selected session language and to
which the user has granted access to
• As they are no real SQL queries there's no danger of SQL injections as
everything gets handled by the SQL Parser.
Insert / Update / Deletion of objects

private function create():void


{
var obj:Object = new Object();
obj.obj_type = 12345; // obj_type ID in j2Flex
obj.name = "Hello";
j2Flex.createObject(obj);
}

private function update():void


{
var obj:Object = new Object();
obj.obj_id = 789; // obj_id of the object
obj.obj_type = 12345; // obj_type ID in j2Flex
obj.name = "Hello";
j2Flex.updateObject(obj);
}

private function delete():void


{
var obj:Object = new Object();
obj.obj_id = 789; // obj_id of the object
obj.obj_type = 12345; // obj_type ID in j2Flex
j2Flex.deleteObject(obj);
}
Flex Application with Data Management Service Access to j2flex

1. Creation of a physical database model and mapping inside the meta model
2. Destination definition in data-mangement-config.xml of LCDS 2.5
3. Create Assembler classes in Java for all defined destinations
4. Using the j2flex API in Flex for accessing the j2flex Persistence Store
Flex Application with Data Management Service Access to j2flex

1. Creation of a physical database model and mapping inside the meta model
2. Destination definition in data-mangement-config.xml of LCDS 2.5
3. Create Assembler classes in Java for all defined destinations
4. Using the j2flex API in Flex for accessing the j2flex Persistence Store
Destination definition in data-mangement-config.xml of LCDS 2.5

<destination id="Produkt">
<adapter ref="java-dao"/>
<security>
<security-constraint ref="j2flex"/>
</security>
<properties>
<source>workflowsystem.assemblers.ProduktAssembler</source>
<scope>application</scope>
<metadata>
<identity property="obj_id"/> Mapping of a destination to a
</metadata>
</properties>
j2flex assembler class
</destination>
Here you have to program server-
side Java!
Flex Application with Data Management Service Access to j2flex

1. Creation of a physical database model and mapping inside the meta model
2. Definition der Destinations in der datamanagement.xml der LC Data Services
3. Create Assembler classes in Java for all defined destinations
4. Using the j2flex API in Flex for accessing the j2flex Persistence Store
Create a Assembler class for a destination

• j2flex provides a BaseAssembler.java and an AbstractDao.java class


• These classes are the blueprint for your own destination specific Dao-Code and
Assemblers
• Inside the Dao-Code use special j2flex methods for Login and SQL-Queries

sql ="Select * from product";


J2FlexRecordSet data = getService().getObjects(sql, null, true);
List list = recordSetToList(data,
J2FlexServiceUtils.getTypeMapper().getTypeForObject(OBJ_NAME), null);
Flex Application with Data Management Service Access to j2flex

1. Creation of a physical database model and mapping inside the meta model
2. Definition der Destinations in der datamanagement.xml der LC Data Services
3. Create Assembler classes in Java for all defined destinations
4. Using the j2flex API in Flex for accessing the j2flex Persistence Store
Flex Source with j2flex and Data Service Management Services
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=http://www.adobe.com/2006/mxml layout="absolute"
creationComplete="init()">
<mx:Script>
<![CDATA[
import com.j2flex.core.J2FlexService;
import com.j2flex.events.J2FlexResultEvent;
import mx.collections.ArrayCollection;
import com.j2flex.events.J2FlexEventKind;
[Bindable]
private var collection:ArrayCollection;
private var service:J2FlexService;
private function init():void {
collection = new ArrayCollection();
service = new J2FlexService();
service.destination = "J2Flex.service";
service.loginUser("admin", "test");
service.addEventListener(J2FlexEventKind.LOGIN_USER, getData);
}
private function getData(event:J2FlexResultEvent):void {
ds.fill(collection)
}
]]>
</mx:Script>
<mx:DataService id="ds" destination= "product" autoCommit=“true" />

<mx:DataGrid dataProvider="{collection}"/>
</mx:Application>
j2flex Systemrequirements

• Database: SQLServer 2000, MSDE2000, SQLServer 2005 Express, SQLServer


2005, Oracle 9i, 10g
• Adobe LiveCycle Data Services 2.x
• J2EE Applicationsserver: TomCat, JBoss, WebSphere
j2flex Hibernate / TopLink

• Uses standard SQL and a simple • Quite complicated and own SQL
API for communication with Flex dialect, not optimized for Flex

• Integrated asset management • no integrated User-management


with up- and download
functionality
• Integrated user and right • no integrated right management
management system with LDAP system
Synchronisation
• Integrated support of • no integrated multilanguage
multilanguage object properties capabilities

• Integrated support for object • no support for workflows and


versioning and workflow object versioning
Find out more:

http://www.j2flex.com
http://blog.j2flex.com
http://docs.j2flex.com

Você também pode gostar