org.sakaiproject.tool.assessment.facade
Class QuestionPoolFacadeQueries

java.lang.Object
  extended byorg.springframework.dao.support.DaoSupport
      extended byorg.springframework.orm.hibernate.support.HibernateDaoSupport
          extended byorg.sakaiproject.tool.assessment.facade.QuestionPoolFacadeQueries
All Implemented Interfaces:
InitializingBean, QuestionPoolFacadeQueriesAPI

public class QuestionPoolFacadeQueries
extends HibernateDaoSupport
implements QuestionPoolFacadeQueriesAPI


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
QuestionPoolFacadeQueries()
           
 
Method Summary
 Long add()
           
 void addItemsToSection(Collection ids, long sectionId)
          DOCUMENTATION PENDING
 void addItemToPool(QuestionPoolItemData qpi)
          add a question to a pool
 void copyPool(Tree tree, String agentId, Long sourceId, Long destId)
          Copy a pool to a new location.
 void deletePool(Long poolId, String agent, Tree tree)
          Delete pool and questions attached to it plus any subpool under it
 List getAllItemFacades(Long questionPoolId)
           
 List getAllItemFacadesOrderByItemText(Long questionPoolId, String orderBy)
           
 List getAllItemFacadesOrderByItemType(Long questionPoolId, String orderBy)
           
 List getAllItems(Long questionPoolId)
           
 List getAllItemsInThisPoolOnly(Long questionPoolId)
           
 List getAllPools()
          Get a list of all the pools in the site.
 QuestionPoolIteratorFacade getAllPools(String agentId)
          Get all the pools that the agent has access to.
 List getAllPoolsByAgent(String agentId)
           
 ArrayList getBasicInfoOfAllPools(String agentId)
           
 ItemFacade getItem(String id)
          This method returns an ItemFacade that we can use to construct our ItemImpl
 QuestionPoolFacade getPool(Long poolId, String agent)
          Get a pool based on poolId.
 QuestionPoolFacade getPoolById(Long questionPoolId)
           
 List getPoolIdsByAgent(String agentId)
          Return a list of questionPoolId (java.lang.Long)
 List getPoolIdsByItem(String itemId)
          Return a list of questionPoolId (java.lang.Long)
 QuestionPoolAccessData getQuestionPoolAccessData(Long poolId, String agentId)
           
 IdImpl getQuestionPoolId(long id)
           
 IdImpl getQuestionPoolId(Long id)
           
 IdImpl getQuestionPoolId(String id)
           
 HashMap getQuestionPoolItemMap()
           
 List getSubPools(Long poolId)
          Get all the children pools of a pool.
 int getSubPoolSize(Long poolId)
           
 boolean hasSubPools(Long poolId)
          DOCUMENTATION PENDING
 boolean isDescendantOf(QuestionPoolFacade destPool, QuestionPoolFacade sourcePool)
          Is destination a descendant of the source?
static void main(String[] args)
           
 void moveItemToPool(String itemId, Long sourceId, Long destId)
          DOCUMENTATION PENDING
 void movePool(String agentId, Long sourcePoolId, Long destPoolId)
          Move pool under another pool.
 boolean poolIsUnique(Long questionPoolId, String title, Long parentPoolId)
           
 void removeItemFromPool(String itemId, Long poolId)
          DOCUMENTATION PENDING
 QuestionPoolFacade savePool(QuestionPoolFacade pool)
          DOCUMENTATION PENDING
 void setPoolAccessType(QuestionPoolData qpp, String agentId)
           
 
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

QuestionPoolFacadeQueries

public QuestionPoolFacadeQueries()
Method Detail

getQuestionPoolId

public IdImpl getQuestionPoolId(String id)
Specified by:
getQuestionPoolId in interface QuestionPoolFacadeQueriesAPI

getQuestionPoolId

public IdImpl getQuestionPoolId(Long id)
Specified by:
getQuestionPoolId in interface QuestionPoolFacadeQueriesAPI

getQuestionPoolId

public IdImpl getQuestionPoolId(long id)
Specified by:
getQuestionPoolId in interface QuestionPoolFacadeQueriesAPI

getAllPools

public List getAllPools()
Get a list of all the pools in the site. Note that questions in each pool will not be populated. We must keep this list updated.

Specified by:
getAllPools in interface QuestionPoolFacadeQueriesAPI

getAllPoolsByAgent

public List getAllPoolsByAgent(String agentId)

getAllPools

public QuestionPoolIteratorFacade getAllPools(String agentId)
Get all the pools that the agent has access to. The easiest way seems to be #1. get all the existing pool #2. get all the QuestionPoolAccessData record of the agent #3. go through the existing pools and check it against the QuestionPoolAccessData (qpa) record to see if the agent is granted access to it. qpa record (if exists) always trumps the default access right set up for a pool e.g. if the defaultAccessType for a pool is ACCESS_DENIED but the qpa record say ADMIN, then access=ADMIN e.g. if the defaultAccessType for a pool is ADMIN but the qpa record say ACCESS_DENIED, then access=ACCESS_DENIED e.g. if no qpa record exists, then access rule will follow the defaultAccessType set by the pool

Specified by:
getAllPools in interface QuestionPoolFacadeQueriesAPI

getBasicInfoOfAllPools

public ArrayList getBasicInfoOfAllPools(String agentId)
Specified by:
getBasicInfoOfAllPools in interface QuestionPoolFacadeQueriesAPI

getAllItemsInThisPoolOnly

public List getAllItemsInThisPoolOnly(Long questionPoolId)

getAllItems

public List getAllItems(Long questionPoolId)
Specified by:
getAllItems in interface QuestionPoolFacadeQueriesAPI

getAllItemFacadesOrderByItemText

public List getAllItemFacadesOrderByItemText(Long questionPoolId,
                                             String orderBy)
Specified by:
getAllItemFacadesOrderByItemText in interface QuestionPoolFacadeQueriesAPI

getAllItemFacadesOrderByItemType

public List getAllItemFacadesOrderByItemType(Long questionPoolId,
                                             String orderBy)
Specified by:
getAllItemFacadesOrderByItemType in interface QuestionPoolFacadeQueriesAPI

getAllItemFacades

public List getAllItemFacades(Long questionPoolId)
Specified by:
getAllItemFacades in interface QuestionPoolFacadeQueriesAPI

getItem

public ItemFacade getItem(String id)
This method returns an ItemFacade that we can use to construct our ItemImpl

Specified by:
getItem in interface QuestionPoolFacadeQueriesAPI

getPool

public QuestionPoolFacade getPool(Long poolId,
                                  String agent)
Get a pool based on poolId. I am not sure why agent is not used though is being parsed.

Specified by:
getPool in interface QuestionPoolFacadeQueriesAPI
Parameters:
agent - DOCUMENTATION PENDING
Returns:
DOCUMENTATION PENDING

setPoolAccessType

public void setPoolAccessType(QuestionPoolData qpp,
                              String agentId)
Specified by:
setPoolAccessType in interface QuestionPoolFacadeQueriesAPI

getQuestionPoolAccessData

public QuestionPoolAccessData getQuestionPoolAccessData(Long poolId,
                                                        String agentId)
Specified by:
getQuestionPoolAccessData in interface QuestionPoolFacadeQueriesAPI

addItemsToSection

public void addItemsToSection(Collection ids,
                              long sectionId)
DOCUMENTATION PENDING

Specified by:
addItemsToSection in interface QuestionPoolFacadeQueriesAPI
Parameters:
ids - DOCUMENTATION PENDING
sectionId - DOCUMENTATION PENDING

addItemToPool

public void addItemToPool(QuestionPoolItemData qpi)
add a question to a pool

Specified by:
addItemToPool in interface QuestionPoolFacadeQueriesAPI

deletePool

public void deletePool(Long poolId,
                       String agent,
                       Tree tree)
Delete pool and questions attached to it plus any subpool under it

Specified by:
deletePool in interface QuestionPoolFacadeQueriesAPI
Parameters:
poolId - DOCUMENTATION PENDING

movePool

public void movePool(String agentId,
                     Long sourcePoolId,
                     Long destPoolId)
Move pool under another pool. The dest pool must not be the descendant of the source nor can they be the same pool .

Specified by:
movePool in interface QuestionPoolFacadeQueriesAPI

isDescendantOf

public boolean isDescendantOf(QuestionPoolFacade destPool,
                              QuestionPoolFacade sourcePool)
Is destination a descendant of the source?

Specified by:
isDescendantOf in interface QuestionPoolFacadeQueriesAPI

removeItemFromPool

public void removeItemFromPool(String itemId,
                               Long poolId)
DOCUMENTATION PENDING

Specified by:
removeItemFromPool in interface QuestionPoolFacadeQueriesAPI
Parameters:
itemId - DOCUMENTATION PENDING
poolId - DOCUMENTATION PENDING

moveItemToPool

public void moveItemToPool(String itemId,
                           Long sourceId,
                           Long destId)
DOCUMENTATION PENDING

Specified by:
moveItemToPool in interface QuestionPoolFacadeQueriesAPI
Parameters:
itemId - DOCUMENTATION PENDING

savePool

public QuestionPoolFacade savePool(QuestionPoolFacade pool)
DOCUMENTATION PENDING

Specified by:
savePool in interface QuestionPoolFacadeQueriesAPI
Parameters:
pool - DOCUMENTATION PENDING

getSubPools

public List getSubPools(Long poolId)
Get all the children pools of a pool. Return a list of QuestionPoolData should return QuestionPool instead - need fixing, daisyf

Specified by:
getSubPools in interface QuestionPoolFacadeQueriesAPI
Parameters:
poolId - DOCUMENTATION PENDING

getSubPoolSize

public int getSubPoolSize(Long poolId)
Specified by:
getSubPoolSize in interface QuestionPoolFacadeQueriesAPI

hasSubPools

public boolean hasSubPools(Long poolId)
DOCUMENTATION PENDING

Specified by:
hasSubPools in interface QuestionPoolFacadeQueriesAPI
Parameters:
poolId - DOCUMENTATION PENDING

poolIsUnique

public boolean poolIsUnique(Long questionPoolId,
                            String title,
                            Long parentPoolId)
Specified by:
poolIsUnique in interface QuestionPoolFacadeQueriesAPI

getPoolIdsByAgent

public List getPoolIdsByAgent(String agentId)
Return a list of questionPoolId (java.lang.Long)

Specified by:
getPoolIdsByAgent in interface QuestionPoolFacadeQueriesAPI

getPoolIdsByItem

public List getPoolIdsByItem(String itemId)
Return a list of questionPoolId (java.lang.Long)

Specified by:
getPoolIdsByItem in interface QuestionPoolFacadeQueriesAPI
Parameters:
itemId - DOCUMENTATION PENDING

copyPool

public void copyPool(Tree tree,
                     String agentId,
                     Long sourceId,
                     Long destId)
Copy a pool to a new location.

Specified by:
copyPool in interface QuestionPoolFacadeQueriesAPI

main

public static void main(String[] args)
                 throws DataFacadeException
Throws:
DataFacadeException

add

public Long add()
Specified by:
add in interface QuestionPoolFacadeQueriesAPI

getPoolById

public QuestionPoolFacade getPoolById(Long questionPoolId)
Specified by:
getPoolById in interface QuestionPoolFacadeQueriesAPI

getQuestionPoolItemMap

public HashMap getQuestionPoolItemMap()
Specified by:
getQuestionPoolItemMap in interface QuestionPoolFacadeQueriesAPI