View Javadoc

1   /*
2    * Copyright (c) 2004-2005, University Health Network.  All rights reserved. Distributed under the BSD 
3    * license (see http://opensource.org/licenses/bsd-license.php).
4    *  
5    * Created on 15-Dec-2004 at 4:47:07 PM
6    */
7   package ca.uhn.cache.internal.hibernate;
8   
9   import java.util.Map;
10  
11  import ca.uhn.cache.IGroupQueryParam;
12  import ca.uhn.cache.IPointQueryParam;
13  import ca.uhn.cache.internal.hibernate.impl.Field;
14  import ca.uhn.cache.internal.hibernate.impl.Record;
15  
16  /***
17   * Factory like class that acts as a <b>helper</b> to be used by the <code>HibernateQueryResultStore</code>
18   * to create <code>Field</code> subclasses and generate the hibernate HQL corresponding to <code>IQueryParam</code>s.
19   * 
20   * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara </a>
21   * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:58 $ by $Author: bryan_tripp $
22   */
23  public interface IQueryParamHelper {
24  
25      /***
26       * Creates an instance of the <code>Field</code> subclass corresponding to
27       * the provided <code>IQueryParam</code>.
28       * 
29       * @param theRecord The record this field belongs to. 
30       * @param theQueryParam
31       *            The provided query param.
32       * @return The created <code>Field</code> subclass.
33       */
34      public Field createField( Record theRecord, IPointQueryParam theQueryParam );
35  
36      /***
37       * @return The class of the field that is created when invoking 
38       *         the method {@link #createField(Record, IPointQueryParam)}
39       */
40      public Class getFieldClass();
41      
42      /***
43       * Generates the HQL corresponding to the provided "point" query param.
44       *  
45       * @param thePointQueryParam The provided "point" query param.
46       * @param theIndex The index of the query param within the containing query.
47       * 
48       * @return The generated HQL.
49       */
50      public String generateHql( IPointQueryParam thePointQueryParam, int theIndex );
51      
52      /***
53       * Generates the HQL corresponding to the provided "point" query param.
54       *  
55       * @param theGroupQueryParam The provided "group" query param.
56       * @param theIndex The index of the query param within the containing query.
57       * 
58       * @return The generated HQL.
59       */
60      public String generateHql( IGroupQueryParam theGroupQueryParam, int theIndex );
61  
62      /***
63       * Generates a Map of paramName => paramValue corresponding to the provided "point" query param.
64       * 
65       * @param thePointQueryParam The provided "point" query param.
66       * @param theIndex The index of the query param within the containing query.
67       * 
68       * @return The generated Map. 
69       */
70      public Map generateHqlParamMap( IPointQueryParam thePointQueryParam, int theIndex );
71      
72      /***
73       * Generates a Map of paramName => paramValue corresponding to the provided "point" query param.
74       * 
75       * @param theGroupQueryParam The provided "group" query param.
76       * @param theIndex The index of the query param within the containing query.
77       * 
78       * @return The generated Map. 
79       */
80      public Map generateHqlParamMap( IGroupQueryParam theGroupQueryParam, int theIndex );
81      
82  }