jsdai.lang
Interface SdaiQuery


public interface SdaiQuery

This interface is a way to deal with SDAI queries. The query first has to be created from SdaiSession. The parameters of a query can be set using setParameter. The query can be then executed. Prior to execution Query source and domain can be set. Alternatively they can be supplied in execute method. Domain is used to override the domain defined in QuerySource (see QuerySource.getQuerySourceDomain()). If query source nor domain are defined the query is executed on a predefined query source which is implementation specific. The preferred way to get the results is getResultSet.

See Also:
SdaiSession.newQuery(org.w3c.dom.Document), SdaiSession.newQuery(org.w3c.dom.Element)

Method Summary
 void execute()
          Executes this query on a default or predefined query source.
 void execute(QuerySource qs)
          Executes this query on the supplied query source.
 void execute(QuerySource qs, ASdaiModel domain)
          Executes this query on the supplied query source and domain.
 AEntity getResult(int index)
          Deprecated. This method does not support <items> constraint. For queries V1.1 the preferred way is to use getResultSet(int).
 AEntity getResult(java.lang.String name)
          Deprecated. This method does not support <items> constraint. For queries V1.1 the preferred way is to use getResultSet(String).
 java.lang.String[] getResultNames()
          Returns all result names.
 QueryResultSet getResultSet(int index)
          Returns result set by index.
 QueryResultSet getResultSet(java.lang.String name)
          Returns result set by name.
 void setDomain(ASdaiModel domain)
          Sets a query domain.
 void setParameter(java.lang.String name, java.lang.Object value)
          Sets the parameter of this query.
 void setQuerySource(QuerySource qs)
          Sets the default query source to be later used be execute() method.
 

Method Detail

setQuerySource

public void setQuerySource(QuerySource qs)
                    throws SdaiException
Sets the default query source to be later used be execute() method.

Parameters:
qs - The QuerySource to set
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

setDomain

public void setDomain(ASdaiModel domain)
               throws SdaiException
Sets a query domain. This method makes it possible to override the domain defined in a QuerySource.

Parameters:
domain - The domain to set
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

execute

public void execute()
             throws SdaiException
Executes this query on a default or predefined query source.

Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

execute

public void execute(QuerySource qs)
             throws SdaiException
Executes this query on the supplied query source.

Parameters:
qs - The QuerySource to execute this query on
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

execute

public void execute(QuerySource qs,
                    ASdaiModel domain)
             throws SdaiException
Executes this query on the supplied query source and domain.

Parameters:
qs - The QuerySource to execute this query on
domain - The domain which overrides query source domain
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

getResult

public AEntity getResult(java.lang.String name)
                  throws SdaiException
Deprecated. This method does not support <items> constraint. For queries V1.1 the preferred way is to use getResultSet(String).

Returns result by name as AEntity. The query has to be executed before the result can be obtained.

Parameters:
name - The name of the result. All result names can be obtained from getResultNames()
Returns:
AEntity containing entity instances of this result
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

getResult

public AEntity getResult(int index)
                  throws SdaiException
Deprecated. This method does not support <items> constraint. For queries V1.1 the preferred way is to use getResultSet(int).

Returns result by index as AEntity. The query has to be executed before the result can be obtained.

Parameters:
index - The 1 based index of the result. The number of the results is the size of the array returned by getResultNames()
Returns:
AEntity containing entity instances of this result
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

getResultSet

public QueryResultSet getResultSet(java.lang.String name)
                            throws SdaiException
Returns result set by name. The query has to be executed before the result set can be obtained.

Parameters:
name - The name of the result. All result names can be obtained from getResultNames()
Returns:
QueryResultSet containing the result values
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

getResultSet

public QueryResultSet getResultSet(int index)
                            throws SdaiException
Returns result set by index. The query has to be executed before the result set can be obtained.

Parameters:
index - The 1 based index of the result. The number of the results is the size of the array returned by getResultNames()
Returns:
QueryResultSet containing the result values
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

getResultNames

public java.lang.String[] getResultNames()
                                  throws SdaiException
Returns all result names.

Returns:
The array of all result names
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object value)
                  throws SdaiException
Sets the parameter of this query.

Parameters:
name - The name of the parameter
value - The value of the parameter
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations

Copyright © LKSoftWare GmbH, 1999-2008