Class: Es::VelocityField

Inherits:
Field
  • Object
show all
Defined in:
lib/es.rb

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

Instance Method Summary collapse

Methods inherited from Field

#==, #is_attribute?, #is_autoincrement?, #is_date?, #is_duration?, #is_fact?, #is_hid?, #is_recordid?, #is_snapshot?, #is_timestamp?, parse, #to_config_generator, #to_config_generator_extract, #to_load_config, #to_load_fragment

Constructor Details

#initialize(name, type, options = {}) ⇒ VelocityField

Returns a new instance of VelocityField.



876
877
878
879
# File 'lib/es.rb', line 876

def initialize(name, type, options = {})
  super(name, type)
  @control_attribute = options[:control_attribute] || "StageName"
end

Instance Attribute Details

#control_attributeObject

Returns the value of attribute control_attribute.



874
875
876
# File 'lib/es.rb', line 874

def control_attribute
  @control_attribute
end

#nameObject

Returns the value of attribute name.



874
875
876
# File 'lib/es.rb', line 874

def name
  @name
end

#typeObject

Returns the value of attribute type.



874
875
876
# File 'lib/es.rb', line 874

def type
  @type
end

Instance Method Details

#is_velocity?Boolean

Returns:

  • (Boolean)


881
882
883
# File 'lib/es.rb', line 881

def is_velocity?
  true
end

#to_extract_fragment(pid, fields, options = {}) ⇒ Object



885
886
887
888
889
890
891
892
893
894
895
896
897
# File 'lib/es.rb', line 885

def to_extract_fragment(pid, fields, options = {})
  {
    :name => "StageVelocity",
    :preferred => "stagevelocity",
    :definition => {
        :type => "velocity",
        :ops => [{
            :type => "stream",
            :data => control_attribute
        }]
    }
  }
end