org.clazzes.jdbc2xml.tools
Class ProcessRestrictionFilter

java.lang.Object
  extended by org.clazzes.jdbc2xml.tools.ProcessRestrictionFilter
All Implemented Interfaces:
IndexFilter, TableFilter

public class ProcessRestrictionFilter
extends Object
implements TableFilter

This class holds all properties to customize dumping and restoring database to/from XML files.

Author:
lech

Field Summary
protected  String[] excludedTableNames
           
protected  boolean prettyPrintXml
           
protected  Map<String,String> primaryRestrictions
           
protected  boolean processConstraints
           
protected  boolean processData
           
protected  boolean processXmlSchemaCheck
           
protected  String[] tableNames
           
 
Constructor Summary
ProcessRestrictionFilter()
           
 
Method Summary
 void addPrimaryRestriction(String table, String pkValue)
          Add a data restriction to a given table.
 int getBatchSize()
           
 String[] getExcludedTableNames()
           
 String getIdMapper()
           
 Map<String,String> getPrimaryRestrictions()
           
 String[] getTableNames()
           
 boolean isCreateFKIndices()
           
 boolean isKeepInternalIndices()
           
 boolean isPrettyPrintXml()
           
 boolean isProcessConstraints()
           
 boolean isProcessData()
           
 boolean isProcessXmlSchemaCheck()
           
 boolean isTransactional()
           
 boolean processTable(String tableName)
           
 void setBatchSize(int batchSize)
           
 void setCreateFKIndices(boolean createFKIndices)
           
 void setExcludedTableNames(String[] excludedTableNames)
           
 void setIdMapper(String idMapper)
           
 void setKeepInternalIndices(boolean keepInternalIndices)
           
 void setPrettyPrintXml(boolean prettyPrintXml)
           
 void setPrimaryRestrictions(Map<String,String> primaryRestrictions)
           
 void setProcessConstraints(boolean processConstraints)
           
 void setProcessData(boolean processData)
           
 void setProcessXmlSchemaCheck(boolean processXmlSchemaCheck)
           
 void setTableNames(String[] tableNames)
           
 void setTransactional(boolean transactional)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tableNames

protected String[] tableNames

excludedTableNames

protected String[] excludedTableNames

primaryRestrictions

protected Map<String,String> primaryRestrictions

processData

protected boolean processData

processConstraints

protected boolean processConstraints

processXmlSchemaCheck

protected boolean processXmlSchemaCheck

prettyPrintXml

protected boolean prettyPrintXml
Constructor Detail

ProcessRestrictionFilter

public ProcessRestrictionFilter()
Method Detail

processTable

public boolean processTable(String tableName)
Specified by:
processTable in interface TableFilter
Parameters:
tableName - The table name.
Returns:
Whether the table with the given name shall be processed.

getTableNames

public String[] getTableNames()
Returns:
the tableNames

setTableNames

public void setTableNames(String[] tableNames)
Parameters:
tableNames - the tableNames to set

getExcludedTableNames

public String[] getExcludedTableNames()
Returns:
the excludedTableNames

setExcludedTableNames

public void setExcludedTableNames(String[] excludedTableNames)
Parameters:
excludedTableNames - the excludedTableNames to set

isProcessData

public boolean isProcessData()
Returns:
the processData

setProcessData

public void setProcessData(boolean processData)
Parameters:
processData - the processData to set

isProcessConstraints

public boolean isProcessConstraints()
Returns:
the processConstraints

setProcessConstraints

public void setProcessConstraints(boolean processConstraints)
Parameters:
processConstraints - the processConstraints to set

getBatchSize

public int getBatchSize()
Returns:
the batchSize

setBatchSize

public void setBatchSize(int batchSize)
Parameters:
batchSize - the batchSize to set

isProcessXmlSchemaCheck

public boolean isProcessXmlSchemaCheck()
Returns:
the processXmlSchemaCheck

setProcessXmlSchemaCheck

public void setProcessXmlSchemaCheck(boolean processXmlSchemaCheck)
Parameters:
processXmlSchemaCheck - the processXmlSchemaCheck to set

isPrettyPrintXml

public boolean isPrettyPrintXml()
Returns:
the prettyPrintXml

setPrettyPrintXml

public void setPrettyPrintXml(boolean prettyPrintXml)
Parameters:
prettyPrintXml - the prettyPrintXml to set

isKeepInternalIndices

public boolean isKeepInternalIndices()
Specified by:
isKeepInternalIndices in interface IndexFilter
Returns:
Whether we should keep indices generated by the RDBMS, which are covering primary key / and or foreign key columns.

setKeepInternalIndices

public void setKeepInternalIndices(boolean keepInternalIndices)
Parameters:
keepInternalIndices - The keepInternalIndices flag to set.

isCreateFKIndices

public boolean isCreateFKIndices()
Returns:
Whether to create an index on each foreign key column of an imported table. Some database engines like MySQL create such an index by default, others might show performance improvements, if such an index is manually created.

setCreateFKIndices

public void setCreateFKIndices(boolean createFKIndices)
Parameters:
createFKIndices - Set whether to create an index on each foreign key column of an imported table. Some database engines like MySQL create such an index by default, others might show performance improvements, if such an index is manually created.

getPrimaryRestrictions

public Map<String,String> getPrimaryRestrictions()
Returns:
The restrictions on the primary key of a table. The keys of the map are table names, whose data is restricted. The values are the primary key values to which the table data is restricted. If the primary key value is null, the table data should be omitted and foreign key columns in tables, which import the primary key of the given table should be set to null.

setPrimaryRestrictions

public void setPrimaryRestrictions(Map<String,String> primaryRestrictions)
Parameters:
primaryRestrictions - the primaryRestrictions to set

addPrimaryRestriction

public void addPrimaryRestriction(String table,
                                  String pkValue)
Add a data restriction to a given table.

Parameters:
table - The table which shall be restricted.
pkValue - The primary key value which restricts the table data. If this value is null, the nullable foreign keys of the table are not used to restrict the table data, but are set to null, if the dependent dataset is not present in the target database.

getIdMapper

public String getIdMapper()
Returns:
The key of the mapper used to transform SQL identifier to their XML representation.
See Also:
ISqlIdentifierMapperFactory.newMapper(String)

setIdMapper

public void setIdMapper(String idMapper)
Parameters:
idMapper - The of the mapper used to transform SQL identifier to their XML representation to set.
See Also:
ISqlIdentifierMapperFactory.newMapper(String)

isTransactional

public boolean isTransactional()
Returns:
The transactional flag. If set to true, database dumps are generated inside a read-only transaction.

setTransactional

public void setTransactional(boolean transactional)
Parameters:
transactional - The transactional flag to set.


Copyright © 2012. All Rights Reserved.