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 18:12:06 UTC
[06/34] isis git commit: ISIS-1194: factor out createInstance
(overloads) from createTransientInstance and createViewModelInstance in
PersistenceSession.
ISIS-1194: factor out createInstance (overloads) from createTransientInstance and createViewModelInstance in PersistenceSession.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/d85822fe
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/d85822fe
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/d85822fe
Branch: refs/heads/ISIS-1194
Commit: d85822fe9cabed3b682251323d9c6e411ab0582a
Parents: d108c80
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 15:02:56 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 15:02:56 2015 +0100
----------------------------------------------------------------------
.../runtime/system/persistence/PersistenceSession.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/d85822fe/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 4250d00..2a9f0ce 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
@@ -387,6 +387,10 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
* {@link org.apache.isis.applib.DomainObjectContainer}.
*/
public ObjectAdapter createTransientInstance(final ObjectSpecification objectSpec) {
+ return createInstance(objectSpec);
+ }
+
+ private ObjectAdapter createInstance(final ObjectSpecification objectSpec) {
if (LOG.isDebugEnabled()) {
LOG.debug("creating transient instance of " + objectSpec);
}
@@ -395,20 +399,23 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
return initializePropertiesAndDoCallback(adapter);
}
-
-
public ObjectAdapter createViewModelInstance(final ObjectSpecification objectSpec, final String memento) {
+ return createInstance(objectSpec, memento);
+ }
+
+ private ObjectAdapter createInstance(final ObjectSpecification objectSpec, final String memento) {
if (LOG.isDebugEnabled()) {
LOG.debug("creating view model instance of " + objectSpec);
}
final Object pojo = instantiateAndInjectServices(objectSpec);
+
final ViewModelFacet facet = objectSpec.getFacet(ViewModelFacet.class);
facet.initialize(pojo, memento);
+
final ObjectAdapter adapter = adapterManager.adapterFor(pojo);
return initializePropertiesAndDoCallback(adapter);
}
-
public Object instantiateAndInjectServices(final ObjectSpecification objectSpec) {
final Class<?> correspondingClass = objectSpec.getCorrespondingClass();