Package com.tibco.patterns.qbp
Class GeneralQueryBuilder
- java.lang.Object
-
- com.netrics.likeit.ANetricsQueryBuilder
-
- com.tibco.patterns.qbp.ANetricsQueryBuilderBuilderBase
-
- com.tibco.patterns.qbp.GeneralQueryBuilder
-
public class GeneralQueryBuilder extends ANetricsQueryBuilderBuilderBase
Generalized query builder class. The query built by this query builder class is defined by an XML configuration file. The XML supports building almost any single table query structure.In addition to the standard query builder operations this class supports generating and compiling java classes that build the queries defined by the XML file.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tibco.patterns.qbp.ANetricsQueryBuilderBuilderBase
ANetricsQueryBuilderBuilderBase.AndQlt, ANetricsQueryBuilderBuilderBase.CognateQueryField, ANetricsQueryBuilderBuilderBase.ConfidenceType, ANetricsQueryBuilderBuilderBase.CoreMatchCaseQlt, ANetricsQueryBuilderBuilderBase.FirstValidQlt, ANetricsQueryBuilderBuilderBase.OrQlt, ANetricsQueryBuilderBuilderBase.SimpleQueryField, ANetricsQueryBuilderBuilderBase.SupportingMatchCaseQlt
-
-
Constructor Summary
Constructors Constructor Description GeneralQueryBuilder()Creat an uninitialized general query builder object.GeneralQueryBuilder(com.tibco.patterns.qbp.jaxb.GeneralBuilderConfig input_config, AQBPLogger logger)Create a new general query builder from a configuration object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangenerateSource(java.io.File generated_source_directory, AQBPLogger logger)Generate code for this query builder.com.netrics.likeit.NetricsQuerygetQuery()Return a query object for the current field values.booleaninstallCustomClasses(java.io.File generated_class_directory, AQBPLogger logger)Install the custom classes for this query builder.java.lang.ObjectsetConfiguration(java.io.File config_file)Configure this object from a configuration file.java.lang.ObjectsetConfiguration(java.io.InputStream config_stream)Configure this object from an input stream.voidsetConfiguration(java.lang.Object config_object)Configure this object from a GeneralQueryBuilderConfig object.java.lang.ObjectsetConfiguration(java.lang.String config_src)Configure this object from a configuration source.voidsetFileMgr(IQBPFileMgr file_manager)Set the file manager used by this query builder.-
Methods inherited from class com.tibco.patterns.qbp.ANetricsQueryBuilderBuilderBase
andQuery, cognateQuery, cognateQuery, dateQuery, dateQuery, firstValidQuery, matchCaseQuery, orQuery, predicateQuery, referenceQuery, rlinkQuery, simpleQuery, simpleQuery, weightByFieldQuery
-
Methods inherited from class com.netrics.likeit.ANetricsQueryBuilder
changeItemName, changeItemNames, getCurInputFieldNames, getCurItemName, getCurItemName, getCurItemNames, getCurJoinedFieldName, getCurJoinedFieldNames, getCurOutputFieldName, getCurOutputFieldNames, getDefaultItemNames, getDfltInputNames, getDfltOutputNames, getExtraData, getFieldValueArray, getFieldValues, getInputFieldNames, getUsedItemTypes, mapDataString, mapPredicateString, setDefaultValue, setDfltInputFields, setDfltItemNames, setDfltOutputFields, setExtraData, setFieldValues, setFieldValues, setFieldValues, setInputFieldName, setInputFieldNames, setInputFieldOrdering, setJoinTable, setOutputFieldName, setOutputFieldNames, setQueryConfiguration, setSearchOpts
-
-
-
-
Constructor Detail
-
GeneralQueryBuilder
public GeneralQueryBuilder()
Creat an uninitialized general query builder object. This object will throw IllegalStateException until it is initialized via one of the setConfiguration methods.
-
GeneralQueryBuilder
public GeneralQueryBuilder(com.tibco.patterns.qbp.jaxb.GeneralBuilderConfig input_config, AQBPLogger logger) throws java.lang.IllegalArgumentException, AQBPLogger.QBPException, AQBPLogger.QBPConfigExceptionCreate a new general query builder from a configuration object.- Parameters:
input_config- the definition of the query to be built. This includes information needed to generate the class files.logger- a logger used to log all messages and errors.- Throws:
java.lang.IllegalArgumentException- if any argument is null.AQBPLogger.QBPConfigException- if a fatal configuration error is encountered or a configuration error is encountered and exception mode is on in the logger.AQBPLogger.QBPException- if a fatal error is encountered or an error is encountered and exception mode is on in the logger.
-
-
Method Detail
-
setConfiguration
public java.lang.Object setConfiguration(java.io.InputStream config_stream) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException, java.lang.IllegalStateExceptionConfigure this object from an input stream. This is called to initialize an object created with the default constructor. It expects to read from the input stream a valid GeneralBuilderConfig item.- Overrides:
setConfigurationin classcom.netrics.likeit.ANetricsQueryBuilder- Parameters:
config_stream- this must be an open stream containing a valid XML GeneralBuilderConfig item.- Throws:
java.lang.IllegalArgumentException- if config_stream is null, or does not contain a GeneralBuilderConfig XML as the top level item.java.lang.IllegalStateException- if this object is already initialized.java.lang.UnsupportedOperationException
-
setConfiguration
public java.lang.Object setConfiguration(java.lang.String config_src) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException, java.lang.IllegalStateExceptionConfigure this object from a configuration source. This is called to initialize an object created with the default constructor. It reads configuration data from a file source. The file source is opened with the current file manager. The default manager expects a source to be a standard file name or path.- Overrides:
setConfigurationin classcom.netrics.likeit.ANetricsQueryBuilder- Parameters:
config_src- this must be file source containing a valid GeneralBuilderConfig XML element.- Throws:
java.lang.IllegalArgumentException- if config_src is null, is not an existing, readable source, or does not contain a GeneralBuilderConfig XML as the top level item.java.lang.IllegalStateException- if this object is already initialized.java.lang.UnsupportedOperationException
-
setConfiguration
public java.lang.Object setConfiguration(java.io.File config_file) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException, java.lang.IllegalStateExceptionConfigure this object from a configuration file. This is called to initialize an object created with the default constructor.- Overrides:
setConfigurationin classcom.netrics.likeit.ANetricsQueryBuilder- Parameters:
config_file- this must be an XML file containing a valid GeneralQueryBuilder element.- Throws:
java.lang.IllegalArgumentException- if config_file is null, is not an existing, readable file, or does not contain a GeneralBuilderConfig XML as the top level item.java.lang.IllegalStateException- if this object is already initialized.java.lang.UnsupportedOperationException
-
setConfiguration
public void setConfiguration(java.lang.Object config_object) throws java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionConfigure this object from a GeneralQueryBuilderConfig object. This is called to initialize an object created with the default constructor.- Overrides:
setConfigurationin classcom.netrics.likeit.ANetricsQueryBuilder- Parameters:
config_object- this must be a valid GeneralBuilderConfig object.- Throws:
java.lang.IllegalArgumentException- if config_object is null, is not an instance of GeneralBuilderConfig or is invalid.java.lang.IllegalStateException- if this object is already initialized.java.lang.UnsupportedOperationException
-
getQuery
public com.netrics.likeit.NetricsQuery getQuery() throws java.lang.IllegalStateException, java.lang.ExceptionReturn a query object for the current field values.- Specified by:
getQueryin classcom.netrics.likeit.ANetricsQueryBuilder- Throws:
java.lang.IllegalStateException- if this object is not initialized, or if the GeneralQueryBuilder is based on a user class, or if any feature uses a custom query class, or if the field values are not set.java.lang.Exception- on other errors.
-
setFileMgr
public void setFileMgr(IQBPFileMgr file_manager)
Set the file manager used by this query builder. A file manager is used to enforce access restrictions on configuration files. It can also be used to enable reading of configuration data from non standard sources, such as a DBMS or a web-service.- Parameters:
file_manager- the file manager to use.- Throws:
java.lang.IllegalArgumentException- if file_manager is null.
-
generateSource
public boolean generateSource(java.io.File generated_source_directory, AQBPLogger logger) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, AQBPLogger.QBPExceptionGenerate code for this query builder.- Parameters:
generated_source_directory- this is the root directory where the generated source is placed. This directory must exist. Source files are generated into sub-directories under this directory following standard java package directory conventions. The sub-directories are created as needed.logger- a logger used to log all messages and errors.- Returns:
- true if successful, false otherwise.
- Throws:
java.lang.IllegalArgumentException- if any argument is null.java.lang.IllegalStateException- if this object is not initialized.AQBPLogger.QBPException- if exception mode is on and an error is encountered or if a fatal error is encountered. Otherwise all errors are logged without throwing an exception.
-
installCustomClasses
public boolean installCustomClasses(java.io.File generated_class_directory, AQBPLogger logger) throws java.lang.IllegalArgumentException, AQBPLogger.QBPExceptionInstall the custom classes for this query builder. This copies any custom query classes into the class directory.- Parameters:
generated_class_directory- this is the root directory where the custom class files are placed. This directory must exist. Class files are copied into sub-directories under this directory following standard java package directory conventions. The sub-directories are created as needed.logger- a logger used to log all messages and errors.- Returns:
- true if installed successfully, false otherwise.
- Throws:
java.lang.IllegalArgumentException- if any argument is null.AQBPLogger.QBPException- if exception mode is on and an error is encountered or if a fatal error is encountered. Otherwise all errors are logged without throwing an exception.
-
-