|
|
Line 4: |
Line 4: |
| | | |
| The deliverable component is described in [[Task_Management_Method#Deliverable|"Task Management Method"]]. The deliverables in the project are stored in a table in the project database. Since the name does not have to be unique, a deliverable has to have a unique id which can be generated as a integer primary key [http://www.sqlite.org/lang_createtable.html#rowid] by the database [http://www.sqlite.org/lang_createtable.html#rowid]. Since a deliverable represents a graphical element, it has a position, a width and a height. When using a true-type font, the width and height will be determined when the task is displayed. | | The deliverable component is described in [[Task_Management_Method#Deliverable|"Task Management Method"]]. The deliverables in the project are stored in a table in the project database. Since the name does not have to be unique, a deliverable has to have a unique id which can be generated as a integer primary key [http://www.sqlite.org/lang_createtable.html#rowid] by the database [http://www.sqlite.org/lang_createtable.html#rowid]. Since a deliverable represents a graphical element, it has a position, a width and a height. When using a true-type font, the width and height will be determined when the task is displayed. |
| + | |
| + | == Constraints == |
| | | |
| The following constraints apply for the deliverables table: | | The following constraints apply for the deliverables table: |
| * When a container task is deleted, the contained tasks need to be deleted as well. | | * When a container task is deleted, the contained tasks need to be deleted as well. |
− | * When the connection between the parent and the connected task is deleted, the [[Clone|clone]] must be deleted as well. | + | * When the connection between the parent and the connected task is deleted, a [[Clone|cloned deliverable]] must be deleted as well. |
| * When a deliverable is deleted, all its connections are deleted as well. | | * When a deliverable is deleted, all its connections are deleted as well. |
| | | |
| == Design == | | == Design == |
| | | |
− | === Definition ===
| + | The <tt>Deliverables</tt> table has the following fields: |
− | | + | |
− | The <b><tt>Deliverables</tt></b> table has the following fields: | + | |
| | | |
| {| valign="top" border="1" cellpadding="3" cellspacing="0" | | {| valign="top" border="1" cellpadding="3" cellspacing="0" |
Line 43: |
Line 43: |
| |} | | |} |
| | | |
− | The C-interface structure is given by <tt>tdd_deliverable</tt>.
| |
− |
| |
− | === Actions ===
| |
− | * [[Create deliverables database table]]: When a new project is created, the deliverables table is created. Because of the reference to the task (see [[#Constraints|"Constraints"]], the deliverables table must be created ''after'' the [[Tasks database table|tasks table]].
| |
− | * [[Insert into the deliverables database table]]
| |
− | A deliverable can only be inserted in the current diagram, so in the current container. Therefore, when inserting a deliverable, the <tt>ContainerId</tt> os filled in by using the id of the current container as stored in the [[State variables database table|state-variables table]].
| |
− |
| |
− | * [[Update element in the deliverables database table]]
| |
− |
| |
− | A deliverable can only be updated ore deleted when it is selected. The selected deliverables are listed in the [[Selected_deliverables_database table|selected deliverables table]]. This means that the user does not have to supply the id when updating or deleting a selected deliverable.
| |
− |
| |
− | * [[Delete an element from the deliverables database table]]: Only selected deliverable can be deleted. This means that the user does not have to supply an id, but simply all selected deliverables are deleted.
| |
− |
| |
− | * [[Cut an element from the deliverables database table]]
| |
− |
| |
− | As described in [[Cut selected elements|"Cut selected elements"]], selected elements can be 'cut to the clipboard' by setting the <tt>ContainerId</tt> column to the maximum integer value. Since the <tt>Id</tt> of a deliverable is stored in a [[Types|<tt>uint32</tt>]], this value is explicitly set to 4294967295 (=2<sup>32</sup>).
| |
− |
| |
− | * [[Paste an element from the deliverables database table]]
| |
− |
| |
− | As described in [[Paste elements|"Paste elements"]], elements can be pasted into the current diagram by setting the <tt>ContainerId</tt> column to the current container. As follows from the previous section, this is done by finding all the deliverables that have this <tt>ContainerId</tt> set to the maximum integer value of 4294967295.
| |
− |
| |
− | == Implementation ==
| |
− |
| |
− | === Interface structure ===
| |
− |
| |
− | <syntaxhighlight lang="cpp">
| |
− | typedef struct
| |
− | {
| |
− | uint32 id,
| |
− | char* name,
| |
− | char* description,
| |
− | uint resourceId,
| |
− | uint x,
| |
− | uint y,
| |
− | uint width,
| |
− | uint height,
| |
− | uint32 container_id
| |
− | } tdd_deliverable;
| |
− | </syntaxhighlight>
| |
− |
| |
− | === Insert ===
| |
− |
| |
− | <syntaxhighlight lang="sql">
| |
− | INSERT INTO Deliverables
| |
− | (Name,Description, Resource, X, Y, Width, Height, Link, Available, ConnectionId, ContainerId)
| |
− | VALUES (%s, %s, %s, %d, %d, %d, %d, %s, %d, 0, (SELECT Val FROM StateVariables WHERE Name='CurrentContainerId'))
| |
− | </syntaxhighlight>
| |
− |
| |
− | === Update ===
| |
− |
| |
− | <syntaxhighlight lang="sql">
| |
− | UPDATE Deliverables SET
| |
− | Name=%s,
| |
− | Description=%s,
| |
− | Resource=%s,
| |
− | X=%d,
| |
− | Y=%d,
| |
− | Link=%s,
| |
− | Width=%d,
| |
− | Height=%d
| |
− | Available=%d
| |
− | WHERE Id IN (SELECT Id FROM SelectedDeliverables LIMIT 1)
| |
− | </syntaxhighlight>
| |
− |
| |
− | === Delete deliverable ===
| |
− |
| |
− | <syntaxhighlight lang="sql">
| |
− | DELETE FROM Deliverables WHERE Id=%d
| |
− | </syntaxhighlight>
| |
− |
| |
− | === Cut selected deliverables ===
| |
− |
| |
− | <syntaxhighlight lang="sql">
| |
− | UPDATE Deliverables SET ContainerId=4294967295 WHERE Id IN (SELECT Id FROM SelectedDeliverables)
| |
− | </syntaxhighlight>
| |
| | | |
− | === Paste deliverables ===
| + | The following actions are defined: |
| + | * [[Deliverables database table - Create|Create]] |
| + | * [[Deliverables database table - Insert|Insert]] |
| + | * [[Deliverables database table - Update|Update]] |
| + | * [[Deliverables database table - Delete|Delete]] |
| + | * [[Deliverables database table - Cut|Cut]] |
| + | * [[Deliverables database table - Paste|Paste]] |
| | | |
− | <syntaxhighlight lang="sql">
| |
− | UPDATE Deliverables SET ContainerId=(SELECT Val FROM StateVariables WHERE Name='CurrentContainerId') WHERE ContainerId=4294967295
| |
− | </syntaxhighlight>
| |
| | | |
| ---- | | ---- |
| * [[Database]] | | * [[Database]] |