ca.uhn.cache.internal.impl
Class HibernateQueryResultStore

java.lang.Object
  extended byorg.springframework.orm.hibernate.support.HibernateDaoSupport
      extended byca.uhn.cache.internal.impl.HibernateQueryResultStore
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, IQueryResultStore

public class HibernateQueryResultStore
extends org.springframework.orm.hibernate.support.HibernateDaoSupport
implements IQueryResultStore, org.springframework.beans.factory.InitializingBean

Hibernate implementation of IQueryResultStore.

Version:
$Revision: 1.1 $ updated on $Date: 2005/01/24 22:54:03 $ by $Author: bryan_tripp $
Author:
Alexei Guevara

Field Summary
 
Fields inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
logger
 
Constructor Summary
HibernateQueryResultStore()
           
 
Method Summary
protected  void copy(Field theSource, Field theDestination)
          copy all the attributes except: hibernateId and record.
protected  void copy(Record theSource, Record theDestination)
          copy all the attributes except: hibernateId and fields.
protected  Field createFieldFrom(Record theRecord, IPointQueryParam theQueryParam)
          Creates the corresponding Field subclass for the provided IQueryParam.
protected  Record createRecordFrom(IDataItem theDataItem)
          Creates the corresponding Record for the provided IQuery.
 int delete(IQuery theProjection)
          Removes the data matching the specified query from the store.
 IParamSpace getParamSpace()
           
protected  IQueryParamHelper getQueryParamHelper(IQueryParam theQueryParam)
          Retrieves the IQueryParamHelper corresponding to the provided query param.
 void insert(IQueryResult theQueryResult)
          Stores the given query result.
protected  void registerQueryParamToQueryParamHelper(java.lang.Class theQueryParamClazz, IQueryParamHelper theFieldFactory)
          Registers the mapping between an IQueryParam and the corresponding Field subclass.
 IQueryResult select(IQuery theQuery)
          Returns the query result from the store that matches the given query.
 void setParamSpace(IParamSpace theParamSpace)
           
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
afterPropertiesSet, closeSessionIfNecessary, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, initDao, setHibernateTemplate, setSessionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
 

Constructor Detail

HibernateQueryResultStore

public HibernateQueryResultStore()
Method Detail

delete

public int delete(IQuery theProjection)
           throws QueryResultStoreException
Removes the data matching the specified query from the store.

Specified by:
delete in interface IQueryResultStore
Parameters:
theProjection - The query.
Returns:
The number of data items deleted from the query result store.
Throws:
QueryResultStoreException - If the delete operation could not be successfully completed.

getParamSpace

public IParamSpace getParamSpace()
Returns:
Returns the paramSpace.

insert

public void insert(IQueryResult theQueryResult)
            throws QueryResultStoreException
Stores the given query result.

Specified by:
insert in interface IQueryResultStore
Parameters:
theQueryResult - The IQueryResult.
Throws:
QueryResultStoreException - If the insert operation could not be successfully completed.

copy

protected void copy(Record theSource,
                    Record theDestination)
copy all the attributes except: hibernateId and fields. TODO use reflection


copy

protected void copy(Field theSource,
                    Field theDestination)
copy all the attributes except: hibernateId and record. TODO use reflection


select

public IQueryResult select(IQuery theQuery)
                    throws QueryResultStoreException
Returns the query result from the store that matches the given query.

Specified by:
select in interface IQueryResultStore
Parameters:
theQuery - The query.
Returns:
The IQueryResult matching the query.
Throws:
QueryResultStoreException - If the select operation could not be successfully completed.

setParamSpace

public void setParamSpace(IParamSpace theParamSpace)
Parameters:
theParamSpace - The paramSpace to set.

createFieldFrom

protected Field createFieldFrom(Record theRecord,
                                IPointQueryParam theQueryParam)
Creates the corresponding Field subclass for the provided IQueryParam. Use #registerQueryParamToField(Class, IFieldFactory) to register mapping between an IQueryParam and the corresponding Field subclass.

Parameters:
theRecord - The record the field will be associated with.
theQueryParam - The provided IPointQueryParam.
Returns:
The created Field, or null if no mapping has been registered for the provided IQueryParam

createRecordFrom

protected Record createRecordFrom(IDataItem theDataItem)
Creates the corresponding Record for the provided IQuery.

Parameters:
theDataItem - The provided IQuery.
Returns:
The created Record.

getQueryParamHelper

protected IQueryParamHelper getQueryParamHelper(IQueryParam theQueryParam)
Retrieves the IQueryParamHelper corresponding to the provided query param.

Parameters:
theQueryParam - The provided query param.
Returns:
The corresponding IQueryParamHelper, or null if there is no corresponding IQueryParamHelper for the provided query param.
See Also:
registerQueryParamToQueryParamHelper(Class, IQueryParamHelper)

registerQueryParamToQueryParamHelper

protected void registerQueryParamToQueryParamHelper(java.lang.Class theQueryParamClazz,
                                                    IQueryParamHelper theFieldFactory)
Registers the mapping between an IQueryParam and the corresponding Field subclass.

Parameters:
theQueryParamClazz - The query param class.
theFieldFactory - The Field subclass factory.


Copyright © 2004-2005 University Health Network. All Rights Reserved.