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/11 00:08:44 UTC
[20/50] isis git commit: ISIS-1194: PersistenceSession put guard in
createInstance overload per the variant param;
ISIS-1194: PersistenceSession put guard in createInstance overload per the variant param;
update the log files to use variant
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/16734b78
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/16734b78
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/16734b78
Branch: refs/heads/master
Commit: 16734b78cd6c5154d1f1d23fe27df8b97ae33806
Parents: 71dd91d
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 15:06:58 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 15:06:58 2015 +0100
----------------------------------------------------------------------
.../runtime/system/persistence/PersistenceSession.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/16734b78/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 419e6ae..38e45c2 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
@@ -403,9 +403,11 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
final ObjectSpecification objectSpec,
final Variant variant) {
if (LOG.isDebugEnabled()) {
- LOG.debug("creating transient instance of " + objectSpec);
+ LOG.debug("creating " + variant + " instance of " + objectSpec);
}
final Object pojo = instantiateAndInjectServices(objectSpec);
+
+
final ObjectAdapter adapter = adapterManager.adapterFor(pojo);
return initializePropertiesAndDoCallback(adapter);
}
@@ -416,12 +418,14 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
final Variant variant,
final String memento) {
if (LOG.isDebugEnabled()) {
- LOG.debug("creating view model instance of " + objectSpec);
+ LOG.debug("creating " + variant + " instance of " + objectSpec);
}
final Object pojo = instantiateAndInjectServices(objectSpec);
- final ViewModelFacet facet = objectSpec.getFacet(ViewModelFacet.class);
- facet.initialize(pojo, memento);
+ if(variant == Variant.VIEW_MODEL) {
+ final ViewModelFacet facet = objectSpec.getFacet(ViewModelFacet.class);
+ facet.initialize(pojo, memento);
+ }
final ObjectAdapter adapter = adapterManager.adapterFor(pojo);
return initializePropertiesAndDoCallback(adapter);