org.kuali.student.sonar.database.plugin
Class ForeignKeyConstraint
java.lang.Object
org.sonar.api.resources.Resource
org.kuali.student.sonar.database.plugin.ForeignKeyConstraint
public class ForeignKeyConstraint
- extends org.sonar.api.resources.Resource
Created with IntelliJ IDEA.
User: lsymms
Date: 5/16/13
Time: 9:11 PM
Entity class for managing FK Constraints
Fields inherited from class org.sonar.api.resources.Resource |
QUALIFIER_CLASS, QUALIFIER_DIRECTORY, QUALIFIER_FIELD, QUALIFIER_FILE, QUALIFIER_LIB, QUALIFIER_METHOD, QUALIFIER_MODULE, QUALIFIER_PACKAGE, QUALIFIER_PROJECT, QUALIFIER_SUBVIEW, QUALIFIER_UNIT_TEST_CLASS, QUALIFIER_VIEW, SCOPE_ENTITY, SCOPE_SET, SCOPE_SPACE |
Methods inherited from class org.sonar.api.resources.Resource |
equals, getEffectiveKey, getId, getKey, hashCode, isExcluded, setEffectiveKey, setExcluded, setId, setKey |
localTable
public String localTable
localColumn
public String localColumn
foreignTable
public String foreignTable
foreignColumn
public String foreignColumn
constraintName
public String constraintName
exception
public Exception exception
ForeignKeyConstraint
public ForeignKeyConstraint(String localTable,
String localColumn,
String foreignTable,
String foreignColumn,
String constraintName)
ForeignKeyConstraint
public ForeignKeyConstraint(ResultSet resultSet)
throws SQLException
- Assumes the resultset contains the field names
"local_table", "local_column", "foreign_table", and "foreign_column"
- Parameters:
resultSet
- an open cursor - careful not to do anything inefficient here
- Throws:
SQLException
- when something really bad happens to the cursor
toString
public String toString()
- Overrides:
toString
in class Object
addFKConstraint
public void addFKConstraint(Connection conn)
throws FKConstraintException,
SQLException
- Adds the constraint to the local table
- Parameters:
conn
- An active DB connection
- Throws:
ParentKeysMissingException
- if there is orphaned data
TableMappingException
- if a table name doesn't exist
ColumnTypeIncompatException
- if field type from local table doesn't match primary key from foreign table
NonPKMappingException
- if an unknown error occurs
SQLException
- if cursor fails to close
FKConstraintException
deleteFKConstraint
public void deleteFKConstraint(Connection conn)
throws InvalidConstraintException,
SQLException
- Drops the constraint from the local table
- Parameters:
conn
- An active DB connection
- Throws:
FieldMappingException
- if the constraintName or localTable fields are empty
SQLException
- if cursor fails to close
InvalidConstraintException
getName
public String getName()
- Specified by:
getName
in class org.sonar.api.resources.Resource
getLongName
public String getLongName()
- Specified by:
getLongName
in class org.sonar.api.resources.Resource
getDescription
public String getDescription()
- Specified by:
getDescription
in class org.sonar.api.resources.Resource
getLanguage
public org.sonar.api.resources.Language getLanguage()
- Specified by:
getLanguage
in class org.sonar.api.resources.Resource
getScope
public String getScope()
- Specified by:
getScope
in class org.sonar.api.resources.Resource
getQualifier
public String getQualifier()
- Specified by:
getQualifier
in class org.sonar.api.resources.Resource
getParent
public org.sonar.api.resources.Resource getParent()
- Specified by:
getParent
in class org.sonar.api.resources.Resource
matchFilePattern
public boolean matchFilePattern(String s)
- Specified by:
matchFilePattern
in class org.sonar.api.resources.Resource
getErrorMessage
public Exception getErrorMessage()
setErrorMessage
public void setErrorMessage(Exception exception)
getLocalColumn
public Object getLocalColumn()
getForeignColumn
public Object getForeignColumn()
Copyright © 2004-2013 The Kuali Foundation. All Rights Reserved.