Class: ActiveFacts::Metamodel::ValueType

Inherits:
Object
  • Object
show all
Defined in:
lib/activefacts/generators/cql.rb,
lib/activefacts/generators/transform/surrogate.rb

Instance Method Summary collapse

Instance Method Details

#as_cqlObject



639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'lib/activefacts/generators/cql.rb', line 639

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_surrogateObject



73
74
75
76
# 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_surrogateObject



69
70
71
# File 'lib/activefacts/generators/transform/surrogate.rb', line 69

def needs_surrogate
  !is_auto_assigned
end