You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2008/06/25 20:38:36 UTC

svn commit: r671626 - in /ode/sandbox/singleshot: app/models/context.rb app/models/person.rb app/models/stakeholder.rb app/models/task.rb db/migrate/20080506015046_create_tasks.rb db/migrate/20080621023051_create_contexts.rb db/schema.rb

Author: assaf
Date: Wed Jun 25 11:38:35 2008
New Revision: 671626

URL: http://svn.apache.org/viewvc?rev=671626&view=rev
Log:
Added contexts.

Added:
    ode/sandbox/singleshot/app/models/context.rb
    ode/sandbox/singleshot/db/migrate/20080621023051_create_contexts.rb
Modified:
    ode/sandbox/singleshot/app/models/person.rb
    ode/sandbox/singleshot/app/models/stakeholder.rb
    ode/sandbox/singleshot/app/models/task.rb
    ode/sandbox/singleshot/db/migrate/20080506015046_create_tasks.rb
    ode/sandbox/singleshot/db/schema.rb

Added: ode/sandbox/singleshot/app/models/context.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/context.rb?rev=671626&view=auto
==============================================================================
--- ode/sandbox/singleshot/app/models/context.rb (added)
+++ ode/sandbox/singleshot/app/models/context.rb Wed Jun 25 11:38:35 2008
@@ -0,0 +1,22 @@
+# == Schema Information
+# Schema version: 20080621023051
+#
+# Table name: contexts
+#
+#  id          :integer         not null, primary key
+#  title       :string(255)     not null
+#  description :string(255)
+#  created_at  :datetime
+#  updated_at  :datetime
+#
+
+class Context < ActiveRecord::Base
+
+  def initialize(attributes = {}) #:nodoc:
+    super
+    self.description ||= ''
+  end
+
+  has_many :tasks
+
+end

Modified: ode/sandbox/singleshot/app/models/person.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/person.rb?rev=671626&r1=671625&r2=671626&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/person.rb (original)
+++ ode/sandbox/singleshot/app/models/person.rb Wed Jun 25 11:38:35 2008
@@ -1,5 +1,5 @@
 # == Schema Information
-# Schema version: 20080506015153
+# Schema version: 20080621023051
 #
 # Table name: people
 #

Modified: ode/sandbox/singleshot/app/models/stakeholder.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/stakeholder.rb?rev=671626&r1=671625&r2=671626&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/stakeholder.rb (original)
+++ ode/sandbox/singleshot/app/models/stakeholder.rb Wed Jun 25 11:38:35 2008
@@ -1,5 +1,5 @@
 # == Schema Information
-# Schema version: 20080506015153
+# Schema version: 20080621023051
 #
 # Table name: stakeholders
 #

Modified: ode/sandbox/singleshot/app/models/task.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/app/models/task.rb?rev=671626&r1=671625&r2=671626&view=diff
==============================================================================
--- ode/sandbox/singleshot/app/models/task.rb (original)
+++ ode/sandbox/singleshot/app/models/task.rb Wed Jun 25 11:38:35 2008
@@ -16,6 +16,7 @@
 #  outcome_type  :string(255)
 #  access_key    :string(32)
 #  data          :text            not null
+#  context_id    :integer         not null
 #  version       :integer         default(0), not null
 #  created_at    :datetime
 #  updated_at    :datetime
@@ -34,6 +35,7 @@
     self.description ||= ''
     self.data ||= {}
     self.access_key = MD5.hexdigest(OpenSSL::Random.random_bytes(128))
+    self.context ||= Context.new(:title=>self.title)
   end
 
   def to_param #:nodoc:
@@ -186,6 +188,7 @@
 
   validates_presence_of :title
 
+  belongs_to :context
 
 
   # --- Task data ---

Modified: ode/sandbox/singleshot/db/migrate/20080506015046_create_tasks.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/db/migrate/20080506015046_create_tasks.rb?rev=671626&r1=671625&r2=671626&view=diff
==============================================================================
--- ode/sandbox/singleshot/db/migrate/20080506015046_create_tasks.rb (original)
+++ ode/sandbox/singleshot/db/migrate/20080506015046_create_tasks.rb Wed Jun 25 11:38:35 2008
@@ -1,19 +1,22 @@
 class CreateTasks < ActiveRecord::Migration
   def self.up
     create_table 'tasks' do |t|
-      t.string    'title',        :null=>false
-      t.string    'description',  :null=>false
-      t.integer   'priority',     :null=>false, :limit=>1
-      t.date      'due_on',       :null=>true
-      t.string    'status',       :null=>false
-      t.string    'perform_url'
-      t.string    'details_url'
-      t.boolean   'integrated_ui'
-      t.string    'outcome_url',  :null=>true
-      t.string    'outcome_type', :null=>true
-      t.string    'access_key',   :null=>true, :limit=>32
-      t.text      'data',         :null=>false
-      t.integer   'version',      :null=>false, :default=>0
+      t.string      'title',        :null=>false
+      t.string      'description',  :null=>false
+      t.integer     'priority',     :null=>false, :limit=>1
+      t.date        'due_on',       :null=>true
+      t.date        'start_by',     :null=>true
+      t.string      'status',       :null=>false
+      t.string      'perform_url'
+      t.string      'details_url'
+      t.string      'instructions'
+      t.boolean     'integrated_ui'
+      t.string      'outcome_url',  :null=>true
+      t.string      'outcome_type', :null=>true
+      t.string      'access_key',   :null=>true, :limit=>32
+      t.text        'data',         :null=>false
+      t.belongs_to  'context',      :null=>false
+      t.integer     'version',      :null=>false, :default=>0
       t.timestamps
     end
   end

Added: ode/sandbox/singleshot/db/migrate/20080621023051_create_contexts.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/db/migrate/20080621023051_create_contexts.rb?rev=671626&view=auto
==============================================================================
--- ode/sandbox/singleshot/db/migrate/20080621023051_create_contexts.rb (added)
+++ ode/sandbox/singleshot/db/migrate/20080621023051_create_contexts.rb Wed Jun 25 11:38:35 2008
@@ -0,0 +1,13 @@
+class CreateContexts < ActiveRecord::Migration
+  def self.up
+    create_table 'contexts' do |t|
+      t.string    'title',        :null=>false
+      t.string    'description',  :null=>true
+      t.timestamps
+    end
+  end
+
+  def self.down
+    drop_table 'contexts'
+  end
+end

Modified: ode/sandbox/singleshot/db/schema.rb
URL: http://svn.apache.org/viewvc/ode/sandbox/singleshot/db/schema.rb?rev=671626&r1=671625&r2=671626&view=diff
==============================================================================
--- ode/sandbox/singleshot/db/schema.rb (original)
+++ ode/sandbox/singleshot/db/schema.rb Wed Jun 25 11:38:35 2008
@@ -9,7 +9,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20080506015153) do
+ActiveRecord::Schema.define(:version => 20080621023051) do
 
   create_table "activities", :force => true do |t|
     t.integer  "person_id"
@@ -18,6 +18,13 @@
     t.datetime "created_at", :null => false
   end
 
+  create_table "contexts", :force => true do |t|
+    t.string   "title",       :null => false
+    t.string   "description"
+    t.datetime "created_at"
+    t.datetime "updated_at"
+  end
+
   create_table "people", :force => true do |t|
     t.string   "identity",                 :null => false
     t.string   "fullname",                 :null => false
@@ -30,10 +37,10 @@
     t.datetime "updated_at"
   end
 
-  add_index "people", ["identity"], :name => "index_people_on_identity", :unique => true
-  add_index "people", ["fullname"], :name => "index_people_on_fullname"
-  add_index "people", ["email"], :name => "index_people_on_email", :unique => true
   add_index "people", ["access_key"], :name => "index_people_on_access_key", :unique => true
+  add_index "people", ["email"], :name => "index_people_on_email", :unique => true
+  add_index "people", ["fullname"], :name => "index_people_on_fullname"
+  add_index "people", ["identity"], :name => "index_people_on_identity", :unique => true
 
   create_table "stakeholders", :force => true do |t|
     t.integer  "task_id",    :null => false
@@ -55,6 +62,7 @@
     t.string   "outcome_type"
     t.string   "access_key",    :limit => 32
     t.text     "data",                                       :null => false
+    t.integer  "context_id",                                 :null => false
     t.integer  "version",                     :default => 0, :null => false
     t.datetime "created_at"
     t.datetime "updated_at"