com.flexive.shared.scripting.groovy
Class GroovyQueryBuilder

java.lang.Object
  extended by groovy.lang.GroovyObjectSupport
      extended by groovy.util.BuilderSupport
          extended by com.flexive.shared.scripting.groovy.GroovyQueryBuilder
All Implemented Interfaces:
groovy.lang.GroovyObject

public class GroovyQueryBuilder
extends groovy.util.BuilderSupport

An (experimental) groovy builder for search queries.
Example:

    new GroovyQueryBuilder().select(["@pk", "caption", "*"]) {
      eq("caption", "bla")
      not_empty("filename")
      or {
         gt("id", 0)
         lt("id", 100)
      }
      lt("created_at", new Date())
    }.sqlQuery
 

Version:
$Rev: 2906 $
Author:
Daniel Lichtenberger (daniel.lichtenberger@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)

Constructor Summary
GroovyQueryBuilder()
           
GroovyQueryBuilder(SqlQueryBuilder builder)
          Use an external query builder as the target builder.
 
Method Summary
 java.lang.Object builder(groovy.lang.Closure closure)
           
protected  java.lang.Object createNode(java.lang.Object name)
          
protected  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes)
          
protected  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
          
protected  java.lang.Object createNode(java.lang.Object name, java.lang.Object value)
          
protected  java.lang.Object doInvokeMethod(java.lang.String methodName, java.lang.Object name, java.lang.Object args)
          
protected  void setParent(java.lang.Object parent, java.lang.Object child)
          
 
Methods inherited from class groovy.util.BuilderSupport
getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyQueryBuilder

public GroovyQueryBuilder()

GroovyQueryBuilder

public GroovyQueryBuilder(SqlQueryBuilder builder)
Use an external query builder as the target builder.

Parameters:
builder - a sql query builder to be used for creating the query
Method Detail

builder

public java.lang.Object builder(groovy.lang.Closure closure)

doInvokeMethod

protected java.lang.Object doInvokeMethod(java.lang.String methodName,
                                          java.lang.Object name,
                                          java.lang.Object args)

Overrides:
doInvokeMethod in class groovy.util.BuilderSupport

setParent

protected void setParent(java.lang.Object parent,
                         java.lang.Object child)

Specified by:
setParent in class groovy.util.BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name)

Specified by:
createNode in class groovy.util.BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.lang.Object value)

Specified by:
createNode in class groovy.util.BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.util.Map attributes)

Specified by:
createNode in class groovy.util.BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.util.Map attributes,
                                      java.lang.Object value)

Specified by:
createNode in class groovy.util.BuilderSupport