Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "ProjectInfoAPI"

(New page: == ProjectInfo Schema == The following is the schema for a pair of tables to replace the existing project-info.xml system and other database and XML files associated with project data. ...)
 
(ProjectInfo Schema)
Line 1: Line 1:
 
+
== ProjectInfo Database Schema ==
== ProjectInfo Schema ==
+
  
 
The following is the schema for a pair of tables to replace the existing project-info.xml system and other database and XML files associated with project data.
 
The following is the schema for a pair of tables to replace the existing project-info.xml system and other database and XML files associated with project data.
Line 7: Line 6:
  
 
ProjectInfo can have multiple rows for each MainKey for each ProjectID, and ProjectInfoValues can have multiple rows for each row in ProjectInfo.
 
ProjectInfo can have multiple rows for each MainKey for each ProjectID, and ProjectInfoValues can have multiple rows for each row in ProjectInfo.
 
  
 
[[Image:ProjectInfo.png]]
 
[[Image:ProjectInfo.png]]
 +
 +
== ProjectInfo Database Example ==
 +
 +
Here is a mock-up of some partial data for the tools.ajdt project:
 +
 +
[[Image:ProjectInfoExample.png]]
 +
 +
The MainKeys and SubKeys are highlighted in blue to indicate that these are the values on which you would generally query these tables. The ProjectInfoID is only used as a mapping between all of the values in the ProjectInfoValues table.
 +
 +
This can quite easily be queried via SQL. A number of rows together form one record which will need to be assembled as needed by the code calling the query, much as it is today from the XML files, but with a much simpler interface.
 +
 +
== Using the ProjectInfo Database on your Phoenix pages ==
 +
 +
Two new classes have been defined for consumption by Phoenix developers.  To use these classes a new function has been added to the $App Class and can be called by using the following function
 +
 +
    $App->UseProjectInfo()
 +
 +
This function will include the following two classes.
 +
 +
== ProjectInfo ==
 +
 +
This class will gather and hold all of the info for a project upon creation.
 +
 +
    $projectInfo = new ProjectInfo('tools.ajdt');
 +
 +
The data that is gathered is stored in an array of ProjectInfoValue class objects.  These object can be retrieved through two functions
 +
 +
    $projectInfo->GetValue("MainKey" [,"SubKey"]);  //This function will return the data stored in Value for the matching MainKey / SubKey
 +
 +
    $projectInfo->GetValueList("MainKey" [,"SubKey"]);  //This function will return an array of ProjectInfoValue objects for the matching MainKey / SubKey
 +
 +
== ProjectInfoList ==
 +
 +
This class is used to gather a list of ProjectInfo class objects.  This class is useful when you want to gather a set or ProjectInfo that meet a certain set of criteria.
 +
 +
    $projectInfoList = new ProjectInfoList();
 +
 
 +
The main worker function in this class is selectProjectInfoList.
 +
 +
    selectProjectInfoList($ProjectInfoID [, $MainKey [, $SubKey [,$Value [,$ProjectInfoID [, $orderBy]]]]]);
 +
 +
Examples
 +
    selectProjectInfoList(NULL, "mailinglist"); //This will return a list of ProjectInfo objects that have a MainKey = "mailinglist"
 +
    selectProjectInfoList(NULL, "categories", NULL, "ENT");  //This will return a list of ProjectInfo objects that have MainKey = "categories" and Value = "ENT"
 +
 +
Once selectProjectInfoList has been called the ProjectInfoList object can be iterated using the getItemAt($i) and getCount() functions.

Revision as of 10:29, 12 September 2007

ProjectInfo Database Schema

The following is the schema for a pair of tables to replace the existing project-info.xml system and other database and XML files associated with project data.

There is a master table (ProjectInfo) which stores all of the keys which link into the sub-table (ProjectInfoValues). The two tables are tied together by an auto-generated sequence ProjectInfoID which is created by inserting the record into the ProjectInfo table. Having a secondary table allows for multiple values to be associated with a single key. The values table can also contain SubKeys as necessary to further classify the value.

ProjectInfo can have multiple rows for each MainKey for each ProjectID, and ProjectInfoValues can have multiple rows for each row in ProjectInfo.

ProjectInfo.png

ProjectInfo Database Example

Here is a mock-up of some partial data for the tools.ajdt project:

ProjectInfoExample.png

The MainKeys and SubKeys are highlighted in blue to indicate that these are the values on which you would generally query these tables. The ProjectInfoID is only used as a mapping between all of the values in the ProjectInfoValues table.

This can quite easily be queried via SQL. A number of rows together form one record which will need to be assembled as needed by the code calling the query, much as it is today from the XML files, but with a much simpler interface.

Using the ProjectInfo Database on your Phoenix pages

Two new classes have been defined for consumption by Phoenix developers. To use these classes a new function has been added to the $App Class and can be called by using the following function

    $App->UseProjectInfo()

This function will include the following two classes.

ProjectInfo

This class will gather and hold all of the info for a project upon creation.

    $projectInfo = new ProjectInfo('tools.ajdt');

The data that is gathered is stored in an array of ProjectInfoValue class objects. These object can be retrieved through two functions

    $projectInfo->GetValue("MainKey" [,"SubKey"]);  //This function will return the data stored in Value for the matching MainKey / SubKey
    $projectInfo->GetValueList("MainKey" [,"SubKey"]);  //This function will return an array of ProjectInfoValue objects for the matching MainKey / SubKey

ProjectInfoList

This class is used to gather a list of ProjectInfo class objects. This class is useful when you want to gather a set or ProjectInfo that meet a certain set of criteria.

    $projectInfoList = new ProjectInfoList();
  

The main worker function in this class is selectProjectInfoList.

    selectProjectInfoList($ProjectInfoID [, $MainKey [, $SubKey [,$Value [,$ProjectInfoID [, $orderBy]]]]]);

Examples

    selectProjectInfoList(NULL, "mailinglist"); //This will return a list of ProjectInfo objects that have a MainKey = "mailinglist"
    selectProjectInfoList(NULL, "categories", NULL, "ENT");  //This will return a list of ProjectInfo objects that have MainKey = "categories" and Value = "ENT"

Once selectProjectInfoList has been called the ProjectInfoList object can be iterated using the getItemAt($i) and getCount() functions.

Back to the top