activefacts-examples 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +22 -0
- data/Rakefile +6 -0
- data/activefacts-examples.gemspec +26 -0
- data/cql/Address.cql +44 -0
- data/cql/Astronomy.cql +35 -0
- data/cql/Blog.cql +54 -0
- data/cql/CinemaBookings.cql +64 -0
- data/cql/CinemaTickets.cql +127 -0
- data/cql/CompanyDirectorEmployee.cql +56 -0
- data/cql/Death.cql +17 -0
- data/cql/Diplomacy.cql +48 -0
- data/cql/Genealogy.cql +98 -0
- data/cql/Health.cql +78 -0
- data/cql/Insurance.cql +320 -0
- data/cql/Marriage.cql +18 -0
- data/cql/Metamodel.cql +567 -0
- data/cql/Monogamy.cql +24 -0
- data/cql/MultiInheritance.cql +22 -0
- data/cql/MultipleSubtyping.cql +30 -0
- data/cql/NonRoleId.cql +14 -0
- data/cql/OddIdentifier.cql +18 -0
- data/cql/OilSupply.cql +53 -0
- data/cql/OneRoleNesting.cql +38 -0
- data/cql/OneToOnes.cql +17 -0
- data/cql/Orienteering.cql +111 -0
- data/cql/PartyModel.cql +38 -0
- data/cql/PersonPlaysGame.cql +18 -0
- data/cql/RedundantDependency.cql +34 -0
- data/cql/SchoolActivities.cql +33 -0
- data/cql/SeparateSubtype.cql +30 -0
- data/cql/ServiceDirector.cql +276 -0
- data/cql/SimplestUnary.cql +12 -0
- data/cql/Supervision.cql +34 -0
- data/cql/VenueSeating.cql +45 -0
- data/cql/WaiterTips.cql +33 -0
- data/cql/Warehousing.cql +101 -0
- data/cql/WindowInRoomInBldg.cql +28 -0
- data/cql/unit.cql +474 -0
- data/diagrams/json/Address.json +41 -0
- data/diagrams/json/Astronomy.json +31 -0
- data/diagrams/json/Blog.json +46 -0
- data/diagrams/json/CinemaBookings.json +53 -0
- data/diagrams/json/CinemaTickets.json +101 -0
- data/diagrams/json/CompanyDirectorEmployee.json +44 -0
- data/diagrams/json/Death.json +20 -0
- data/diagrams/json/Diplomacy.json +34 -0
- data/diagrams/json/Genealogy.json +78 -0
- data/diagrams/json/Insurance.json +259 -0
- data/diagrams/json/Marriage.json +21 -0
- data/diagrams/json/Metamodel.json +318 -0
- data/diagrams/json/Monogamy.json +22 -0
- data/diagrams/json/MultiInheritance.json +25 -0
- data/diagrams/json/MultipleSubtyping.json +22 -0
- data/diagrams/json/OilSupply.json +49 -0
- data/diagrams/json/OneRoleNesting.json +37 -0
- data/diagrams/json/Orienteering.json +94 -0
- data/diagrams/json/PersonPlaysGame.json +22 -0
- data/diagrams/json/RedundantDependency.json +33 -0
- data/diagrams/json/SchoolActivities.json +28 -0
- data/diagrams/json/SeparateSubtype.json +29 -0
- data/diagrams/json/SimplestUnary.json +15 -0
- data/diagrams/json/Supervision.json +27 -0
- data/diagrams/json/VenueSeating.json +40 -0
- data/diagrams/json/WaiterTips.json +29 -0
- data/diagrams/json/Warehousing.json +86 -0
- data/diagrams/json/WindowInRoomInBldg.json +31 -0
- data/images/Address.SQL.png +0 -0
- data/images/Address.png +0 -0
- data/images/Blog.png +0 -0
- data/images/CinemaBookings.png +0 -0
- data/images/CinemaTickets.png +0 -0
- data/images/CompanyDirectorEmployee.png +0 -0
- data/images/Death.png +0 -0
- data/images/Diplomacy.png +0 -0
- data/images/DumpMetamodel.bat +2 -0
- data/images/Genealogy.png +0 -0
- data/images/Insurance/Claim.png +0 -0
- data/images/Insurance/Insurance.png +0 -0
- data/images/Insurance/Person.png +0 -0
- data/images/Insurance/Policy.png +0 -0
- data/images/Insurance/Related.png +0 -0
- data/images/Insurance/VehicleIncident.png +0 -0
- data/images/Marriage.png +0 -0
- data/images/Metamodel/Concepts.png +0 -0
- data/images/Metamodel/Constraints.png +0 -0
- data/images/Metamodel/ContextNote.png +0 -0
- data/images/Metamodel/Diagrams.png +0 -0
- data/images/Metamodel/Language.png +0 -0
- data/images/Metamodel/Legacy.png +0 -0
- data/images/Metamodel/Objects.png +0 -0
- data/images/Metamodel/Populations.png +0 -0
- data/images/Metamodel/Query.png +0 -0
- data/images/Metamodel/Units.png +0 -0
- data/images/Metamodel/ValueConstraints.png +0 -0
- data/images/Metamodel/ValueTypes.png +0 -0
- data/images/MetamodelER.bcp +1 -0
- data/images/MetamodelER.pdf +0 -0
- data/images/MultiInheritance.png +0 -0
- data/images/NorthwindER.png +0 -0
- data/images/OilSupply.png +0 -0
- data/images/Orienteering/Administration.png +0 -0
- data/images/Orienteering/Registration.png +0 -0
- data/images/Orienteering/Scoring.png +0 -0
- data/images/PersonPlaysGame.png +0 -0
- data/images/RedundantDependency.png +0 -0
- data/images/SchoolActivities.png +0 -0
- data/images/SeparateSubtype.png +0 -0
- data/images/SimplestUnary.png +0 -0
- data/images/Supervision.png +0 -0
- data/images/VenueSeating.png +0 -0
- data/images/WaiterTips.png +0 -0
- data/images/Warehousing.png +0 -0
- data/images/WindowInRoomInBldg.png +0 -0
- data/metadata/json/Astronomy.json +175 -0
- data/metadata/json/CinemaBookings.json +354 -0
- data/metadata/json/CinemaTickets.json +768 -0
- data/metadata/json/CompanyDirectorEmployee.json +270 -0
- data/metadata/json/Diplomacy.json +186 -0
- data/metadata/json/Metamodel.json +3214 -0
- data/metadata/json/OilSupply.json +411 -0
- data/metadata/json/SeparateSubtype.json +157 -0
- data/metadata/json/Supervision.json +128 -0
- data/metadata/json/VenueSeating.json +209 -0
- data/orm/.gitignore +11 -0
- data/orm/Address.orm +1268 -0
- data/orm/Astronomy.orm +925 -0
- data/orm/Blog.orm +1711 -0
- data/orm/CinemaBookings.orm +1998 -0
- data/orm/CinemaTickets.orm +5060 -0
- data/orm/CompanyDirectorEmployee.orm +2094 -0
- data/orm/Death.orm +386 -0
- data/orm/Diplomacy.orm +1478 -0
- data/orm/ExampleModels2010.csproj +764 -0
- data/orm/ExampleModels2010.sln +16 -0
- data/orm/Genealogy.orm +3209 -0
- data/orm/Health.orm +2407 -0
- data/orm/Insurance.orm +12727 -0
- data/orm/Marriage.orm +493 -0
- data/orm/Metamodel.orm +20998 -0
- data/orm/Monogamy.orm +328 -0
- data/orm/MultiInheritance.orm +537 -0
- data/orm/MultipleSubtyping.orm +347 -0
- data/orm/OilSupply.orm +2533 -0
- data/orm/OneRoleNesting.orm +1237 -0
- data/orm/Orienteering.orm +3976 -0
- data/orm/PersonPlaysGame.orm +426 -0
- data/orm/RedundantDependency.orm +844 -0
- data/orm/SchoolActivities.orm +961 -0
- data/orm/SeparateSubtype.orm +821 -0
- data/orm/SimplestUnary.orm +172 -0
- data/orm/Supervision.orm +734 -0
- data/orm/VenueSeating.orm +1289 -0
- data/orm/WaiterTips.orm +789 -0
- data/orm/Warehousing.orm +3792 -0
- data/orm/WindowInRoomInBldg.orm +772 -0
- data/rails/models/Astronomy.models +17 -0
- data/rails/models/CinemaBookings.models +123 -0
- data/rails/models/CinemaTickets.models +192 -0
- data/rails/models/Diplomacy.models +126 -0
- data/rails/models/Metamodel.models +894 -0
- data/rails/models/OneRoleNesting.models +18 -0
- data/rails/models/SeparateSubtype.models +49 -0
- data/rails/models/VenueSeating.models +70 -0
- data/rails/schema/Astronomy.schema.rb +25 -0
- data/rails/schema/CinemaBookings.schema.rb +78 -0
- data/rails/schema/CinemaTickets.schema.rb +132 -0
- data/rails/schema/Diplomacy.schema.rb +74 -0
- data/rails/schema/Metamodel.schema.rb +538 -0
- data/rails/schema/OneRoleNesting.rb +20 -0
- data/rails/schema/SeparateSubtype.schema.rb +35 -0
- data/rails/schema/VenueSeating.schema.rb +46 -0
- data/rails/schema/Warehousing.schema.rb +145 -0
- data/ruby/Address.rb +68 -0
- data/ruby/Astronomy.rb +55 -0
- data/ruby/Blog.rb +84 -0
- data/ruby/CinemaBookings.rb +109 -0
- data/ruby/CinemaTickets.rb +218 -0
- data/ruby/CompanyDirectorEmployee.rb +73 -0
- data/ruby/Death.rb +26 -0
- data/ruby/Diplomacy.rb +59 -0
- data/ruby/Genealogy.rb +173 -0
- data/ruby/Insurance.rb +562 -0
- data/ruby/Marriage.rb +21 -0
- data/ruby/Metamodel.rb +621 -0
- data/ruby/Monogamy.rb +27 -0
- data/ruby/MultiInheritance.rb +38 -0
- data/ruby/OilSupply.rb +112 -0
- data/ruby/OneRoleNesting.rb +66 -0
- data/ruby/Orienteering.rb +216 -0
- data/ruby/PersonPlaysGame.rb +31 -0
- data/ruby/RedundantDependency.rb +53 -0
- data/ruby/SchoolActivities.rb +49 -0
- data/ruby/SeparateSubtype.rb +46 -0
- data/ruby/SimplestUnary.rb +10 -0
- data/ruby/Supervision.rb +33 -0
- data/ruby/TwoValues.rb +14 -0
- data/ruby/VenueSeating.rb +64 -0
- data/ruby/WaiterTips.rb +49 -0
- data/ruby/Warehousing.rb +167 -0
- data/ruby/WindowInRoomInBldg.rb +45 -0
- data/sql/server/Address.sql +40 -0
- data/sql/server/Astronomy.sql +36 -0
- data/sql/server/Blog.sql +78 -0
- data/sql/server/CinemaBookings.sql +95 -0
- data/sql/server/CinemaTickets.sql +191 -0
- data/sql/server/CompanyDirectorEmployee.sql +104 -0
- data/sql/server/Death.sql +11 -0
- data/sql/server/Diplomacy.sql +66 -0
- data/sql/server/Genealogy.sql +138 -0
- data/sql/server/Health.sql +169 -0
- data/sql/server/Insurance.sql +484 -0
- data/sql/server/Marriage.sql +30 -0
- data/sql/server/Metamodel.sql +1000 -0
- data/sql/server/Monogamy.sql +20 -0
- data/sql/server/MultiInheritance.sql +27 -0
- data/sql/server/OilSupply.sql +105 -0
- data/sql/server/OneRoleNesting.sql +29 -0
- data/sql/server/Orienteering.sql +186 -0
- data/sql/server/PersonPlaysGame.sql +9 -0
- data/sql/server/RedundantDependency.sql +54 -0
- data/sql/server/SchoolActivities.sql +30 -0
- data/sql/server/SeparateSubtype.sql +33 -0
- data/sql/server/SimplestUnary.sql +9 -0
- data/sql/server/Supervision.sql +30 -0
- data/sql/server/VenueSeating.sql +54 -0
- data/sql/server/WaiterTips.sql +31 -0
- data/sql/server/Warehousing.sql +203 -0
- data/sql/server/WindowInRoomInBldg.sql +13 -0
- data/transform/surrogate/Address.absorption +2 -0
- data/transform/surrogate/Blog.absorption +5 -0
- data/transform/surrogate/CinemaBookings.absorption +7 -0
- data/transform/surrogate/CompanyDirectorEmployee.absorption +7 -0
- data/transform/surrogate/Death.absorption +1 -0
- data/transform/surrogate/Diplomacy-revised.absorption +6 -0
- data/transform/surrogate/Diplomacy.absorption +6 -0
- data/transform/surrogate/Genealogy.absorption +8 -0
- data/transform/surrogate/Insurance.absorption +18 -0
- data/transform/surrogate/Marriage.absorption +2 -0
- data/transform/surrogate/Metamodel.absorption +25 -0
- data/transform/surrogate/Monogamy.absorption +1 -0
- data/transform/surrogate/MultiInheritance.absorption +1 -0
- data/transform/surrogate/MultipleSubtyping.absorption +1 -0
- data/transform/surrogate/OilSupply.absorption +8 -0
- data/transform/surrogate/OneRoleNesting.absorption +1 -0
- data/transform/surrogate/Orienteering.absorption +11 -0
- data/transform/surrogate/PersonPlaysGame.absorption +1 -0
- data/transform/surrogate/RedundantDependency.absorption +3 -0
- data/transform/surrogate/SchoolActivities.absorption +3 -0
- data/transform/surrogate/SeparateSubtype.absorption +3 -0
- data/transform/surrogate/SimplestUnary.absorption +1 -0
- data/transform/surrogate/Supervision.absorption +2 -0
- data/transform/surrogate/WaiterTips.absorption +3 -0
- data/transform/surrogate/Warehousing.absorption +12 -0
- data/transform/surrogate/WindowInRoomInBldg.absorption +1 -0
- data/transform/surrogate/unit.absorption +0 -0
- metadata +374 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
module Concernz
|
|
3
|
+
module AstronomicalObject
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
included do
|
|
6
|
+
self.primary_key = 'astronomical_object_id'
|
|
7
|
+
|
|
8
|
+
# AstronomicalObject is involved in Orbit and Orbit is around AstronomicalObject
|
|
9
|
+
belongs_to :center_via_orbit, :class_name => 'AstronomicalObject', :foreign_key => :orbit_center_astronomical_object_id
|
|
10
|
+
|
|
11
|
+
# Orbit is around AstronomicalObject and Orbit involves AstronomicalObject
|
|
12
|
+
has_many :astronomical_objects_via_orbit, :class_name => 'AstronomicalObject', :foreign_key => :orbit_center_astronomical_object_id, :dependent => :destroy
|
|
13
|
+
|
|
14
|
+
validates :astronomical_object_code, :presence => true
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
|
|
2
|
+
module Concernz
|
|
3
|
+
module Booking
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
included do
|
|
6
|
+
self.primary_key = 'booking_id'
|
|
7
|
+
|
|
8
|
+
# Booking involves Person
|
|
9
|
+
belongs_to :person, :foreign_key => :person_id
|
|
10
|
+
|
|
11
|
+
# Booking involves Session
|
|
12
|
+
belongs_to :session, :foreign_key => :session_id
|
|
13
|
+
|
|
14
|
+
# Booking is involved in Seat Allocation
|
|
15
|
+
has_many :seat_allocations, :class_name => 'SeatAllocation', :foreign_key => :booking_id, :dependent => :destroy
|
|
16
|
+
has_many :seats, :through => :seat_allocations
|
|
17
|
+
|
|
18
|
+
validates :number, :presence => true
|
|
19
|
+
validates :person_id, :presence => true
|
|
20
|
+
validates :session_id, :presence => true
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
module Concernz
|
|
26
|
+
module Cinema
|
|
27
|
+
extend ActiveSupport::Concern
|
|
28
|
+
included do
|
|
29
|
+
self.primary_key = 'cinema_id'
|
|
30
|
+
|
|
31
|
+
# Cinema contains Row and Row contains Seat
|
|
32
|
+
has_many :seats_via_row, :class_name => 'Seat', :foreign_key => :row_cinema_id, :dependent => :destroy
|
|
33
|
+
has_many :row_nrs, :through => :seats_via_row
|
|
34
|
+
|
|
35
|
+
# Cinema is involved in Session
|
|
36
|
+
has_many :sessions, :class_name => 'Session', :foreign_key => :cinema_id, :dependent => :destroy
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
module Concernz
|
|
42
|
+
module Film
|
|
43
|
+
extend ActiveSupport::Concern
|
|
44
|
+
included do
|
|
45
|
+
self.primary_key = 'film_id'
|
|
46
|
+
|
|
47
|
+
# Film is involved in Session
|
|
48
|
+
has_many :sessions, :class_name => 'Session', :foreign_key => :film_id, :dependent => :destroy
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
module Concernz
|
|
54
|
+
module Person
|
|
55
|
+
extend ActiveSupport::Concern
|
|
56
|
+
included do
|
|
57
|
+
self.primary_key = 'person_id'
|
|
58
|
+
|
|
59
|
+
# Person is involved in Booking
|
|
60
|
+
has_many :bookings, :class_name => 'Booking', :foreign_key => :person_id, :dependent => :destroy
|
|
61
|
+
|
|
62
|
+
validates :login_name, :presence => true
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
module Concernz
|
|
68
|
+
module Seat
|
|
69
|
+
extend ActiveSupport::Concern
|
|
70
|
+
included do
|
|
71
|
+
self.primary_key = 'seat_id'
|
|
72
|
+
|
|
73
|
+
# Seat is in Row and Row is in Cinema
|
|
74
|
+
belongs_to :cinema_via_row, :class_name => 'Cinema', :foreign_key => :row_cinema_id
|
|
75
|
+
|
|
76
|
+
# Seat is involved in Seat Allocation
|
|
77
|
+
has_many :seat_allocations, :class_name => 'SeatAllocation', :foreign_key => :allocated_seat_id, :dependent => :destroy
|
|
78
|
+
has_many :bookings, :through => :seat_allocations
|
|
79
|
+
|
|
80
|
+
validates :row_cinema_id, :presence => true
|
|
81
|
+
validates :row_nr, :presence => true
|
|
82
|
+
validates :seat_number, :presence => true
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
module Concernz
|
|
88
|
+
module SeatAllocation
|
|
89
|
+
extend ActiveSupport::Concern
|
|
90
|
+
included do
|
|
91
|
+
# Seat Allocation involves Booking
|
|
92
|
+
belongs_to :booking, :foreign_key => :booking_id
|
|
93
|
+
|
|
94
|
+
# Seat Allocation involves Seat
|
|
95
|
+
belongs_to :allocated_seat, :class_name => 'Seat', :foreign_key => :allocated_seat_id
|
|
96
|
+
|
|
97
|
+
validates :booking_id, :presence => true
|
|
98
|
+
validates :allocated_seat_id, :presence => true
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
module Concernz
|
|
104
|
+
module Session
|
|
105
|
+
extend ActiveSupport::Concern
|
|
106
|
+
included do
|
|
107
|
+
self.primary_key = 'session_id'
|
|
108
|
+
|
|
109
|
+
# Session involves Cinema
|
|
110
|
+
belongs_to :cinema, :foreign_key => :cinema_id
|
|
111
|
+
|
|
112
|
+
# Session involves Film
|
|
113
|
+
belongs_to :film, :foreign_key => :film_id
|
|
114
|
+
|
|
115
|
+
# Session is involved in Booking
|
|
116
|
+
has_many :bookings, :class_name => 'Booking', :foreign_key => :session_id, :dependent => :destroy
|
|
117
|
+
|
|
118
|
+
validates :cinema_id, :presence => true
|
|
119
|
+
validates :date_time_value, :presence => true
|
|
120
|
+
validates :film_id, :presence => true
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
|
|
2
|
+
module Concernz
|
|
3
|
+
module AllocatableCinemaSection
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
included do
|
|
6
|
+
self.primary_key = 'allocatable_cinema_section_id'
|
|
7
|
+
|
|
8
|
+
# AllocatableCinemaSection involves Cinema
|
|
9
|
+
belongs_to :cinema, :foreign_key => :cinema_id
|
|
10
|
+
|
|
11
|
+
validates :cinema_id, :presence => true
|
|
12
|
+
validates :section_name, :presence => true
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
module Concernz
|
|
18
|
+
module Booking
|
|
19
|
+
extend ActiveSupport::Concern
|
|
20
|
+
included do
|
|
21
|
+
self.primary_key = 'booking_id'
|
|
22
|
+
|
|
23
|
+
# Booking involves Person
|
|
24
|
+
belongs_to :person, :foreign_key => :person_id
|
|
25
|
+
|
|
26
|
+
# Booking involves Session
|
|
27
|
+
belongs_to :session, :foreign_key => :session_id
|
|
28
|
+
|
|
29
|
+
# Booking is involved in Places Paid
|
|
30
|
+
has_many :places_paids, :class_name => 'PlacesPaid', :foreign_key => :booking_id, :dependent => :destroy
|
|
31
|
+
|
|
32
|
+
# Booking is involved in Seat Allocation
|
|
33
|
+
has_many :seat_allocations, :class_name => 'SeatAllocation', :foreign_key => :booking_id, :dependent => :destroy
|
|
34
|
+
has_many :seats, :through => :seat_allocations
|
|
35
|
+
|
|
36
|
+
validates :booking_nr, :presence => true
|
|
37
|
+
validates :number, :presence => true
|
|
38
|
+
validates :person_id, :presence => true
|
|
39
|
+
validates :session_id, :presence => true
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
module Concernz
|
|
45
|
+
module Cinema
|
|
46
|
+
extend ActiveSupport::Concern
|
|
47
|
+
included do
|
|
48
|
+
self.primary_key = 'cinema_id'
|
|
49
|
+
|
|
50
|
+
# Cinema is involved in AllocatableCinemaSection
|
|
51
|
+
has_many :allocatable_cinema_sections, :class_name => 'AllocatableCinemaSection', :foreign_key => :cinema_id, :dependent => :destroy
|
|
52
|
+
|
|
53
|
+
# Cinema contains Row and Row contains Seat
|
|
54
|
+
has_many :seats_via_row, :class_name => 'Seat', :foreign_key => :row_cinema_id, :dependent => :destroy
|
|
55
|
+
has_many :row_nrs, :through => :seats_via_row
|
|
56
|
+
|
|
57
|
+
# Cinema is involved in Session
|
|
58
|
+
has_many :sessions, :class_name => 'Session', :foreign_key => :cinema_id, :dependent => :destroy
|
|
59
|
+
|
|
60
|
+
# Cinema is involved in Ticket Pricing
|
|
61
|
+
has_many :ticket_pricings, :class_name => 'TicketPricing', :foreign_key => :cinema_id, :dependent => :destroy
|
|
62
|
+
|
|
63
|
+
validates :name, :presence => true
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
module Concernz
|
|
69
|
+
module Film
|
|
70
|
+
extend ActiveSupport::Concern
|
|
71
|
+
included do
|
|
72
|
+
self.primary_key = 'film_id'
|
|
73
|
+
|
|
74
|
+
# Film is involved in Session
|
|
75
|
+
has_many :sessions, :class_name => 'Session', :foreign_key => :film_id, :dependent => :destroy
|
|
76
|
+
|
|
77
|
+
validates :name, :presence => true
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
module Concernz
|
|
83
|
+
module Person
|
|
84
|
+
extend ActiveSupport::Concern
|
|
85
|
+
included do
|
|
86
|
+
self.primary_key = 'person_id'
|
|
87
|
+
|
|
88
|
+
# Person is involved in Booking
|
|
89
|
+
has_many :bookings, :class_name => 'Booking', :foreign_key => :person_id, :dependent => :destroy
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
module Concernz
|
|
95
|
+
module PlacesPaid
|
|
96
|
+
extend ActiveSupport::Concern
|
|
97
|
+
included do
|
|
98
|
+
self.primary_key = 'places_paid_id'
|
|
99
|
+
|
|
100
|
+
# Places Paid involves Booking
|
|
101
|
+
belongs_to :booking, :foreign_key => :booking_id
|
|
102
|
+
|
|
103
|
+
validates :booking_id, :presence => true
|
|
104
|
+
validates :number, :presence => true
|
|
105
|
+
validates :payment_method_code, :presence => true
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
module Concernz
|
|
111
|
+
module Seat
|
|
112
|
+
extend ActiveSupport::Concern
|
|
113
|
+
included do
|
|
114
|
+
self.primary_key = 'seat_id'
|
|
115
|
+
|
|
116
|
+
# Seat is in Row and Row is in Cinema
|
|
117
|
+
belongs_to :cinema_via_row, :class_name => 'Cinema', :foreign_key => :row_cinema_id
|
|
118
|
+
|
|
119
|
+
# Seat is involved in Seat Allocation
|
|
120
|
+
has_many :seat_allocations, :class_name => 'SeatAllocation', :foreign_key => :allocated_seat_id, :dependent => :destroy
|
|
121
|
+
has_many :bookings, :through => :seat_allocations
|
|
122
|
+
|
|
123
|
+
validates :row_cinema_id, :presence => true
|
|
124
|
+
validates :row_nr, :presence => true
|
|
125
|
+
validates :seat_number, :presence => true
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
module Concernz
|
|
131
|
+
module SeatAllocation
|
|
132
|
+
extend ActiveSupport::Concern
|
|
133
|
+
included do
|
|
134
|
+
# Seat Allocation involves Booking
|
|
135
|
+
belongs_to :booking, :foreign_key => :booking_id
|
|
136
|
+
|
|
137
|
+
# Seat Allocation involves Seat
|
|
138
|
+
belongs_to :allocated_seat, :class_name => 'Seat', :foreign_key => :allocated_seat_id
|
|
139
|
+
|
|
140
|
+
validates :booking_id, :presence => true
|
|
141
|
+
validates :allocated_seat_id, :presence => true
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
module Concernz
|
|
147
|
+
module Session
|
|
148
|
+
extend ActiveSupport::Concern
|
|
149
|
+
included do
|
|
150
|
+
self.primary_key = 'session_id'
|
|
151
|
+
|
|
152
|
+
# Session involves Cinema
|
|
153
|
+
belongs_to :cinema, :foreign_key => :cinema_id
|
|
154
|
+
|
|
155
|
+
# Session involves Film
|
|
156
|
+
belongs_to :film, :foreign_key => :film_id
|
|
157
|
+
|
|
158
|
+
# Session is involved in Booking
|
|
159
|
+
has_many :bookings, :class_name => 'Booking', :foreign_key => :session_id, :dependent => :destroy
|
|
160
|
+
|
|
161
|
+
validates :cinema_id, :presence => true
|
|
162
|
+
validates :film_id, :presence => true
|
|
163
|
+
validates :session_time_year_nr, :presence => true
|
|
164
|
+
validates :session_time_month_nr, :presence => true
|
|
165
|
+
validates :session_time_day, :presence => true
|
|
166
|
+
validates :session_time_hour, :presence => true
|
|
167
|
+
validates :session_time_minute, :presence => true
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
module Concernz
|
|
173
|
+
module TicketPricing
|
|
174
|
+
extend ActiveSupport::Concern
|
|
175
|
+
included do
|
|
176
|
+
self.primary_key = 'ticket_pricing_id'
|
|
177
|
+
|
|
178
|
+
# Ticket Pricing involves Cinema
|
|
179
|
+
belongs_to :cinema, :foreign_key => :cinema_id
|
|
180
|
+
|
|
181
|
+
validates :cinema_id, :presence => true
|
|
182
|
+
validates :high_demand, :presence => true
|
|
183
|
+
validates :price, :presence => true
|
|
184
|
+
validates :section_name, :presence => true
|
|
185
|
+
validates :session_time_year_nr, :presence => true
|
|
186
|
+
validates :session_time_month_nr, :presence => true
|
|
187
|
+
validates :session_time_day, :presence => true
|
|
188
|
+
validates :session_time_hour, :presence => true
|
|
189
|
+
validates :session_time_minute, :presence => true
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
|
|
2
|
+
module Concernz
|
|
3
|
+
module Country
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
included do
|
|
6
|
+
self.primary_key = 'country_id'
|
|
7
|
+
|
|
8
|
+
# Diplomat represents Country
|
|
9
|
+
has_many :diplomats, :class_name => 'Diplomat', :foreign_key => :represented_country_id, :dependent => :destroy
|
|
10
|
+
|
|
11
|
+
# Diplomat serves in Country
|
|
12
|
+
has_many :diplomats, :class_name => 'Diplomat', :foreign_key => :served_country_id, :dependent => :destroy
|
|
13
|
+
|
|
14
|
+
# Country is involved in LanguageUse
|
|
15
|
+
has_many :language_uses, :class_name => 'LanguageUse', :foreign_key => :country_id, :dependent => :destroy
|
|
16
|
+
has_many :languages, :through => :language_uses
|
|
17
|
+
|
|
18
|
+
# Country is involved in Representation
|
|
19
|
+
has_many :representations, :class_name => 'Representation', :foreign_key => :country_id, :dependent => :destroy
|
|
20
|
+
|
|
21
|
+
# Country is involved in Representation
|
|
22
|
+
has_many :representations, :class_name => 'Representation', :foreign_key => :represented_country_id, :dependent => :destroy
|
|
23
|
+
|
|
24
|
+
validates :country_name, :presence => true
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
module Concernz
|
|
30
|
+
module Diplomat
|
|
31
|
+
extend ActiveSupport::Concern
|
|
32
|
+
included do
|
|
33
|
+
self.primary_key = 'diplomat_id'
|
|
34
|
+
|
|
35
|
+
# Diplomat represents Country
|
|
36
|
+
belongs_to :represented_country, :class_name => 'Country', :foreign_key => :represented_country_id
|
|
37
|
+
|
|
38
|
+
# Diplomat serves in Country
|
|
39
|
+
belongs_to :served_country, :class_name => 'Country', :foreign_key => :served_country_id
|
|
40
|
+
|
|
41
|
+
# Diplomat is involved in Fluency
|
|
42
|
+
has_many :fluencies, :class_name => 'Fluency', :foreign_key => :diplomat_id, :dependent => :destroy
|
|
43
|
+
has_many :languages, :through => :fluencies
|
|
44
|
+
|
|
45
|
+
# Diplomat is an Ambassador and Ambassador is involved in Representation
|
|
46
|
+
has_many :representations_via_ambassador, :class_name => 'Representation', :foreign_key => :ambassador_id, :dependent => :destroy
|
|
47
|
+
|
|
48
|
+
validates :diplomat_name, :presence => true
|
|
49
|
+
validates :represented_country_id, :presence => true
|
|
50
|
+
validates :served_country_id, :presence => true
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
module Concernz
|
|
56
|
+
module Fluency
|
|
57
|
+
extend ActiveSupport::Concern
|
|
58
|
+
included do
|
|
59
|
+
# Fluency involves Diplomat
|
|
60
|
+
belongs_to :diplomat, :foreign_key => :diplomat_id
|
|
61
|
+
|
|
62
|
+
# Fluency involves Language
|
|
63
|
+
belongs_to :language, :foreign_key => :language_id
|
|
64
|
+
|
|
65
|
+
validates :diplomat_id, :presence => true
|
|
66
|
+
validates :language_id, :presence => true
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
module Concernz
|
|
72
|
+
module Language
|
|
73
|
+
extend ActiveSupport::Concern
|
|
74
|
+
included do
|
|
75
|
+
self.primary_key = 'language_id'
|
|
76
|
+
|
|
77
|
+
# Language is involved in Fluency
|
|
78
|
+
has_many :fluencies, :class_name => 'Fluency', :foreign_key => :language_id, :dependent => :destroy
|
|
79
|
+
has_many :diplomats, :through => :fluencies
|
|
80
|
+
|
|
81
|
+
# Language is involved in LanguageUse
|
|
82
|
+
has_many :language_uses, :class_name => 'LanguageUse', :foreign_key => :language_id, :dependent => :destroy
|
|
83
|
+
has_many :countries, :through => :language_uses
|
|
84
|
+
|
|
85
|
+
validates :language_name, :presence => true
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
module Concernz
|
|
91
|
+
module LanguageUse
|
|
92
|
+
extend ActiveSupport::Concern
|
|
93
|
+
included do
|
|
94
|
+
# LanguageUse involves Country
|
|
95
|
+
belongs_to :country, :foreign_key => :country_id
|
|
96
|
+
|
|
97
|
+
# LanguageUse involves Language
|
|
98
|
+
belongs_to :language, :foreign_key => :language_id
|
|
99
|
+
|
|
100
|
+
validates :language_id, :presence => true
|
|
101
|
+
validates :country_id, :presence => true
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
module Concernz
|
|
107
|
+
module Representation
|
|
108
|
+
extend ActiveSupport::Concern
|
|
109
|
+
included do
|
|
110
|
+
self.primary_key = 'representation_id'
|
|
111
|
+
|
|
112
|
+
# Representation involves Country
|
|
113
|
+
belongs_to :country, :foreign_key => :country_id
|
|
114
|
+
|
|
115
|
+
# Representation involves Country
|
|
116
|
+
belongs_to :represented_country, :class_name => 'Country', :foreign_key => :represented_country_id
|
|
117
|
+
|
|
118
|
+
# Representation involves Ambassador and Ambassador is a kind of Diplomat
|
|
119
|
+
belongs_to :diplomat_via_ambassador, :class_name => 'Diplomat', :foreign_key => :ambassador_id
|
|
120
|
+
|
|
121
|
+
validates :ambassador_id, :presence => true
|
|
122
|
+
validates :country_id, :presence => true
|
|
123
|
+
validates :represented_country_id, :presence => true
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|