lib/core/core_process.rb
# Function to execute an object update. This function returns a Lorj::Data
# of type :object, refreshed.
#
# It uses the event 'refresh_e'. If not defined, the refresh is simply not
# executed. No warning exposed, but a debug info is thrown.
#
# refresh_e is defined and called as follow:
#
# BaseDefinition class derived function. This Process function should do any
# task required to execute a refresh of the object passed.
# The controller object data should be extracted by the controller_refresh
# call to refresh :attrs. See #controller_refresh.
# It should return true or false if the object refresh was done successfully
# or not
#
# It is possible to call directly the controller_refresh as the process
# event
#
# * *args*:
#   - object_type: The object_type to refresh
#   - object     : The Lorj::Data object to refresh
#
# * *returns*:
#   - boolean : true if refresh was executed successfully.
#     false otherwise.
#
# From the object itself, you can call object.refresh. This will call this
# function.
#
# The controller event usually called is controller_refresh.
#
# * *Args* :
#   - +object_type+ : Meta object type to query.
#   - +config+      : Optional. Hash containing list of data to use for
# updating.
#
# * *Returns* :
#   - boolean : true if the refresh was executed successfully.
#     false otherwise.
#
# * *Raises* :
#   - Warning if the Config data passed are not required by the meta object
#     (or dependencies) at creation time.
#   - Error if ObjectType has never been declared.
#   - Error if the dependencies get_e process handler did not return any
#     data. (nil) - Loop detection.
#   - Error if the get_e process handler raise an error.
#
Function to execute an object update. This function returns a Lorj::Data
of type :object, refreshed.

It uses the event 'refresh_e'. If not defined, the refresh is simply not
executed. No warning exposed, but a debug info is thrown.

refresh_e is defined and called as follow.

BaseDefinition class derived function. This Process function should do any
task required to execute a refresh of the object passed.
The controller object data should be extracted by the controller_refresh
call to refresh :attrs.

It is possible to call directly the controller_refresh as the process
event



*returns*:
boolean : true if refresh was executed successfully.
false otherwise.

From the object itself, you can call object.refresh. This will call this
function.

The controller event usually called is controller_refresh.

*Args* :
+object_type+ : Meta object type to query.
+config+      : Optional. Hash containing list of data to use for
updating.

*Returns* :
boolean : true if the refresh was executed successfully.
false otherwise.

*Raises* :
Warning if the Config data passed are not required by the meta object
(or dependencies) at creation time.
Error if ObjectType has never been declared.
Error if the dependencies get_e process handler did not return any
data. (nil) - Loop detection.
Error if the get_e process handler raise an error.
Function to execute an object update . This function returns a Lorj :: Data of type : object refreshed . It uses the event ' refresh_e ' . If not defined the refresh is simply not executed . No warning exposed but a debug info is thrown . refresh_e is defined and called as follow . BaseDefinition class derived function . This Process function should do any task required to execute a refresh of the object passed . The controller object data should be extracted by the controller_refresh call to refresh : attrs . It is possible to call directly the controller_refresh as the process event * returns * : boolean : true if refresh was executed successfully . false otherwise . From the object itself you can call object . refresh . This will call this function . The controller event usually called is controller_refresh . * Args * : + object_type + : Meta object type to query . + config + : Optional . Hash containing list of data to use for updating . * Returns * : boolean : true if the refresh was executed successfully . false otherwise . * Raises * : Warning if the Config data passed are not required by the meta object ( or dependencies ) at creation time . Error if ObjectType has never been declared . Error if the dependencies get_e process handler did not return any data . ( nil ) - Loop detection . Error if the get_e process handler raise an error .
def process_refresh(object)
      return nil unless object.is_a?(Lorj::Data) && object.type == :object &&
                        !object.empty?
      object_type = object.object_type?
      unless PrcLib.model.meta_obj.rh_exist?(object_type)
        PrcLib.runtime_fail "$s.%s: '%s' is not a known object type.",
                            self.class, __callee__, object_type
      end
      proc = PrcLib.model.meta_obj.rh_get(object_type, :lambdas, :refresh_e)
      if proc.nil?
        Lorj.debug(1, "No 'refresh_e' event found for object type '%s'",
                   object_type)
        return false
      end
      ret = @process.method(proc).call(object_type, object)
      unless ret.boolean?
        Lorj.debug(1, "'%s' has not returned a boolean. Consider return false.",
                   object_type)
        ret = false
      end
      ret
    end
def process_refresh ( object ) return nil unless object . is_a? ( Lorj :: Data ) && object . type == :object && ! object . empty? object_type = object . object_type? unless PrcLib . model . meta_obj . rh_exist? ( object_type ) PrcLib . runtime_fail "$s.%s: '%s' is not a known object type." , self . class , __callee__ , object_type end proc = PrcLib . model . meta_obj . rh_get ( object_type , :lambdas , :refresh_e ) if proc . nil? Lorj . debug ( 1 , "No 'refresh_e' event found for object type '%s'" , object_type ) return false end ret = @process . method ( proc ) . call ( object_type , object ) unless ret . boolean? Lorj . debug ( 1 , "'%s' has not returned a boolean. Consider return false." , object_type ) ret = false end ret end
Function to execute an object update.
Function to execute an object update .
object
<not_specific>