ALF-11032: Load file in to object graph

Added facility to load an object graph from an XML input stream.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31568 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2011-10-31 15:14:45 +00:00
parent fa7854a9aa
commit b7c32e2c92
13 changed files with 474 additions and 9 deletions

View File

@@ -35,6 +35,11 @@ public class Column extends AbstractDbObject
private boolean nullable;
public Column(String name)
{
super(null, name);
}
/**
* Construct a Column.
*

View File

@@ -21,7 +21,6 @@ package org.alfresco.util.schemacomp.model;
import org.alfresco.util.schemacomp.DbObjectVisitor;
import org.alfresco.util.schemacomp.DbProperty;
import org.alfresco.util.schemacomp.DiffContext;
import org.alfresco.util.schemacomp.Results;
import org.alfresco.util.schemacomp.Result.Strength;
@@ -38,6 +37,11 @@ public class ForeignKey extends AbstractDbObject
private String targetColumn;
public ForeignKey(String name)
{
super(null, name);
}
/**
* Constructor.
*

View File

@@ -18,6 +18,7 @@
*/
package org.alfresco.util.schemacomp.model;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.util.schemacomp.DbObjectVisitor;
@@ -32,9 +33,14 @@ import org.alfresco.util.schemacomp.Result.Strength;
*/
public class Index extends AbstractDbObject
{
private List<String> columnNames;
private final List<String> columnNames = new ArrayList<String>();
public Index(String name)
{
super(null, name);
}
/**
* @param table the parent table
* @param columnNames
@@ -42,7 +48,7 @@ public class Index extends AbstractDbObject
public Index(Table table, String name, List<String> columnNames)
{
super(table, name);
this.columnNames = columnNames;
this.columnNames.addAll(columnNames);
setNameStrength(Strength.WARN);
}
@@ -59,7 +65,8 @@ public class Index extends AbstractDbObject
*/
public void setColumnNames(List<String> columnNames)
{
this.columnNames = columnNames;
this.columnNames.clear();
this.columnNames.addAll(columnNames);
}
@Override

View File

@@ -18,6 +18,7 @@
*/
package org.alfresco.util.schemacomp.model;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.util.schemacomp.DbObjectVisitor;
@@ -32,9 +33,14 @@ import org.alfresco.util.schemacomp.Result.Strength;
*/
public class PrimaryKey extends AbstractDbObject
{
private List<String> columnNames;
private final List<String> columnNames = new ArrayList<String>();
public PrimaryKey(String name)
{
super(null, name);
}
/**
* Constructor
* @param table the parent table
@@ -44,7 +50,7 @@ public class PrimaryKey extends AbstractDbObject
public PrimaryKey(Table table, String name, List<String> columnNames)
{
super(table, name);
this.columnNames = columnNames;
this.columnNames.addAll(columnNames);
}
/**
@@ -60,7 +66,8 @@ public class PrimaryKey extends AbstractDbObject
*/
public void setColumnNames(List<String> columnNames)
{
this.columnNames = columnNames;
this.columnNames.clear();
this.columnNames.addAll(columnNames);
}
@Override

View File

@@ -28,6 +28,12 @@ import org.alfresco.util.schemacomp.DbObjectVisitor;
*/
public class Sequence extends AbstractDbObject
{
public Sequence(String name)
{
super(null, name);
}
public Sequence(DbObject parent, String name)
{
super(parent, name);

View File

@@ -39,6 +39,17 @@ public class Table extends AbstractDbObject
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)
{