Class: Lorj::BaseController
Overview
Defining basic Controller functions
Instance Method Summary collapse
-
#connect(_sObjectType, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Create functions.
-
#controller_error(msg, *p) ⇒ Object
Simply raise an error.
-
#create(_sObjectType, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Create functions.
-
#delete(_sObjectType, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Delete functions.
-
#get(_sObjectType, _sUniqId, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Get functions.
-
#query(_sObjectType, _sQuery, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Query functions.
-
#required?(oParams, *key) ⇒ Boolean
check if required data is loaded.
-
#update(_sObjectType, _oObject, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Update functions.
Instance Method Details
#connect(_sObjectType, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Create functions.
33 34 35 |
# File 'lib/core/lorj_basecontroller.rb', line 33 def connect(_sObjectType, _hParams) controller_error 'connect has not been redefined by the controller.' end |
#controller_error(msg, *p) ⇒ Object
Simply raise an error
-
Args :
-
Msg: Error message to print out.
-
-
Returns :
-
nil
-
-
Raises :
-
Lorj::PrcError
75 76 77 78 |
# File 'lib/core/lorj_basecontroller.rb', line 75 def controller_error(msg, *p) msg = format(msg, *p) fail Lorj::PrcError.new, format('%s: %s', self.class, msg) end |
#create(_sObjectType, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Create functions.
39 40 41 |
# File 'lib/core/lorj_basecontroller.rb', line 39 def create(_sObjectType, _hParams) controller_error 'create_object has not been redefined by the controller.' end |
#delete(_sObjectType, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Delete functions.
45 46 47 |
# File 'lib/core/lorj_basecontroller.rb', line 45 def delete(_sObjectType, _hParams) controller_error 'delete_object has not been redefined by the controller.' end |
#get(_sObjectType, _sUniqId, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Get functions.
51 52 53 |
# File 'lib/core/lorj_basecontroller.rb', line 51 def get(_sObjectType, _sUniqId, _hParams) controller_error 'get_object has not been redefined by the controller.' end |
#query(_sObjectType, _sQuery, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Query functions.
57 58 59 |
# File 'lib/core/lorj_basecontroller.rb', line 57 def query(_sObjectType, _sQuery, _hParams) controller_error 'query_object has not been redefined by the controller.' end |
#required?(oParams, *key) ⇒ Boolean
check if required data is loaded. raise an error if not
-
Args :
-
Params: Lorj::ObjectData object for controller. -
key: Key to check.
-
-
Returns :
-
nil
-
-
Raises :
-
Errorif the key do not exist.
-
89 90 91 92 93 |
# File 'lib/core/lorj_basecontroller.rb', line 89 def required?(oParams, *key) return if oParams.exist?(key) controller_error '%s is not set.', key end |
#update(_sObjectType, _oObject, _hParams) ⇒ Object
Default handlers which needs to be defined by the controller, called by BaseDefinition Update functions.
63 64 65 |
# File 'lib/core/lorj_basecontroller.rb', line 63 def update(_sObjectType, _oObject, _hParams) controller_error 'update_object has not been redefined by the controller.' end |