org.kuali.rice.kns.lookup
Class LookupResultsServiceImpl

java.lang.Object
  extended by org.kuali.rice.kns.lookup.LookupResultsServiceImpl
All Implemented Interfaces:
Serializable, LookupResultsService

public class LookupResultsServiceImpl
extends Object
implements LookupResultsService

See Also:
Serialized Form

Constructor Summary
LookupResultsServiceImpl()
           
 
Method Summary
 void clearPersistedLookupResults(String lookupResultsSequenceNumber)
          Removes the lookup results that were persisted under this lookup results sequence number
 void clearPersistedSelectedObjectIds(String lookupResultsSequenceNumber)
          Removes the lookup results that were persisted under this selected object IDs
 void deleteOldLookupResults(Timestamp expirationDate)
          removes all LookupResults BO where the lookup date attribute is older than the parameter
 void deleteOldSelectedObjectIds(Timestamp expirationDate)
          removes all LookupResults BO where the lookup date attribute is older than the parameter
 BusinessObjectService getBusinessObjectService()
           
 LookupResultsSupportStrategyService getDataDictionarySupportStrategy()
           
 String getLookupId(BusinessObject businessObject)
          Figures out which LookupResultsServiceSupportStrategy to defer to, and uses that to get the lookup id
 LookupResultsSupportStrategyService getPersistableBusinessObjectSupportStrategy()
           
 PersistedLookupMetadataDao getPersistedLookupMetadataDao()
           
protected  LookupResultsSupportStrategyService getQualifingSupportStrategy(Class boClass)
          Given the business object class, determines the best qualifying LookupResultsSupportStrategyService to use
protected  boolean isAuthorizedToAccessLookupResults(LookupResults lookupResults, String personId)
          Returns whether the user ID parameter is allowed to view the results.
 boolean isAuthorizedToAccessLookupResults(String lookupResultsSequenceNumber, String personId)
          Returns whether a user is allowed to view the lookup results of the given sequence number
protected  boolean isAuthorizedToAccessMultipleValueLookupMetadata(MultipleValueLookupMetadata mvlm, String personId)
          Determines whether the passed in user ID is allowed to view the lookup metadata (object IDs or results table)
protected  boolean isAuthorizedToAccessSelectedObjectIds(SelectedObjectIds selectedObjectIds, String personId)
          Returns whether the user ID parameter is allowed to view the selected object IDs
 boolean isAuthorizedToAccessSelectedObjectIds(String lookupResultsSequenceNumber, String personId)
          Returns whether a user is allowed to view the selected object IDs of the given sequence number
 void persistResultsTable(String lookupResultsSequenceNumber, List<ResultRow> resultTable, String personId)
          Persists a list of result row objects into a database.
 void persistSelectedObjectIds(String lookupResultsSequenceNumber, Set<String> selectedObjectIds, String personId)
          Persists a list of BO object IDs that have been selected for return to the calling document (the back location in lookup terminology).
protected  LookupResults retrieveLookupResults(String lookupResultsSequenceNumber)
          Retrieves the LookupResults BO with the given sequence number.
 List<ResultRow> retrieveResultsTable(String lookupResultsSequenceNumber, String personId)
          Returns the list of result rows that was persisted under the passed in sequence number
protected  SelectedObjectIds retrieveSelectedObjectIds(String lookupResultsSequenceNumber)
          Retrieves the SelectedObjectIds BO with the given sequence number.
<T extends BusinessObject>
Collection<T>
retrieveSelectedResultBOs(String lookupResultsSequenceNumber, Class<T> boClass, String personId)
          Figures out which support strategy to defer to and uses that service to retrieve the results; if the bo class doesn't qualify with any support strategy, an exception is thrown.
 void setBusinessObjectService(BusinessObjectService businessObjectService)
           
 void setDataDictionarySupportStrategy(LookupResultsSupportStrategyService dataDictionarySupportStrategy)
           
 void setPersistableBusinessObjectSupportStrategy(LookupResultsSupportStrategyService persistableBusinessObjectSupportStrategy)
           
 void setPersistedLookupMetadataDao(PersistedLookupMetadataDao persistedLookupMetadataDao)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LookupResultsServiceImpl

public LookupResultsServiceImpl()
Method Detail

persistResultsTable

public void persistResultsTable(String lookupResultsSequenceNumber,
                                List<ResultRow> resultTable,
                                String personId)
                         throws Exception
Description copied from interface: LookupResultsService
Persists a list of result row objects into a database. The lookup results sequence number acts like a key identifying the lookup results set. If results are persisted under the same sequence number, then the previously persisted list will be overwritten.

Specified by:
persistResultsTable in interface LookupResultsService
Parameters:
lookupResultsSequenceNumber - the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated
resultTable - A list of result rows. Note that this list does not contain BOs, but the data necessary to render a lookup results screen
personId - the user that is performing the search. This prevents a malicious user from passing someone else's sequence number (which he can guess) and eventually retrieving it, possibly exposing sensitive data
Throws:
Exception
See Also:
org.kuali.rice.krad.lookup.LookupResultsService#persistResultsTable(java.lang.String, java.util.List, java.lang.String)

persistSelectedObjectIds

public void persistSelectedObjectIds(String lookupResultsSequenceNumber,
                                     Set<String> selectedObjectIds,
                                     String personId)
                              throws Exception
Description copied from interface: LookupResultsService
Persists a list of BO object IDs that have been selected for return to the calling document (the back location in lookup terminology). The lookup results sequence number acts like a key identifying the selected object IDs. If results are persisted under the same sequence number, then the previously persisted list will be overwritten.

Specified by:
persistSelectedObjectIds in interface LookupResultsService
Parameters:
lookupResultsSequenceNumber - the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated
selectedObjectIds - A set of the object IDs of the selected rows.
personId - the user that is performing the search. This prevents a malicious user from passing someone else's sequence number (which he can guess) and eventually retrieving it, possibly exposing sensitive data
Throws:
Exception
See Also:
org.kuali.rice.krad.lookup.LookupResultsService#persistSelectedObjectIds(java.lang.String, java.util.Set, java.lang.String)

retrieveLookupResults

protected LookupResults retrieveLookupResults(String lookupResultsSequenceNumber)
                                       throws Exception
Retrieves the LookupResults BO with the given sequence number. Does not check authentication.

Parameters:
lookupResultsSequenceNumber -
Returns:
Throws:
Exception

retrieveSelectedObjectIds

protected SelectedObjectIds retrieveSelectedObjectIds(String lookupResultsSequenceNumber)
                                               throws Exception
Retrieves the SelectedObjectIds BO with the given sequence number. Does not check authentication.

Parameters:
lookupResultsSequenceNumber -
Returns:
Throws:
Exception

isAuthorizedToAccessLookupResults

public boolean isAuthorizedToAccessLookupResults(String lookupResultsSequenceNumber,
                                                 String personId)
Description copied from interface: LookupResultsService
Returns whether a user is allowed to view the lookup results of the given sequence number

Specified by:
isAuthorizedToAccessLookupResults in interface LookupResultsService
Parameters:
lookupResultsSequenceNumber - the lookup sequence number that was used to persist the results table
personId - the user id that was used to persist the results table.
Returns:
if the user ID used to persist the lookup results is the same user ID as the parameter
See Also:
org.kuali.rice.krad.lookup.LookupResultsService#isAuthorizedToAccessLookupResults(java.lang.String, java.lang.String)

isAuthorizedToAccessLookupResults

protected boolean isAuthorizedToAccessLookupResults(LookupResults lookupResults,
                                                    String personId)
Returns whether the user ID parameter is allowed to view the results.

Parameters:
lookupResults -
personId -
Returns:

isAuthorizedToAccessSelectedObjectIds

public boolean isAuthorizedToAccessSelectedObjectIds(String lookupResultsSequenceNumber,
                                                     String personId)
Description copied from interface: LookupResultsService
Returns whether a user is allowed to view the selected object IDs of the given sequence number

Specified by:
isAuthorizedToAccessSelectedObjectIds in interface LookupResultsService
Parameters:
lookupResultsSequenceNumber - the lookup sequence number that was used to persist the selected object IDs
personId - the user id that was used to persist the selected object IDs
Returns:
if the user ID used to persist the selected object IDs is the same user ID as the parameter
See Also:
org.kuali.rice.krad.lookup.LookupResultsService#isAuthorizedToAccessSelectedObjectIds(java.lang.String, java.lang.String)

isAuthorizedToAccessSelectedObjectIds

protected boolean isAuthorizedToAccessSelectedObjectIds(SelectedObjectIds selectedObjectIds,
                                                        String personId)
Returns whether the user ID parameter is allowed to view the selected object IDs

Parameters:
selectedObjectIds -
personId -
Returns:

retrieveResultsTable

public List<ResultRow> retrieveResultsTable(String lookupResultsSequenceNumber,
                                            String personId)
                                     throws Exception
Description copied from interface: LookupResultsService
Returns the list of result rows that was persisted under the passed in sequence number

Specified by:
retrieveResultsTable in interface LookupResultsService
Parameters:
lookupResultsSequenceNumber - the lookup sequence number that was used to persist
personId - the user id that was used to persist the results table. This prevents a malicious user from passing someone else's sequence number (which he can guess) and eventually retrieving it, possibly exposing sensitive data
Returns:
Throws:
Exception - many reasons, including if the user id parameter does not match the user used to persist the results
See Also:
org.kuali.rice.krad.lookup.LookupResultsService#retrieveResultsTable(java.lang.String, java.lang.String)

retrieveSelectedResultBOs

public <T extends BusinessObject> Collection<T> retrieveSelectedResultBOs(String lookupResultsSequenceNumber,
                                                                          Class<T> boClass,
                                                                          String personId)
                                                               throws Exception
Figures out which support strategy to defer to and uses that service to retrieve the results; if the bo class doesn't qualify with any support strategy, an exception is thrown. A nasty one, too.

Specified by:
retrieveSelectedResultBOs in interface LookupResultsService
Parameters:
lookupResultsSequenceNumber - the lookup sequence number that was used to persist
boClass - The class of BO being retrieved from the lookup
personId - the user id that was used to persist the results table. This prevents a malicious user from passing someone else's sequence number (which he can guess) and eventually retrieving it, possibly exposing sensitive data
Returns:
A list of BOs corresponding to the
Throws:
Exception - many reasons, including if the user id parameter does not match the user used to persist the results
See Also:
org.kuali.rice.krad.lookup.LookupResultsService#retrieveSelectedResultBOs(java.lang.String, java.lang.Class, java.lang.String)

getQualifingSupportStrategy

protected LookupResultsSupportStrategyService getQualifingSupportStrategy(Class boClass)
Given the business object class, determines the best qualifying LookupResultsSupportStrategyService to use

Parameters:
boClass - a business object class
Returns:
an LookupResultsSupportStrategyService implementation, or null if no qualifying strategies could be found

clearPersistedLookupResults

public void clearPersistedLookupResults(String lookupResultsSequenceNumber)
                                 throws Exception
Description copied from interface: LookupResultsService
Removes the lookup results that were persisted under this lookup results sequence number

Specified by:
clearPersistedLookupResults in interface LookupResultsService
Throws:
Exception
See Also:
org.kuali.rice.krad.lookup.LookupResultsService#clearPersistedLookupResults(java.lang.String)

clearPersistedSelectedObjectIds

public void clearPersistedSelectedObjectIds(String lookupResultsSequenceNumber)
                                     throws Exception
Description copied from interface: LookupResultsService
Removes the lookup results that were persisted under this selected object IDs

Specified by:
clearPersistedSelectedObjectIds in interface LookupResultsService
Throws:
Exception
See Also:
org.kuali.rice.krad.lookup.LookupResultsService#clearPersistedSelectedObjectIds(java.lang.String)

getLookupId

public String getLookupId(BusinessObject businessObject)
Figures out which LookupResultsServiceSupportStrategy to defer to, and uses that to get the lookup id

Specified by:
getLookupId in interface LookupResultsService
Parameters:
businessObject - the business object to get a lookup id for
Returns:
the lookup id
See Also:
org.kuali.rice.krad.lookup.LookupResultsService#getLookupId(org.kuali.rice.krad.bo.BusinessObject)

getBusinessObjectService

public BusinessObjectService getBusinessObjectService()

setBusinessObjectService

public void setBusinessObjectService(BusinessObjectService businessObjectService)

isAuthorizedToAccessMultipleValueLookupMetadata

protected boolean isAuthorizedToAccessMultipleValueLookupMetadata(MultipleValueLookupMetadata mvlm,
                                                                  String personId)
Determines whether the passed in user ID is allowed to view the lookup metadata (object IDs or results table)

Parameters:
mvlm -
personId -
Returns:

deleteOldLookupResults

public void deleteOldLookupResults(Timestamp expirationDate)
Description copied from interface: LookupResultsService
removes all LookupResults BO where the lookup date attribute is older than the parameter

Specified by:
deleteOldLookupResults in interface LookupResultsService
Parameters:
expirationDate - all LookupResults having a lookup date before this date will be removed

deleteOldSelectedObjectIds

public void deleteOldSelectedObjectIds(Timestamp expirationDate)
Description copied from interface: LookupResultsService
removes all LookupResults BO where the lookup date attribute is older than the parameter

Specified by:
deleteOldSelectedObjectIds in interface LookupResultsService
Parameters:
expirationDate - all LookupResults having a lookup date before this date will be removed

getPersistedLookupMetadataDao

public PersistedLookupMetadataDao getPersistedLookupMetadataDao()

setPersistedLookupMetadataDao

public void setPersistedLookupMetadataDao(PersistedLookupMetadataDao persistedLookupMetadataDao)

getPersistableBusinessObjectSupportStrategy

public LookupResultsSupportStrategyService getPersistableBusinessObjectSupportStrategy()
Returns:
the persistableBusinessObjectSupportStrategy

getDataDictionarySupportStrategy

public LookupResultsSupportStrategyService getDataDictionarySupportStrategy()
Returns:
the dataDictionarySupportStrategy

setPersistableBusinessObjectSupportStrategy

public void setPersistableBusinessObjectSupportStrategy(LookupResultsSupportStrategyService persistableBusinessObjectSupportStrategy)
Parameters:
persistableBusinessObjectSupportStrategy - the persistableBusinessObjectSupportStrategy to set

setDataDictionarySupportStrategy

public void setDataDictionarySupportStrategy(LookupResultsSupportStrategyService dataDictionarySupportStrategy)
Parameters:
dataDictionarySupportStrategy - the dataDictionarySupportStrategy to set


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.