Package DE_EPAGES::Object::API::Object::Class
object interface for Class.
Base |
DE_EPAGES::Object::API::Object::Object |
Functions
- allDefaultAttributes
- attribute
- attributePackages
- attributes
- baseClass
- baseClasses
- className
- cloneAttributes
- dalObject
- dbPackage
- defaultAttributes
- deleteAttribute
- deleteObjects
- directAttribute
- directAttributes
- directObjects
- directSubClasses
- existsAttribute
- existsDirectAttribute
- existsObject
- findObjects
- getObjects
- insertAttribute
- insertObject
- insertSubClass
- isSubClassOf
- loadObject
- multiObjects
- objects
- packageObject
- subClasses
- updateAttribute
allDefaultAttributes
Returns hash of default attribute values of this class (including undef for not defined defaults).
Syntax |
$hValues = $Class->allDefaultAttributes($Parent, $hInfo); |
Input |
|
Return |
|
attribute
Returns information about an attribute.
Syntax |
$hAttribute = $Class->attribute( $Alias ); |
Input |
|
Return |
|
attributePackages
Returns all attribute packages and the corresponding attribute names.
Syntax |
$haPackages = $Class->attributePackages |
Return |
|
attributes
Returns all attributes of a class, including inherited ones.
Syntax |
$aAttributes = $Class->attributes; |
Return |
|
baseClass
Returns the base class or undef if the class does not have a base class.
Syntax |
$BaseClass = $Class->baseClass; |
Return |
|
baseClasses
Returns all base classes recursively in ascending order, i.e. the Object class (which has no other base class) is the first array element. This array includes the given class as last element.
Syntax |
$aBaseClasses = $Class->baseClasses; |
Return |
|
className
Returns the class name, used for DAL access.
Syntax |
$ClassName = $Class->className; |
Return |
|
cloneAttributes
call cloneAttribute for each attribute package
Syntax |
$Class->cloneAttributes($Object, $Clone); |
Input |
|
dalObject
Returns the dal (database abstration layer) of objects of this class, not of the class it self ($Class->dal).
Syntax |
$DAL = $Class->dalObject; |
Return |
|
dbPackage
Returns the database package, used for DAL access.
Syntax |
$DbPackage = $Class->dbPackage; |
Return |
|
defaultAttributes
Returns hash of default attribute values of this class.
Syntax |
$hValues = $Class->defaultAttributes($Parent, $hInfo); |
Input |
|
Return |
|
deleteAttribute
Deletes an attribute from the class.
Syntax |
$Deleted = $Class->deleteAttribute( $Alias ); |
Input |
|
Return |
|
deleteObjects
Removes matching objects.
Syntax |
$Class->deleteObjects($IndexName, $hParameter); |
Input |
|
directAttribute
Returns the attribute object with this alias exists in the class and is defined in this class (not in a base class).
Syntax |
$Attribute = $Class->directAttribute( $Alias ) |
Input |
|
Return |
|
directAttributes
Returns all direct attributes of a class (not including inherited ones).
Syntax |
$aAttributes = $Class->directAttributes; |
Return |
|
directObjects
Returns all objects that are directly instanciated from this class.
Syntax |
$aObjects = $Class->directObjects; |
Example |
$_->delete foreach @{ $Class->directObjects }; |
Return |
|
directSubClasses
Returns all direct sub classes of a class (not recursively).
Syntax |
$aSubClasses = $Class->directSubClasses; |
Return |
|
existsAttribute
Returns true if an attribute with this name exists in the class.
Syntax |
$Exists = $Class->existsAttribute( $Alias ) |
Example |
if( $Class->existsAttribute( 'MinOrderLevel' ) ) { ... } |
Input |
|
Return |
|
existsDirectAttribute
Returns true if an attribute with this alias exists in the class and is defined in this class (not in a base class).
Syntax |
$Exists = $Class->existsDirectAttribute( $Alias ) |
Example |
if( $Class->existsDirectAttribute( 'MinOrderLevel' ) ) { ... } |
Input |
|
Return |
|
existsObject
Returns true if the object of this class exists in the database.
Syntax |
$Exists = $Class->existsObject($ObjectID); |
Input |
|
Return |
|
findObjects
Returns matching objects identifiers by index.
Syntax |
$aObjectIDs = $Class->findObjects($IndexName, $hParameter); |
Input |
|
Return |
|
getObjects
Returns matching objects by index.
Syntax |
$aObjects = $Class->getObjects($IndexName, $hParameter); $aObjects = $Class->getObjects($IndexName, $aParameter); $aObjects = $Class->getObjects('ByParentID', { ObjectID => $ObjectID, Alias => $Alias, }); |
Example |
$Class = LoadClassByAlias('Object'); $aObjects = $Class->getObjects('ByParentID', [$ObjectID]); $aObjects = $Class->getObjects('ByParentID', [$ObjectID, $Alias]); |
Input |
|
Return |
|
insertAttribute
Adds a new attribute to the class.
Syntax |
$Class->insertAttribute( $hAttribute ); |
Input |
|
Return |
|
insertObject
Creates a new object instance of this class with the given attribute values.
Syntax |
$Object = $Class->insertObject($hValues); |
Example |
$Product = $ProductType->insertObject({ Parent => $Shop->child('Products'), Alias => '08/15', }); |
Input |
|
Return |
|
insertSubClass
Creates a new sub class. The default package is 'DE_EPAGES::Object::API::Object::Object'.
Syntax |
$SubClass = $Class->insertSubClass($hClass); |
Input |
|
Return |
|
isSubClassOf
Returns true if the class is a sub class of the class or one of its sub classes.
Syntax |
$IsSubClass = $Class->isSubClassOf( $Class ) $IsSubClass = $Class->isSubClassOf( $ClassName ) |
Example |
my $ClassProduct = LoadClassByAlias( 'Product' ); if( $Class->isSubClassOf( $ClassProduct ) ) { ... } if( $Class->isSubClassOf('Product' ) ) { ... } |
Input |
|
Return |
|
loadObject
Returns object from id of this class.
Syntax |
$Object = $Class->loadObject($ObjectID, $LoadIt); |
Input |
|
Return |
|
multiObjects
Returns multiple objects by object id.
Syntax |
$aObjects = $Class->multiObjects($aIDs); |
Input |
|
Return |
|
objects
Returns all objects that are direct or indirect instances of this class.
Syntax |
$aObjects = $Class->objects; |
Example |
$_->delete foreach @{ $Class->objects }; |
Return |
|
packageObject
Returns the perl package of objects of this class. The returned package was imported via use before.
Syntax |
$Package = $Class->packageObject; |
Return |
|
subClasses
Returns all known sub classes of a class recursively.
Syntax |
$aSubClasses = $Class->subClasses; |
Return |
|
updateAttribute
Updates properties of an attribute.
Syntax |
$Class->updateAttribute( $Alias, $hAttribute ); |
Input |
|