Object Model » History » Version 1
Eric Vieillevigne, 05/12/2015 08:46 AM
| 1 | 1 | Eric Vieillevigne | h1. Object Model (general) |
|---|---|---|---|
| 2 | |||
| 3 | This wiki page documents general principle about the Object Model of the application, such as account, owner, author, etc... |
||
| 4 | |||
| 5 | h2. Owner and owned objects |
||
| 6 | |||
| 7 | h3. OWNERS |
||
| 8 | |||
| 9 | Objects in the database may be either 'owner' or 'owned' objects. |
||
| 10 | |||
| 11 | _OWNER_ objects are main objects of the application that can be retrived directly from the database using their ID or another identifier. |
||
| 12 | They are like-entry points in the database. There are two owners objects at the moment in the application: |
||
| 13 | * Accounts |
||
| 14 | * Families |
||
| 15 | |||
| 16 | > |
||
| 17 | > Owner objects are main entry points of the database. That means in case of database horizontal partitioning, two owners may be located on different databases. |
||
| 18 | > |
||
| 19 | > *OwnerId are LONG which are unique across all kind of owners* |
||
| 20 | > |
||
| 21 | |||
| 22 | h3. OWNED |
||
| 23 | |||
| 24 | Other objects are owner by accounts or families. For instance: |
||
| 25 | * messages, |
||
| 26 | * contact, |
||
| 27 | * events, |
||
| 28 | * profile, |
||
| 29 | * setting, |
||
| 30 | * location, etc... |
||
| 31 | |||
| 32 | > |
||
| 33 | > That means that you cannot retrieve directly a message from the application, you must have his OWNER before, and any database access to a specific message will be |
||
| 34 | done in the context of his owner. Typically it is entirely possible that messages with a different owners could be stored in different databases. |
||
| 35 | > |
||
| 36 | |||
| 37 | h3. Kind of Owned objects |
||
| 38 | |||
| 39 | There are several kind of owned objects: |
||
| 40 | * Owned by accounts and public: owned by account and any accounts belonging to the same family (or other groups) can access those objects (IModelObject). |
||
| 41 | * Owned by accounts and private: owned by account and only the owner can access the object. |
||
| 42 | * Owned by family: any account of the family can access this object. |
||
| 43 | |||
| 44 | h3. MetaId |
||
| 45 | |||
| 46 | Ids of object are expressed as a string and shall be considered as OPAQUE by any client. |
||
| 47 | |||
| 48 | However in many cases such ids are MetaId and the syntax of such ids are |
||
| 49 | |||
| 50 | <pre> <ObjectType>/<OwnerId>_<ObjectId>_<SubId> </pre> |
||
| 51 | |||
| 52 | * ObjectType define the type of objects such as account, contact, etc... |
||
| 53 | * OwnerId is a long being the internal id of the owner. Any one type of object can only have one type of owner so the Id is unambiguous. |
||
| 54 | * ObjectId is a long internal id of the object. In case of a owner, it is not present. |
||
| 55 | * SubId is an optional information. |
||
| 56 | * accountId is simply represented by a long, there is no ObjectType/ |
||
| 57 | |||
| 58 | For instance: |
||
| 59 | * thread/282_16766 is a message thread of id=16766 which belong to the family 282 (the fact that this is a family and not an account is bound by the nature of thread) |
||
| 60 | * place/282_3522 is a place of id=3522 which belong to the family 282 (idem) |
||
| 61 | * event/282_4725_2012 is an event of id=4725 which belong to the family 282 (idem) and the subId=2012 indicate that this is the recurence of year=2012 for a bday. |
||
| 62 | * 123 is the id of the account 123 |
||
| 63 | * family/63 is the id of the family 63 |
||
| 64 | |||
| 65 | h2. AUTHOR |
||
| 66 | |||
| 67 | * _AUTHOR_ is representing who has created the object. It has specifically much sense for object owned by the family such as Events or Contacts. |
||
| 68 | It is represented in the database and in the JSON by the attribute *accountId* |
||
| 69 | |||
| 70 | h2. Special cases of messages |
||
| 71 | |||
| 72 | Message management is a little bit strange in regard to those aspects (owner, author), so they are specifically explained here: |
||
| 73 | |||
| 74 | # Messages are _Owned by accounts and private_ : that means that you can only see your messages |
||
| 75 | # When somebody send a message, *two objects* are created: one message for the sender (in the sent-box) and one for the recipient. |
||
| 76 | # The message for the sender is owned by the sender so he can see it in his view of the message thread. |
||
| 77 | # The message for the recipiend is owned by the recipiend so he can see it in his view of the message thread. |
||
| 78 | |||
| 79 | > |
||
| 80 | > This enables to have a email-like behavior: if the sender is deleting a thread of messages, the recipient's thread is left unchanged. Same for read/unread flag |
||
| 81 | > |