dke.smwp.trigger
Class PrimaryDataTrigger

java.lang.Object
  |
  +--dke.smwp.trigger.AbstractTrigger
        |
        +--dke.smwp.trigger.PrimaryDataTrigger

public class PrimaryDataTrigger
extends AbstractTrigger

class for creating/deploying and deleting Fragmentation Triggers.

This triggers are used to propagate tuple modifications in parameter relations (ValueParameter, PredicateParameter) to Fragmentation Relations.

Version:
1.0
Author:
Werner Enser

Fields inherited from class dke.smwp.trigger.AbstractTrigger
_connectionPool, NEW_OPERATOR, OLD_OPERATOR
 
Constructor Summary
PrimaryDataTrigger()
          default constructor
 
Method Summary
 void createPrimaryTrigger(FragmentClass fragmentClass)
          create Primary Data Trigger on Fragment Class trigger is defined upon the Fragment Base Class of fragmentClass and uses fragmentClass as trigger target; fragmentClass must not bee Root Fragment Class
private  java.lang.String getLabelTriggerCode(java.sql.Connection con, PredicateParameter param, java.util.ArrayList columns, java.lang.String fragmentPredicate_pf, java.lang.String labelPrefix)
          creates PL/SQL trigger code to get Predicate Parameter Label for inserted/deleted/updated tuples in corresponding Fragment Base Class
private  java.lang.String getPrimaryTrigger(FragmentClass fragmentClass)
          creates PL/SQL trigger code for Primary Tuple Trigger where the newest Fragment Class Parameter is ValueParameter;
private  java.lang.String getPrimaryTriggerPredicateBased(java.sql.Connection con, FragmentClass fragmentClass)
          creates PL/SQL trigger code for Primary Tuple Trigger where the newest Fragment Class Parameter is PredicateParameter;
 
Methods inherited from class dke.smwp.trigger.AbstractTrigger
dropTrigger, getTColumnPosition, getTColumnPosition, getTColumnPosition, getTColumnString, getWhereClause, getWhereClause, getWhereClause, getWhereClause, stingReplace, stingTablenameReplace
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

PrimaryDataTrigger

public PrimaryDataTrigger()
default constructor
Method Detail

createPrimaryTrigger

public void createPrimaryTrigger(FragmentClass fragmentClass)
                          throws java.sql.SQLException,
                                 SMWPException
create Primary Data Trigger on Fragment Class

trigger is defined upon the Fragment Base Class of fragmentClass and uses fragmentClass as trigger target; fragmentClass must not bee Root Fragment Class

Parameters:
fragmentClass - trigger target
Throws:
java.sql.SQLException - deployment of trigger fails

getPrimaryTrigger

private java.lang.String getPrimaryTrigger(FragmentClass fragmentClass)
creates PL/SQL trigger code for Primary Tuple Trigger where the newest Fragment Class Parameter is ValueParameter;
Parameters:
fragmentClass - Fragment Class relation is trigger target; it's Fragment Base Class relation is trigger base / source
Returns:
String representation for Primary Tuple Trigger

getPrimaryTriggerPredicateBased

private java.lang.String getPrimaryTriggerPredicateBased(java.sql.Connection con,
                                                         FragmentClass fragmentClass)
                                                  throws java.sql.SQLException,
                                                         SMWPException
creates PL/SQL trigger code for Primary Tuple Trigger where the newest Fragment Class Parameter is PredicateParameter;
Parameters:
con - Connection handle
fragmentClass - Fragment Class relation is trigger target; it's Fragment Base Class relation is trigger base / source
Returns:
String representation for Primary Tuple Trigger
Throws:
java.sql.SQLException - fetching meta-data failed
SMWPException - newest parameter is not predicate parameter

getLabelTriggerCode

private java.lang.String getLabelTriggerCode(java.sql.Connection con,
                                             PredicateParameter param,
                                             java.util.ArrayList columns,
                                             java.lang.String fragmentPredicate_pf,
                                             java.lang.String labelPrefix)
                                      throws java.sql.SQLException,
                                             java.lang.IllegalArgumentException
creates PL/SQL trigger code to get Predicate Parameter Label for inserted/deleted/updated tuples in corresponding Fragment Base Class
Parameters:
con - Connection handle
param - Predicate Parameter
columns - list of Column objects which are columns of Fragment Class
fragmentPredicate_pf - SQL statement; used as filter
labelPrefix - states ":NEW." or ":OLD."
Throws:
java.sql.SQLException - error on fetching data from PredicateParameter relation (RP<>)
java.lang.IllegalArgumentException - labelPrefix is neither ":NEW." nor ":OLD." nor NULL