NAME

SIAM::Object - the base class for all SIAM object (including the root).

SYNOPSIS

INSTANCE METHODS

new

$new_object = new SIAM::Object($driver, $id)

Instantiates a new object. The method expects a driver object and an Object ID.

get_contained_objects

my $list = $object->get_contained_objects($classname, $options);

Fetches the list of contained objects of a given class. Returns arrayref of SIAM::Object instances. This is the preferred method of instantiating new objects instead of manually calling the new method.

It is assumed that the class name is already known to Perl, and the corresponding module was loaded with use or require.

Without the options, the method retrieves all available objects. Options may define a filter criteria as follows:

my $list =
  $siam->get_contained_objects('SIAM::Contract', {
      'match_attribute' => [ 'object.access_scope_id',
                                ['SCOPEID01', 'SCOPEID02'] ]
    });

Currently only one filter condition is supported.

id

Returns a value of object.id attribute

attr

$val = $contract->attr('contract.inventory_id');

Returns a value of an attribute.

attributes

Returns a hashref with copies of all object attributes.

is_root

Returns true if the object is a root.

is_predefined

Returns true if the object is a predefined object (the one with the ID starting with SIAM.)

CLASS METHODS

validate_driver

Takes a driver object as an argument and verifies if it implements all required methods. returns true if all required methods are present. It issues critical error messages in case of missing methods.

had_error

Returns true in case of an error;

errmsg

Returns the error string with the error details.

set_log_manager

Sets a log manager. Unless a log manager is set, all warnings and errors are sent to STDERR. The method expects one argument, an object which implements the following methods:

  • debug

  • info

  • warn, warning

  • error, err

  • critical, fatal

Classes that suit as log managers: Log::Handler, Log::Log4perl, ...

debug, info, warning, error, critical

These methods dispatch a message to the log manager. If the log manager is undefined, all except debug() print the message to STDERR with a preceeding timestamp.

error() and critical() also set the error status and error message.

PRIVATE METHODS

_driver

Returns the driver object

_print_stderr

Prints a message to STDERR with a preceeding timestamp