ALF-11030: Create object graph from real database schema

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31625 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2011-11-01 19:19:45 +00:00
parent 8e3b917505
commit 68997e630a
13 changed files with 727 additions and 9 deletions

View File

@@ -68,8 +68,11 @@ public class DbObjectXMLTransformer
String tagName = dbObject.getClass().getSimpleName().toLowerCase();
final AttributesImpl attribs = new AttributesImpl();
attribs.addAttribute("", "", "name", "CDATA", dbObject.getName());
// Add class-specific attributes.
addAttributes(dbObject, attribs);
xmlOut.startElement("", "", tagName, attribs);
// The element's contents can optionally be populated with class-specific content.
transformDbObject(dbObject);
@@ -77,6 +80,21 @@ public class DbObjectXMLTransformer
xmlOut.endElement("", "", tagName);
}
/**
* Add class-specific attributes.
*
* @param dbObject
* @param attribs
*/
private void addAttributes(DbObject dbObject, AttributesImpl attribs)
{
if (dbObject instanceof Index)
{
Index index = (Index) dbObject;
attribs.addAttribute("", "", "unique", "CDATA", Boolean.toString(index.isUnique()));
}
}
private void transformDbObject(DbObject dbObject) throws SAXException
{
if (dbObject instanceof Schema)