n = classNode.getAttributes().getNamedItem("name");
if (n == null) {
logger.log(BasicLevel.ERROR, "Attribute 'name' for tag class required.");
return;
}
SpeedoClass c = new SpeedoClass();
c.name = n.getNodeValue();
p.addClass(c, true, logger);
//attribute identity-type
n = classNode.getAttributes().getNamedItem("identity-type");
if (n != null)
c.setIdentityType(SpeedoIdentity.getStrategy(n.getNodeValue()));
//attribute object-id
n = classNode.getAttributes().getNamedItem("objectid-class");
if (n != null) {
c.identity.objectidClass = n.getNodeValue();
c.setIdentityType(SpeedoIdentity.USER_ID);
}
//attribute requires-extent is not taken into account
//attribute detachable
n = classNode.getAttributes().getNamedItem("detachable");
if (n != null)
c.isDetachable = Boolean.valueOf(n.getNodeValue()).booleanValue();
//attribute persistence-capable-superclass
n = classNode.getAttributes().getNamedItem("persistence-capable-superclass");
if (n != null) {
if (c.inheritance == null) {
c.inheritance = new SpeedoInheritance(c);
}
c.inheritance.superClassName = n.getNodeValue();
}
//attribute table
n = classNode.getAttributes().getNamedItem("table");
if (n != null) {
c.mainTable = new SpeedoTable();
c.mainTable.name = n.getNodeValue();
}
if (c.mainTable == null) {
if (c.inheritance == null
|| c.inheritance.strategy == SpeedoInheritance.STRATEGY_NEW_TABLE) {
c.mainTable = new SpeedoTable();
c.mainTable.name = c.name.toUpperCase();
}
}
logger.log(BasicLevel.DEBUG, "New class: "
+ "name=" + c.name
+ " / id = " + c.getIdentityType()
+ " / idClass = " + c.identity.objectidClass
+ " / detachable = " + c.isDetachable
);
Map classChildren = groupChildrenByName(classNode);
//extension*, implements*, datastore-identity?, inheritance?, version?,
// join*, foreign-key*, index*, unique*, field*, query*, fetch-group*, extension*
treatExtensions((List) classChildren.get("extension"), c);
List l = (List) classChildren.get("datastore-identity");
if (l != null) {
treatDataStoreId((Node) l.get(0), c);
}
l = (List) classChildren.get("inheritance");
if (l != null) {
treatInheritance((Node) l.get(0), c);
}
l = (List) classChildren.get("version");
if (l != null) {
treatVersion((Node) l.get(0), c);
}
l = (List) classChildren.get("join");
if (l != null) {
for (int j = 0; j < l.size(); j++) {
Object[] os = getJoin((Node) l.get(j), null);
SpeedoJoin join = (SpeedoJoin) os[0];
String tableName = (String) os[1];
//define an external/secondary table
c.addJoin(join);
if (c.mainTable != null) {
join.mainTable = c.mainTable;
}
if (tableName != null) {
join.extTable = new SpeedoTable();