Author: hardy.ferentschik
Date: 2009-01-20 11:41:50 -0500 (Tue, 20 Jan 2009)
New Revision: 13151
Modified:
workspace/max/jpaap/jpaap/src/org/jboss/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java
Log:
Modified:
workspace/max/jpaap/jpaap/src/org/jboss/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java
===================================================================
---
workspace/max/jpaap/jpaap/src/org/jboss/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java 2009-01-20
16:05:23 UTC (rev 13150)
+++
workspace/max/jpaap/jpaap/src/org/jboss/jpa/metamodel/ap/JPAMetaModelEntityProcessor.java 2009-01-20
16:41:50 UTC (rev 13151)
@@ -27,7 +27,7 @@
private static final String ORM_XML_LOCATION = "/META-INF/orm.xml";
- private static final Map<String, Entity> xmlEntitiesMap = new
HashMap<String, Entity>();
+ private static final Map<String, MetaEntity> metaEntities = new
HashMap<String, MetaEntity>();
public JPAMetaModelEntityProcessor() {
}
@@ -52,10 +52,22 @@
Unmarshaller unmarshaller = jc.createUnmarshaller();
EntityMappings mappings = (EntityMappings)
unmarshaller.unmarshal(ormStream);
Collection<Entity> entities = mappings.getEntity();
- for ( Entity entity : entities ) {
- xmlEntitiesMap.put(entity.getClazz(), entity);
+ String packageName = mappings.getPackage();
+ for (Entity entity : entities) {
+ String fullyQualifiedClassName = packageName + "." +
entity.getClazz();
+ Element typeElement =
processingEnv.getElementUtils().getTypeElement(fullyQualifiedClassName);
+ MetaEntity metaEntity = new MetaEntity(processingEnv, (TypeElement)
typeElement);
+
+ // TODO
+ // here we would like to somehow take the XML info and merge it into the
MetaEntity
+ // or maybe create interfaces for the MetaXXX classes. One set of
implementation could be backed by
+ // TypeEelement and one by the xml Entity
+
+
+
+ // keep track of alreay processed entities
+ metaEntities.put(fullyQualifiedClassName, metaEntity);
}
- System.out.println(xmlEntitiesMap);
} catch (JAXBException e) {
System.err.println("Error unmarshalling orm.xml");
e.printStackTrace();
@@ -174,7 +186,7 @@
pw.println("}");
return sw.getBuffer();
} finally {
- if (pw !=null) pw.close();
- }
- }
+ if (pw != null) pw.close();
+ }
+ }
}
Show replies by date