root/trunk/components/server/src/ome/services/query/StringQuerySource.java
| Revision 1167, 1.7 kB (checked in by jmoore, 2 years ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /* |
| 2 | * ome.services.query.StringQuerySource |
| 3 | * |
| 4 | * Copyright 2006 University of Dundee. All rights reserved. |
| 5 | * Use is subject to license terms supplied in LICENSE.txt |
| 6 | */ |
| 7 | |
| 8 | /*------------------------------------------------------------------------------ |
| 9 | * |
| 10 | * Written by: Josh Moore <josh.moore@gmx.de> |
| 11 | * |
| 12 | *------------------------------------------------------------------------------ |
| 13 | */ |
| 14 | |
| 15 | package ome.services.query; |
| 16 | |
| 17 | // Java imports |
| 18 | |
| 19 | // Third-party libraries |
| 20 | import org.apache.commons.logging.Log; |
| 21 | import org.apache.commons.logging.LogFactory; |
| 22 | |
| 23 | // Application-internal dependencies |
| 24 | import ome.parameters.Parameters; |
| 25 | |
| 26 | /** |
| 27 | * interprets the query id as an HQL query. In this implementation, no parsing |
| 28 | * is done at lookup or creation-time, but an implementation which does so is |
| 29 | * conceivable. The id itself is added to the list of parameters with the name |
| 30 | * {@link ome.services.query.StringQuery#STRING} |
| 31 | * |
| 32 | * This query source should be placed at the end of the array of query sources |
| 33 | * provided to {@link ome.services.query.QueryFactory} because it will always |
| 34 | * return a {@link ome.services.query.Query} regardless of the id. An exception |
| 35 | * will be thrown at execution time if the HQL is invalid. |
| 36 | * |
| 37 | * @author Josh Moore, <a href="mailto:josh.moore@gmx.de">josh.moore@gmx.de</a> |
| 38 | * @version 1.0 <small> (<b>Internal version:</b> $Rev$ $Date$) </small> |
| 39 | * @since OMERO 3.0 |
| 40 | */ |
| 41 | public class StringQuerySource extends QuerySource { |
| 42 | |
| 43 | private static Log log = LogFactory.getLog(StringQuerySource.class); |
| 44 | |
| 45 | @Override |
| 46 | public Query lookup(String queryID, Parameters parameters) { |
| 47 | Parameters p = new Parameters(parameters); |
| 48 | p.addString(StringQuery.STRING, queryID); |
| 49 | return new StringQuery(p); |
| 50 | } |
| 51 | |
| 52 | } |
Note: See TracBrowser
for help on using the browser.
