mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-10770: create schema representation
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31224 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
/**
|
||||
* TODO: comment me!
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public abstract class AbstractDbObject implements DbObject
|
||||
{
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public AbstractDbObject()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate, giving the object a name.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public AbstractDbObject(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getIdentifier()
|
||||
{
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((this.name == null) ? 0 : this.name.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj) return true;
|
||||
if (obj == null) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
AbstractDbObject other = (AbstractDbObject) obj;
|
||||
if (this.name == null)
|
||||
{
|
||||
if (other.name != null) return false;
|
||||
}
|
||||
else if (!this.name.equals(other.name)) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
87
source/java/org/alfresco/util/schemacomp/model/Column.java
Normal file
87
source/java/org/alfresco/util/schemacomp/model/Column.java
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
/**
|
||||
* TODO: comment me!
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class Column extends AbstractDbObject
|
||||
{
|
||||
private String type;
|
||||
private boolean nullable;
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nullable
|
||||
*/
|
||||
public boolean isNullable()
|
||||
{
|
||||
return this.nullable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nullable the nullable to set
|
||||
*/
|
||||
public void setNullable(boolean nullable)
|
||||
{
|
||||
this.nullable = nullable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + (this.nullable ? 1231 : 1237);
|
||||
result = prime * result + ((this.type == null) ? 0 : this.type.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj) return true;
|
||||
if (!super.equals(obj)) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
Column other = (Column) obj;
|
||||
if (this.nullable != other.nullable) return false;
|
||||
if (this.type == null)
|
||||
{
|
||||
if (other.type != null) return false;
|
||||
}
|
||||
else if (!this.type.equals(other.type)) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
29
source/java/org/alfresco/util/schemacomp/model/DbObject.java
Normal file
29
source/java/org/alfresco/util/schemacomp/model/DbObject.java
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
/**
|
||||
* All database objects to be modelled for schema comparisons must implement this interface.
|
||||
*
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public interface DbObject
|
||||
{
|
||||
Object getIdentifier();
|
||||
}
|
112
source/java/org/alfresco/util/schemacomp/model/ForeignKey.java
Normal file
112
source/java/org/alfresco/util/schemacomp/model/ForeignKey.java
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO: comment me!
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class ForeignKey extends AbstractDbObject
|
||||
{
|
||||
private String localColumn;
|
||||
private String targetTable;
|
||||
private String targetColumn;
|
||||
|
||||
|
||||
/**
|
||||
* @return the localColumn
|
||||
*/
|
||||
public String getLocalColumn()
|
||||
{
|
||||
return this.localColumn;
|
||||
}
|
||||
/**
|
||||
* @param localColumn the localColumn to set
|
||||
*/
|
||||
public void setLocalColumn(String localColumn)
|
||||
{
|
||||
this.localColumn = localColumn;
|
||||
}
|
||||
/**
|
||||
* @return the targetTable
|
||||
*/
|
||||
public String getTargetTable()
|
||||
{
|
||||
return this.targetTable;
|
||||
}
|
||||
/**
|
||||
* @param targetTable the targetTable to set
|
||||
*/
|
||||
public void setTargetTable(String targetTable)
|
||||
{
|
||||
this.targetTable = targetTable;
|
||||
}
|
||||
/**
|
||||
* @return the targetColumn
|
||||
*/
|
||||
public String getTargetColumn()
|
||||
{
|
||||
return this.targetColumn;
|
||||
}
|
||||
/**
|
||||
* @param targetColumn the targetColumn to set
|
||||
*/
|
||||
public void setTargetColumn(String targetColumn)
|
||||
{
|
||||
this.targetColumn = targetColumn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.localColumn == null) ? 0 : this.localColumn.hashCode());
|
||||
result = prime * result + ((this.targetColumn == null) ? 0 : this.targetColumn.hashCode());
|
||||
result = prime * result + ((this.targetTable == null) ? 0 : this.targetTable.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj) return true;
|
||||
if (!super.equals(obj)) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
ForeignKey other = (ForeignKey) obj;
|
||||
if (this.localColumn == null)
|
||||
{
|
||||
if (other.localColumn != null) return false;
|
||||
}
|
||||
else if (!this.localColumn.equals(other.localColumn)) return false;
|
||||
if (this.targetColumn == null)
|
||||
{
|
||||
if (other.targetColumn != null) return false;
|
||||
}
|
||||
else if (!this.targetColumn.equals(other.targetColumn)) return false;
|
||||
if (this.targetTable == null)
|
||||
{
|
||||
if (other.targetTable != null) return false;
|
||||
}
|
||||
else if (!this.targetTable.equals(other.targetTable)) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
83
source/java/org/alfresco/util/schemacomp/model/Index.java
Normal file
83
source/java/org/alfresco/util/schemacomp/model/Index.java
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO: comment me!
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class Index extends AbstractDbObject
|
||||
{
|
||||
private List<String> columnNames;
|
||||
|
||||
|
||||
/**
|
||||
* @return the columnNames
|
||||
*/
|
||||
public List<String> getColumnNames()
|
||||
{
|
||||
return this.columnNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param columnNames the columnNames to set
|
||||
*/
|
||||
public void setColumnNames(List<String> columnNames)
|
||||
{
|
||||
this.columnNames = columnNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: column names should be fully qualified, OR an Index should have a table name field
|
||||
* and the identifier should include it.
|
||||
*
|
||||
* @return the Index identifier
|
||||
*/
|
||||
@Override
|
||||
public Object getIdentifier()
|
||||
{
|
||||
return getColumnNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.columnNames == null) ? 0 : this.columnNames.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj) return true;
|
||||
if (!super.equals(obj)) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
Index other = (Index) obj;
|
||||
if (this.columnNames == null)
|
||||
{
|
||||
if (other.columnNames != null) return false;
|
||||
}
|
||||
else if (!this.columnNames.equals(other.columnNames)) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO: comment me!
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class PrimaryKey extends AbstractDbObject
|
||||
{
|
||||
private List<String> columnNames;
|
||||
|
||||
|
||||
/**
|
||||
* @return the columnNames
|
||||
*/
|
||||
public List<String> getColumnNames()
|
||||
{
|
||||
return this.columnNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param columnNames the columnNames to set
|
||||
*/
|
||||
public void setColumnNames(List<String> columnNames)
|
||||
{
|
||||
this.columnNames = columnNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.columnNames == null) ? 0 : this.columnNames.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj) return true;
|
||||
if (!super.equals(obj)) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
PrimaryKey other = (PrimaryKey) obj;
|
||||
if (this.columnNames == null)
|
||||
{
|
||||
if (other.columnNames != null) return false;
|
||||
}
|
||||
else if (!this.columnNames.equals(other.columnNames)) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
91
source/java/org/alfresco/util/schemacomp/model/Schema.java
Normal file
91
source/java/org/alfresco/util/schemacomp/model/Schema.java
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Instances of this class will represent a database schema.
|
||||
*
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class
|
||||
Schema extends AbstractDbObject implements Iterable<DbObject>
|
||||
{
|
||||
private final Map<Object, DbObject> objects = new LinkedHashMap<Object, DbObject>();
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public DbObject get(Object key)
|
||||
{
|
||||
return this.objects.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param table
|
||||
*/
|
||||
public void put(DbObject dbObject)
|
||||
{
|
||||
objects.put(dbObject.getIdentifier(), dbObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<DbObject> iterator()
|
||||
{
|
||||
return objects.values().iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param identifier
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(Object identifier)
|
||||
{
|
||||
return objects.containsKey(identifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.objects == null) ? 0 : this.objects.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj) return true;
|
||||
if (!super.equals(obj)) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
Schema other = (Schema) obj;
|
||||
if (this.objects == null)
|
||||
{
|
||||
if (other.objects != null) return false;
|
||||
}
|
||||
else if (!this.objects.equals(other.objects)) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
27
source/java/org/alfresco/util/schemacomp/model/Sequence.java
Normal file
27
source/java/org/alfresco/util/schemacomp/model/Sequence.java
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
/**
|
||||
* TODO: comment me!
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class Sequence extends AbstractDbObject
|
||||
{
|
||||
}
|
169
source/java/org/alfresco/util/schemacomp/model/Table.java
Normal file
169
source/java/org/alfresco/util/schemacomp/model/Table.java
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.util.schemacomp.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Instances of this class will represent a database table.
|
||||
*
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class Table extends AbstractDbObject
|
||||
{
|
||||
private List<Column> columns = new ArrayList<Column>();
|
||||
private PrimaryKey primaryKey;
|
||||
private ForeignKey foreignKey;
|
||||
private List<Index> indexes = new ArrayList<Index>();
|
||||
|
||||
|
||||
public Table(String name, Collection<Column> columns, PrimaryKey primaryKey,
|
||||
ForeignKey foreignKey, Collection<Index> indexes)
|
||||
{
|
||||
super(name);
|
||||
if (columns != null)
|
||||
{
|
||||
columns.addAll(columns);
|
||||
}
|
||||
this.primaryKey = primaryKey;
|
||||
this.foreignKey = foreignKey;
|
||||
if (indexes != null)
|
||||
{
|
||||
indexes.addAll(indexes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the columns
|
||||
*/
|
||||
public List<Column> getColumns()
|
||||
{
|
||||
return this.columns;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param columns the columns to set
|
||||
*/
|
||||
public void setColumns(List<Column> columns)
|
||||
{
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the primaryKey
|
||||
*/
|
||||
public PrimaryKey getPrimaryKey()
|
||||
{
|
||||
return this.primaryKey;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param primaryKey the primaryKey to set
|
||||
*/
|
||||
public void setPrimaryKey(PrimaryKey primaryKey)
|
||||
{
|
||||
this.primaryKey = primaryKey;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the foreignKey
|
||||
*/
|
||||
public ForeignKey getForeignKey()
|
||||
{
|
||||
return this.foreignKey;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param foreignKey the foreignKey to set
|
||||
*/
|
||||
public void setForeignKey(ForeignKey foreignKey)
|
||||
{
|
||||
this.foreignKey = foreignKey;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the indexes
|
||||
*/
|
||||
public List<Index> getIndexes()
|
||||
{
|
||||
return this.indexes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param indexes the indexes to set
|
||||
*/
|
||||
public void setIndexes(List<Index> indexes)
|
||||
{
|
||||
this.indexes = indexes;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((this.columns == null) ? 0 : this.columns.hashCode());
|
||||
result = prime * result + ((this.foreignKey == null) ? 0 : this.foreignKey.hashCode());
|
||||
result = prime * result + ((this.indexes == null) ? 0 : this.indexes.hashCode());
|
||||
result = prime * result + ((this.primaryKey == null) ? 0 : this.primaryKey.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj) return true;
|
||||
if (!super.equals(obj)) return false;
|
||||
if (getClass() != obj.getClass()) return false;
|
||||
Table other = (Table) obj;
|
||||
if (this.columns == null)
|
||||
{
|
||||
if (other.columns != null) return false;
|
||||
}
|
||||
else if (!this.columns.equals(other.columns)) return false;
|
||||
if (this.foreignKey == null)
|
||||
{
|
||||
if (other.foreignKey != null) return false;
|
||||
}
|
||||
else if (!this.foreignKey.equals(other.foreignKey)) return false;
|
||||
if (this.indexes == null)
|
||||
{
|
||||
if (other.indexes != null) return false;
|
||||
}
|
||||
else if (!this.indexes.equals(other.indexes)) return false;
|
||||
if (this.primaryKey == null)
|
||||
{
|
||||
if (other.primaryKey != null) return false;
|
||||
}
|
||||
else if (!this.primaryKey.equals(other.primaryKey)) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user