ePages 6.11.0 - DE_EPAGES/Core/API/Object/BaseObject.pm

Package DE_EPAGES::Core::API::Object::BaseObject

base class for all objects

Functions

_deleteAttribute
_existsAttribute
default
definedAttributes
delete
deleteSelf
deleteXML
deleteXMLEnd
exportXML
exportXMLAttributes
exportXMLElements
exportableAttributes
get
importXML
importXMLEnd
new
recursiveGet
set
template
tleHash

_deleteAttribute

delete attribute if exists.

Syntax
$Object->_deleteAttribute($Name);
Input
$Name (string)
name of attribute

_existsAttribute

Returns true if attribute exists (not if it's defined).

Syntax
$hValues = $Object->_existsAttribute($Name);
Input
$Name (string)
name of attribute
Return
$Exists (boolean)
attribute exists

default

Returns default attribute values for new objects. Used by DE_EPAGES::Object::Object::Class::defaultAttributes

Syntax
$hValues = #Package::API::Object::#Name->default( $Parent, $aNames, $hInfo );
Example
$hDefaults = $Class->defaultAttributes($Parent, $hInfo); # for insert a new object
$hDefaults = $Object->class->defaultAttributes($Object->parent, $hValues); # for an existing object
Input
$Parent (object)
parent object of the new object
$aNames (ref.array)
list of attribute names
$hInfo (ref.hash)
attribute name => value hash (passed to insert())
Return
$hValues (ref.hash)
hash with default attribute values (name => value)

definedAttributes

Returns all defined attribute values.

Syntax
$hValues = $Object->definedAttributes;
Return
$hValues (hash ref)
name => value pairs

delete

calls $self->deleteSelf.

Syntax
$Object->delete;

deleteSelf

deletes an basic object (this dummy function does nothing)

Syntax
$Object->deleteSelf;

deleteXML

place holder to delete xml data see DE_EPAGES::Object::API::Object::Object::deleteXML. This function will be called at start tag. The end tag calls deleteXMLEnd.

Syntax
$Object = DE_EPAGES::Object::API::BaseObject->deleteXML($Handler, $hElement, $hAttributes);
Input
$Handler (object)
delete handler
$hElement (object)
current xml element
$hAttributes (object)
attributes of xml element
Return
$Object (object)
created object

deleteXMLEnd

place holder to delete xml data see DE_EPAGES::Object::API::Object::Object::deleteXML. This function will be called at end tag. The object will be created on start tag.

Syntax
$Object->deleteXMLEnd($Handler, $hElement, $hAttributes);
Input
$Handler (object)
delete handler
$hElement (object)
current xml element

exportXML

Returns all attributes of object to XML export driver. This base function adds plain and localized attributes in the Attributes hash.

Syntax
$Object->exportXML($Driver);
Input
$Driver (object)
xml export driver with support function addObject
Return
$hAttributes (ref.hash)
attributes and possible child element keys are:
  • Attributes - plain attributes of tag - ref.hash.string
  • Elements - [ 'TagName', \%Parameter ] see $Driver->addElement - ref.array.array
  • Objects - [ 'TagName', $Object ] see $Driver->addObject - ref.array.array

exportXMLAttributes

Returns plain attribute values of the object to XML export driver, i.e. all attributes that are not localizable, objects, hashes or arrays.

Syntax
$hAttributes = $Object->exportXMLAttributes( $hAttributes, $hAllAttributes );
Input
$Driver (object)
xml export driver with support function addObject
$hAllAttributes (ref.hash)
all attribute values
Return
$hAttributes (ref.hash.string)
plain attribute values

exportXMLElements

place holder to export xml data to export sub elements of this object.

Syntax
$Object->exportXMLElements($Driver, $hAllAttributes);
Input
$Driver (object)
export driver
$hAllAttributes (ref.hash.*)
all attributes of object

exportableAttributes

Returns all defined attribute values (used for export object).

Syntax
$hValues = $Object->exportableAttributes;
Return
$hValues (hash ref)
name => value pairs

get

Returns one or more attribute values.

Syntax
$Value = $Object->get( $Name );
$hValues = $Object->get( $aNames );
Example
$Password = $Object->get( 'Password' );
$Password = $Object->get( ['Login', 'Password'] )->{'Password'};
Input
$Name (string)
attribute name
$aNames (array ref)
list of attribute names
Return
$hValues (hash ref)
name => value pairs
$Value (string (or other))
attribute value

importXML

place holder to import xml data see DE_EPAGES::Object::API::Object::Object::importXML. This function will be called at start tag. The end tag calls importXMLEnd.

Syntax
$Object = DE_EPAGES::Object::API::BaseObject->importXML($Handler, $hElement, $Class, $hAttributes);
Input
$Handler (object)
xml import handler with support function addObject
$hElement (ref.hash)
XML element structure, see XML::SAX
$Class (object)
class object; the new object will be an instance of this class
$hAttributes (ref.hash)
attributes hash
Return
$Object (object)
created object

importXMLEnd

place holder to import xml data see DE_EPAGES::Object::API::Object::Object::importXML. This function will be called at end tag. The object will be created on start tag.

Syntax
$Object->importXMLEnd($Handler, $hElement, $hAttributes);
Input
$Handler (object)
import handler
$hElement (object)
current xml element

new

creates an basic object, which is not saved at database as object.

Syntax
$Object = DE_EPAGES::Core::API::BaseObject->new('ObjectID' => $ObjectID );
Input
%Attributes (hash)
attribute value hash
Return
$Object (object)
existing object

recursiveGet

Obsolete. Do not use.

set

Sets attribute values of an object.

Syntax
$Object->set( $Key, $Value );
$Object->set( $hValues );
Example
$Object->set( 'Login', 'ich');
$Object->set( { Login => 'ich', Password => 'geheim' } );
Input
$hValues (hash ref)
name => value pairs

template

this function can overwrite the given template name.

Syntax
$Name = $Object->template($Name);
Input
$Name (string)
include name
Return
$Name (string)
include name

tleHash

returns the tied hash for tle compiler

Syntax
$Object->tleHash;