jgd.comapi
Class QueryCOM

java.lang.Object
  extended by jgd.comapi.QueryCOM

public class QueryCOM
extends java.lang.Object

Class for performing GD queries This class - as well as the ComponentRegistrator class - uses the Jacob Java-COM -bridge See http://desktop.google.com/queryapi.html#queryobjects and http://desktop.google.com/queryapi.html#queryex

Author:
Arne Solheim (Protector Forsikring ASA - www.protectorforsikring.no), Maso Gato

Field Summary
private  boolean async
           
private  java.lang.String category
           
private  java.lang.String cookie
           
private  com.jacob.com.Variant cookieVariant
           
private  boolean filterDuplicates
           
protected static org.apache.commons.logging.Log log
           
private  boolean matchAllTerms
           
private static java.lang.String[] MIN_GD_PROPERTIES
           
static boolean QUERY
           
static boolean QUERY_EX
           
private  java.lang.String queryString
           
private  int ranking
           
(package private)  JGDRegister register
           
private  boolean useQueryEx
           
 
Constructor Summary
QueryCOM(java.lang.String queryString)
           
QueryCOM(java.lang.String cookie, java.lang.String queryString)
          Uses QueryEx as the query-type
QueryCOM(java.lang.String cookie, java.lang.String queryString, boolean useQueryEx)
          See http://desktop.google.com/queryapi.html#queryobjects and http://desktop.google.com/queryapi.html#queryex
 
Method Summary
 IJGDResultsIterator execute()
           
 QueryResultSet execute(int start, int length)
          See http://desktop.google.com/queryapi.html#querynative Executes the query defined by the current cookie, queryString and useQueryEx
private  QueryResultItem generateResultItem(int i, com.jacob.com.Variant searchResultEntryVariant)
           
 java.lang.String getCategory()
          See http://desktop.google.com/queryapi.html#queryobjects
protected static com.jacob.com.Variant getProperty(com.jacob.activeX.ActiveXComponent searchResultEntry, java.lang.String propertyName)
          See http://desktop.google.com/queryapi.html#individualresult
 java.lang.String getQueryString()
           
 int getRanking()
           
 boolean isAsync()
          See http://desktop.google.com/queryapi.html#queryex
 boolean isFilterDuplicates()
          See http://desktop.google.com/queryapi.html#queryex
 boolean isMatchAllTerms()
          See http://desktop.google.com/queryapi.html#queryex
 void setAsync(boolean async)
          See http://desktop.google.com/queryapi.html#queryex
 void setCategory(java.lang.String category)
          See http://desktop.google.com/queryapi.html#queryobjects
 void setFilterByJournal()
           
 void setFilterDuplicates(boolean filterDuplicates)
          See http://desktop.google.com/queryapi.html#queryex
 void setMatchAllTerms(boolean matchAllTerms)
          See http://desktop.google.com/queryapi.html#queryex
protected  void setProperty(com.jacob.activeX.ActiveXComponent queryEx, java.lang.String propertyName, boolean propertyValue)
          See http://desktop.google.com/queryapi.html#queryex
 void setQueryString(java.lang.String queryString)
           
 void setRanking(int ranking)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

QUERY

public static final boolean QUERY
See Also:
Constant Field Values

QUERY_EX

public static final boolean QUERY_EX
See Also:
Constant Field Values

MIN_GD_PROPERTIES

private static final java.lang.String[] MIN_GD_PROPERTIES

async

private boolean async

filterDuplicates

private boolean filterDuplicates

matchAllTerms

private boolean matchAllTerms

category

private java.lang.String category

ranking

private int ranking

cookie

private java.lang.String cookie

cookieVariant

private com.jacob.com.Variant cookieVariant

queryString

private java.lang.String queryString

useQueryEx

private boolean useQueryEx

register

JGDRegister register
Constructor Detail

QueryCOM

public QueryCOM(java.lang.String queryString)
         throws JGDError
Throws:
JGDError

QueryCOM

public QueryCOM(java.lang.String cookie,
                java.lang.String queryString)
         throws JGDError
Uses QueryEx as the query-type

Throws:
JGDError
See Also:
protector.test.arne.gd.Query(String,String,boolean)

QueryCOM

public QueryCOM(java.lang.String cookie,
                java.lang.String queryString,
                boolean useQueryEx)
         throws JGDError
See http://desktop.google.com/queryapi.html#queryobjects and http://desktop.google.com/queryapi.html#queryex

Parameters:
cookie - The cookie returned when registering the query-component in GD
queryString - the query to be executed within GD
useQueryEx - if true use QueryEx query-type. If false use Query query-type
Throws:
JGDError
Method Detail

execute

public IJGDResultsIterator execute()

execute

public QueryResultSet execute(int start,
                              int length)
See http://desktop.google.com/queryapi.html#querynative Executes the query defined by the current cookie, queryString and useQueryEx

Returns:
a QueryResultSet which in turn contains 0..N QueryResultItem -instances
See Also:
Important: Note that if you are using q Query -object, or a QueryEx -object with async=true then you can't get the correct value of the count -attribute until the query is done executing. You can probably know when you can read the count -attribute using the ready_state -attribute, but that is an exercise left for the reader ;-)

generateResultItem

private QueryResultItem generateResultItem(int i,
                                           com.jacob.com.Variant searchResultEntryVariant)

setProperty

protected void setProperty(com.jacob.activeX.ActiveXComponent queryEx,
                           java.lang.String propertyName,
                           boolean propertyValue)
See http://desktop.google.com/queryapi.html#queryex


getProperty

protected static com.jacob.com.Variant getProperty(com.jacob.activeX.ActiveXComponent searchResultEntry,
                                                   java.lang.String propertyName)
See http://desktop.google.com/queryapi.html#individualresult


isAsync

public boolean isAsync()
See http://desktop.google.com/queryapi.html#queryex


setAsync

public void setAsync(boolean async)
See http://desktop.google.com/queryapi.html#queryex


isFilterDuplicates

public boolean isFilterDuplicates()
See http://desktop.google.com/queryapi.html#queryex


setFilterDuplicates

public void setFilterDuplicates(boolean filterDuplicates)
See http://desktop.google.com/queryapi.html#queryex


isMatchAllTerms

public boolean isMatchAllTerms()
See http://desktop.google.com/queryapi.html#queryex


setMatchAllTerms

public void setMatchAllTerms(boolean matchAllTerms)
See http://desktop.google.com/queryapi.html#queryex


setFilterByJournal

public void setFilterByJournal()
See Also:
setCategory(String)

getCategory

public java.lang.String getCategory()
See http://desktop.google.com/queryapi.html#queryobjects


setCategory

public void setCategory(java.lang.String category)
See http://desktop.google.com/queryapi.html#queryobjects


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this Query -object

getQueryString

public java.lang.String getQueryString()
Returns:
the queryString

setQueryString

public void setQueryString(java.lang.String queryString)
Parameters:
queryString - the queryString to set

getRanking

public int getRanking()
Returns:
the ranking

setRanking

public void setRanking(int ranking)
Parameters:
ranking - the ranking to set


Copyright 2007