Enterprise Information Portal APIs

com.ibm.gcs.db.component
Class DB2AnnotationHelper

java.lang.Object
  |
  +--com.ibm.gcs.db.component.DB2AnnotationHelper

public class DB2AnnotationHelper
extends java.lang.Object

DB2AnnotationHelper provides methods to produce DB2Annotation related SQL strings for INSERT, UPDATE, and SELECT operations, and methods that call a DB2AnnotationFactory to reconstruct DB2Annotation objects from data retrieved from the database.

By default, uses DefaultDB2AnnotationFactory. The type of factory may be set with setDB2AnnotationFactory().


Field Summary
static java.lang.String ANN_TYPE_KEY
          The name of the column for the annotation type in db annotation table.
static java.lang.String ANNOTATEE_KEY
          The name of the column for hte annotatee in db annotation table.
static java.lang.String ANNOTATOR_KEY
          The name of column for the annotator in the db annotation table.
static int BYTES_PER_ROW
          The number of bytes per row in the db annotation table.
static boolean debug
           
static java.lang.String TABLE_NAME
          The name of the db annotation table.
 
Constructor Summary
DB2AnnotationHelper()
           
 
Method Summary
static com.ibm.gcs.urlpool.Annotation[] getAnnotationsByAnnotator(com.ibm.gcs.urlpool.URLContainer annotator, Transaction t)
          Returns the annotations for the specified annotator from the parentstable.
static com.ibm.gcs.urlpool.Annotation[] getAnnotationsForAnnotatee(com.ibm.gcs.urlpool.URLContainer annotatee, Transaction t)
          Returns the annotation objects for the specified annotatee from the parentstable.
static int getAnnotationType(java.util.Hashtable h)
          Obtains the DB2Annotation type from the type value in the db record.
static java.lang.String getGroupInsertSQL(java.util.Enumeration annEnum)
          Constructs the SQL statement to insert a group of annotations into the table
static java.lang.String getInsertSQL(DB2Annotation ann)
          Constructs the SQL statement to insert this annotation as a new row in the table
static java.lang.String getSelectSQL(DB2Annotation ann)
          Constructs the SQL statement to select this annotation from the table.
static java.lang.String getUpdateSQL(DB2Annotation ann)
          Constructs the SQL statement to update this annotation as in the table
static java.lang.String makeHashKey(DB2Annotation ann)
          Returns the concatentation of the annotator string followed by the annotatee string.
static void save(DB2Annotation ann, Transaction t)
          Save this annotation by writing it to the database table.
static void saveAll(java.util.Enumeration annEnum, Transaction t)
          Saves an enumeration of annotations into the parentstable.
static void setDB2AnnotationFactory(DB2AnnotationFactory annotationFactory)
          Sets the DB2AnnotationFactory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug

BYTES_PER_ROW

public static final int BYTES_PER_ROW
The number of bytes per row in the db annotation table.

TABLE_NAME

public static final java.lang.String TABLE_NAME
The name of the db annotation table. (Defined in LinksTableDef.)

ANNOTATOR_KEY

public static final java.lang.String ANNOTATOR_KEY
The name of column for the annotator in the db annotation table. (Defined in LinksTableDef.)

ANNOTATEE_KEY

public static final java.lang.String ANNOTATEE_KEY
The name of the column for hte annotatee in db annotation table. (Defined in LinksTableDef.)

ANN_TYPE_KEY

public static final java.lang.String ANN_TYPE_KEY
The name of the column for the annotation type in db annotation table. (Defined in LinksTableDef.)
Constructor Detail

DB2AnnotationHelper

public DB2AnnotationHelper()
Method Detail

setDB2AnnotationFactory

public static void setDB2AnnotationFactory(DB2AnnotationFactory annotationFactory)
Sets the DB2AnnotationFactory.
Parameters:
annotationFactory - The annotation factory to be used to produce DB2Annotation objects

getInsertSQL

public static java.lang.String getInsertSQL(DB2Annotation ann)
Constructs the SQL statement to insert this annotation as a new row in the table

getUpdateSQL

public static java.lang.String getUpdateSQL(DB2Annotation ann)
Constructs the SQL statement to update this annotation as in the table

getSelectSQL

public static java.lang.String getSelectSQL(DB2Annotation ann)
Constructs the SQL statement to select this annotation from the table.

getGroupInsertSQL

public static java.lang.String getGroupInsertSQL(java.util.Enumeration annEnum)
Constructs the SQL statement to insert a group of annotations into the table

save

public static void save(DB2Annotation ann,
                        Transaction t)
                 throws TransactionException
Save this annotation by writing it to the database table. Overwrites old data if it already exists.
Parameters:
Transaction - t The transaction object with which to make the database connection

saveAll

public static void saveAll(java.util.Enumeration annEnum,
                           Transaction t)
                    throws TransactionException
Saves an enumeration of annotations into the parentstable. This method is much more efficient than saving each item individually.

getAnnotationsByAnnotator

public static com.ibm.gcs.urlpool.Annotation[] getAnnotationsByAnnotator(com.ibm.gcs.urlpool.URLContainer annotator,
                                                                         Transaction t)
                                                                  throws TransactionException
Returns the annotations for the specified annotator from the parentstable.
Parameters:
annotator - The annotator or childURLContainer
t - The transaction object with which to make the database connection
Returns:
 

getAnnotationsForAnnotatee

public static com.ibm.gcs.urlpool.Annotation[] getAnnotationsForAnnotatee(com.ibm.gcs.urlpool.URLContainer annotatee,
                                                                          Transaction t)
                                                                   throws TransactionException
Returns the annotation objects for the specified annotatee from the parentstable.
Parameters:
annotatee - The annotatee or child URLContainer
t - The transaction object with which to make the database connection
Returns:
 

makeHashKey

public static java.lang.String makeHashKey(DB2Annotation ann)
Returns the concatentation of the annotator string followed by the annotatee string.
Returns:
String A key for the annotation.

getAnnotationType

public static int getAnnotationType(java.util.Hashtable h)
Obtains the DB2Annotation type from the type value in the db record.
Parameters:
h - The hastable containing the db2 data for an annotation.
Returns:
int Type as specified by contants in this class

EIP Web Crawler APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.