org.sakaiproject.tool.assessment.integration.helper.integrated
Class AgentHelperImpl

java.lang.Object
  extended byorg.sakaiproject.tool.assessment.integration.helper.integrated.AgentHelperImpl
All Implemented Interfaces:
AgentHelper, Serializable

public class AgentHelperImpl
extends Object
implements AgentHelper

Description: This is an integrated context implementation helper delegate class for the AgentFacade class. "Integrated" means that Samigo (Tests and Quizzes) is running within the context of the Sakai portal and authentication mechanisms, and therefore makes calls on Sakai for things it needs.

Note: To customize behavior you can add your own helper class to the Spring injection via the integrationContext.xml for your context. The particular integrationContext.xml to be used is selected by the build process.

Sakai Project Copyright (c) 2005

Author:
Ed Smiley based on code originally in AgentFacade
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.sakaiproject.tool.assessment.integration.helper.ifc.AgentHelper
UNASSIGNED_AGENT_STRING
 
Constructor Summary
AgentHelperImpl()
           
 
Method Summary
 String createAnonymous(AgentFacade agent)
          Create anonymous user and return the anonymous user id.
 AgentImpl getAgent()
          Get an osid Agent implementation class instance.
 String getAgentString(String agentString)
          Get the agent string.
 String getAnonymousId(String agentString)
          Get the anonymous user id.
 String getCurrentSiteId(boolean accessViaUrl)
          Get the current site id.
 String getCurrentSiteName(boolean accessViaUrl)
          Get the current site name.
 String getDisplayName(String agentS)
          Get the Agent display name.
 String getDisplayNameByAgentId(String agentId)
          Get the display name for a specific agent id string.
 String getFirstName(String agentString)
          Get the Agent first name.
 String getLastName(String agentString)
          Get the Agent last name.
 String getRole(String agentString)
          Can be called statically from AgentFacade from an instance
 String getRoleForAgentAndSite(String agentString, String siteId)
           
 String getRoleForCurrentAgent(String agentString)
          Called by AgentFacade from an instance.
 String getSiteName(String siteId)
          Get the site name.
 Map getUserRolesFromContextRealm(Collection inUsers)
          This gets the current site id and transforms it into the realm.
 boolean isFileUploadAvailable()
          Deprecated.  
 boolean isIntegratedEnvironment()
          Is this an integrated environment?
 boolean isStandaloneEnvironment()
          Is this a standlaone environment?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgentHelperImpl

public AgentHelperImpl()
Method Detail

getAgent

public AgentImpl getAgent()
Get an osid Agent implementation class instance.

Specified by:
getAgent in interface AgentHelper
Returns:
an AgentImpl: osid Agent implementation class.

getAgentString

public String getAgentString(String agentString)
Get the agent string.

Specified by:
getAgentString in interface AgentHelper
Returns:
the agent string.

getDisplayName

public String getDisplayName(String agentS)
Get the Agent display name.

Specified by:
getDisplayName in interface AgentHelper
Parameters:
agentS - the Agent string.
Returns:
the Agent display name.

getFirstName

public String getFirstName(String agentString)
Get the Agent first name.

Specified by:
getFirstName in interface AgentHelper
Parameters:
agentString - teh agent string
Returns:
the Agent first name.

getLastName

public String getLastName(String agentString)
Get the Agent last name.

Specified by:
getLastName in interface AgentHelper
Parameters:
agentString - teh agent string
Returns:
the Agent last name.

getRole

public String getRole(String agentString)
Can be called statically from AgentFacade from an instance

Specified by:
getRole in interface AgentHelper
Parameters:
agentString - the agent string for an agent
Returns:
role string

getRoleForCurrentAgent

public String getRoleForCurrentAgent(String agentString)
Called by AgentFacade from an instance. In integrated just wrap the above.

Specified by:
getRoleForCurrentAgent in interface AgentHelper
Parameters:
agentString - the agent string for current AgentFacade instance
Returns:
role string

getCurrentSiteId

public String getCurrentSiteId(boolean accessViaUrl)
Get the current site id.

Specified by:
getCurrentSiteId in interface AgentHelper
Returns:
the site id.

createAnonymous

public String createAnonymous(AgentFacade agent)
Create anonymous user and return the anonymous user id.

Specified by:
createAnonymous in interface AgentHelper
Returns:
the anonymous user id.

getCurrentSiteName

public String getCurrentSiteName(boolean accessViaUrl)
Get the current site name.

Specified by:
getCurrentSiteName in interface AgentHelper
Returns:
the site name.

getSiteName

public String getSiteName(String siteId)
Get the site name.

Specified by:
getSiteName in interface AgentHelper
Parameters:
siteId - site id
Returns:
the site name.

getDisplayNameByAgentId

public String getDisplayNameByAgentId(String agentId)
Get the display name for a specific agent id string.

Specified by:
getDisplayNameByAgentId in interface AgentHelper
Parameters:
agentId - the agent id string.
Returns:
the display name.

isStandaloneEnvironment

public boolean isStandaloneEnvironment()
Is this a standlaone environment?

Specified by:
isStandaloneEnvironment in interface AgentHelper
Returns:
false, in this implementation

isIntegratedEnvironment

public boolean isIntegratedEnvironment()
Is this an integrated environment?

Specified by:
isIntegratedEnvironment in interface AgentHelper
Returns:
true, in this implementation

getAnonymousId

public String getAnonymousId(String agentString)
Get the anonymous user id.

Specified by:
getAnonymousId in interface AgentHelper
Returns:
the anonymous user id.

getUserRolesFromContextRealm

public Map getUserRolesFromContextRealm(Collection inUsers)
This gets the current site id and transforms it into the realm. From there it asks the AuthzGroupService for the roles of the given users

Specified by:
getUserRolesFromContextRealm in interface AgentHelper
Parameters:
inUsers - the Collection of users who have their roles looked up. This is a Collection of userId Strings
Returns:
Returns the map of users as keys and their roles as values. If the user is not in the realm then they will have a null role.

getRoleForAgentAndSite

public String getRoleForAgentAndSite(String agentString,
                                     String siteId)
Specified by:
getRoleForAgentAndSite in interface AgentHelper

isFileUploadAvailable

public boolean isFileUploadAvailable()
Deprecated.  

This is a kludge to work around a JSF scriptlet dependency introduced by cwen on org.sakaiproject.service.framework.config.cover.ServerConfigurationService.

Specified by:
isFileUploadAvailable in interface AgentHelper
Returns:
true unless it is turned off