easik.sketch.util.Export.Constraints
Class ExportSumConstraint

java.lang.Object
  extended by easik.sketch.util.Export.Constraints.ExportConstraint
      extended by easik.sketch.util.Export.Constraints.ExportSumConstraint

public class ExportSumConstraint
extends ExportConstraint

A class to create a sum constraint object, including all necessary information gleaned from the XML file. Should not be used for any other purpose than database exportation, as it contains no graphical information.

Since:
2006-05-22 Vera Ranieri
Version:
2006-08-28 Kevin Green
Author:
Vera Ranieri 2006, Kevin Green 2006

Field Summary
private  java.util.HashMap<java.lang.String,java.lang.String> _varTable
          A hashmap of the target tables of the first edge in the paths leading from the pullback domain, indexed by the name of the domain of the path.
private static java.lang.String DEL_PROC_NAME
          The delete procedure name
private static java.lang.String INS_PROC_NAME
          The insert procedure name
 
Fields inherited from class easik.sketch.util.Export.Constraints.ExportConstraint
_a_i_tables, _b_d_tables, _b_i_tables, _baseTable, _db_name, _id, _paths, _procedureStrings
 
Constructor Summary
ExportSumConstraint(int id)
          Constructor.
 
Method Summary
private  java.lang.String getInsertString(ExportPath path)
          Formats the INSERT string contained inside the sum procedure
 java.lang.String getVarTable(java.lang.String inTable)
          Gets the target table of the first edge in the path that has as its domain, the table inTable.
 void setBaseTable()
          Sets the base table in the superclass based on requirements for a sum constraint.
 void setConstraintStrings()
          Sets all constraint strings for this constraint.
private  void setDeleteProcs()
          Sets the delete procedure strings for this constraint, and returns it.
private  void setInsertProcs()
          Sets the insert procedure strings for this constraint, and returns it.
 
Methods inherited from class easik.sketch.util.Export.Constraints.ExportConstraint
addPath, getBaseTable, getConstraintStrings, getPaths, getTimeNames, set_db_name, setTargetTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEL_PROC_NAME

private static final java.lang.String DEL_PROC_NAME
The delete procedure name

See Also:
Constant Field Values

INS_PROC_NAME

private static final java.lang.String INS_PROC_NAME
The insert procedure name

See Also:
Constant Field Values

_varTable

private java.util.HashMap<java.lang.String,java.lang.String> _varTable
A hashmap of the target tables of the first edge in the paths leading from the pullback domain, indexed by the name of the domain of the path.

Constructor Detail

ExportSumConstraint

public ExportSumConstraint(int id)
Constructor.

Parameters:
id - A unique identifier for this constraint.
Method Detail

setBaseTable

public void setBaseTable()
Sets the base table in the superclass based on requirements for a sum constraint. This base table is the codomain of all paths included in this constraint.

Overrides:
setBaseTable in class ExportConstraint

setConstraintStrings

public void setConstraintStrings()
Sets all constraint strings for this constraint.

Overrides:
setConstraintStrings in class ExportConstraint
Since:
2006-06-22 Vera Ranieri

setDeleteProcs

private void setDeleteProcs()
Sets the delete procedure strings for this constraint, and returns it. One delete procedure string is created for each table contributing to the sum constraint. .

Since:
2006-06-09 Vera Ranieri

setInsertProcs

private void setInsertProcs()
Sets the insert procedure strings for this constraint, and returns it. One insert procedure string is created for each table contributing to the sum constraint.
When called, the procedure adds an element along the path, beginning at the base table (i.e. the sum table) to ensure an insert is allowed. By using the SQL function LAST_INSERT_ID(), it is ensured that each entry is new and unique.

Since:
2006-06-21 Vera Ranieri

getInsertString

private java.lang.String getInsertString(ExportPath path)
Formats the INSERT string contained inside the sum procedure

Parameters:
path - The path for which this procedure is being called
Returns:
The string of the insert, formatted for SQL
Since:
2006-06-21 Vera Ranieri

getVarTable

public java.lang.String getVarTable(java.lang.String inTable)
Gets the target table of the first edge in the path that has as its domain, the table inTable. This is required so that triggers can pass the correct parameter to the BEFORE INSERT procedure.

Parameters:
inTable - The table which is the domain of the path for which the trigger is being called.
Returns:
The string representation of the codomain of the first edge of the path.
Since:
2006-07-13 Vera Ranieri