org.sakaiproject.component.app.help
Class HelpManagerImpl

java.lang.Object
  extended byorg.springframework.dao.support.DaoSupport
      extended byorg.springframework.orm.hibernate.support.HibernateDaoSupport
          extended byorg.sakaiproject.component.app.help.HelpManagerImpl
All Implemented Interfaces:
HelpManager, InitializingBean

public class HelpManagerImpl
extends HibernateDaoSupport
implements HelpManager

HelpManager provides database and search capabilitites for the Sakai help tool.

Version:
$Id: HelpManagerImpl.java 5569 2006-01-26 17:26:02Z suiyy@umich.edu $
Author:
Jarrod Lannan

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
HelpManagerImpl()
           
 
Method Summary
 void addContexts(Map session, String mappedView)
          adds a context to the active context list
 Category createCategory()
          Create Category
 Resource createResource()
          create a resource
 void deleteContext(Long contextId)
          delete context by id
 void deleteResource(Long resourceId)
          delete a resource by id
 void deleteSource(Long sourceId)
          delete source by id
 List getActiveContexts(Map session)
          returns a list of all active contexts.
 Category getCategoryByName(String name)
          Find a Category by name
 Context getContext(Long id)
          get context by id
 List getContexts(String mappedView)
          find all contexts associated with mappedView
 int getContextSize()
          Get ContextSize.
protected  org.apache.lucene.document.Document getDocument(ResourceBean resource)
          Get Document.
 String getExternalLocation()
          get static EXTERNAL_LOCATION
 Glossary getGlossary()
          get glossary
 Resource getResource(Long id)
          get a resource by id
 Resource getResourceByDocId(String docId)
          get resource by doc id
protected  ResourceBean getResourceFromDocument(org.apache.lucene.document.Document document)
          Get Resource From Document.
protected  Collection getResources()
          Get entire Collection of Resources.
 Set getResources(Long contextId)
          return list of resources matching context id
 Map getResourcesForActiveContexts(Map session)
           
 RestConfiguration getRestConfiguration()
          get REST configuration
 ServerConfigurationService getServerConfigurationService()
          get server config service
 Source getSource(Long id)
          get source
 String getSupportEmailAddress()
          Get Support Email Address.
 TableOfContents getTableOfContents()
          get table of contents of manager
 TableOfContentsBean getToc()
          Get Table Of Contents Bean.
 ToolManager getToolManager()
          get tool manager
 String getWelcomePage()
          get Welcome Page
 void initialize()
          Synchronize first access to tool.
 void recursiveExternalReg(Node n, Category category)
          Parse external help reg doc recursively
 void registerCorpusDocs(Document doc)
          Parse corpus document
 void registerExternalHelpContent(String externalHelpReg)
          register external help content build document from external reg file
 void registerStaticContent()
          register local content
 void reInitialize()
          Reinitialize help content from UI
 GlossaryEntry searchGlossary(String keyword)
          searches the glossary for the keyword.
protected  Set searchResources(org.apache.lucene.search.Query query)
          Search Resources
 Set searchResources(String queryStr)
           
protected  Set searchResources(String queryStr, String defaultField)
          Search Lucene
 void setContextSize(int contextSize)
          Set ContextSize
 void setGlossary(Glossary glossary)
          Set Glossary.
 void setRestConfiguration(RestConfiguration restConfiguration)
          set REST configuration
 void setServerConfigurationService(ServerConfigurationService s)
          set server config service
 void setSupportEmailAddress(String email)
          set Support Email Address.
 void setTableOfContents(TableOfContents toc)
          set table of contents
 void setToc(TableOfContentsBean toc)
          Set Table Of Contents Bean.
 void setToolManager(ToolManager toolManager)
          set tool manager
 void setTxManager(HibernateTransactionManager txManager)
           
 void storeCategory(Category category)
          Store Category
 void storeContext(Context context)
          store context
 void storeResource(Resource resource)
          Store resource
 void storeSource(Source source)
          store source
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, closeSessionIfNecessary, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelpManagerImpl

public HelpManagerImpl()
Method Detail

getServerConfigurationService

public ServerConfigurationService getServerConfigurationService()
Description copied from interface: HelpManager
get server config service

Specified by:
getServerConfigurationService in interface HelpManager
Returns:
See Also:
HelpManager.getServerConfigurationService()

setServerConfigurationService

public void setServerConfigurationService(ServerConfigurationService s)
Description copied from interface: HelpManager
set server config service

Specified by:
setServerConfigurationService in interface HelpManager
Parameters:
s -
See Also:
HelpManager.setServerConfigurationService(org.sakaiproject.service.framework.config.ServerConfigurationService)

getContexts

public List getContexts(String mappedView)
Description copied from interface: HelpManager
find all contexts associated with mappedView

Specified by:
getContexts in interface HelpManager
Parameters:
mappedView -
Returns:
- list of contexts (String)

getActiveContexts

public List getActiveContexts(Map session)
Description copied from interface: HelpManager
returns a list of all active contexts. Active contexts are created when the user navigates around the site.

Specified by:
getActiveContexts in interface HelpManager
Parameters:
session -
Returns:

addContexts

public void addContexts(Map session,
                        String mappedView)
Description copied from interface: HelpManager
adds a context to the active context list

Specified by:
addContexts in interface HelpManager
Parameters:
session -
mappedView -

getResources

public Set getResources(Long contextId)
return list of resources matching context id

Specified by:
getResources in interface HelpManager
Parameters:
contextId -
Returns:

storeResource

public void storeResource(Resource resource)
Store resource

Specified by:
storeResource in interface HelpManager
Parameters:
resource -
See Also:
org.sakaiproject.api.app.help.HelpManager#storeResource(org.sakaiproject.api.help.Entity)

getResource

public Resource getResource(Long id)
Description copied from interface: HelpManager
get a resource by id

Specified by:
getResource in interface HelpManager
Parameters:
id -
Returns:
See Also:
HelpManager.getResource(java.lang.Long)

deleteResource

public void deleteResource(Long resourceId)
Description copied from interface: HelpManager
delete a resource by id

Specified by:
deleteResource in interface HelpManager
Parameters:
resourceId -
See Also:
HelpManager.deleteResource(java.lang.Long)

getSource

public Source getSource(Long id)
Description copied from interface: HelpManager
get source

Specified by:
getSource in interface HelpManager
Parameters:
id -
Returns:
Source
See Also:
HelpManager.getSource(java.lang.Long)

storeSource

public void storeSource(Source source)
Description copied from interface: HelpManager
store source

Specified by:
storeSource in interface HelpManager
Parameters:
source -
See Also:
org.sakaiproject.api.app.help.HelpManager#storeSource(org.sakaiproject.api.help.Source)

deleteSource

public void deleteSource(Long sourceId)
Description copied from interface: HelpManager
delete source by id

Specified by:
deleteSource in interface HelpManager
Parameters:
sourceId -
See Also:
HelpManager.deleteSource(java.lang.Long)

getContext

public Context getContext(Long id)
Description copied from interface: HelpManager
get context by id

Specified by:
getContext in interface HelpManager
Parameters:
id -
Returns:
Context
See Also:
HelpManager.getContext(java.lang.Long)

storeContext

public void storeContext(Context context)
Description copied from interface: HelpManager
store context

Specified by:
storeContext in interface HelpManager
Parameters:
context -
See Also:
org.sakaiproject.api.app.help.HelpManager#storeContext(org.sakaiproject.api.help.Context)

deleteContext

public void deleteContext(Long contextId)
Description copied from interface: HelpManager
delete context by id

Specified by:
deleteContext in interface HelpManager
Parameters:
contextId -
See Also:
HelpManager.deleteContext(java.lang.Long)

getResourcesForActiveContexts

public Map getResourcesForActiveContexts(Map session)
Specified by:
getResourcesForActiveContexts in interface HelpManager
Parameters:
session -
Returns:
map of resources keyed by active contexts
See Also:
HelpManager.getResourcesForActiveContexts(java.util.Map)

searchResources

public Set searchResources(String queryStr)
Specified by:
searchResources in interface HelpManager
Parameters:
queryStr -
Returns:
set of resources found by searching with the supplied query.
See Also:
HelpManager.searchResources(java.lang.String)

getTableOfContents

public TableOfContents getTableOfContents()
Description copied from interface: HelpManager
get table of contents of manager

Specified by:
getTableOfContents in interface HelpManager
Returns:
TableOfContents
See Also:
HelpManager.getTableOfContents()

setTableOfContents

public void setTableOfContents(TableOfContents toc)
Description copied from interface: HelpManager
set table of contents

Specified by:
setTableOfContents in interface HelpManager
Parameters:
toc -
See Also:
org.sakaiproject.api.app.help.HelpManager#setTableOfContents(org.sakaiproject.api.help.TableOfContents)

searchGlossary

public GlossaryEntry searchGlossary(String keyword)
Description copied from interface: HelpManager
searches the glossary for the keyword. Returns a GlossaryEntry for this keyword if found, return null if no entry is found.

Specified by:
searchGlossary in interface HelpManager
Parameters:
keyword -
Returns:
See Also:
HelpManager.searchGlossary(java.lang.String)

searchResources

protected Set searchResources(org.apache.lucene.search.Query query)
Search Resources

Parameters:
query -
Returns:
Set of matching results.

searchResources

protected Set searchResources(String queryStr,
                              String defaultField)
                       throws org.apache.lucene.queryParser.ParseException
Search Lucene

Parameters:
queryStr -
defaultField -
Returns:
Throws:
org.apache.lucene.queryParser.ParseException

getResourceFromDocument

protected ResourceBean getResourceFromDocument(org.apache.lucene.document.Document document)
Get Resource From Document.

Parameters:
document -
Returns:
resource bean

getResources

protected Collection getResources()
Get entire Collection of Resources.

Returns:
collection of resources

getContextSize

public int getContextSize()
Get ContextSize.

Returns:
size of Context.

setContextSize

public void setContextSize(int contextSize)
Set ContextSize

Parameters:
contextSize -

getDocument

protected org.apache.lucene.document.Document getDocument(ResourceBean resource)
                                                   throws IOException,
                                                          MalformedURLException
Get Document.

Parameters:
resource -
Returns:
document
Throws:
IOException
MalformedURLException

getToc

public TableOfContentsBean getToc()
Get Table Of Contents Bean.

Returns:
table of contents bean

setToc

public void setToc(TableOfContentsBean toc)
Set Table Of Contents Bean.

Parameters:
toc -

getGlossary

public Glossary getGlossary()
Description copied from interface: HelpManager
get glossary

Specified by:
getGlossary in interface HelpManager
Returns:
Glossary
See Also:
HelpManager.getGlossary()

setGlossary

public void setGlossary(Glossary glossary)
Set Glossary.

Parameters:
glossary -

storeCategory

public void storeCategory(Category category)
Description copied from interface: HelpManager
Store Category

Specified by:
storeCategory in interface HelpManager
Parameters:
category -
See Also:
org.sakaiproject.api.app.help.HelpManager#storeCategory(org.sakaiproject.api.help.Category)

createCategory

public Category createCategory()
Description copied from interface: HelpManager
Create Category

Specified by:
createCategory in interface HelpManager
Returns:
Category
See Also:
HelpManager.createCategory()

createResource

public Resource createResource()
Description copied from interface: HelpManager
create a resource

Specified by:
createResource in interface HelpManager
Returns:
Resource
See Also:
HelpManager.createResource()

getResourceByDocId

public Resource getResourceByDocId(String docId)
Description copied from interface: HelpManager
get resource by doc id

Specified by:
getResourceByDocId in interface HelpManager
Parameters:
docId -
Returns:
Resource
See Also:
HelpManager.getResourceByDocId(java.lang.String)

getWelcomePage

public String getWelcomePage()
Description copied from interface: HelpManager
get Welcome Page

Specified by:
getWelcomePage in interface HelpManager
Returns:
docId of Welcome Page
See Also:
HelpManager.getWelcomePage()

getCategoryByName

public Category getCategoryByName(String name)
Find a Category by name

Parameters:
name -
Returns:
Category

getSupportEmailAddress

public String getSupportEmailAddress()
Get Support Email Address.

Specified by:
getSupportEmailAddress in interface HelpManager
Returns:
address as string
See Also:
HelpManager.getSupportEmailAddress()

setSupportEmailAddress

public void setSupportEmailAddress(String email)
set Support Email Address.

Parameters:
email -

getToolManager

public ToolManager getToolManager()
get tool manager

Returns:
Returns the toolManager.

setToolManager

public void setToolManager(ToolManager toolManager)
set tool manager

Parameters:
toolManager - The toolManager to set.

setTxManager

public void setTxManager(HibernateTransactionManager txManager)
Parameters:
txManager - The txManager to set.

getRestConfiguration

public RestConfiguration getRestConfiguration()
Description copied from interface: HelpManager
get REST configuration

Specified by:
getRestConfiguration in interface HelpManager
Returns:
REST configuration
See Also:
HelpManager.getRestConfiguration()

setRestConfiguration

public void setRestConfiguration(RestConfiguration restConfiguration)
set REST configuration

Parameters:
restConfiguration -

reInitialize

public void reInitialize()
Reinitialize help content from UI

Specified by:
reInitialize in interface HelpManager

initialize

public void initialize()
Synchronize first access to tool.

Specified by:
initialize in interface HelpManager
See Also:
HelpManager.initialize()

getExternalLocation

public String getExternalLocation()
Description copied from interface: HelpManager
get static EXTERNAL_LOCATION

Specified by:
getExternalLocation in interface HelpManager
Returns:
EXTERNAL_LOCATION
See Also:
HelpManager.getExternalLocation()

registerExternalHelpContent

public void registerExternalHelpContent(String externalHelpReg)
register external help content build document from external reg file

Parameters:
externalHelpReg -

registerStaticContent

public void registerStaticContent()
register local content


recursiveExternalReg

public void recursiveExternalReg(Node n,
                                 Category category)
Parse external help reg doc recursively

Parameters:
n -
category -

registerCorpusDocs

public void registerCorpusDocs(Document doc)
Parse corpus document

Parameters:
doc - document