com.plumtree.portaluiinfrastructure.restconsumerframework.pathways
Class PathwaysRestAPIService

java.lang.Object
  extended by com.plumtree.portaluiinfrastructure.restconsumerframework.pathways.PathwaysRestAPIService
All Implemented Interfaces:
IPathwaysRestAPIService

public class PathwaysRestAPIService
extends java.lang.Object
implements IPathwaysRestAPIService

Provides methods to simplify and abstract making Pathways specific Rest API requests. Consumes either a RestXMLParser or RestJSONParser.

Author:
BobbyT

Field Summary
protected  int m_totalCount
           
 
Constructor Summary
protected PathwaysRestAPIService(AActivitySpace space)
           
 
Method Summary
protected  void AddPathwaysAuthenticationToken(RestRequest request)
          Set authentication
 void AddRemoveTagRest(java.lang.String tname, java.lang.String fullId, int action, java.lang.String ptsource)
          This Method is used to Add/Remove a Pathways Tag on a particular document.
 PathwaysSearchRestData[] DoSearch(PathwaysQueryArguments pathwaysQueryArgs)
          Returns a Tag Cloud from a Pathways search query.
static IPathwaysRestAPIService GetInstance(AActivitySpace space)
           
 java.lang.String GetPathwaysAPIBaseURL(IPTSession session)
          Gets the Pathways API base URL from the Pathways API Web Service object
 java.lang.String GetPathwaysAPIGatewayedURL(AActivitySpace space, IPTSession session)
          Gets the Pathways API Gatewayed URL from the Pathways API Web Service object This is used when making Pathways API calls on the client side via JSON.
protected  PathwaysSearchRestData[] GetSearchResultsData(IRestResponse response)
           
 PathwaysTagRestData[] GetTagCloud(java.lang.String view, java.lang.String format, java.lang.String query, java.lang.String resultCount)
          Returns a Tag Cloud from a Pathways search query.
protected  PathwaysTagRestData[] GetTagListData(IRestResponse response)
           
 int GetTotalCount()
          Returns the total count of search results returned
protected  int GetTotalCountSearchResults(IRestResponse response)
           
 PathwaysViewsRestData[] GetViews()
          Queries the Pathways API service and returns an array of Pathways Views.
protected  PathwaysViewsRestData[] GetViewsData(IRestResponse response)
           
 boolean IsAdaptiveLayoutMode()
          Returns if the current user experience supports adaptive layout mode
 boolean IsPathwaysEnabled()
          Checks if Pathways service is enabled from the config settings.
 void RenameTagRest(java.lang.String tname, java.lang.String fullId, java.lang.String ptsource, java.lang.String renametag)
          This Method is used to Rename a Pathways Tag on a particular document.
static void setTestInstance(IPathwaysRestAPIService testHelper)
          Unit tests should use this method to overwrite/teardown existing helper singleton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_totalCount

protected int m_totalCount
Constructor Detail

PathwaysRestAPIService

protected PathwaysRestAPIService(AActivitySpace space)
Method Detail

GetInstance

public static IPathwaysRestAPIService GetInstance(AActivitySpace space)
Returns:
The singleton PathwaysRestAPIService.

setTestInstance

public static void setTestInstance(IPathwaysRestAPIService testHelper)
Unit tests should use this method to overwrite/teardown existing helper singleton. DO NOT USE for production code. NOTE: When finished with a unit test, this should be set back to null so as not to interfere with other tests.


IsPathwaysEnabled

public boolean IsPathwaysEnabled()
Checks if Pathways service is enabled from the config settings.

Specified by:
IsPathwaysEnabled in interface IPathwaysRestAPIService
Returns:
true if Pathways is enabled, otherwise false.

GetPathwaysAPIBaseURL

public java.lang.String GetPathwaysAPIBaseURL(IPTSession session)
Gets the Pathways API base URL from the Pathways API Web Service object

Specified by:
GetPathwaysAPIBaseURL in interface IPathwaysRestAPIService
Parameters:
session - the current user session.
Returns:
the URL to the Pathways API Web Service, null if service is not installed.

GetPathwaysAPIGatewayedURL

public java.lang.String GetPathwaysAPIGatewayedURL(AActivitySpace space,
                                                   IPTSession session)
Gets the Pathways API Gatewayed URL from the Pathways API Web Service object This is used when making Pathways API calls on the client side via JSON.

Specified by:
GetPathwaysAPIGatewayedURL in interface IPathwaysRestAPIService
Parameters:
session - the current user session.
Returns:
the gatewayed URL to the Pathways API Web Service, null if service is not installed.

GetViews

public PathwaysViewsRestData[] GetViews()
Queries the Pathways API service and returns an array of Pathways Views. return PathwaysViewsRestData[] containing list of Pathways views.

Specified by:
GetViews in interface IPathwaysRestAPIService
Returns:
a list of PathwaysViewsRestData

GetTagCloud

public PathwaysTagRestData[] GetTagCloud(java.lang.String view,
                                         java.lang.String format,
                                         java.lang.String query,
                                         java.lang.String resultCount)
Returns a Tag Cloud from a Pathways search query.

Specified by:
GetTagCloud in interface IPathwaysRestAPIService
Parameters:
view - the Pathways view to use when retrieving the Tag Cloud
format - the payload format of the response
query - the Pathways search query
tagCount - the maximum number of tags to return for the Tag Cloud
Returns:
PathwaysTagRestData[] containing a list of tags forming the Tag Cloud.

DoSearch

public PathwaysSearchRestData[] DoSearch(PathwaysQueryArguments pathwaysQueryArgs)
Returns a Tag Cloud from a Pathways search query. TODO: Use a Search Query Argument collection instead of passing in everything by arguments

Specified by:
DoSearch in interface IPathwaysRestAPIService
Parameters:
view - the Pathways view to use when retrieving the Tag Cloud
format - the payload format of the response
query - the Pathways search query
tagCount - the maximum number of tags to return for the Tag Cloud
objectTypes - is the object types to limit the search
Returns:
PathwaysSearchRestData[] containing a collection of search results generated from Pathways API service.

AddRemoveTagRest

public void AddRemoveTagRest(java.lang.String tname,
                             java.lang.String fullId,
                             int action,
                             java.lang.String ptsource)
This Method is used to Add/Remove a Pathways Tag on a particular document. This uses Pathways REST API to connect to Pathways and execute the requested action.

Specified by:
AddRemoveTagRest in interface IPathwaysRestAPIService
Parameters:
tname - Name of the Tag on Which to take action
fullId - Complete ID (CLASSID_DOCUMENTID) of the Document the tag is related to
action - Operation to perform on the tag, 0 = Add, 1 = Delete, 2 = Edit (delete old tag and add new tag)
ptsource - Source of the Object, for Portal it is 'PTPORTAL' and collab it is 'PTCOLLAB'. More sources are in PathwaysConstants.

RenameTagRest

public void RenameTagRest(java.lang.String tname,
                          java.lang.String fullId,
                          java.lang.String ptsource,
                          java.lang.String renametag)
This Method is used to Rename a Pathways Tag on a particular document. This uses Pathways REST API to connect to Pathways and execute the requested action.

Specified by:
RenameTagRest in interface IPathwaysRestAPIService
Parameters:
tname - the Source Tag Name to be used for renaming
fullId - Complete ID (CLASSID_DOCUMENTID) of the Document the tag is related to
ptsource - Source of the Object, for Portal it is 'PTPORTAL' and collab it is 'PTCOLLAB'. More sources are in PathwaysConstants.
renametag - the Target Tag Name to be used for renaming

AddPathwaysAuthenticationToken

protected void AddPathwaysAuthenticationToken(RestRequest request)
Set authentication

Parameters:
request -

GetTagListData

protected PathwaysTagRestData[] GetTagListData(IRestResponse response)

GetSearchResultsData

protected PathwaysSearchRestData[] GetSearchResultsData(IRestResponse response)
Parameters:
response -
Returns:

GetTotalCountSearchResults

protected int GetTotalCountSearchResults(IRestResponse response)

GetTotalCount

public int GetTotalCount()
Description copied from interface: IPathwaysRestAPIService
Returns the total count of search results returned

Specified by:
GetTotalCount in interface IPathwaysRestAPIService

GetViewsData

protected PathwaysViewsRestData[] GetViewsData(IRestResponse response)

IsAdaptiveLayoutMode

public boolean IsAdaptiveLayoutMode()
Description copied from interface: IPathwaysRestAPIService
Returns if the current user experience supports adaptive layout mode

Specified by:
IsAdaptiveLayoutMode in interface IPathwaysRestAPIService
Returns:



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.