implmd.addProperty(propmd);
pushStack(propmd);
}
else if (parent instanceof FetchGroupMetaData)
{
FetchGroupMetaData fgmd = (FetchGroupMetaData)parent;
PropertyMetaData propmd = newPropertyObject(fgmd, attrs);
fgmd.addMember(propmd);
pushStack(propmd);
}
}
// New datastore-identity for this class
else if (localName.equals("datastore-identity"))
{
AbstractClassMetaData acmd = (AbstractClassMetaData)getStack();
IdentityMetaData imd = new IdentityMetaData(acmd,
getAttr(attrs,"column"),
getAttr(attrs,"strategy"),
getAttr(attrs,"sequence"));
acmd.setIdentityMetaData(imd);
pushStack(imd);
}
// New inheritance for this class
else if (localName.equals("inheritance"))
{
MetaData parent = getStack();
AbstractClassMetaData acmd = (AbstractClassMetaData)parent;
InheritanceMetaData imd = new InheritanceMetaData(acmd,
getAttr(attrs,"strategy"));
acmd.setInheritanceMetaData(imd);
pushStack(imd);
}
// Discriminator for this inheritance
else if (localName.equals("discriminator"))
{
InheritanceMetaData imd = (InheritanceMetaData)getStack();
DiscriminatorMetaData dismd = new DiscriminatorMetaData(imd,
getAttr(attrs,"column"),
getAttr(attrs,"value"),
getAttr(attrs,"strategy"),
getAttr(attrs,"indexed"));
imd.setDiscriminatorMetaData(dismd);
pushStack(dismd);
}
// New query for this class
else if (localName.equals("query"))
{
MetaData emd = getStack();
QueryMetaData qmd = new QueryMetaData(emd,
(emd instanceof ClassMetaData ? ((ClassMetaData)emd).getFullClassName() : null),
getAttr(attrs, "name"),
getAttr(attrs, "language"),
getAttr(attrs, "unmodifiable"),
getAttr(attrs, "result-class"),
null,
getAttr(attrs, "unique"),
getAttr(attrs, "fetch-plan"));
if (emd instanceof ClassMetaData)
{
ClassMetaData cmd = (ClassMetaData)emd;
cmd.addQuery(qmd);
}
else if (emd instanceof FileMetaData)
{
FileMetaData fmd = (FileMetaData)emd;
fmd.addQuery(qmd);
}
pushStack(qmd);
}
// New sequence for this class
else if (localName.equals("sequence"))
{
MetaData emd = getStack();
SequenceMetaData seqmd = new SequenceMetaData(emd,
getAttr(attrs,"name"),
getAttr(attrs,"datastore-sequence"),
getAttr(attrs,"factory-class"),
getAttr(attrs,"strategy"),
null, null);
if (emd instanceof PackageMetaData)
{
PackageMetaData pmd = (PackageMetaData)emd;
pmd.addSequence(seqmd);
}
pushStack(seqmd);
}
// New field for this class
else if (localName.equals("field"))
{
MetaData md = getStack();
FieldMetaData fmd = newFieldObject(md,attrs);
if (md instanceof ClassMetaData)
{
ClassMetaData cmd = (ClassMetaData)md;
cmd.addMember(fmd);
}
else if (md instanceof FetchGroupMetaData)
{
FetchGroupMetaData fgmd = (FetchGroupMetaData)md;
fgmd.addMember(fmd);
}
else if (md instanceof EmbeddedMetaData)
{
EmbeddedMetaData emd = (EmbeddedMetaData)md;
emd.addMember(fmd);
}
else if (md instanceof ForeignKeyMetaData)
{
ForeignKeyMetaData fkmd = (ForeignKeyMetaData)md;
fkmd.addMember(fmd);
}
else if (md instanceof IndexMetaData)
{
IndexMetaData imd = (IndexMetaData)md;
imd.addMember(fmd);
}
else if (md instanceof UniqueMetaData)
{
UniqueMetaData umd = (UniqueMetaData)md;
umd.addMember(fmd);
}
pushStack(fmd);
}
// New join
else if (localName.equals("join"))
{
MetaData parent = getStack();
JoinMetaData jnmd = new JoinMetaData(parent,
getAttr(attrs, "table"),
null, null,
getAttr(attrs, "column"),
getAttr(attrs, "outer"),
getAttr(attrs, "delete-action"),
getAttr(attrs, "indexed"),
getAttr(attrs, "unique"));
if (parent instanceof AbstractMemberMetaData)
{
AbstractMemberMetaData fmd = (AbstractMemberMetaData)parent;
fmd.setJoinMetaData(jnmd);
}
else if (parent instanceof AbstractClassMetaData)
{
AbstractClassMetaData cmd = (AbstractClassMetaData)parent;
cmd.addJoin(jnmd);
}
else if (parent instanceof InheritanceMetaData)
{
InheritanceMetaData imd = (InheritanceMetaData)parent;
imd.setJoinMetaData(jnmd);
}
pushStack(jnmd);
}
// New map container for this field
else if (localName.equals("map"))
{
AbstractMemberMetaData fmd = (AbstractMemberMetaData)getStack();
MapMetaData map = new MapMetaData(fmd,
getAttr(attrs,"key-type"),
getAttr(attrs,"embedded-key"),
getAttr(attrs,"dependent-key"),
getAttr(attrs,"serialized-key"),
getAttr(attrs,"value-type"),
getAttr(attrs,"embedded-value"),
getAttr(attrs,"dependent-value"),
getAttr(attrs,"serialized-value"));
fmd.setContainer(map);
pushStack(map);
}
// New array container for this field
else if (localName.equals("array"))
{
AbstractMemberMetaData fmd = (AbstractMemberMetaData)getStack();
ArrayMetaData amd = new ArrayMetaData(fmd,
getAttr(attrs, "element-type"),
getAttr(attrs, "embedded-element"),
getAttr(attrs, "dependent-element"),
getAttr(attrs, "serialized-element"));
fmd.setContainer(amd);
pushStack(amd);
}
// New collection container for this field
else if (localName.equals("collection"))
{
AbstractMemberMetaData fmd = (AbstractMemberMetaData)getStack();
CollectionMetaData colmd = new CollectionMetaData(fmd,
getAttr(attrs,"element-type"),
getAttr(attrs,"embedded-element"),
getAttr(attrs,"dependent-element"),
getAttr(attrs,"serialized-element"));
fmd.setContainer(colmd);
pushStack(colmd);
}
// New column
else if (localName.equals("column"))
{
MetaData md = getStack();
ColumnMetaData clnmd = new ColumnMetaData(md,
getAttr(attrs,"name"),
getAttr(attrs,"target"),
getAttr(attrs,"target-field"),
getAttr(attrs,"jdbc-type"),
getAttr(attrs,"sql-type"),
getAttr(attrs,"length"),
getAttr(attrs,"scale"),
getAttr(attrs,"allows-null"),
getAttr(attrs,"default-value"),
getAttr(attrs,"insert-value"),
null, null, null);
if (md instanceof AbstractMemberMetaData)
{
AbstractMemberMetaData fmd = (AbstractMemberMetaData)md;
fmd.addColumn(clnmd);
}
else if (md instanceof AbstractElementMetaData)
{
AbstractElementMetaData elemd = (AbstractElementMetaData)md;
elemd.addColumn(clnmd);
}
else if (md instanceof JoinMetaData)
{
JoinMetaData jnmd = (JoinMetaData)md;
jnmd.addColumn(clnmd);
}
else if (md instanceof IdentityMetaData)
{
IdentityMetaData idmd = (IdentityMetaData)md;
idmd.addColumn(clnmd);
}
else if (md instanceof ForeignKeyMetaData)
{
ForeignKeyMetaData fkmd = (ForeignKeyMetaData)md;
fkmd.addColumn(clnmd);
}
else if (md instanceof IndexMetaData)
{
IndexMetaData idxmd = (IndexMetaData)md;
idxmd.addColumn(clnmd);
}
else if (md instanceof UniqueMetaData)
{
UniqueMetaData unimd = (UniqueMetaData)md;
unimd.addColumn(clnmd);
}
else if (md instanceof OrderMetaData)
{
OrderMetaData ormd = (OrderMetaData)md;
ormd.addColumn(clnmd);
}
else if (md instanceof DiscriminatorMetaData)
{
DiscriminatorMetaData dismd = (DiscriminatorMetaData)md;
dismd.setColumnMetaData(clnmd);
}
else if (md instanceof VersionMetaData)
{
VersionMetaData vermd = (VersionMetaData)md;
vermd.addColumn(clnmd);
}
else if (md instanceof AbstractClassMetaData)
{
AbstractClassMetaData cmd = (AbstractClassMetaData)md;
cmd.addUnmappedColumn(clnmd);
}
else if (md instanceof PrimaryKeyMetaData)
{
PrimaryKeyMetaData pkmd = (PrimaryKeyMetaData)md;
pkmd.addColumn(clnmd);
}
pushStack(clnmd);
}
// New element
else if (localName.equals("element"))
{
AbstractMemberMetaData fmd = (AbstractMemberMetaData)getStack();
ElementMetaData elemd = new ElementMetaData(fmd,
getAttr(attrs, "column"),
getAttr(attrs, "delete-action"),
getAttr(attrs, "update-action"),
getAttr(attrs, "indexed"),
getAttr(attrs, "unique"),
getAttr(attrs, "mapped-by"));
fmd.setElementMetaData(elemd);
pushStack(elemd);
}
// New key
else if (localName.equals("key"))
{
AbstractMemberMetaData fmd = (AbstractMemberMetaData)getStack();
KeyMetaData keymd = new KeyMetaData(fmd,
getAttr(attrs, "column"),
getAttr(attrs, "delete-action"),
getAttr(attrs, "update-action"),
getAttr(attrs, "indexed"),
getAttr(attrs, "unique"),
getAttr(attrs, "mapped-by"));
fmd.setKeyMetaData(keymd);
pushStack(keymd);
}
// New value
else if (localName.equals("value"))
{
AbstractMemberMetaData fmd = (AbstractMemberMetaData)getStack();
ValueMetaData valuemd = new ValueMetaData(fmd,
getAttr(attrs, "column"),
getAttr(attrs, "delete-action"),
getAttr(attrs, "update-action"),
getAttr(attrs, "indexed"),
getAttr(attrs, "unique"),
getAttr(attrs, "mapped-by"));
fmd.setValueMetaData(valuemd);
pushStack(valuemd);
}
// New fetch-group
else if (localName.equals("fetch-group"))
{
MetaData md = getStack();
FetchGroupMetaData fgmd = new FetchGroupMetaData(md, getAttr(attrs,"post-load"), getAttr(attrs,"name"));
if (md instanceof FetchGroupMetaData)
{
FetchGroupMetaData fgmdParent = (FetchGroupMetaData)md;
fgmdParent.addFetchGroup(fgmd);
}
else if (md instanceof AbstractClassMetaData)
{
AbstractClassMetaData cmd = (AbstractClassMetaData)md;
cmd.addFetchGroup(fgmd);