www.element4solution.com

e4s.db
Class E4DBIntegrity

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.db.E4DBIntegrity

public class E4DBIntegrity
extends E4Object

Database integrity check functionality. The idea of this module is, that generated classes exists for database column definition. Each of those classes "knows" in which table it is used, and there exists a list of tables and column names using those classes. This includes: Referential checks Referential updates Referential deletes For example, you could declare a class called "addressNumber" and it might be used in a database table called "ADDRESSES" and another table called "EMPLOYEE_ADDRESSES". Before you delete a record, you want to check if a particular number is not used any more in one of the other tables. So you can use the array of used tables, automaticly generated within class tabledef.addressNumber.getUsage() and query the database for all relted tables containing the particular value.

Since:
JDK 1.4
See Also:
E4DBTypeUsage

Field Summary
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
E4DBIntegrity()
           
 
Method Summary
static java.lang.String _getSVNVersionString()
           
static void bulkDeleteData_internal(E4DBTypeUsage[] usage, E4DBTableName exclude, E4ApplObj_Intf applobj, java.lang.Object value)
           
static void bulkDeleteData(E4DBTypeUsage[] usage, E4DBTableName exclude, E4ApplObj_Intf applobj, E4Long value)
          Delete a particular type in all tables where this type is used.
static void bulkDeleteData(E4DBTypeUsage[] usage, E4DBTableName exclude, E4ApplObj_Intf applobj, E4String value)
          Delete a particular type in all tables where this type is used.
static void bulkDeleteData(E4DBTypeUsage[] usage, E4Long value)
          Update a particular type in all tables where this type is used.
static void bulkUpdateData(E4DBTypeUsage[] usage, E4DBTableName exclude, E4ApplObj_Intf applobj, E4Long old_value, E4Long new_value)
          Update a particular type in all tables where this type is used.
static void bulkUpdateData(E4DBTypeUsage[] usage, E4DBTableName exclude, E4ApplObj_Intf applobj, E4String old_value, E4String new_value)
          Update a particular type in all tables where this type is used.
static boolean hasAnyData(E4DBTypeUsage[] usage, E4DBTableName exclude, E4ApplObj_Intf applobj, E4String check_data)
          Check, if the data is contained in one or more specified tables.
static boolean hasAnyData(E4DBUsage_Intf[] usage, E4DBTableName exclude, E4ApplObj_Intf applobj, E4Long check_data)
          Check, if the data is contained in one or more specified tables.
static boolean hasAnyData(E4DBUsage_Intf[] usage, E4DBTableName exclude, E4ApplObj_Intf applobj, E4Long check_data, TABLE resulttable)
          Check, if the data is contained in one or more specified tables.
static boolean hasAnyData(E4DBUsage_Intf[] usage, E4DBTableName exclude, E4ApplObj_Intf applobj, E4String check_data, TABLE resulttable)
          Check, if the data is contained in one or more specified tables.
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, toString, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

E4DBIntegrity

public E4DBIntegrity()
Method Detail

hasAnyData

public static boolean hasAnyData(E4DBTypeUsage[] usage,
                                 E4DBTableName exclude,
                                 E4ApplObj_Intf applobj,
                                 E4String check_data)
                          throws E4DBException
Check, if the data is contained in one or more specified tables. This function is very useful for referential integrity checkings. The usage array contains a list of tables and columns against those the occurence of check_data will be tested.

Parameters:
usage - see the getUsage() function in the generated data-type classes or build your own list.
exclude - you can specify a particular table for exclusion, or null if all tables are valid
applobj - the application object, can be null
check_data - the string to be checked
Returns:
false, if no tables/columns are specified or the check_data argument is null. true if at least one table contains check_data.
Throws:
E4DBException

hasAnyData

public static boolean hasAnyData(E4DBUsage_Intf[] usage,
                                 E4DBTableName exclude,
                                 E4ApplObj_Intf applobj,
                                 E4String check_data,
                                 TABLE resulttable)
                          throws E4DBException
Check, if the data is contained in one or more specified tables. This function is very useful for referential integrity checkings. The usage array contains a list of tables and columns against those the occurence of check_data will be tested.

Parameters:
usage - see the getUsage() function in the generated data-type classes or build your own list.
exclude - you can specify a particular table for exclusion, or null if all tables are valid
applobj - the application object, can be null
check_data - the string to be checked
resulttable - you can specify a HTML table for result output. Note that this is much more time consuming, because every occurence must be counted. Set to null if no result output is required.
Returns:
false, if no tables/columns are specified or the check_data argument is null. true if at least one table contains check_data.
Throws:
E4DBException

hasAnyData

public static boolean hasAnyData(E4DBUsage_Intf[] usage,
                                 E4DBTableName exclude,
                                 E4ApplObj_Intf applobj,
                                 E4Long check_data)
                          throws E4DBException
Check, if the data is contained in one or more specified tables. This function is very useful for referential integrity checkings. The usage array contains a list of tables and columns against those the occurence of check_data will be tested.

Parameters:
usage - see the getUsage() function in the generated data-type classes or build your own list.
exclude - you can specify a particular table for exclusion, or null if all tables are valid
applobj - the application object, can be null
check_data - the string to be checked
Returns:
false, if no tables/columns are specified or the check_data argument is null. true if at least one table contains check_data.
Throws:
E4DBException

hasAnyData

public static boolean hasAnyData(E4DBUsage_Intf[] usage,
                                 E4DBTableName exclude,
                                 E4ApplObj_Intf applobj,
                                 E4Long check_data,
                                 TABLE resulttable)
                          throws E4DBException
Check, if the data is contained in one or more specified tables. This function is very useful for referential integrity checkings. The usage array contains a list of tables and columns against those the occurence of check_data will be tested.

Parameters:
usage - see the getUsage() function in the generated data-type classes or build your own list.
exclude - you can specify a particular table for exclusion, or null if all tables are valid
applobj - the application object, can be null
check_data - the string to be checked
resulttable - you can specify a HTML table for result output. Note that this is much more time consuming, because every occurence must be counted. Set to null if no result output is required.
Returns:
false, if no tables/columns are specified or the check_data argument is null. true if at least one table contains check_data.
Throws:
E4DBException

bulkUpdateData

public static void bulkUpdateData(E4DBTypeUsage[] usage,
                                  E4DBTableName exclude,
                                  E4ApplObj_Intf applobj,
                                  E4String old_value,
                                  E4String new_value)
                           throws E4DBException
Update a particular type in all tables where this type is used. This function is very useful for changing key references. The usage array contains a list of tables and columns where the update shall take place. It is recommended, that you check first for occurences of the new data.

Parameters:
usage - see the getUsage() function in the generated data-type classes or build your own list.
exclude - you can specify a particular table for exclusion, or null if all tables are valid
applobj - the application object, can be null
old_value - the string to be replaced from
new_value - the string to be replaced to
Throws:
E4DBException

bulkUpdateData

public static void bulkUpdateData(E4DBTypeUsage[] usage,
                                  E4DBTableName exclude,
                                  E4ApplObj_Intf applobj,
                                  E4Long old_value,
                                  E4Long new_value)
                           throws E4DBException
Update a particular type in all tables where this type is used. This function is very useful for changing key references. The usage array contains a list of tables and columns where the update shall take place. It is recommended, that you check first for occurences of the new data.

Parameters:
usage - see the getUsage() function in the generated data-type classes or build your own list.
exclude - you can specify a particular table for exclusion, or null if all tables are valid
applobj - the application object, can be null
old_value - the string to be replaced from
new_value - the string to be replaced to
Throws:
E4DBException

bulkDeleteData

public static void bulkDeleteData(E4DBTypeUsage[] usage,
                                  E4DBTableName exclude,
                                  E4ApplObj_Intf applobj,
                                  E4String value)
                           throws E4DBException
Delete a particular type in all tables where this type is used. This function is very useful for changing key references. The usage array contains a list of tables and columns where the update shall take place. It is recommended, that you check first for occurences of the new data.

Parameters:
exclude - you can specify a particular table for exclusion, or null if all tables are valid
applobj - the application object, can be null
usage - see the getUsage() function in the generated data-type classes or build your own list.
value - the string to be searched for to identify records deleted
Throws:
E4DBException

bulkDeleteData

public static void bulkDeleteData(E4DBTypeUsage[] usage,
                                  E4DBTableName exclude,
                                  E4ApplObj_Intf applobj,
                                  E4Long value)
                           throws E4DBException
Delete a particular type in all tables where this type is used. This function is very useful for changing key references. The usage array contains a list of tables and columns where the update shall take place. It is recommended, that you check first for occurences of the new data.

Parameters:
exclude - you can specify a particular table for exclusion, or null if all tables are valid
applobj - the application object, can be null
usage - see the getUsage() function in the generated data-type classes or build your own list.
value - the string to be searched for to identify records deleted
Throws:
E4DBException

bulkDeleteData_internal

public static void bulkDeleteData_internal(E4DBTypeUsage[] usage,
                                           E4DBTableName exclude,
                                           E4ApplObj_Intf applobj,
                                           java.lang.Object value)
                                    throws E4DBException
Throws:
E4DBException

bulkDeleteData

public static void bulkDeleteData(E4DBTypeUsage[] usage,
                                  E4Long value)
                           throws E4DBException
Update a particular type in all tables where this type is used. This function is very useful for changing key references. The usage array contains a list of tables and columns where the update shall take place. It is recommended, that you check first for occurences of the new data.

Parameters:
usage - see the getUsage() function in the generated data-type classes or build your own list.
value - the string to be searched for to identify records deleted
Throws:
E4DBException

_getSVNVersionString

public static java.lang.String _getSVNVersionString()

www.element4solution.com