extending oracle e-business suite with ruby on rails

Post on 18-May-2015

2.354 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Presentation at Oracle OpenWorld 2011

TRANSCRIPT

Extending OracleE-Business Suite

withRuby on Rails

Raimonds Simanovskis

github.com/rsim

@rsim

.com

Why to extendOracle

E-BusinessSuite?

Customize or extend functionality

Embed EBS data in other systems

Simplify and make usable

Simplify and make usable

Simplify and make usable

How to extendOracle

E-BusinessSuite?

Release 11, 1998Custom

Forms, Reports,PL/SQL

PL/SQL

Self-Service Web Applications 11, 1998

PL/SQL generated web pages

PL/SQL

Self-Service Web Applications 11i, 2000

PL/SQL => JSPJava

OA Framework 11i, ~2005

JSP => full MVC framework

Java

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

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

Do not blindly trust what

Oracle is recommending...

Many Open-SourceWeb Technologies

CSS 3Raphaël.js

What is Ruby on Rails?

Ruby isobject-oriented

dynamic

programming language

simple from outside

powerful insideYukihiro

Matsumotoor “Matz”

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

Main principles

DRY - Don’t Repeat Yourself

Convention over Configuration

Opinionated software

MVC Architecture

ActionController

ActiveRecord

ActionView

Browser

Request Router

Res

pons

e

Database

SQL

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"

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

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 %>

ActiveRecordOracle enhanced

adapter

Multi-platform support

Ruby 1.8.7 Ruby 1.9.2 JRuby

ruby-oci8 ruby-oci8 JDBC

oracle_enhanced adapter

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)

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

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

ruby-plsql library

gem install ruby-plsql

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

puts plsql.test_uppercase('xxx')

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

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

Demo

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

AdditionalRuby libraries

database_loader

oracle_ebs_authentication

ruby-plsql-spec

Deployment options

Apache Java app sever

Ruby mod_passengerApplication WAR file

JRuby Gems

ApplicationApplication

Application source

References

mydatacrmdata

mytime

Rails on OracleE-Business Suite

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

top related