AquaLogic User Interaction Development Guide

     Previous Next  Open TOC in new window   View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Querying Existing Collaboration Projects Using IDK Remote APIs

To search for collaboration projects by name from a remote application, use the IProjectManager interface in the IDK.

Results can be filtered in a variety of ways. The IProjectManager query method takes in an IProjectFilter object that allows you to set the following search options:
Search Text (Name) Sets the string that will be used to search project names. If you do not set a search string, all projects will be returned. The name search string is case-insensitive by default; all projects will be returned that contain the text using the form *text*.
Maximum Results Sets the maximum number of results returned. The default is to return all results.
Order-By Fields and Sort Order Sets the fields to be displayed with an order-by functionality (name or last modified date) and sets the sort order (ascending or descending).
Security Enables or disables the security filter that applies security to the result set with respect to the user that submitted the query. If the filter is enabled, the query result will only include objects for which the querying user has appropriate permission. The default is false (disabled); all objects matching the query criteria will be returned.
Result Filter: Project Type Limits the query to those projects for which the current user is a project leader, or extend the search to all projects. For details on project roles, see Managing Collaboration Project Roles Using the IDK Remote API.
The code samples below are simplified for illustration.
  1. Create a session with the portal. For details, see Initiating a PRC Session to Use IDK Remote APIs.
  2. Query for a project as shown in the code below.
    1. Retrieve an IProjectManager.
    2. Implement IProjectFilter to filter results and define the query.
    3. Execute the search and display results in table format.

Java

...

//perform the search
IProjectManager projectManager = getProjectManager(request, response, out);
IProjectFilter projectFilter = projectManager.createProjectFilter();

//hard-code the max results to 10
projectFilter.setMaximumResults(10);

//set the query
projectFilter.setNameSearchText(searchText);

//execute the search and print out the results
IProject[] projects = projectManager.queryProjects(projectFilter);
if (projects.length > 0)
{
	%>
	<table>
	<tr>
		<td>
		Search Results
		</td>
	</tr>
	<tr>
		<td>
		Project Name
		</td>
		<td>
		Project ID
		</td>
	</tr>
	<%
	for (int i = 0; i < projects.length; i++)
	{
		IProject project = projects[i];
		%>
		<tr>
			<td>
			<%out.println(project.getName());%>
			</td>
			<td>
			<%out.println(project.getID());%>
			</td>
		</tr>
		<%
	}
}
else
{
	%>
	<tr>
		<td colspan="2">
		<%out.println("No projects found using search query of " + searchText);%>
		</td>
	</tr>
	</table>
...

.NET (C#)

...

//perform the search
Plumtree.Remote.PRC.Collaboration.Project.IProjectManager projectManager = GetProjectManager(Request, Response);
Plumtree.Remote.PRC.Collaboration.Project.IProjectFilter projectFilter = projectManager.CreateProjectFilter();

//hard-code the max results to 10
projectFilter.MaximumResults = 10;

//set the query
projectFilter.NameSearchText = searchText;

//execute the search and print out the results
Plumtree.Remote.PRC.Collaboration.Project.IProject[] projects = projectManager.QueryProjects(projectFilter);
if (projects.Length > 0)
{
	%>
	<table>	
	<tr>
		<td>
		Search Results
		</td>
	</tr>
	<tr>
		<td>
		Project Name
		</td>
		<td>
		Project ID
		</td>
	</tr>
	<%
	for (int i = 0; i < projects.Length; i++)
	{
		Plumtree.Remote.PRC.Collaboration.Project.IProject project = projects[i];
		%>
		<tr>
			<td>
			<%Response.Write(project.Name);%>
			</td>
			<td>
			<%Response.Write(project.ID);%>
			</td>
		</tr>
		<%
	}
}
else
{
	Response.Write("No projects found using search query of " + searchText);
}
... 

.NET (VB)

...

'perform the search
dim projectManager as Plumtree.Remote.PRC.Collaboration.Project.IProjectManager = GetProjectManager(Request, Response)
dim projectFilter as Plumtree.Remote.PRC.Collaboration.Project.IProjectFilter = projectManager.CreateProjectFilter()

'hard-code the max results to 10
projectFilter.MaximumResults = 10

'set the query
projectFilter.NameSearchText = searchText

'execute the search and print out the results
dim projects() as Plumtree.Remote.PRC.Collaboration.Project.IProject = projectManager.QueryProjects(projectFilter)
if projects.Length > 0 then
	%>
	<tr>
		<td>
		Search Results
		</td>
	</tr>
	<tr>
		<td>
		Project Name
		</td>
		<td>
		Project ID
		</td>
	</tr>
	<%
	dim i as Integer
	for i = 0 to projects.Length -1
		dim project as Plumtree.Remote.PRC.Collaboration.Project.IProject = projects(i)
		%>
		<tr>
			<td>
			<%Response.Write(project.Name) %>
			</td>
			<td>
			<%Response.Write(Cstr(project.ID)) %>
			</td>
		</tr>
		<%
	next
else
	Response.Write("No projects found using search query of " + searchText)
...

  Back to Top      Previous Next