KDE 4.2 PyKDE API Reference

- KDE's Python API

# Entity Class Reference

`from PyKDE4.akonadi import *`

Subclasses: Akonadi.Collection, Akonadi.Item, Nepomuk.Class, Nepomuk.Property, Nepomuk.Types.Class, Nepomuk.Types.Ontology, Nepomuk.Types.Property
Namespace: Akonadi

## Detailed Description

The base class for Item and Collection.

Entity is the common base class for Item and Collection that provides unique IDs and attributes handling.

This class is not meant to be used directly, use Item or Collection instead.

Author:
  Tobias Koenig <tokoe@kde.org>

## Enumerations

CreateOption | { AddIfMissing }

## Methods

| __init__ (self, Akonadi.Entity other)
| __init__ (self, EntityPrivate dd)
| addAttribute (self, Akonadi.Attribute attribute)
Akonadi.Attribute | attribute (self, QByteArray name)
Akonadi.Attribute.List | attributes (self)
| clearAttributes (self)
bool | hasAttribute (self, QByteArray name)
Id | id (self)
bool | isValid (self)
bool | operator != (self, Akonadi.Entity other)
bool | operator == (self, Akonadi.Entity other)
QString | remoteId (self)
| removeAttribute (self, QByteArray name)
| setId (self, Id identifier)
| setRemoteId (self, QString id)

## Method Documentation

__init__ | ( | self, |
|  | Akonadi.Entity | other
| ) |  |  |

Creates an entity from an other entity.

__init__ | ( | self, |
|  | EntityPrivate | dd
| ) |  |  |

addAttribute | ( | self, |
|  | Akonadi.Attribute | attribute
| ) |  |  |

Adds an attribute to the entity.

If an attribute of the same type name already exists, it is deleted and replaced with the new one.

Parameters:

  | attribute | The new attribute.

Note:
  The entity takes the ownership of the attribute.

Akonadi.Attribute attribute | ( | self, |
|  | QByteArray | name
| ) |  |  |

Returns the attribute of the given type name if available, 0 otherwise.

Akonadi.Attribute.List attributes | ( |  | self ) |

Returns a list of all attributes of the entity.

clearAttributes | ( |  | self ) |

Removes and deletes all attributes of the entity.

bool hasAttribute | ( | self, |
|  | QByteArray | name
| ) |  |  |

Returns true if the entity has an attribute of the given type name, false otherwise.

Id id | ( |  | self ) |

Returns the unique identifier of the entity.

bool isValid | ( |  | self ) |

Returns whether the entity is valid.

bool operator != | ( | self, |
|  | Akonadi.Entity | other
| ) |  |  |

Returns whether the entity's id does not equal the id of the other entity.

bool operator == | ( | self, |
|  | Akonadi.Entity | other
| ) |  |  |

Returns whether the entity's id equals the id of the other entity.

QString remoteId | ( |  | self ) |

Returns the remote id of the entity.

removeAttribute | ( | self, |
|  | QByteArray | name
| ) |  |  |

Removes and deletes the attribute of the given type name.

setId | ( | self, |
|  | Id | identifier
| ) |  |  |

Sets the unique identifier of the entity.

setRemoteId | ( | self, |
|  | QString | id
| ) |  |  |

Sets the remote id of the entity.

## Enumeration Documentation

CreateOption

Describes the options that can be passed to access attributes.

Enumerator:

  AddIfMissing |