return;
}
}
// Doesn't exist in deployment descriptor -- add new
PersistenceContextRefType persistenceContextRef = annotatedApp.addNewPersistenceContextRef();
//------------------------------------------------------------------------------
// <persistence-context-ref> required elements:
//------------------------------------------------------------------------------
// persistence-context-ref-name
JndiNameType unitRefName = persistenceContextRef.addNewPersistenceContextRefName();
unitRefName.setStringValue(persistenceContextRefName);
//------------------------------------------------------------------------------
// <persistence-context-ref> optional elements:
//------------------------------------------------------------------------------
// persistence-unit-name
String unitNameAnnotation = annotation.unitName();
if (!unitNameAnnotation.equals("")) {
org.apache.geronimo.xbeans.javaee6.String persistenceUnitName = persistenceContextRef.addNewPersistenceUnitName();
persistenceUnitName.setStringValue(unitNameAnnotation);
}
// persistence-context-type
if (annotation.type() == PersistenceContextType.TRANSACTION) {
PersistenceContextTypeType persistenceContextType = persistenceContextRef.addNewPersistenceContextType();
persistenceContextType.setStringValue("Transaction");
persistenceContextRef.setPersistenceContextType(persistenceContextType);
} else if (annotation.type() == PersistenceContextType.EXTENDED) {
PersistenceContextTypeType persistenceContextType = persistenceContextRef.addNewPersistenceContextType();
persistenceContextType.setStringValue("Extended");
persistenceContextRef.setPersistenceContextType(persistenceContextType);
}
// persistence-context-properties
PersistenceProperty[] properties = annotation.properties();
for (PersistenceProperty property : properties) {
PropertyType propertyType = persistenceContextRef.addNewPersistenceProperty();
XsdStringType propertyName = propertyType.addNewName();
propertyName.setStringValue(property.name());
XsdStringType propertyValue = propertyType.addNewValue();
propertyValue.setStringValue(property.value());
}
// injection targets
if (method != null || field != null) {
configureInjectionTarget(persistenceContextRef.addNewInjectionTarget(), method, field);
}
}