Class: OCI::DataIntegration::Models::MacroPivotField

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/data_integration/models/macro_pivot_field.rb

Overview

MacroPivotField is used for the PivotField with macro expressions. It can contain the rules according to the macro pattern/attribute added and create new fields according to the PivotKeyValues

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ MacroPivotField

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 65

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.is_use_source_type = attributes[:'isUseSourceType'] unless attributes[:'isUseSourceType'].nil?
  self.is_use_source_type = false if is_use_source_type.nil? && !attributes.key?(:'isUseSourceType') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isUseSourceType and :is_use_source_type' if attributes.key?(:'isUseSourceType') && attributes.key?(:'is_use_source_type')

  self.is_use_source_type = attributes[:'is_use_source_type'] unless attributes[:'is_use_source_type'].nil?
  self.is_use_source_type = false if is_use_source_type.nil? && !attributes.key?(:'isUseSourceType') && !attributes.key?(:'is_use_source_type') # rubocop:disable Style/StringLiterals

  self.expr = attributes[:'expr'] if attributes[:'expr']

  self.use_type = attributes[:'useType'] if attributes[:'useType']

  raise 'You cannot provide both :useType and :use_type' if attributes.key?(:'useType') && attributes.key?(:'use_type')

  self.use_type = attributes[:'use_type'] if attributes[:'use_type']

  self.type = attributes[:'type'] if attributes[:'type']

  self.column_name_pattern = attributes[:'columnNamePattern'] if attributes[:'columnNamePattern']

  raise 'You cannot provide both :columnNamePattern and :column_name_pattern' if attributes.key?(:'columnNamePattern') && attributes.key?(:'column_name_pattern')

  self.column_name_pattern = attributes[:'column_name_pattern'] if attributes[:'column_name_pattern']
end

Instance Attribute Details

#column_name_patternString

column name pattern can be used to generate the name structure of the generated columns. By default column names are of %PIVOT_KEY_VALUE% or %MACRO_INPUT%%PIVOT_KEY_VALUE%, but we can change it something by passing something like MY_PREFIX%PIVOT_KEY_VALUE%MY_SUFFIX or MY_PREFIX%MACRO_INPUT%%PIVOT_KEY_VALUE%MY_SUFFIX which will add custom prefix and suffix to the column name.

Returns:

  • (String)


26
27
28
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 26

def column_name_pattern
  @column_name_pattern
end

#exprOCI::DataIntegration::Models::Expression



16
17
18
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 16

def expr
  @expr
end

#is_use_source_typeBOOLEAN

Specifies whether the type of macro fields is inferred from an expression or useType (false) or the source field (true).

Returns:

  • (BOOLEAN)


13
14
15
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 13

def is_use_source_type
  @is_use_source_type
end

#typeOCI::DataIntegration::Models::BaseType



22
23
24
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 22

def type
  @type
end

#use_typeOCI::DataIntegration::Models::ConfiguredType



19
20
21
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 19

def use_type
  @use_type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 29

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'is_use_source_type': :'isUseSourceType',
    'expr': :'expr',
    'use_type': :'useType',
    'type': :'type',
    'column_name_pattern': :'columnNamePattern'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 42

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'is_use_source_type': :'BOOLEAN',
    'expr': :'OCI::DataIntegration::Models::Expression',
    'use_type': :'OCI::DataIntegration::Models::ConfiguredType',
    'type': :'OCI::DataIntegration::Models::BaseType',
    'column_name_pattern': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



103
104
105
106
107
108
109
110
111
112
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 103

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    is_use_source_type == other.is_use_source_type &&
    expr == other.expr &&
    use_type == other.use_type &&
    type == other.type &&
    column_name_pattern == other.column_name_pattern
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 137

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


117
118
119
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 117

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



126
127
128
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 126

def hash
  [is_use_source_type, expr, use_type, type, column_name_pattern].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



170
171
172
173
174
175
176
177
178
179
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 170

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



164
165
166
# File 'lib/oci/data_integration/models/macro_pivot_field.rb', line 164

def to_s
  to_hash.to_s
end