mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-30 18:15:39 +00:00
37410: ALF-14386 HttpClient returns a null byte array if there is no response body (eg 204), swap that for an empty array to avoid NPEs and better fit the interface contract 37439: ALF-13979: Schema comparison NPE when encountering a keyless table 37443: Hand merge of second round of PATH query improvements for ALF-13404 to doclib2 API scripts 37480: Merged V4.0 to V4.0-BUG-FIX 37470: ALF-14434: Specify a START WITH value for the rebuilt alf_acl_change_set primary key on DB2 37475: ALF-13839: Transaction purging didn't work on SQL Server! 37484: Merged PATCHES/V3.4.6 to V4.0-BUG-FIX (RECORD ONLY) 36821: ALF-13827: Make replicated caches recover from temporary comms failures by flushing when a change in peers is detected - We do not flush caches who replicate via copy (e.g. tickets cache) as these may not be recoverable 37487: Merged V3.4-BUG-FIX to V4.0-BUG-FIX 37225: ALF-13617 Revert To Version functionality incorrectly reverts to the wrong version/file 37280: Merged DEV to V3.4-BUG-FIX 37279: ALF-14360 : Missing caches from ehcache-custom.xml.sample.cluster org.alfresco.cache.avm.avmVersionRootEntityCache and org.alfresco.cache.tagscopeSummaryCache were added to the ehcache configuration. 37473: ALF-12081: Ensure that cancel checkout can both unlock and cancel offline edit 37478: Merged BRANCHES/DEV/BELARUS/V3.4-BUG-FIX-2012_05_22 to BRANCHES/DEV/V3.4-BUG-FIX: 37471: ALF-9475 : Remove JBPM indexes present from upgrades 37485: ALF-9475: Fix up schema versions 37488: Merged V3.4-BUG-FIX to V4.0-BUG-FIX (RECORD ONLY) 37330: Merged V4.0-BUG-FIX to V3.4-BUG-FIX 37323: ALF-13247: Two nodes with the same primary path. -Fixed by initializing zone before parallel batch processing begins. 37356: ALF-14392: Merged V4.0-BUG-FIX to V3.4-BUG-FIX 36346: Fix for ALF-9466 - We can search contents sorted by categories in Advanced search in Share, but saved search will not be shown in UI. 37373: Merged PATCHES/V3.4.6 to V3.4-BUG-FIX 36821: ALF-13827 / ALF-14402: Make replicated caches recover from temporary comms failures by flushing when a change in peers is detected - We do not flush caches who replicate via copy (e.g. tickets cache) as these may not be recoverable 37122: ALF-13919 / ALF-14403: Merged DEV to PATCHES/V3.4.6 - Rework of Dmitry's implementation - Uses dynamic HQL query to retrieve JBPM workflow instances by specified query criteria - WorkflowInstancesGet web script no longer has to iterate over every workflow instance in the database! - DB index added to enable efficient querying by string variable - Hibernate tastic! 37188: ALF-13919 / ALF-14403: Worked around HQL polymorphism issues by using explicit variable subclass names in from clause 37204: ALF-13919 / ALF-14403: Fix to date range handling by Dmitry 37481: Merged HEAD to V3.4-BUG-FIX 37388: ALF-13545: First attempt at digitally signing the Windows installers 37391: ALF-13545: Fix quoting and output directory specification 37393: ALF-13545: Correct deployment installer signcode command git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37491 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
251 lines
6.6 KiB
Java
251 lines
6.6 KiB
Java
/*
|
|
* 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;
|
|
|
|
import org.alfresco.util.schemacomp.DbObjectVisitor;
|
|
import org.alfresco.util.schemacomp.DiffContext;
|
|
|
|
/**
|
|
* Instances of this class represent a database table.
|
|
*
|
|
* @author Matt Ward
|
|
*/
|
|
public class Table extends AbstractDbObject
|
|
{
|
|
private final List<Column> columns = new ArrayList<Column>();
|
|
private PrimaryKey primaryKey;
|
|
private final List<ForeignKey> foreignKeys = new ArrayList<ForeignKey>();
|
|
private final List<Index> indexes = new ArrayList<Index>();
|
|
|
|
|
|
public Table(String name)
|
|
{
|
|
super(null, name);
|
|
}
|
|
|
|
public Table(String name, Collection<Column> columns, PrimaryKey primaryKey,
|
|
Collection<ForeignKey> foreignKeys, Collection<Index> indexes)
|
|
{
|
|
this(null, name, columns, primaryKey, foreignKeys, indexes);
|
|
}
|
|
|
|
public Table(Schema parentSchema, String name, Collection<Column> columns, PrimaryKey primaryKey,
|
|
Collection<ForeignKey> foreignKeys, Collection<Index> indexes)
|
|
{
|
|
super(parentSchema, name);
|
|
if (columns != null)
|
|
{
|
|
setColumns(columns);
|
|
}
|
|
primaryKey.setParent(this);
|
|
this.primaryKey = primaryKey;
|
|
if (foreignKeys != null)
|
|
{
|
|
setForeignKeys(foreignKeys);
|
|
}
|
|
if (indexes != null)
|
|
{
|
|
setIndexes(indexes);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @return the columns
|
|
*/
|
|
public List<Column> getColumns()
|
|
{
|
|
return this.columns;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param columns the columns to set
|
|
*/
|
|
public void setColumns(Collection<Column> columns)
|
|
{
|
|
this.columns.clear();
|
|
this.columns.addAll(columns);
|
|
|
|
for (Column column : columns)
|
|
{
|
|
column.setParent(this);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @return the primaryKey
|
|
*/
|
|
public PrimaryKey getPrimaryKey()
|
|
{
|
|
return this.primaryKey;
|
|
}
|
|
|
|
/**
|
|
* @return Whether there is a primary key on this table.
|
|
*/
|
|
public boolean hasPrimaryKey()
|
|
{
|
|
return (primaryKey != null);
|
|
}
|
|
|
|
/**
|
|
* @param primaryKey the primaryKey to set
|
|
*/
|
|
public void setPrimaryKey(PrimaryKey primaryKey)
|
|
{
|
|
primaryKey.setParent(this);
|
|
this.primaryKey = primaryKey;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return the foreignKeys
|
|
*/
|
|
public List<ForeignKey> getForeignKeys()
|
|
{
|
|
return this.foreignKeys;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param foreignKeys the foreignKeys to set
|
|
*/
|
|
public void setForeignKeys(Collection<ForeignKey> foreignKeys)
|
|
{
|
|
this.foreignKeys.clear();
|
|
this.foreignKeys.addAll(foreignKeys);
|
|
|
|
for (ForeignKey fk : foreignKeys)
|
|
{
|
|
fk.setParent(this);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @return the indexes
|
|
*/
|
|
public List<Index> getIndexes()
|
|
{
|
|
return this.indexes;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param indexes the indexes to set
|
|
*/
|
|
public void setIndexes(Collection<Index> indexes)
|
|
{
|
|
this.indexes.clear();
|
|
this.indexes.addAll(indexes);
|
|
|
|
for (Index index : indexes)
|
|
{
|
|
index.setParent(this);
|
|
}
|
|
}
|
|
|
|
|
|
@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.foreignKeys == null) ? 0 : this.foreignKeys.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.foreignKeys == null)
|
|
{
|
|
if (other.foreignKeys != null) return false;
|
|
}
|
|
else if (!this.foreignKeys.equals(other.foreignKeys)) 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;
|
|
}
|
|
|
|
|
|
@Override
|
|
protected void doDiff(DbObject other, DiffContext ctx)
|
|
{
|
|
Table rightTable = (Table) other;
|
|
comparisonUtils.compareCollections(columns, rightTable.columns, ctx);
|
|
primaryKey.diff(rightTable.primaryKey, ctx);
|
|
comparisonUtils.compareCollections(foreignKeys, rightTable.foreignKeys, ctx);
|
|
comparisonUtils.compareCollections(indexes, rightTable.indexes, ctx);
|
|
}
|
|
|
|
|
|
private List<DbObject> getChildren()
|
|
{
|
|
List<DbObject> children = new ArrayList<DbObject>();
|
|
children.addAll(columns);
|
|
if (primaryKey != null)
|
|
{
|
|
children.add(primaryKey);
|
|
}
|
|
children.addAll(foreignKeys);
|
|
children.addAll(indexes);
|
|
return children;
|
|
}
|
|
|
|
|
|
@Override
|
|
public void accept(DbObjectVisitor visitor)
|
|
{
|
|
visitor.visit(this);
|
|
|
|
for (DbObject child : getChildren())
|
|
{
|
|
child.accept(visitor);
|
|
}
|
|
}
|
|
}
|