Class: ActiveFacts::Metamodel::SurrogateKey
- Defined in:
- lib/activefacts/metamodel/metamodel.rb,
lib/activefacts/metamodel/extensions.rb
Constant Summary
Constants inherited from Component
Component::RANK_DISCRIMINATOR, Component::RANK_FOREIGN, Component::RANK_IDENT, Component::RANK_INDICATOR, Component::RANK_INJECTION, Component::RANK_MANDATORY, Component::RANK_MULTIPLE, Component::RANK_NON_MANDATORY, Component::RANK_SCOPING, Component::RANK_SUBTYPE, Component::RANK_SUPER, Component::RANK_SURROGATE, Component::RANK_VALUE
Instance Method Summary collapse
Methods inherited from Injection
Methods inherited from Mapping
#all_leaf, #inspect, #is_mandatory, #path_mandatory, #re_rank, #root, #show_trace, #validate_members
Methods inherited from Component
#all_role, #data_type, #depth, #fork_to_new_parent, #in_foreign_key, #in_primary_index, #inspect, #is_mandatory, #leaves, #narrow_value_constraint, #parent_entity_type, #path, #path_mandatory, #primary_index_components, #rank_key, #rank_kind, #rank_path, #root, #show_trace, #uncache_rank_key
Instance Method Details
#comment ⇒ Object
2248 2249 2250 2251 2252 2253 2254 2255 2256 |
# File 'lib/activefacts/metamodel/extensions.rb', line 2248 def comment if parent && (c = parent.comment) != '' return c end if fkf = all_foreign_key_field.single return fkf.foreign_key.composite.mapping.name + ' surrogate key' end (parent ? parent.name + ' ' : '') + 'surrogate key' end |
#is_auto_assigned ⇒ Object
2241 2242 2243 2244 2245 2246 |
# File 'lib/activefacts/metamodel/extensions.rb', line 2241 def is_auto_assigned # It's auto-assigned if it's in its root's primary_index and is not a foreign key field root and (root.primary_index.all_index_field.detect{|ixf| ixf.component == self}) and (!all_foreign_key_field.detect{|fkf| fkf.foreign_key.source_composite == self.root}) end |
#is_identifying ⇒ Object
2234 2235 2236 2237 2238 2239 |
# File 'lib/activefacts/metamodel/extensions.rb', line 2234 def if pk = root.primary_index return pk.all_index_field.detect{|ixf| ixf.component == self} end !parent.parent end |