You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/09/10 14:07:08 UTC
[09/50] [abbrv] isis git commit: ISIS-1194: working towards combining
ObjectStore and PersistenceSession...
ISIS-1194: working towards combining ObjectStore and PersistenceSession...
... moved refreshRoot from ObjectStore to PersistenceSession
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/8b0f6ac3
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/8b0f6ac3
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/8b0f6ac3
Branch: refs/heads/ISIS-1194
Commit: 8b0f6ac3e366b0e6e5f0e6a207d59bd2b59956a5
Parents: 53f5275
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 08:29:11 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 08:29:11 2015 +0100
----------------------------------------------------------------------
.../runtime/system/persistence/ObjectStore.java | 27 -----------------
.../system/persistence/PersistenceSession.java | 31 +++++++++++++++++++-
.../service/support/IsisJdoSupportImpl.java | 5 ++--
3 files changed, 32 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/8b0f6ac3/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
index aabba35..017aa0b 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
@@ -216,33 +216,6 @@ public class ObjectStore implements TransactionalResource, DebuggableWithTitle,
- //region > refreshRoot
- /**
- * Not API; provides the ability to force a reload (refresh in JDO terms)
- * of the domain object wrapped in the {@link ObjectAdapter}.
- */
- public void refreshRoot(final ObjectAdapter adapter) {
-
- final Object domainObject = adapter.getObject();
- if (domainObject == null) {
- // REVIEW: is this possible?
- throw new PojoRefreshException(adapter.getOid());
- }
-
- try {
- getPersistenceManager().refresh(domainObject);
- } catch (final RuntimeException e) {
- throw new PojoRefreshException(adapter.getOid(), e);
- }
-
- // possibly redundant because also called in the post-load event
- // listener, but (with JPA impl) found it was required if we were ever to
- // get an eager left-outer-join as the result of a refresh (sounds possible).
-
- frameworkSynchronizer.postLoadProcessingFor((Persistable) domainObject, CalledFrom.OS_RESOLVE);
- }
- //endregion
-
//region > loadInstancesAndAdapt
public List<ObjectAdapter> loadInstancesAndAdapt(final PersistenceQuery persistenceQuery) {
ensureOpened();
http://git-wip-us.apache.org/repos/asf/isis/blob/8b0f6ac3/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index cf9dee0..a3444c6 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -60,6 +60,7 @@ import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
import org.apache.isis.core.runtime.persistence.FixturesInstalledFlag;
import org.apache.isis.core.runtime.persistence.NotPersistableException;
import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
+import org.apache.isis.core.runtime.persistence.PojoRefreshException;
import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreator;
@@ -731,12 +732,40 @@ public class PersistenceSession implements SessionScopedComponent, DebuggableWit
return;
}
- objectStore.refreshRoot(adapter);
+ refreshRoot(adapter);
}
+ //endregion
+
+ //region > refreshRoot
+ /**
+ * Not API; provides the ability to force a reload (refresh in JDO terms)
+ * of the domain object wrapped in the {@link ObjectAdapter}.
+ */
+ public void refreshRoot(final ObjectAdapter adapter) {
+ final Object domainObject = adapter.getObject();
+ if (domainObject == null) {
+ // REVIEW: is this possible?
+ throw new PojoRefreshException(adapter.getOid());
+ }
+
+ try {
+ objectStore.getPersistenceManager().refresh(domainObject);
+ } catch (final RuntimeException e) {
+ throw new PojoRefreshException(adapter.getOid(), e);
+ }
+
+ // possibly redundant because also called in the post-load event
+ // listener, but (with JPA impl) found it was required if we were ever to
+ // get an eager left-outer-join as the result of a refresh (sounds possible).
+
+ frameworkSynchronizer.postLoadProcessingFor((Persistable) domainObject,
+ FrameworkSynchronizer.CalledFrom.OS_RESOLVE);
+ }
//endregion
+
//region > makePersistent
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/8b0f6ac3/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/service/support/IsisJdoSupportImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/service/support/IsisJdoSupportImpl.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/service/support/IsisJdoSupportImpl.java
index feffcbb..7f0fcbe 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/service/support/IsisJdoSupportImpl.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/service/support/IsisJdoSupportImpl.java
@@ -68,9 +68,8 @@ public class IsisJdoSupportImpl implements IsisJdoSupport {
@Programmatic
@Override
public <T> T refresh(final T domainObject) {
- final ObjectStore objectStore = getObjectStore();
final ObjectAdapter adapter = getAdapterManager().adapterFor(domainObject);
- objectStore.refreshRoot(adapter);
+ getPersistenceSession().refreshRoot(adapter);
return domainObject;
}
@@ -197,7 +196,7 @@ public class IsisJdoSupportImpl implements IsisJdoSupport {
protected ObjectStore getObjectStore() {
- return (ObjectStore) getPersistenceSession().getObjectStore();
+ return getPersistenceSession().getObjectStore();
}
protected AdapterManager getAdapterManager() {