lib/reality/generators/generator.rb
# Collect all generation targets. This is a map of type to an array of element pairs of that type.
# The element pair includes two elements, the "parent" standard element that is facet as per normal
# and the actual element that is used for generation. The first element is used when checking if
# element is applicable? to be generated while the second is basis of generation.
# i.e.
#
# {
#   :repository => [ [repository, repository] ],
#   :data_module => [ [module1, module1], [module2, module2]],
#   :entity => [[entity1, entity1], [entity2, entity2]],
#   :'keycloak.client' => [[repository, client]],
#   ...
# }
#
Collect all generation targets. This is a map of type to an array of element pairs of that type.
The element pair includes two elements, the "parent" standard element that is facet as per normal
and the actual element that is used for generation. The first element is used when checking if
element is applicable. to be generated while the second is basis of generation.


Collect all generation targets . This is a map of type to an array of element pairs of that type . The element pair includes two elements the " parent " standard element that is facet as per normal and the actual element that is used for generation . The first element is used when checking if element is applicable . to be generated while the second is basis of generation .
def collect_generation_targets(element_type, scope_element, element, targets)
        (targets[element_type] ||= []) << [scope_element, element]
        self.template_set_container.target_manager.targets_by_container(element_type).each do |target|
          next unless self.template_set_container.handle_subelement?(element, target.key)
          subelements = nil
          subscope = nil
          if target.standard?
            subelements = element.send(target.access_method)
          elsif element.facet_enabled?(target.facet_key)
            subelements = element.send(target.facet_key).send(target.access_method)
            subscope = element
          end
          next unless subelements
          subelements = [subelements] unless subelements.is_a?(Array)
          subelements.each do |subelement|
            collect_generation_targets(target.qualified_key, subscope || subelement, subelement, targets)
          end
        end
      end
def collect_generation_targets ( element_type , scope_element , element , targets ) ( targets [ element_type ] ||= [ ] ) << [ scope_element , element ] self . template_set_container . target_manager . targets_by_container ( element_type ) . each do | target | next unless self . template_set_container . handle_subelement? ( element , target . key ) subelements = nil subscope = nil if target . standard? subelements = element . send ( target . access_method ) elsif element . facet_enabled? ( target . facet_key ) subelements = element . send ( target . facet_key ) . send ( target . access_method ) subscope = element end next unless subelements subelements = [ subelements ] unless subelements . is_a? ( Array ) subelements . each do | subelement | collect_generation_targets ( target . qualified_key , subscope || subelement , subelement , targets ) end end end
Collect all generation targets.
Collect all generation targets .
element_type
<not_specific>
scope_element
<not_specific>
element
<not_specific>
targets
<not_specific>