extending oracle e-business suite with ruby on rails

47
Extending Oracle E-Business Suite with Ruby on Rails

Upload: rsim

Post on 18-May-2015

2.354 views

Category:

Technology


1 download

DESCRIPTION

Presentation at Oracle OpenWorld 2011

TRANSCRIPT

Page 1: Extending Oracle E-Business Suite with Ruby on Rails

Extending OracleE-Business Suite

withRuby on Rails

Page 2: Extending Oracle E-Business Suite with Ruby on Rails

Raimonds Simanovskis

github.com/rsim

@rsim

.com

Page 3: Extending Oracle E-Business Suite with Ruby on Rails

Why to extendOracle

E-BusinessSuite?

Page 4: Extending Oracle E-Business Suite with Ruby on Rails

Customize or extend functionality

Page 5: Extending Oracle E-Business Suite with Ruby on Rails

Embed EBS data in other systems

Page 6: Extending Oracle E-Business Suite with Ruby on Rails

Simplify and make usable

Page 7: Extending Oracle E-Business Suite with Ruby on Rails

Simplify and make usable

Page 8: Extending Oracle E-Business Suite with Ruby on Rails

Simplify and make usable

Page 9: Extending Oracle E-Business Suite with Ruby on Rails

How to extendOracle

E-BusinessSuite?

Page 10: Extending Oracle E-Business Suite with Ruby on Rails

Release 11, 1998Custom

Forms, Reports,PL/SQL

PL/SQL

Page 11: Extending Oracle E-Business Suite with Ruby on Rails

Self-Service Web Applications 11, 1998

PL/SQL generated web pages

PL/SQL

Page 12: Extending Oracle E-Business Suite with Ruby on Rails

Self-Service Web Applications 11i, 2000

PL/SQL => JSPJava

Page 13: Extending Oracle E-Business Suite with Ruby on Rails

OA Framework 11i, ~2005

JSP => full MVC framework

Java

Page 14: Extending Oracle E-Business Suite with Ruby on Rails

OA Framework 12, 2007

or maybe move to ADF?

“My general advice is to stick with OAF so long as you are working with the E-Business Suite, and wait until you move to the Fusion

Applications before moving to ADF”-- Steven Chan

Java

Page 15: Extending Oracle E-Business Suite with Ruby on Rails

Oracle E-Business Suite today

ADF?

APEX?“New Whitepaper: Extending E-Business Suite

12.1.3 using Oracle Application Express”

“Extending Oracle E-Business Suite with Oracle ADF and Oracle SOA Suite”

Java

PL/SQL

Page 16: Extending Oracle E-Business Suite with Ruby on Rails

Do not blindly trust what

Oracle is recommending...

Page 17: Extending Oracle E-Business Suite with Ruby on Rails

Many Open-SourceWeb Technologies

CSS 3Raphaël.js

Page 18: Extending Oracle E-Business Suite with Ruby on Rails

What is Ruby on Rails?

Page 19: Extending Oracle E-Business Suite with Ruby on Rails

Ruby isobject-oriented

dynamic

programming language

simple from outside

powerful insideYukihiro

Matsumotoor “Matz”

Page 20: Extending Oracle E-Business Suite with Ruby on Rails

Ruby on RailsWeb applications development framework

Developed in Ruby

Extracted from 37signals Basecamp application

Open source software

Focused on developer productivity

Agile software development approach

Page 21: Extending Oracle E-Business Suite with Ruby on Rails

Main principles

DRY - Don’t Repeat Yourself

Convention over Configuration

Opinionated software

Page 22: Extending Oracle E-Business Suite with Ruby on Rails

MVC Architecture

ActionController

ActiveRecord

ActionView

Browser

Request Router

Res

pons

e

Database

SQL

Page 23: Extending Oracle E-Business Suite with Ruby on Rails

class CreatePosts < ActiveRecor::Migration def self.up create_table :posts do |t| t.string :title t.text :body t.timestamps end endend

Active Record (Model)CREATE TABLE posts ( id NUMBER(38) NOT NULL, title VARCHAR2(255), body CLOB, created_at DATE, updated_at DATE);CREATE SEQUENCE posts_seq;

class Post < ActiveRecord::Base # nothing here!endpost = Post.newpost.title = "First post"post.savepost = Post.find(1)puts post.name # output: "First post"

Page 24: Extending Oracle E-Business Suite with Ruby on Rails

Action Controllerclass PostsController < ApplicationController def index @posts = Post.all end

def show @post = Post.find(params[:id]) end

def new @post = Post.new end

# ...end

Page 25: Extending Oracle E-Business Suite with Ruby on Rails

Action View

<h1>Posts</h1><% @posts.each do |post| %> <h2><%= post.title %></h2> <h3>Created at <%= post.created_at %></h3> <p><%= post.body %></p><% end %>

Page 26: Extending Oracle E-Business Suite with Ruby on Rails

ActiveRecordOracle enhanced

adapter

Page 27: Extending Oracle E-Business Suite with Ruby on Rails

Multi-platform support

Ruby 1.8.7 Ruby 1.9.2 JRuby

ruby-oci8 ruby-oci8 JDBC

oracle_enhanced adapter

Page 28: Extending Oracle E-Business Suite with Ruby on Rails

Oracle Data TypesRuby Rails Oracle

Fixnum :integer NUMBERFloat :float NUMBER

BigDecimal :decimal NUMBER, DECIMALTime :datetime DATETime :time DATEDate :date DATEString :string VARCHAR2String :text CLOBString :binary BLOB

True/FalseClass :boolean NUMBER(1), CHAR(1)

Page 29: Extending Oracle E-Business Suite with Ruby on Rails

Existing database schemas

class Employee < ActiveRecord::Base set_table_name "hr_employees" set_primary_key "employee_id" set_sequence_name "hr_employee_s"

set_date_columns :hired_on, :birth_date_on set_datetime_columns :last_login_time

set_boolean_columns :manager, :active

ignore_table_columns :attribute1, :attribute2end

Page 30: Extending Oracle E-Business Suite with Ruby on Rails

PL/SQL calls from Ruby(old way)

require "oci8"conn = OCI8.new("hr","hr","xe")

cursor = conn.parse <<-EOSBEGIN :return := test_uppercase(:p_string);END;EOScursor.bind_param(':p_string',"xxx",String)cursor.bind_param(':return',nil,String,4000)cursor.execputs cursor[':return']cursor.close

Page 31: Extending Oracle E-Business Suite with Ruby on Rails

ruby-plsql library

gem install ruby-plsql

require "ruby-plsql"plsql.connect! "hr","hr","xe"

puts plsql.test_uppercase('xxx')

Page 32: Extending Oracle E-Business Suite with Ruby on Rails

ruby-plsql libraryplsql.connect! "hr","hr","xe"

plsql.test_uppercase('xxx') # => "XXX"plsql.test_uppercase(:p_string => 'xxx') # => "XXX"plsql.test_copy("abc", nil, nil) # => { :p_to => "abc", # :p_to_double => "abcabc" }plsql.test_copy(:p_from => "abc", :p_to => nil, :p_to_double => nil) # => { :p_to => "abc", # :p_to_double => "abcabc" }plsql.hr.test_uppercase('xxx') # => "XXX"plsql.test_package.test_uppercase('xxx') # => 'XXX'plsql.hr.test_package.test_uppercase('xxx') # => 'XXX'

plsql.logoff

Page 33: Extending Oracle E-Business Suite with Ruby on Rails

ActiveRecordwith

PL/SQLCRUD

procedures

class Employee < ActiveRecord::Base set_create_method do plsql.employees_pkg.create_employee( :p_first_name => first_name, :p_last_name => last_name, :p_employee_id => nil )[:p_employee_id] end set_update_method do plsql.employees_pkg.update_employee( :p_employee_id => id, :p_first_name => first_name, :p_last_name => last_name ) end set_delete_method do plsql.employees_pkg.delete_employee( :p_employee_id => id ) endend

Page 34: Extending Oracle E-Business Suite with Ruby on Rails

Demo

Page 35: Extending Oracle E-Business Suite with Ruby on Rails

Ruby on Rails on Oracle E-Business Suite

Oracle EBS Database

ActionController

ActiveRecord

ActionView

Browser

Request Router

Res

pons

e

APPS schemaXXAPP_% viewsXXAPP_% packages

XXAPP schemaadditional application tables

EBS module schemasEBS module schemasEBS module schemasEBS module schemas

Page 36: Extending Oracle E-Business Suite with Ruby on Rails

AdditionalRuby libraries

database_loader

oracle_ebs_authentication

ruby-plsql-spec

Page 37: Extending Oracle E-Business Suite with Ruby on Rails

Deployment options

Apache Java app sever

Ruby mod_passengerApplication WAR file

JRuby Gems

ApplicationApplication

Application source

Page 38: Extending Oracle E-Business Suite with Ruby on Rails

References

Page 39: Extending Oracle E-Business Suite with Ruby on Rails

mydatacrmdata

mytime

Rails on OracleE-Business Suite

Page 40: Extending Oracle E-Business Suite with Ruby on Rails
Page 41: Extending Oracle E-Business Suite with Ruby on Rails
Page 42: Extending Oracle E-Business Suite with Ruby on Rails
Page 43: Extending Oracle E-Business Suite with Ruby on Rails
Page 44: Extending Oracle E-Business Suite with Ruby on Rails
Page 45: Extending Oracle E-Business Suite with Ruby on Rails
Page 46: Extending Oracle E-Business Suite with Ruby on Rails

Why Rails?Fast agile / iterative development

Flexible HTML/CSS/JavaScript front-end

Test-driven development support

Easy to put on top of legacy applications

Open-source with liberal license

Libraries for all new “cool” technologies