appendTextChild(ejbNode, EjbTagNames.PRIMARY_KEY_CLASS, ejbDesc.getPrimaryKeyClassName());
appendTextChild(ejbNode, EjbTagNames.REENTRANT, ejbDesc.getReentrant());
// cmp entity beans related tags
if (ejbDesc instanceof EjbCMPEntityDescriptor) {
EjbCMPEntityDescriptor cmpDesc = (EjbCMPEntityDescriptor) ejbDesc;
if (cmpDesc.getCMPVersion()==EjbCMPEntityDescriptor.CMP_1_1) {
appendTextChild(ejbNode, EjbTagNames.CMP_VERSION, EjbTagNames.CMP_1_VERSION);
} else {
appendTextChild(ejbNode, EjbTagNames.CMP_VERSION, EjbTagNames.CMP_2_VERSION);
}
appendTextChild(ejbNode, EjbTagNames.ABSTRACT_SCHEMA_NAME, cmpDesc.getAbstractSchemaName());
// cmp-field*
CmpFieldNode cmpNode = new CmpFieldNode();
for (Iterator fields = cmpDesc.getPersistenceDescriptor().getCMPFields().iterator();fields.hasNext();) {
FieldDescriptor aField = (FieldDescriptor) fields.next();
cmpNode.writeDescriptor(ejbNode, EjbTagNames.CMP_FIELD, aField);
}
if ( cmpDesc.getPrimaryKeyFieldDesc()!=null) {
appendTextChild(ejbNode, EjbTagNames.PRIMARY_KEY_FIELD, cmpDesc.getPrimaryKeyFieldDesc().getName());
}
}
// env-entry*
writeEnvEntryDescriptors(ejbNode, ejbDesc.getEnvironmentProperties().iterator());
// ejb-ref * and ejb-local-ref*
writeEjbReferenceDescriptors(ejbNode, ejbDesc.getEjbReferenceDescriptors().iterator());
// service-ref*
writeServiceReferenceDescriptors(ejbNode, ejbDesc.getServiceReferenceDescriptors().iterator());
// resource-ref*
writeResourceRefDescriptors(ejbNode, ejbDesc.getResourceReferenceDescriptors().iterator());
// resource-env-ref*
writeResourceEnvRefDescriptors(ejbNode, ejbDesc.getResourceEnvReferenceDescriptors().iterator());
// message-destination-ref*
writeMessageDestinationRefDescriptors(ejbNode, ejbDesc.getMessageDestinationReferenceDescriptors().iterator());
// persistence-context-ref*
writeEntityManagerReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerReferenceDescriptors().iterator());
// persistence-unit-ref*
writeEntityManagerFactoryReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerFactoryReferenceDescriptors().iterator());
// post-construct
writeLifeCycleCallbackDescriptors(ejbNode, TagNames.POST_CONSTRUCT, ejbDesc.getPostConstructDescriptors());
// pre-destroy
writeLifeCycleCallbackDescriptors(ejbNode, TagNames.PRE_DESTROY, ejbDesc.getPreDestroyDescriptors());
// all descriptors (includes DSD, MSD, JMSCFD, JMSDD,AOD, CRD)*
writeResourceDescriptors(ejbNode, ejbDesc.getResourceDescriptors(JavaEEResourceType.ALL).iterator());
// security-role-ref*
writeRoleReferenceDescriptors(ejbNode, ejbDesc.getRoleReferences().iterator());
// security-identity
writeSecurityIdentityDescriptor(ejbNode, ejbDesc);
// query
if (ejbDesc instanceof EjbCMPEntityDescriptor) {
EjbCMPEntityDescriptor cmpDesc = (EjbCMPEntityDescriptor) ejbDesc;
Set queriedMethods = cmpDesc.getPersistenceDescriptor().getQueriedMethods();
if (queriedMethods.size()>0) {
QueryNode queryNode = new QueryNode();
for (Iterator e=queriedMethods.iterator();e.hasNext();) {
queryNode.writeDescriptor(ejbNode, EjbTagNames.QUERY,
cmpDesc.getPersistenceDescriptor().getQueryFor((MethodDescriptor) e.next()));
}
}
}
return ejbNode;
}