Sha256: cc70931f7761baa28d1aee69a18f34c3830b19916a3b761a67ddb82367941491

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'activefacts/api'

module ::Supervision

  class CompanyName < String
    value_type 
    one_to_one :company                         # See Company.company_name
  end

  class EmployeeNr < SignedInteger
    value_type :length => 32
  end

  class Company
    identified_by :company_name
    has_one :ceo, :class => "CEO", :mandatory => true  # See CEO.all_company
    one_to_one :company_name, :mandatory => true  # See CompanyName.company
  end

  class Employee
    identified_by :company, :employee_nr
    has_one :company, :mandatory => true        # See Company.all_employee
    has_one :employee_nr, :mandatory => true    # See EmployeeNr.all_employee
    has_one :manager                            # See Manager.all_employee
  end

  class Manager < Employee
  end

  class CEO < Manager
  end

  class CEOShareholding
    identified_by :ceo, :company
    has_one :ceo, :class => CEO, :mandatory => true  # See CEO.all_ceo_shareholding
    has_one :company, :mandatory => true        # See Company.all_ceo_shareholding
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activefacts-examples-1.9.9 ruby/Supervision.rb
activefacts-examples-1.9.8 ruby/Supervision.rb