lib/core/core_controller.rb
# controller_update call lorj framework to execute a controller update task
#
# parameters:
# - +object_type+: Lorj object type to use for the update.
# - +params+     : Parameters to use for update.
#
# returns:
# - The controller must return true to inform about the real deletion
controller_update call lorj framework to execute a controller update task
parameters:
+object_type+: Lorj object type to use for the update.
+params+     : Parameters to use for update.

The controller must return true to inform about the real deletion
controller_update call lorj framework to execute a controller update task parameters : + object_type + : Lorj object type to use for the update . + params + : Parameters to use for update . The controller must return true to inform about the real deletion
def controller_update(sObjectType, params = nil)
      _add_instant_config(params)
      controller_params = _get_controller_params(sObjectType,
                                                 :update_e, :update)
      data_obj = @object_data[sObjectType, :ObjectData]
      controller_obj = data_obj[:object]
      is_updated = false
      attributes = data_obj[:attrs]
      attributes.each do |key, value|
        attribute_obj = KeyPath.new(key)
        attribute_map = PrcLib.model.meta_obj.rh_get(sObjectType, :returns,
                                                     attribute_obj.fpath)
        attr_map_obj = KeyPath.new(attribute_map)
        old_value = @controller.get_attr(controller_obj, attr_map_obj.tree)
        next if value == old_value
        is_updated = true
        @controller.set_attr(controller_obj, attr_map_obj.tree, value)
        Lorj.debug(2, '%s.%s - Updating: %s = %s (old : %s)',
                   @process.class, sObjectType, key, value, old_value)
      end
      is_done = @controller.update(sObjectType, data_obj,
                                   controller_params) if is_updated
      PrcLib.runtime_fail "Controller function 'update' must return True or "\
                          "False. Class returned: '%s'",
                          is_done.class unless is_done.boolean?
      Lorj.debug(1, '%s.%s - updated.',
                 @process.class, sObjectType) if is_done
      data_obj.set(controller_obj, sObjectType) do |sObjType, an_object|
        begin
          _return_map(sObjType, an_object)
        rescue => e
          PrcLib.runtime_fail 'update %s.%s : %s',
                              @process.class, sObjectType, e.message
        end
      end
      _remove_instant_config(params)
      is_done
    end
def controller_update ( sObjectType , params = nil ) _add_instant_config ( params ) controller_params = _get_controller_params ( sObjectType , :update_e , :update ) data_obj = @object_data [ sObjectType , :ObjectData ] controller_obj = data_obj [ :object ] is_updated = false attributes = data_obj [ :attrs ] attributes . each do | key , value | attribute_obj = KeyPath . new ( key ) attribute_map = PrcLib . model . meta_obj . rh_get ( sObjectType , :returns , attribute_obj . fpath ) attr_map_obj = KeyPath . new ( attribute_map ) old_value = @controller . get_attr ( controller_obj , attr_map_obj . tree ) next if value == old_value is_updated = true @controller . set_attr ( controller_obj , attr_map_obj . tree , value ) Lorj . debug ( 2 , '%s.%s - Updating: %s = %s (old : %s)' , @process . class , sObjectType , key , value , old_value ) end is_done = @controller . update ( sObjectType , data_obj , controller_params ) if is_updated PrcLib . runtime_fail "Controller function 'update' must return True or " "False. Class returned: '%s'" , is_done . class unless is_done . boolean? Lorj . debug ( 1 , '%s.%s - updated.' , @process . class , sObjectType ) if is_done data_obj . set ( controller_obj , sObjectType ) do | sObjType , an_object | begin _return_map ( sObjType , an_object ) rescue => e PrcLib . runtime_fail 'update %s.%s : %s' , @process . class , sObjectType , e . message end end _remove_instant_config ( params ) is_done end
controller_update call lorj framework to execute a controller update task
parameters:
 +object_type+: Lorj object type to use for the update.
controller_update call lorj framework to execute a controller update task parameters : + object_type + : Lorj object type to use for the update .
# Need to detect data updated and update the Controler object with the # controler
sObjectType
<not_specific>
params
<not_specific>