From: <fg...@us...> - 2009-02-20 19:28:47
|
Revision: 1048 http://openutils.svn.sourceforge.net/openutils/?rev=1048&view=rev Author: fgrilli Date: 2009-02-20 19:28:38 +0000 (Fri, 20 Feb 2009) Log Message: ----------- imporved javadoc and commented out method Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-02-20 17:43:14 UTC (rev 1047) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-02-20 19:28:38 UTC (rev 1048) @@ -28,13 +28,10 @@ * Order.desc("@jcr:score()")).list(); * </pre> * - * will be translated (if an xpath Criteria implementation is chosen) into the following xpath statement + * will be translated into the following xpath statement * * <pre> - * // dogs//*[((jcr:contains(@name, 'Nana')) and (@weight>10.0) and (@birthDate >= - * // xs:dateTime('2004-01-01T00:00:00.000+00:00') and @birthDate <= - * // xs:dateTime('2008-12-01T23:59:59.000+00:00')))] order by @jcr:score() - * // descending + * //dogs//*[((jcr:contains(@name, 'Nana')) and (@weight>10.0) and (@birthDate >=xs:dateTime('2004-01-01T00:00:00.000+00:00') and @birthDate <=xs:dateTime('2008-12-01T23:59:59.000+00:00')))] order by @jcr:score() descending * </pre> * * This API is blatantly inspired by and respectfully borrows code from Hibernate's Criteria API. <br> @@ -79,12 +76,13 @@ */ public Criteria setFirstResult(int firstResult); - /** + /* * Set a timeout for the underlying query. * @param timeout The timeout value to apply. * @return this (for method chaining) FIXME is it possible in JCR? - */ - public Criteria setTimeout(int timeout); + * + public Criteria setTimeout(int timeout); + */ /** * Get the results. <strong>The implementation should guarantee the caller that the returned Collection is never This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2009-02-20 23:23:20
|
Revision: 1050 http://openutils.svn.sourceforge.net/openutils/?rev=1050&view=rev Author: fgrilli Date: 2009-02-20 21:38:47 +0000 (Fri, 20 Feb 2009) Log Message: ----------- again javadoc Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-02-20 19:45:49 UTC (rev 1049) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-02-20 21:38:47 UTC (rev 1050) @@ -38,9 +38,9 @@ * <br> * @see JCRCriteriaFactory#createMgnlCriteria(String, info.magnolia.cms.core.search.QueryManager, String) * @see JCRCriteriaFactory#createMgnlCriteria(String, info.magnolia.cms.core.search.QueryManager, String, Class) + * @see JCRCriteriaFactory#createJCRCriteria(String, javax.jcr.query.QueryManager, String) * @see Restrictions * @see Order - * @see Criteria * @author Federico Grilli * @version $Id$ */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2009-08-11 19:43:44
|
Revision: 1253 http://openutils.svn.sourceforge.net/openutils/?rev=1253&view=rev Author: fgrilli Date: 2009-08-11 19:43:28 +0000 (Tue, 11 Aug 2009) Log Message: ----------- improved javadoc Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-08-10 12:35:20 UTC (rev 1252) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-08-11 19:43:28 UTC (rev 1253) @@ -18,7 +18,6 @@ */ package net.sourceforge.openutils.mgnlcriteria.jcr.query; - import java.util.Collection; import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Criterion; @@ -27,6 +26,7 @@ /** + * * <tt>Criteria</tt> is a simplified API for retrieving JCR Nodes by composing <tt>Criterion</tt> objects. This is a * very convenient approach for functionality like "search" screens where there is a variable number of conditions to be * placed upon the result set.<br> @@ -35,29 +35,34 @@ * * <pre> * Calendar begin = Calendar.getInstance(); - * begin.set(2004, 0, 1); + * begin.set(2004, Calendar.JANUARY, 1); * Calendar end = Calendar.getInstance(); - * end.set(2008, 11, 1); + * end.set(2008, Calendar.DECEMBER, 1); * * Collection pets = JCRCriteriaFactory.createMgnlCriteria("//dogs//*", MgnlContext.getQueryManager("website"), "nt:base").add( * Restrictions.contains("@name", "Nana")).add( * Restrictions.gt("@weight", new Float(10))).add( * Restrictions.between("@birthDate", begin, end).addOrder( - * Order.desc("@jcr:score()")).list(); + * Order.desc("@name")).list(); * </pre> * * will be translated into the following xpath statement * * <pre> - * //dogs//*[((jcr:contains(@name, 'Nana')) and (@weight>10.0) and (@birthDate >=xs:dateTime('2004-01-01T00:00:00.000+00:00') and @birthDate <=xs:dateTime('2008-12-01T23:59:59.000+00:00')))] order by @jcr:score() descending + * //dogs//*[((jcr:contains(@name, 'Nana')) and (@weight>10.0) and (@birthDate >=xs:dateTime('2004-01-01T00:00:00.000+00:00') and @birthDate <=xs:dateTime('2008-12-01T23:59:59.000+00:00')))] order by @name descending * </pre> * - * This API is blatantly inspired by and respectfully borrows code from Hibernate's Criteria API. <br> + * A word of warning about implementations returned by JCRCriteriaFactory. They are <strong>NOT</strong> thread-safe, therefore client + * code wishing to use one of them as a shared global variable <strong>MUST</strong> coordinate access to it. These objects are actually + * meant to be instantiated and used within a method scope (e.g. a service method), where no concurrent issues arise. <br> * <br> + * This API was inspired by Hibernate's Criteria API. <br> + * * @see JCRCriteriaFactory#createMgnlCriteria(String, info.magnolia.cms.core.search.QueryManager, String) * @see JCRCriteriaFactory#createMgnlCriteria(String, info.magnolia.cms.core.search.QueryManager, String, Class) * @see JCRCriteriaFactory#createMgnlCriteriaWithLimit(String, info.magnolia.cms.core.search.QueryManager, String) - * @see JCRCriteriaFactory#createMgnlCriteriaWithLimit(String, info.magnolia.cms.core.search.QueryManager, String, Class) + * @see JCRCriteriaFactory#createMgnlCriteriaWithLimit(String, info.magnolia.cms.core.search.QueryManager, String, + * Class) * @see Restrictions * @see Order * @author Federico Grilli @@ -98,10 +103,8 @@ /* * Set a timeout for the underlying query. * @param timeout The timeout value to apply. - * @return this (for method chaining) FIXME is it possible in JCR? - * - public Criteria setTimeout(int timeout); - */ + * @return this (for method chaining) FIXME is it possible in JCR? public Criteria setTimeout(int timeout); + */ /** * Get the results. <strong>The implementation should guarantee the caller that the returned Collection is never This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2009-08-13 08:42:32
|
Revision: 1260 http://openutils.svn.sourceforge.net/openutils/?rev=1260&view=rev Author: fgrilli Date: 2009-08-13 08:42:22 +0000 (Thu, 13 Aug 2009) Log Message: ----------- improced javadoc for Criteria Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-08-13 08:10:16 UTC (rev 1259) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-08-13 08:42:22 UTC (rev 1260) @@ -26,7 +26,6 @@ /** - * * <tt>Criteria</tt> is a simplified API for retrieving JCR Nodes by composing <tt>Criterion</tt> objects. This is a * very convenient approach for functionality like "search" screens where there is a variable number of conditions to be * placed upon the result set.<br> @@ -52,12 +51,57 @@ * //dogs//*[((jcr:contains(@name, 'Nana')) and (@weight>10.0) and (@birthDate >=xs:dateTime('2004-01-01T00:00:00.000+00:00') and @birthDate <=xs:dateTime('2008-12-01T23:59:59.000+00:00')))] order by @name descending * </pre> * - * A word of warning about implementations returned by JCRCriteriaFactory. They are <strong>NOT</strong> thread-safe, therefore client - * code wishing to use one of them as a shared global variable <strong>MUST</strong> coordinate access to it. These objects are actually - * meant to be instantiated and used within a method scope (e.g. a service method), where no concurrent issues arise. <br> + * You can also specify a different type to be returned in the Collection of results. eg. + * + * <pre> + * Collection<Pet> pets = JCRCriteriaFactory.createMgnlCriteria("//dogs//*", MgnlContext.getQueryManager("website"), "mgnl:content", Pet.class).add( + * Restrictions.contains("@name", "Nana")).add( + * Restrictions.gt("@weight", new Float(10))).add( + * Restrictions.between("@birthDate", begin, end).addOrder( + * Order.desc("@name")).list(); + * </pre> + * + * Internally, this will use info.magnolia.content2bean.Content2BeanUtil.toBean() to transform nodes into beans. So, for + * example, if you have a domain Pet class like this + * + * <pre> + * public class Pet + * { + * private String name; + * private Float weight; + * private Calendar birthDate; + * //getters and setters here... + * } + * </pre> + * + * Content nodes returned by the above query will be automatically converted to and populate instances of the + * <code>Pet</code> type. Furthermore, you may want to have only a subset of the whole result set returned, much like in + * a MySQL limit clause. In this case, you will use the <code>JCRCriteriaFactory.createMgnlCriteriaWithLimit</code> factory method. + * For this to work, the underlying JCR repository implementation must support this feature (Jackrabbit 1.4+ does). Here + * is an example. + * + *<pre> + * Collection<Pet> pets = JCRCriteriaFactory.createMgnlCriteriaWithLimit("//dogs//*", MgnlContext.getQueryManager("website"), "mgnl:content", Pet.class).add( + * Restrictions.contains("@name", "Nana")).add( + * Restrictions.gt("@weight", new Float(10))).add( + * Restrictions.between("@birthDate", begin, end). + * setFirstResult(5). + * setMaxResults(10). + * addOrder(Order.desc("@jcr:score()")).list(); + *</pre> + * + * Notice the <code>setFirstResult(int)</code> and <code>setMaxResults(int)</code> methods. Now calling + * <code>list()</code> will return a subset of only five <code>Pet</code> objects, starting from the 6th item (counting + * starts from 0). If you dont specify these two calls, <code>list()</code> will behave as usual by returning the entire result set. + * If you only call <code>setMaxResults(int)</code>, the result set will be the subset of elements <code>[0, maxResults]</code> + * (firstResultValue is 0 by default). + * <br><br> + * A word of warning about implementations returned by <code>JCRCriteriaFactory</code>. They are <strong>NOT</strong> thread-safe, + * therefore client code wishing to use one of them as a shared global variable <strong>MUST</strong> coordinate access + * to it. These objects are actually meant to be instantiated and used within a method scope (e.g. a service method), + * where no concurrent issues arise. <br> * <br> - * This API was inspired by Hibernate's Criteria API. <br> - * + * This API was inspired by Hibernate's Criteria API. <br><br> * @see JCRCriteriaFactory#createMgnlCriteria(String, info.magnolia.cms.core.search.QueryManager, String) * @see JCRCriteriaFactory#createMgnlCriteria(String, info.magnolia.cms.core.search.QueryManager, String, Class) * @see JCRCriteriaFactory#createMgnlCriteriaWithLimit(String, info.magnolia.cms.core.search.QueryManager, String) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2009-08-28 11:23:47
|
Revision: 1319 http://openutils.svn.sourceforge.net/openutils/?rev=1319&view=rev Author: fgrilli Date: 2009-08-28 11:23:30 +0000 (Fri, 28 Aug 2009) Log Message: ----------- "Code lives in the examples" (Joshua Bloch). Then dont corrupt the young and the innocent by using new Float(10), instead use Float.valueOf(10) Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-08-26 13:36:56 UTC (rev 1318) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2009-08-28 11:23:30 UTC (rev 1319) @@ -40,7 +40,7 @@ * * Collection pets = JCRCriteriaFactory.createMgnlCriteria("//dogs//*", MgnlContext.getQueryManager("website"), "nt:base").add( * Restrictions.contains("@name", "Nana")).add( - * Restrictions.gt("@weight", new Float(10))).add( + * Restrictions.gt("@weight", Float.valueOf(10))).add( * Restrictions.between("@birthDate", begin, end).addOrder( * Order.desc("@name")).list(); * </pre> @@ -56,7 +56,7 @@ * <pre> * Collection<Pet> pets = JCRCriteriaFactory.createMgnlCriteria("//dogs//*", MgnlContext.getQueryManager("website"), "mgnl:content", Pet.class).add( * Restrictions.contains("@name", "Nana")).add( - * Restrictions.gt("@weight", new Float(10))).add( + * Restrictions.gt("@weight", Float.valueOf(10))).add( * Restrictions.between("@birthDate", begin, end).addOrder( * Order.desc("@name")).list(); * </pre> @@ -83,11 +83,11 @@ *<pre> * Collection<Pet> pets = JCRCriteriaFactory.createMgnlCriteriaWithLimit("//dogs//*", MgnlContext.getQueryManager("website"), "mgnl:content", Pet.class).add( * Restrictions.contains("@name", "Nana")).add( - * Restrictions.gt("@weight", new Float(10))).add( + * Restrictions.gt("@weight", Float.valueOf(10))).add( * Restrictions.between("@birthDate", begin, end). * setFirstResult(5). * setMaxResults(10). - * addOrder(Order.desc("@jcr:score()")).list(); + * addOrder(Order.desc("@name")).list(); *</pre> * * Notice the <code>setFirstResult(int)</code> and <code>setMaxResults(int)</code> methods. Now calling This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <die...@us...> - 2010-05-12 17:17:14
|
Revision: 2431 http://openutils.svn.sourceforge.net/openutils/?rev=2431&view=rev Author: diego_schivo Date: 2010-05-12 17:17:07 +0000 (Wed, 12 May 2010) Log Message: ----------- CRIT-11 javadocs Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2010-05-12 16:51:27 UTC (rev 2430) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2010-05-12 17:17:07 UTC (rev 2431) @@ -156,31 +156,31 @@ Collection< ? > list() throws JCRQueryException; /** - * - * @param path - * @return + * Sets the base path of the query, i.e. the branch in the repository tree where the search will take place + * @param path the handle of a node, or a xpath query prefix in the form //handle/of/a/node//* + * @return this (for method chaining) */ Criteria setBasePath(String path); /** * - * @param itemsPerPage - * @param pageNumberStartingFromOne - * @return + * @param itemsPerPage maximum number of results per page (i.e. page size) + * @param pageNumberStartingFromOne page number to retrieve (1, 2, 3, ...) + * @return this (for method chaining) */ Criteria setPaging(int itemsPerPage, int pageNumberStartingFromOne); /** * * @param spellCheckString - * @return + * @return this (for method chaining) */ Criteria setSpellCheckString(String spellCheckString); /** - * - * @param path - * @return + * Sets the name of the workspace where the search will take place + * @param workspace the name of a workspace + * @return this (for method chaining) */ Criteria setWorkspace(String workspace); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <die...@us...> - 2010-05-13 07:58:39
|
Revision: 2438 http://openutils.svn.sourceforge.net/openutils/?rev=2438&view=rev Author: diego_schivo Date: 2010-05-13 07:58:33 +0000 (Thu, 13 May 2010) Log Message: ----------- CRIT-11 javadocs Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2010-05-13 07:46:59 UTC (rev 2437) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2010-05-13 07:58:33 UTC (rev 2438) @@ -38,12 +38,15 @@ * begin.set(2004, Calendar.JANUARY, 1); * Calendar end = Calendar.getInstance(); * end.set(2008, Calendar.DECEMBER, 1); - * - * Collection pets = JCRCriteriaFactory.createMgnlCriteria("//dogs//*", MgnlContext.getQueryManager("website"), "nt:base").add( - * Restrictions.contains("@name", "Nana")).add( - * Restrictions.gt("@weight", Float.valueOf(10))).add( - * Restrictions.between("@birthDate", begin, end).addOrder( - * Order.desc("@name")).list(); + * + * Criteria criteria = JCRCriteriaFactory + * .createCriteria() + * .setWorkspace(ContentRepository.WEBSITE) + * .setBasePath("/dogs") + * .add(Restrictions.contains("@name", "Nana")) + * .add(Restrictions.gt("@weight", Float.valueOf(10))) + * .add(Restrictions.between("@birthDate", begin, end)) + * .addOrder(Order.desc("@name")); * </pre> * * will be translated into the following xpath statement @@ -52,31 +55,7 @@ * //dogs//*[((jcr:contains(@name, 'Nana')) and (@weight>10.0) and (@birthDate >=xs:dateTime('2004-01-01T00:00:00.000+00:00') and @birthDate <=xs:dateTime('2008-12-01T23:59:59.000+00:00')))] order by @name descending * </pre> * - * You can also specify a different type to be returned in the Collection of results. eg. - * - * <pre> - * Collection<Pet> pets = JCRCriteriaFactory.createMgnlCriteria("//dogs//*", MgnlContext.getQueryManager("website"), "mgnl:content", Pet.class).add( - * Restrictions.contains("@name", "Nana")).add( - * Restrictions.gt("@weight", Float.valueOf(10))).add( - * Restrictions.between("@birthDate", begin, end).addOrder( - * Order.desc("@name")).list(); - * </pre> - * - * Internally, this will use info.magnolia.content2bean.Content2BeanUtil.toBean() to transform nodes into beans. So, for - * example, if you have a domain Pet class like this - * - * <pre> - * public class Pet - * { - * private String name; - * private Float weight; - * private Calendar birthDate; - * //getters and setters here... - * } - * </pre> - * - * Content nodes returned by the above query will be automatically converted to and populate instances of the - * <code>Pet</code> type. Furthermore, you may want to have only a subset of the whole result set returned, much like in + * Furthermore, you may want to have only a subset of the whole result set returned, much like in * a MySQL limit clause. In this case, you will use the <code>JCRCriteriaFactory.createMgnlCriteriaWithLimit</code> * factory method. For this to work, the underlying JCR repository implementation must support this feature (Jackrabbit * 1.4+ does). Here is an example. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <die...@us...> - 2010-05-13 10:29:47
|
Revision: 2442 http://openutils.svn.sourceforge.net/openutils/?rev=2442&view=rev Author: diego_schivo Date: 2010-05-13 10:29:41 +0000 (Thu, 13 May 2010) Log Message: ----------- CRIT-11 javadocs Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2010-05-13 10:25:46 UTC (rev 2441) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/Criteria.java 2010-05-13 10:29:41 UTC (rev 2442) @@ -90,14 +90,12 @@ * <br> * This API was inspired by Hibernate's Criteria API. <br> * <br> - * @see JCRCriteriaFactory#createMgnlCriteria(String, info.magnolia.cms.core.search.QueryManager, String) - * @see JCRCriteriaFactory#createMgnlCriteria(String, info.magnolia.cms.core.search.QueryManager, String, Class) - * @see JCRCriteriaFactory#createMgnlCriteriaWithLimit(String, info.magnolia.cms.core.search.QueryManager, String) - * @see JCRCriteriaFactory#createMgnlCriteriaWithLimit(String, info.magnolia.cms.core.search.QueryManager, String, - * Class) + * @see JCRCriteriaFactory#createCriteria() + * @see JCRCriteriaFactory#createDirectJcrQuery(info.magnolia.cms.core.HierarchyManager, String, String) * @see Restrictions * @see Order * @author Federico Grilli + * @author fgiust * @version $Id$ */ public interface Criteria extends ExecutableQuery This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |