Warning, /pim/sink/docs/applicationdomaintypes.md is written in an unsupported language. File is not indexed.

0001 ## Domain Types
0002 A set of standardized domain types is defined. This is necessary to decouple applications from resources (so a calendar can access events from all resources), and to have a "language" for queries.
0003 
0004 The definition of the domain model directly affects:
0005 
0006 * granularity for data retrieval (email property, or individual subject, date, ...)
0007 * queriable properties for filtering and sorting (sender, id, ...)
0008 
0009 The purpose of these domain types is strictly to be the interface and the types are not meant to be used by applications directly, or to be restricted by any other specifications (such as ical). By nature these types will be part of the evolving interface, and will need to be adjusted for every new property that an application accesses.
0010 
0011 ### Application Domain Types
0012 This is the currently defined set of types. Hierarchical types are required to be able to query for a result set of mixed types, but are not necessarily structured as such in the inheritance model.
0013 
0014 * Entity
0015     * Domain Object
0016         * Incidence
0017             * Event
0018             * Todo
0019             * Journal
0020             * Freebusy
0021         * Note
0022         * Mail
0023         * Contact
0024         * Collection
0025             * Sink Resource
0026             * Mail Folder
0027             * Calendar
0028             * Todolist
0029             * Journal
0030             * Address Book
0031         * Relation
0032             * Tag
0033             * Contact Group
0034             * Thread
0035     * Sink Resource
0036         * Maildir Resource
0037         * IMAP Resource
0038     * Account
0039 
0040 #### Properties
0041 ```no-highlight
0042 Entity: The smallest unit in the sink universe
0043     id [QByteArray]: unique identifier in the sink storage. Not persistant over db recreations and can therefore only be referenced from within the sink database.
0044 ```
0045 ```no-highlight
0046 Domain Object:
0047     uid [QByteArray}: unique identifier of the domain object.
0048     revision [int]: revision of the entity
0049     resource [SinkResource.id]: The parent resource.
0050 ```
0051 ```no-highlight
0052 Event:
0053     summary [QString]: A string containing a short summary of the event.
0054     startDate [QDateTime]: The start date of the event.
0055     startTime [QDateTime]: The start time of the event. Optional.
0056 ```
0057 ```no-highlight
0058 Mail:
0059     messageId [QByteArray]: The message id.
0060     subject [QString]: The subject of the email.
0061     folder [MailFolder.id]: The parent folder.
0062     date [QDateTime]: The date of the email.
0063     mimeMessage [QString]: A string containing the path to the mime message
0064 ```
0065 ```no-highlight
0066 Mail Folder:
0067     parent [MailFolder.id]: The parent folder.
0068     name [QString]: The user visible name of the folder.
0069     icon [QString]: The name of the icon of the folder.
0070     lastUpdated [QDateTime]: time of last successful update.
0071     count [int]: Number of messages available on the server.
0072     fullDataAvailable [bool]: Inidicates whether the local dataset is complete.
0073 ```
0074 ```no-highlight
0075 Contact:
0076     uid [QByteArray]: The contact uid.
0077     fn [QString]: The full name.
0078     firstName [QString]: The first name.
0079     lastName [QString]: The last name.
0080     addressbook [Addressbook.id]: The parent addressbook.
0081     emails [Email]: The availale email addresses.
0082 ```
0083 ```no-highlight
0084 Addressbook:
0085     parent [Addressbook.id]: The parent addressbook.
0086     name [QString]: The user visible name of the addressbook.
0087     icon [QString]: The name of the icon of the addressbook.
0088     lastUpdated [QDateTime]: time of last successful update.
0089 ```
0090 ```no-highlight
0091 Sink Resource:
0092     type [QByteArray]: The type of the resource.
0093     name [QString]: The name of the resource.
0094     account [Account.id]: The identifier of the associated account.
0095 ```
0096 ```no-highlight
0097 Maildir Resource:
0098     path [QString]: The path to the maildir.
0099 ```
0100 ```no-highlight
0101 Mailtransport Resource:
0102     server [QByteArray]: The server address.
0103     username [QByteArray]: The username.
0104     password [QByteArray]: The password.
0105 ```
0106 ```no-highlight
0107 Account:
0108     name [QString]: The name of the account.
0109     icon [QString]: The name of the icon of the account.
0110 ```
0111 ```no-highlight
0112 Identity:
0113     name [QString]: The name of the identity.
0114     username [QString]: The username.
0115     address [QString]: The email address.
0116     account [Account.id]: The identifier of the associated account.
0117 ```
0118 
0119 ### References/Hierachies
0120 Some domain objects reference others, and that is often used to build hierarchies.
0121 Examples are folder hierachies, tags, todo hierarchies, mail threads, contact groups, etc.
0122 
0123 These references can be built on two levels:
0124 * On the sink entity level: The referenced object *must* be available in local storage, and we're only linking to that specific instance. If the referenced entity is removed, the reference breaks. The reference always only references a single sink entity.
0125 * On the domain object level: The reference can remain also if no object currently matches the reference. The reference automatically applies to new entities containing an object with the referenced uid. More than one entity can be matched if they contain the same domain object.
0126 
0127 #### Examples
0128 The following hierachies exist among others:
0129 
0130 * Parent Collection
0131     * Given by the source (path of the folder in IMAP)
0132     * Parent folder "owns" the sub entity
0133     * Link exists on the sink entity level: We specify where the entity lives, this MUST always be a single parent entity.
0134 * Subtodos
0135     * Given by the todo itself
0136     * Not necessarly owning (though often implemented as such, similar to threading)
0137     * Link exists on domain object level.
0138 * Mail Threads
0139     * Non owning, but a mail always only belongs to one thread.
0140     * Hierarchy given by message-id references in headers and subject + date.
0141     * Link exists on domain object level.
0142 * Contact Groups
0143     * A contact can belong to many groups and the reference is non-owning.
0144     * Link exists on domain object level.
0145 * Tags
0146     * An entity can have many tags
0147     * The tag references the entity, not the other way around.
0148     * Link exists on domain object level.
0149 
0150 #### Example queries:
0151 * All mail folders of a resource
0152 * All threads within date-time range