public class Database extends HistoricObject
changeListener, changeSupport
Constructor and Description |
---|
Database() |
Modifier and Type | Method and Description |
---|---|
boolean |
addRelationSchema(RelationSchema schema)
Adds a RelationSchema to the database and adds
PropertyChangedListener
|
java.util.ArrayList<java.lang.String> |
getAllRelationNames()
Returns the names of all existing relations
|
Database |
getClone() |
java.lang.String |
getCustAdress() |
java.lang.String |
getCustCompany() |
java.util.ArrayList<RelationSchema> |
getDatabase() |
java.util.ArrayList<ForeignKeyConstraint> |
getForeignKeys() |
java.lang.String |
getNotes() |
java.util.ArrayList<Person> |
getPersons() |
RelationSchema |
getRelationSchema(java.lang.String text)
Returns the RelationSchema with the given Name / Index (starting
with 1)
|
RelationSchema |
getRelationSchemaByIndex(java.lang.Integer index)
Returns the Relation at the given Index
|
RelationSchema |
getRelationSchemaByName(java.lang.String name)
Returns the Relation with the given Name
|
TypeEnum |
getType() |
void |
initPropertyChangeListeners() |
boolean |
insertNormalizationResult(RelationSchema targetRelation,
java.util.ArrayList<RelationSchema> sourceRelations,
java.util.ArrayList<ForeignKeyConstraint> foreignKeys)
Replaces a old targetRelation with the results of a
normalization, including Relations and ForeignKeys
|
void |
removeForeignKey(java.lang.String sourceRelationName,
java.lang.String sourceAttributeName)
Removes a existent ForeignKey associated with this attribute
|
boolean |
removeRelationSchema(RelationSchema schema)
Removes a RelationSchema from the database (also removes the
Listener)
|
void |
renameAttribute(RelationSchema parentRelation,
Attribute attribute,
java.lang.String newName)
Renames a Attribute
|
void |
renameRelationSchema(RelationSchema relation,
java.lang.String newName)
Renames the RelationSchema and updates the ForeignKey-Constraints
|
boolean |
replaceRangeOfRelationSchemas(RelationSchema targetRelation,
java.util.ArrayList<RelationSchema> sourceRelations)
Replaces the targetRelation with the sourceRelation
|
void |
replaceRangeOfRelationsWithoutFiring(RelationSchema targetRelation,
java.util.ArrayList<RelationSchema> sourceRelations)
Replaces the targetRelation with the sourceRelation, no
ChangeEvent gets fired!
|
boolean |
replaceRelationSchema(RelationSchema targetRelation,
RelationSchema sourceRelation)
Replaces the targetRelation with the sourceRelation
|
void |
restoreReferences()
Restores the references between the attributes and the fd's
|
void |
setCustAdress(java.lang.String custAdress) |
void |
setCustCompany(java.lang.String custCompany) |
void |
setNotes(java.lang.String notes) |
void |
setPersons(java.util.ArrayList<Person> persons) |
void |
setType(TypeEnum type) |
java.lang.String |
toString() |
void |
updateFkAttributeNames(java.lang.String relationName,
java.lang.String attributeName,
java.lang.String newAttributeName)
Replace old AttributeNames with new ones
|
void |
updateFkRelationNames(java.lang.String oldRelationName,
java.lang.String newRelationName)
Replaces a old relation name with a new one
|
addChangeListener, isDirty, removeChangeListener, setDirty
public java.util.ArrayList<RelationSchema> getDatabase()
public boolean addRelationSchema(RelationSchema schema)
schema
- to add to the databasepublic void renameRelationSchema(RelationSchema relation, java.lang.String newName)
relation
- the relation to renamenewName
- the new name for the relationpublic void renameAttribute(RelationSchema parentRelation, Attribute attribute, java.lang.String newName)
parentRelation
- the parentrelation of the attribute to renameattribute
- the attribute to renamenewName
- the name name for the attributepublic boolean replaceRelationSchema(RelationSchema targetRelation, RelationSchema sourceRelation)
targetRelation
- the relation to replacesourceRelation
- the new relationpublic boolean replaceRangeOfRelationSchemas(RelationSchema targetRelation, java.util.ArrayList<RelationSchema> sourceRelations)
targetRelation
- the relation to replacesourceRelations
- the new relationspublic boolean insertNormalizationResult(RelationSchema targetRelation, java.util.ArrayList<RelationSchema> sourceRelations, java.util.ArrayList<ForeignKeyConstraint> foreignKeys)
targetRelation
- the relation to replacesourceRelations
- the results of a normalizationforeignKeys
- the new foreignKeyspublic void replaceRangeOfRelationsWithoutFiring(RelationSchema targetRelation, java.util.ArrayList<RelationSchema> sourceRelations)
targetRelation
- the relation to replacesourceRelations
- the new relationpublic boolean removeRelationSchema(RelationSchema schema)
schema
- the relation to remove from the databasepublic void restoreReferences()
public void initPropertyChangeListeners()
public Database getClone()
getClone
in class HistoricObject
public RelationSchema getRelationSchema(java.lang.String text)
text
- search for text as Index or as Name if no numberpublic RelationSchema getRelationSchemaByIndex(java.lang.Integer index)
index
- of the relation to returnpublic RelationSchema getRelationSchemaByName(java.lang.String name)
name
- the name of the Relation to look forpublic java.util.ArrayList<java.lang.String> getAllRelationNames()
public java.util.ArrayList<ForeignKeyConstraint> getForeignKeys()
public void removeForeignKey(java.lang.String sourceRelationName, java.lang.String sourceAttributeName)
public void updateFkRelationNames(java.lang.String oldRelationName, java.lang.String newRelationName)
oldRelationName
- the relationName to look fornewRelationName
- the new name for the relationpublic void updateFkAttributeNames(java.lang.String relationName, java.lang.String attributeName, java.lang.String newAttributeName)
relationName
- the relatioName to look forattributeName
- the old name of the attribute inside the relationnewAttributeName
- the new name for the attributepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getCustCompany()
public void setCustCompany(java.lang.String custCompany)
custCompany
- the custCompany to setpublic java.lang.String getCustAdress()
public void setCustAdress(java.lang.String custAdress)
custAdress
- the custAdress to setpublic java.lang.String getNotes()
public void setNotes(java.lang.String notes)
notes
- the notes to setpublic java.util.ArrayList<Person> getPersons()
public void setPersons(java.util.ArrayList<Person> persons)
persons
- the persons to setpublic TypeEnum getType()
public void setType(TypeEnum type)
type
- database type