mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user