Extending Oracle E-Business Suite with Ruby on Rails

2,985 views
2,687 views

Published on

Presentation at Oracle OpenWorld 2011

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,985
On SlideShare
0
From Embeds
0
Number of Embeds
36
Actions
Shares
0
Downloads
38
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Extending Oracle E-Business Suite with Ruby on Rails

  1. 1. Extending OracleE-Business Suite with Ruby on Rails
  2. 2. Raimonds Simanovskis github.com/rsim @rsim .com
  3. 3. Why to extend Oracle E-Business Suite?
  4. 4. Customize or extend functionality
  5. 5. Embed EBS data in other systems
  6. 6. Simplify and make usable
  7. 7. Simplify and make usable
  8. 8. Simplify and make usable
  9. 9. How to extend Oracle E-Business Suite?
  10. 10. Release 11, 1998 Custom Forms, Reports, PL/SQLPL/SQL
  11. 11. Self-Service Web Applications 11, 1998 PL/SQL generated web pagesPL/SQL
  12. 12. Self-Service WebApplications 11i, 2000 PL/SQL => JSP Java
  13. 13. OA Framework 11i, ~2005 JSP => full MVC framework Java
  14. 14. OA Framework 12, 2007 or maybe move to ADF? “My general advice is to stick with OAF solong as you are working with the E-Business Suite, and wait until you move to the Fusion Applications before moving to ADF” Java -- Steven Chan
  15. 15. Oracle E-Business Suite today ADF? Java “Extending Oracle E-Business Suite with Oracle ADF and Oracle SOA Suite” APEX?PL/SQL “New Whitepaper: Extending E-Business Suite 12.1.3 using Oracle Application Express”
  16. 16. Do not blindly trust what Oracle isrecommending...
  17. 17. Many Open-Source Web TechnologiesCSS 3 Raphaël.js
  18. 18. What isRuby on Rails?
  19. 19. Ruby is object-oriented dynamic programming language simple from outside YukihiroMatsumoto or “Matz” powerful inside
  20. 20. Ruby on Rails Web applications development framework Developed in RubyExtracted from 37signals Basecamp application Open source software Focused on developer productivity Agile software development approach
  21. 21. Main principlesDRY - Don’t Repeat YourselfConvention over Configuration Opinionated software
  22. 22. MVC Architecture Request Router Database SQLBrowser Response Action Active Controller RecordAction View
  23. 23. Active Record (Model)class CreatePosts < ActiveRecor::Migration def self.up create_table :posts do |t| CREATE TABLE posts ( t.string :title id NUMBER(38) NOT t.text :body NULL, t.timestamps title VARCHAR2(255), end body CLOB, end created_at DATE,end 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"
  24. 24. 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
  25. 25. 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 %>
  26. 26. ActiveRecordOracle enhanced adapter
  27. 27. Multi-platform support oracle_enhanced adapter Ruby 1.8.7 Ruby 1.9.2 JRuby ruby-oci8 ruby-oci8 JDBC
  28. 28. Oracle Data Types Ruby Rails Oracle Fixnum :integer NUMBER Float :float NUMBER BigDecimal :decimal NUMBER, DECIMAL Time :datetime DATE Time :time DATE Date :date DATE String :string VARCHAR2 String :text CLOB String :binary BLOBTrue/FalseClass :boolean NUMBER(1), CHAR(1)
  29. 29. Existing database schemasclass 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
  30. 30. PL/SQL calls from Ruby (old way) require "oci8" conn = OCI8.new("hr","hr","xe") cursor = conn.parse <<-EOS BEGIN :return := test_uppercase(:p_string); END; EOS cursor.bind_param(:p_string,"xxx",String) cursor.bind_param(:return,nil,String,4000) cursor.exec puts cursor[:return] cursor.close
  31. 31. ruby-plsql librarygem install ruby-plsqlrequire "ruby-plsql"plsql.connect! "hr","hr","xe"puts plsql.test_uppercase(xxx)
  32. 32. 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) # => XXXplsql.hr.test_package.test_uppercase(xxx) # => XXXplsql.logoff
  33. 33. class Employee < ActiveRecord::Base set_create_method do plsql.employees_pkg.create_employee( :p_first_name => first_name,ActiveRecord :p_last_name => last_name, :p_employee_id => nil )[:p_employee_id] with end set_update_method do PL/SQL plsql.employees_pkg.update_employee( :p_employee_id => id, :p_first_name => first_name, CRUD ) :p_last_name => last_name procedures end set_delete_method do plsql.employees_pkg.delete_employee( :p_employee_id => id ) end end
  34. 34. Demo
  35. 35. Ruby on Rails on Oracle E-Business Suite Request RouterBrowser Oracle EBS Database Response XXAPP schema Action additional Controller application tables EBS module EBS module EBS module schemas EBS moduleAction schemas schemas schemas View APPS schema XXAPP_% views Active XXAPP_% packages Record
  36. 36. Additional Ruby libraries database_loaderoracle_ebs_authentication ruby-plsql-spec
  37. 37. Deployment options Application source Apache Java app sever Application WAR fileRuby mod_passenger JRuby Gems Application Application
  38. 38. References
  39. 39. Rails on Oracle E-Business Suitemytimemydatacrmdata
  40. 40. Why Rails? Fast agile / iterative development Test-driven development supportFlexible HTML/CSS/JavaScript front-endEasy to put on top of legacy applicationsLibraries for all new “cool” technologies Open-source with liberal license
  41. 41. More information Demo app source code:https://github.com/rsim/rails_ebs_demohttp://github.com/rsim/oracle-enhanced http://blog.rayapps.com

×