class ActiveFacts::Metamodel::ValueType

Public Instance Methods

as_cql() click to toggle source
# File lib/activefacts/generators/cql.rb, line 641
def as_cql
  parameters =
    [ length != 0 || scale != 0 ? length : nil,
      scale != 0 ? scale : nil
    ].compact
  parameters = parameters.length > 0 ? "("+parameters.join(",")+")" : ""

  "#{name
    } #{
      (is_independent ? '[independent] ' : '')
    }is written as #{
      (supertype || self).name
    }#{
      parameters
    }#{
      unit && " "+unit.name
    }#{
      transaction_phase && " auto-assigned at "+transaction_phase
    }#{
      concept.all_context_note_as_relevant_concept.map do |cn|
        cn.verbalise
      end.join("\n")
    }#{
      value_constraint && " "+value_constraint.describe
    };"
end
inject_surrogate() click to toggle source
# File lib/activefacts/generators/transform/surrogate.rb, line 73
def inject_surrogate
  trace :transform_surrogate, "Adding surrogate ID to Value Type #{name}"
  add_surrogate('Auto Counter', 'ID')
end
needs_surrogate() click to toggle source
# File lib/activefacts/generators/transform/surrogate.rb, line 69
def needs_surrogate
  !is_auto_assigned
end