Class: Es::HIDField
Constant Summary
Constants inherited from Field
Field::ATTRIBUTE_TYPE, Field::AUTOINCREMENT_TYPE, Field::DATE_TYPE, Field::DURATION_TYPE, Field::FACT_TYPE, Field::FIELD_TYPES, Field::HID_TYPE, Field::HISTORIC_TYPE, Field::IS_DELETED_TYPE, Field::RECORDID_TYPE, Field::SNAPSHOT_TYPE, Field::TIMEATTRIBUTE_TYPE, Field::TIMESTAMP_TYPE, Field::TIME_TYPE, Field::VELOCITY_TYPE
Instance Attribute Summary collapse
-
#entity ⇒ Object
Returns the value of attribute entity.
-
#fieldsInner ⇒ Object
Returns the value of attribute fieldsInner.
-
#name ⇒ Object
Returns the value of attribute name.
-
#through ⇒ Object
Returns the value of attribute through.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, type, options) ⇒ HIDField
constructor
A new instance of HIDField.
- #is_hid? ⇒ Boolean
- #to_config_generator_extract ⇒ Object
- #to_extract_fragment(pid, fields, options = {}) ⇒ Object
Methods inherited from Field
#==, #is_attribute?, #is_autoincrement?, #is_date?, #is_duration?, #is_fact?, #is_recordid?, #is_snapshot?, #is_timestamp?, #is_velocity?, parse, #to_config_generator, #to_load_config, #to_load_fragment
Constructor Details
#initialize(name, type, options) ⇒ HIDField
Returns a new instance of HIDField.
757 758 759 760 761 762 763 |
# File 'lib/es.rb', line 757 def initialize(name, type, ) name = "#{name}-#{[:entity]}" super(name, type) @entity = [:entity] || fail("Entity has to be scpecified for a HID Field") @fieldsInner = [:fields] || fail("Fields has to be scpecified for a HID Field") @through = [:through] end |
Instance Attribute Details
#entity ⇒ Object
Returns the value of attribute entity.
751 752 753 |
# File 'lib/es.rb', line 751 def entity @entity end |
#fieldsInner ⇒ Object
Returns the value of attribute fieldsInner.
751 752 753 |
# File 'lib/es.rb', line 751 def fieldsInner @fieldsInner end |
#name ⇒ Object
Returns the value of attribute name.
751 752 753 |
# File 'lib/es.rb', line 751 def name @name end |
#through ⇒ Object
Returns the value of attribute through.
751 752 753 |
# File 'lib/es.rb', line 751 def through @through end |
#type ⇒ Object
Returns the value of attribute type.
751 752 753 |
# File 'lib/es.rb', line 751 def type @type end |
Instance Method Details
#is_hid? ⇒ Boolean
753 754 755 |
# File 'lib/es.rb', line 753 def is_hid? true end |
#to_config_generator_extract ⇒ Object
789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 |
# File 'lib/es.rb', line 789 def to_config_generator_extract if through.empty? then { :hid => { :from_entity => entity, :from_fields => fields.map{|f| f} } } else { :hid => { :from_entity => entity, :from_fields => fields.map{|f| f}, :connected_through => through } } end end |
#to_extract_fragment(pid, fields, options = {}) ⇒ Object
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 |
# File 'lib/es.rb', line 765 def to_extract_fragment(pid, fields, = {}) { :name => name, :preferred => name, :definition => { :ops => [ through.nil? ? {:type => RECORDID_TYPE} : {:type => "stream", :data => through}, { :type => "entity", :data => entity, :ops => fieldsInner.map do |f| { :type => "stream", :data => f } end } ], :type => "historicid" } } end |