Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2013-11-17 18:25:15 -0500
committerMartin Taal2013-11-17 18:25:15 -0500
commit66186a2e789a128d4e323ceb3f0ba4e98bd0f59f (patch)
tree93593f9a08dfbacacf048dd6694ee1852f761414
parent164a17321cb39bcc1223761bb4dbe7de359ab1a0 (diff)
downloadorg.eclipse.emf.teneo-66186a2e789a128d4e323ceb3f0ba4e98bd0f59f.tar.gz
org.eclipse.emf.teneo-66186a2e789a128d4e323ceb3f0ba4e98bd0f59f.tar.xz
org.eclipse.emf.teneo-66186a2e789a128d4e323ceb3f0ba4e98bd0f59f.zip
[421446] - [Hibernate] consider smarter resolution of audit entries
-rw-r--r--hibernate/org.eclipse.emf.teneo.hibernate/src/org/eclipse/emf/teneo/hibernate/auditing/AuditVersionProvider.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/hibernate/org.eclipse.emf.teneo.hibernate/src/org/eclipse/emf/teneo/hibernate/auditing/AuditVersionProvider.java b/hibernate/org.eclipse.emf.teneo.hibernate/src/org/eclipse/emf/teneo/hibernate/auditing/AuditVersionProvider.java
index 63f6bd99f..5f667a94e 100644
--- a/hibernate/org.eclipse.emf.teneo.hibernate/src/org/eclipse/emf/teneo/hibernate/auditing/AuditVersionProvider.java
+++ b/hibernate/org.eclipse.emf.teneo.hibernate/src/org/eclipse/emf/teneo/hibernate/auditing/AuditVersionProvider.java
@@ -63,6 +63,8 @@ public class AuditVersionProvider implements ExtensionPoint {
private ResourceSet resourceSet;
private AuditDataStore dataStore;
+ private Map<String, EObject> auditEntryCache = new HashMap<String, EObject>();
+
public AuditVersionProvider() {
auditResource = new AuditResource(URI.createURI(URI_STR));
@@ -361,7 +363,12 @@ public class AuditVersionProvider implements ExtensionPoint {
return null;
}
- final EObject target = eClass.getEPackage().getEFactoryInstance().create(eClass);
+ EObject target = auditEntryCache.get(idAsString + "_" + auditEntry.getTeneo_audit_id());
+ if (target != null) {
+ return target;
+ }
+
+ target = eClass.getEPackage().getEFactoryInstance().create(eClass);
for (EStructuralFeature targetEFeature : target.eClass().getEAllStructuralFeatures()) {
final EStructuralFeature sourceEFeature = auditingEClass.getEStructuralFeature(targetEFeature
.getName());
@@ -426,7 +433,7 @@ public class AuditVersionProvider implements ExtensionPoint {
((InternalEObject) target).eSetResource(auditResource, null);
}
auditResource.putEObjectInCache(fullId, target);
-
+ auditEntryCache.put(idAsString + "_" + auditEntry.getTeneo_audit_id(), target);
return target;
}

Back to the top