com.xpn.xwiki.plugin.query
Class QueryPlugin

java.lang.Object
  extended by com.xpn.xwiki.plugin.XWikiDefaultPlugin
      extended by com.xpn.xwiki.plugin.query.QueryPlugin
All Implemented Interfaces:
IQueryFactory, XWikiPluginInterface

public class QueryPlugin
extends XWikiDefaultPlugin
implements IQueryFactory

Plugin for Query API


Field Summary
(package private)  XWikiCache cache
           
(package private)  XWikiContext context
           
private static org.apache.commons.logging.Log log
           
(package private)  QueryPluginApi queryApi
           
 
Constructor Summary
QueryPlugin(java.lang.String name, java.lang.String className, XWikiContext context)
           
 
Method Summary
 IQuery getAttachment(java.lang.String docname, java.lang.String attachname, java.lang.String order)
          create query for attachments
 XWikiCache getCache()
           
 IQuery getChildDocs(java.lang.String docname, java.lang.String prop, java.lang.String order)
          create query for child documents
 XWikiContext getContext()
           
 IQuery getDocs(java.lang.String docname, java.lang.String prop, java.lang.String order)
          create query for docs
 java.lang.String getName()
           
 IQuery getObjects(java.lang.String docname, java.lang.String oclass, java.lang.String prop, java.lang.String order)
          create query for objects
protected  java.lang.String getOrderXPath(java.lang.String order)
           
 Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context)
           
protected  java.lang.String getPropertyXPath(java.lang.String prop)
           
 XWikiStoreInterface getStore()
           
protected  java.lang.String getXPathName(java.lang.String name)
           
protected  java.lang.String getXWikiName(java.lang.String name)
           
(package private)  boolean isHibernate()
           
private  java.lang.String n2e(java.lang.String s)
           
protected  org.apache.jackrabbit.core.query.QueryRootNode parse(java.lang.String query, java.lang.String language)
          Translate query string to query tree
 IQuery ql(java.lang.String q)
          create JCRSQL query unsupported for now
 IQuery xpath(java.lang.String q)
          create xpath query
 
Methods inherited from class com.xpn.xwiki.plugin.XWikiDefaultPlugin
beginRendering, commonTagsHandler, downloadAttachment, endRendering, endRenderingHandler, flushCache, getClassName, init, insidePREHandler, outsidePREHandler, setClassName, setName, startRenderingHandler, virtualInit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

cache

XWikiCache cache

context

XWikiContext context

queryApi

QueryPluginApi queryApi
Constructor Detail

QueryPlugin

public QueryPlugin(java.lang.String name,
                   java.lang.String className,
                   XWikiContext context)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface XWikiPluginInterface
Overrides:
getName in class XWikiDefaultPlugin

getPluginApi

public Api getPluginApi(XWikiPluginInterface plugin,
                        XWikiContext context)
Specified by:
getPluginApi in interface XWikiPluginInterface
Overrides:
getPluginApi in class XWikiDefaultPlugin

getContext

public XWikiContext getContext()
Specified by:
getContext in interface IQueryFactory

getStore

public XWikiStoreInterface getStore()
Specified by:
getStore in interface IQueryFactory

getCache

public XWikiCache getCache()
Specified by:
getCache in interface IQueryFactory

isHibernate

boolean isHibernate()

parse

protected org.apache.jackrabbit.core.query.QueryRootNode parse(java.lang.String query,
                                                               java.lang.String language)
                                                        throws javax.jcr.query.InvalidQueryException
Translate query string to query tree

Throws:
javax.jcr.query.InvalidQueryException

xpath

public IQuery xpath(java.lang.String q)
             throws javax.jcr.query.InvalidQueryException
create xpath query

Specified by:
xpath in interface IQueryFactory
Throws:
javax.jcr.query.InvalidQueryException

ql

public IQuery ql(java.lang.String q)
          throws javax.jcr.query.InvalidQueryException
create JCRSQL query unsupported for now

Specified by:
ql in interface IQueryFactory
Throws:
javax.jcr.query.InvalidQueryException

getDocs

public IQuery getDocs(java.lang.String docname,
                      java.lang.String prop,
                      java.lang.String order)
               throws javax.jcr.query.InvalidQueryException
create query for docs

Specified by:
getDocs in interface IQueryFactory
Parameters:
web, - docname - document.web & .name. it may consist xpath []-selection. if any - *
prop - - return property, start with @, if null - return document
order - - properties for sort, separated by ','; order: ascending/descending after prop. name, or +/- before. if null - not sort
Throws:
javax.jcr.query.InvalidQueryException

getChildDocs

public IQuery getChildDocs(java.lang.String docname,
                           java.lang.String prop,
                           java.lang.String order)
                    throws javax.jcr.query.InvalidQueryException
create query for child documents

Specified by:
getChildDocs in interface IQueryFactory
Parameters:
web,docname - must be without templates & [] select
Throws:
javax.jcr.query.InvalidQueryException
See Also:
getDocs

getAttachment

public IQuery getAttachment(java.lang.String docname,
                            java.lang.String attachname,
                            java.lang.String order)
                     throws javax.jcr.query.InvalidQueryException
create query for attachments

Specified by:
getAttachment in interface IQueryFactory
Parameters:
attachname - - name of attachment, may be *, *[]
Throws:
javax.jcr.query.InvalidQueryException
See Also:
getDocs

getObjects

public IQuery getObjects(java.lang.String docname,
                         java.lang.String oclass,
                         java.lang.String prop,
                         java.lang.String order)
                  throws javax.jcr.query.InvalidQueryException
create query for objects

Specified by:
getObjects in interface IQueryFactory
Parameters:
oweb, - oclass - object web & class. if any - *
prop. - for flex-attributes use f:flexname
Throws:
javax.jcr.query.InvalidQueryException
See Also:
getDocs

getXWikiName

protected java.lang.String getXWikiName(java.lang.String name)

getXPathName

protected java.lang.String getXPathName(java.lang.String name)

getOrderXPath

protected java.lang.String getOrderXPath(java.lang.String order)

getPropertyXPath

protected java.lang.String getPropertyXPath(java.lang.String prop)

n2e

private final java.lang.String n2e(java.lang.String s)


Copyright 2003 Ludovic Dubost