# class Entity

###

Module | akonadi
Namespace | Akonadi
Class | Entity
Inherits |

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>

### enums

- CreateOption { AddIfMissing }

enum details

### methods

- Entity (other)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  other | Akonadi.Entity |

  Creates an entity from an other entity.

- Entity (dd)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  dd | EntityPrivate |

- addAttribute (attribute)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  attribute | Akonadi.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.

  attribute - The new attribute.

  The entity takes the ownership of the attribute.

- attribute (name)

  returns Akonadi.Attribute

  Argument | Type | Default
  --- | --- | ---
  name | QByteArray |

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

- attributes ( )

  returns Akonadi.Attribute.List

  Returns a list of all attributes of the entity.

- clearAttributes ( )

  returns Nothing

  Removes and deletes all attributes of the entity.

- hasAttribute (name)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  name | QByteArray |

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

- id ( )

  returns Id

  Returns the unique identifier of the entity.

- isValid ( )

  returns bool

  Returns whether the entity is valid.

- operator != (other)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  other | Akonadi.Entity |

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

- operator == (other)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  other | Akonadi.Entity |

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

- remoteId ( )

  returns QString

  Returns the remote id of the entity.

- removeAttribute (name)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  name | QByteArray |

  Removes and deletes the attribute of the given type name.

- setId (id)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  id | Id |

  Sets the unique identifier of the entity.

- setRemoteId (id)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  id | QString |

  Sets the remote id of the entity.

### enums - detail

- CreateOption { AddIfMissing }

  Describes the options that can be passed to access attributes.

  | AddIfMissing | - | - |