Akonadi.Entity

KDE 4.7 PyKDE API Reference

- KDE's Python API

# Entity Class Reference

`from PyKDE4.akonadi import *`

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)
| addAttribute (self, Akonadi.Attribute attribute)
Akonadi.Attribute | attribute (self, QByteArray name)
[Akonadi.Attribute] | attributes (self)
| clearAttributes (self)
bool | hasAttribute (self, QByteArray name)
long | id (self)
bool | isValid (self)
bool | operator != (self, Akonadi.Entity other)
bool | operator == (self, Akonadi.Entity other)
Akonadi.Collection | parentCollection (self)
QString | remoteId (self)
QString | remoteRevision (self)
| removeAttribute (self, QByteArray name)
| setId (self, long identifier)
| setParentCollection (self, Akonadi.Collection parent)
| setRemoteId (self, QString id)
| setRemoteRevision (self, QString revision)

## Method Documentation

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

Creates an entity from an other entity.

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 requested type or 0 if it is not available.

[Akonadi.Attribute] 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 whether the entity has an attribute of the requested type.

long 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.

Akonadi.Collection parentCollection | ( |  | self ) |

Returns a reference to the parent collection of this object.

Note:
  This will of course only return a useful value if it was explictly retrieved from the Akonadi server.

Since:
  4.4

QString remoteId | ( |  | self ) |

Returns the remote id of the entity.

QString remoteRevision | ( |  | self ) |

Returns the remote revision of the entity.

Note:
  This method is supposed to be used by resources only.

Since:
  4.5

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

Removes and deletes the attribute of the requested type.

setId | ( | self, |
|  | long | identifier
| ) |  |  |

Sets the unique identifier of the entity.

setParentCollection | ( | self, |
|  | Akonadi.Collection | parent
| ) |  |  |

Set the parent collection of this object.

Note:
  Calling this method has no immediate effect for the object itself, such as being moved to another collection. It is mainly relevant to provide a context for RID-based operations inside resources.

Parameters:

  | parent | The parent collection.

Since:
  4.4

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

Sets the remote id of the entity.

setRemoteRevision | ( | self, |
|  | QString | revision
| ) |  |  |

Sets the remote revision of the entity.

The remote revision can be used by resources to store some revision information of the backend to detect changes there.

Note:
  This method is supposed to be used by resources only.

Since:
  4.5

## Enumeration Documentation

CreateOption

Describes the options that can be passed to access attributes.

Enumerator:

  AddIfMissing |