Building an Enterprise Reporting Framework Using Adobe Flex.pdf

49 downloads 4856 Views 373KB Size Report
Senior Principal. Farata Systems. Building an Enterprise. Reporting Framework. Using Adobe Flex. 2006 Adobe Systems Incorporated. All Rights Reserved. 2.
MAX 2006

Beyond Boundaries

Presentation Outline Customer Challenges – 2 min

ƒ ƒ

Building an Enterprise Reporting Framework Using Adobe Flex Anatole Tartakovsky

Senior Principal

Senior Principal

1

How we meet the requirement – 2 min

ƒ

Architecture of the solution - 3 min

ƒ

DaoFlex Solution technical overview and demo -15 min Reporting Framework technical overview and demo - 25 min

Q&A – 7 min

2006 Adobe Systems Incorporated. All Rights Reserved.

2

Requirements for the Solution

IFS/StateStreet accountants are processing about 10,000 back-office generated reports on a daily basis

ƒ

Links to PDF of selected reports which pass accounting verification are exposed to the customers – Fortune 100 financial corporations

ƒ

IFS customers are not able to manipulate the report data themselves, i.e: add/remove columns, filter/sort accounts, drilldown/rollup etc.

ƒ

IFS accountants are not able to manipulate the data either. All requests for adding computed fields, modifications of groupings, filtering, aggregation, pivoting etc. fall back to IFS IT IFS/StateStreet plans to introduce a new service – Web-based user-driven reporting solution, allowing end-users and in-house accountants to manipulate the existing report data as well as build and persist the report structure for later reuse on personal and shared level

2006 Adobe Systems Incorporated. All Rights Reserved.

ƒ

ƒ

Customer Challenges

ƒ

Requirement for the solution

Farata Systems

2006 Adobe Systems Incorporated. All Rights Reserved.

ƒ

Challenges of the current process

Technical Solution – 45 min

ƒ

ƒ

Victor Rasputnis Farata Systems

ƒ

3

ƒ

Web-based Report Delivery

ƒ

Data Location ƒ Due to the volatile nature of the data, manipulation should be done on the client desktop, i.e. inside the browser as oppose to hitting the datastore again

ƒ

Intuitive User Interface to allow report manipulation : ƒ

Adding/removing columns;

ƒ

Support of computed fields;

ƒ

Support dynamic grouping with group and cross-group

ƒ

Support custom filtering and sorting

ƒ

ƒ

computations;

Support bi-directional link with Excel

Support of business quality client-side printing w/out server side trip (PDF generation, etc.)

2006 Adobe Systems Incorporated. All Rights Reserved.

4

Requirements for the Solution (continued)

How Farata Systems meets the requirement

ƒ

Performance, look-and-feel, cross-browser

ƒ

ƒ

Development and deployment has to be highly automated, currently labor intensive parts streamlined or eliminated

ƒ

SuperGrid control, a natural extension of standard DataGrid

ƒ

Custom MXML tags to support arbitrary groupings and computations

Power users should be able to customize templates either via UI or directly – but without low-level coding

ƒ

Metadata as MXML

ƒ

Database as persistent storage of metadata and pre-compiled reports

ƒ

Dynamic visual modification of report MXML by the end-user

ƒ

Web-tier compilation, support of add-hoc expressions: filtering, sorting, formulas

ƒ ƒ

Customization has to be available on all levels independently, no “black box” integration

ƒ

Initial metadata has to automatically derive from SQL or stored procedure defined for a base report

2006 Adobe Systems Incorporated. All Rights Reserved.

5

FlexBI – Flex-based business intelligence solution

ƒ

Printing, Excel Link

DaoFlex – XSL Template-based design-time code generator

ƒ ƒ

SQL statements as Java doclet annotations; mix and match pure Java and “SQL” methods

ƒ

Java code: DAO - both Remoting and DataServices flavors; data transfer objects; JARs

ƒ

Test MXML UI, ActionScript and Java data transfer objects

ƒ

Initial report Metadata

ƒ

Deployment descriptors, etc

2006 Adobe Systems Incorporated. All Rights Reserved.

6

1

Session Agenda ƒ

Introductions

ƒ

DaoFlex – MXML/ActionScript/Java code generator

ƒ

Generated code review (live demo)

ƒ

SuperGrid Control

ƒ

Saving base reports as templates

ƒ

FlexBI – flexible end-user driven reporting tool

Introductions ƒ

ƒ

WebTier compilation engine for business formulas, expressions and complete design

ƒ

Database-based deployment of the reports

ƒ

ƒ

Who we are

What we do

ƒ

Mentoring consultants

ƒ

Mentoring

ƒ

Software Engineers

ƒ

Consulting

ƒ

Educators

ƒ

Training

ƒ

Publications ƒ

Books

ƒ

Articles

ƒ

Blogs

ƒ

Adobe Exchange

Open Source Projects ƒ

DaoFlex

ƒ

FlexBI

ƒ

fAnt

ƒ

log4F

Brief Introduction 2006 Adobe Systems Incorporated. All Rights Reserved.

7

2006 Adobe Systems Incorporated. All Rights Reserved.

DaoFlex: RAD approach to Data Access in Flex

8

DaoFlex At A Glance package com.theriabook.datasource; /**

PRODUCTIVITY ƒ

ƒ

* @daoflex:webservice * pool=jdbc/theriabook

Eliminate the need for manual Java coding of data access tasks

*/ public abstract class Employee { /** * @daoflex:sql

Eliminate the need of manual synchronization of data transfer classes on Java and ActionScript side

ƒ

Eliminate the need of manual synchronization of DataGridColumn definitions with ActionScript classes.

ƒ

And more…

2006 Adobe Systems Incorporated. All Rights Reserved.

* sql= select * from employee where start_date < :startDate * transferType=EmployeeDTO[] * keyColumns=emp_id */ public abstract List getEmployees(Date startDate); }

9

DaoFlex Input: Annotated Abstract Class

ƒ

Code generation solution that completely automates manual Java coding for CRUD (create, retrieve, update, delete) tasks

ƒ

Integrates with Eclipse or works standalone as Ant task

ƒ

Goes all the way from simple annotated Java class to deployed JARs in the WEB-INF/lib

ƒ

Generates all required Java, ActionScript, MXML, XML

2006 Adobe Systems Incorporated. All Rights Reserved.

10

Application Completely Built by DaoFlex

package com.theriabook.datasource; /** * @daoflex:webservice * pool=jdbc/theriabook */ public abstract class Employee { /** * @daoflex:sql * sql= select * from employee where start_date < :startDate * transferType=EmployeeDTO[] * keyColumns=emp_id */ public abstract List getEmployees(Date startDate); } The compete source code of the Employee class is here 2006 Adobe Systems Incorporated. All Rights Reserved.

The deployed sample application is here 11

2006 Adobe Systems Incorporated. All Rights Reserved.

12

2

DaoFlex At A Glance

DaoFlex Process Diagram

package com.theriabook.datasource; /* @daoflex:webservice

Written

* pool=jdbc/theriabook

Annotated abstract Java class

by developer

*/ public abstract class Employee { /* @daoflex:sql * sql= select * from employee where start_date < :startDate

Physical data source pointed by pool=jdbc/theriabook

* transferType=EmployeeDTO[] * keyColumns=emp_id

DaoFlex

*/

DAO

Pre-built + custom DaoFlex

Templates

public abstract List getEmployees(Date startDate);

Assembler

Test MXML

Report metadata

Java DTO

DataGrid

AS DTO

}

ƒ

Code-generation of all required Java, ActionScript, MXML, configuration files is based on the pre-written customizable XSL templates

ƒ

Code generation includes connecting to the database and obtaining result set metadata

ƒ

XSL Templates are processing combined metadata extracted from DB with info extracted from the Doclet tags

2006 Adobe Systems Incorporated. All Rights Reserved.

Java Implementation classes

Generated by DaoFlex

MXML, ActionScript classes

Deployed by DaoFlex

13

2006 Adobe Systems Incorporated. All Rights Reserved.

DaoFlex Directory Structure

JAR with abstract classes

JAR with implementation classes

14

ANT Process Based on DaoFlex

Directory structure can be viewed here 2006 Adobe Systems Incorporated. All Rights Reserved.

15

2006 Adobe Systems Incorporated. All Rights Reserved.

Generated Java DAO: Fill Method public final List getEmployees(java.util.Date startDate) {

16

Generated Java DAO: doUpdate private void doUpdate_getEmployees(Connection conn, ChangeObject co) …{

String sql = "select * from employee where start_date < ? or start_date=?"; …

StringBuffer sql = new StringBuffer("UPDATE EMPLOYEE SET ");

conn = JDBCConnection.getConnection("jdbc/theriabook");

String [] names = co.getChangedPropertyNames();

stmt = conn.prepareStatement(sql);

for (int ii=0; ii < names.length; ii++) {

stmt.setDate(1, DateTimeConversion.toSqlDate(startDate));

sql.append((ii!=0?", ":"") + names[ii] +" = ? ");

rs = stmt.executeQuery();

}

while( rs.next() ) {

sql.append( " WHERE (EMP_ID=?)" );

EmployeeDTO dto = new EmployeeDTO();

stmt = conn.prepareStatement(sql.toString());

dto.EMP_FNAME = rs.getString("EMP_FNAME");

Map values = co.getChangedValues();

dto.SALARY = rs.getDouble("SALARY");

int ii=0;

dto.START_DATE = DateTimeConversion.toUtilDate(rs.getDate("START_DATE"));

for (ii=0; ii < names.length; ii++) {

list.add(dto);

}

stmt.setObject( ii+1, values.get(names[ii])); }

ii++;

return list; // … catch … finally

stmt.setObject(ii++, co.getPreviousValue("EMP_ID"));

}

if (stmt.executeUpdate()==0) throw new DataSyncException(co); }

The full source of the generated JavaDAO can be seen here 2006 Adobe Systems Incorporated. All Rights Reserved.

The full source of the generated JavaDAO can be seen here 17

2006 Adobe Systems Incorporated. All Rights Reserved.

18

3

Generated Java DAO: doCreate private ChangeObject doCreate_getEmployees(Connection conn, ChangeObject co) throws … {

Generated Java DAO: Sync Method public final List searchEmployees_sync(List items) { Connection conn = null;

PreparedStatement stmt = null;

ChangeObject co = null;

String sql = "INSERT INTO EMPLOYEE " + "(EMP_ID, …SALARY,START_DATE)"+ " values (?,…?,?)";

try { conn = JDBCConnection.getPooledConnection("jdbc/theriabook");

stmt = conn.prepareStatement(sql);

Iterator iterator = items.iterator();

EmployeeDTO item = (EmployeeDTO) co.getNewVersion();

while (iterator.hasNext() ) { // Do all deletes first

stmt.setInt(1, item.EMP_ID); . . .

co = (ChangeObject)iterator.next();

stmt.setString(12, item.SS_NUMBER);

if(co.isDelete()) doDelete_searchEmployees(conn, co);

if (Double.isNaN(item.SALARY))

}

stmt.setNull(13,Types.DOUBLE);

iterator = items.iterator(); while (iterator.hasNext()) { // Proceed to all updates next …

else

iterator = items.iterator();

stmt.setDouble(13, item.SALARY);

while (iterator.hasNext()) { // Finish with inserts …

stmt.setDate(14, DateTimeConversion.toSqlDate(item.START_DATE)); . . .

} catch …

if (stmt.executeUpdate()==0) throw new DAOException("Failed inserting.");

} finally {

co.setNewVersion(item);

if( conn!=null ) JDBCConnection.releasePooledConnection(conn);

return co;

}

}

return items; } The full source of the generated JavaDAO can be seen here 2006 Adobe Systems Incorporated. All Rights Reserved.

19

20

2006 Adobe Systems Incorporated. All Rights Reserved.

Generated Java DTO

Generated ActionScript DTO

/* Generated by DAOFLEX Utility (JavaDTO.xsl) */

/* Generated by DAOFLEX Utility (ActionScriptDTO.xsl) */

package com.theriabook.datasource.dto;

package com.theriabook.datasource.dto{ [Managed]

public class EmployeeDTO implements Serializable{

[RemoteClass(alias="com.theriabook.datasource.dto.EmployeeDTO")]

private static final long serialVersionUID = 1L;

public dynamic class EmployeeDTO { public var EMP_ID : Number;

public int EMP_ID;

public var EMP_FNAME : String; . . .

public String EMP_FNAME;

public var SALARY : Number;

public double SALARY; …

public var START_DATE : Date; . . .

public java.util.Date START_DATE; private var _uid:String; private String _uid;

public function get uid():String

public EmployeeDTO() { _uid = UUIDGen.getUUID(); }

public function set uid(value:String):void {_uid = value;

}

public function EmployeeDTO() {_uid = UIDUtil.createUID();

}

{ return _uid; }

public String getUid() { return _uid; } public void setUid(String value) { _uid = value; } }

} //EmployeeDTO } The full source of the generated JavaDAO can be seen here 2006 Adobe Systems Incorporated. All Rights Reserved.

The full source of the generated ActionScriptDTO can be seen here 21

Generated Test MXML Application

2006 Adobe Systems Incorporated. All Rights Reserved.

22

DaoFlex in Action

. . .

Suggest Documents