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/08 08:51:22 UTC

[11/12] isis git commit: ISIS-1194: minor tidy up of code.

ISIS-1194: minor tidy up of code.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/0e86b8a4
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/0e86b8a4
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/0e86b8a4

Branch: refs/heads/master
Commit: 0e86b8a4a2dae82bf658a90e7092abc5c536d2e0
Parents: 587996a
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Sep 8 07:19:59 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Sep 8 07:19:59 2015 +0100

----------------------------------------------------------------------
 .../persistence/adapter/PojoAdapter.java        | 38 ++++----------------
 1 file changed, 7 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/0e86b8a4/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
index b78e774..00d1f11 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
@@ -156,22 +156,14 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
 
     @Override
     public boolean isTransient() {
-        if(getSpecification().isService()) {
-            // view models are treated as persistent objects
-            return false;
-        }
-        if(getSpecification().isViewModel()) {
-            // view models are treated as persistent objects
+        if(getSpecification().isService() || getSpecification().isViewModel()) {
+            // services and view models are treated as persistent objects
             return false;
         }
         if (pojo instanceof Persistable) {
             final Persistable pojo = (Persistable) this.pojo;
-            final boolean isNew = pojo.dnIsNew();
             final boolean isPersistent = pojo.dnIsPersistent();
-            final boolean isDirty = pojo.dnIsDirty();
             final boolean isDeleted = pojo.dnIsDeleted();
-            final boolean isDetached = pojo.dnIsDetached();
-            final boolean isTransactional = pojo.dnIsTransactional();
             if (!isPersistent && !isDeleted) {
                 return true;
             }
@@ -181,22 +173,15 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
 
     @Override
     public boolean representsPersistent() {
-        if(getSpecification().isService()) {
-            // view models are treated as persistent objects
-            return true;
-        }
-        if(getSpecification().isViewModel()) {
-            // view models are treated as persistent objects
+        if(getSpecification().isService() || getSpecification().isViewModel()) {
+            // services and view models are treated as persistent objects
             return true;
         }
         if (pojo instanceof Persistable) {
             final Persistable pojo = (Persistable) this.pojo;
-            final boolean isNew = pojo.dnIsNew();
             final boolean isPersistent = pojo.dnIsPersistent();
-            final boolean isDirty = pojo.dnIsDirty();
             final boolean isDeleted = pojo.dnIsDeleted();
-            final boolean isDetached = pojo.dnIsDetached();
-            final boolean isTransactional = pojo.dnIsTransactional();
+            // REVIEW: should we also ensure !isDeleted ???
             if (isPersistent) {
                 return true;
             }
@@ -206,22 +191,13 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
 
     @Override
     public boolean isDestroyed() {
-        if(getSpecification().isService()) {
-            // view models are treated as persistent objects
-            return false;
-        }
-        if(getSpecification().isViewModel()) {
-            // view models are treated as persistent objects
+        if(getSpecification().isService() || getSpecification().isViewModel()) {
+            // services and view models are treated as persistent objects
             return false;
         }
         if (pojo instanceof Persistable) {
             final Persistable pojo = (Persistable) this.pojo;
-            final boolean isNew = pojo.dnIsNew();
-            final boolean isPersistent = pojo.dnIsPersistent();
-            final boolean isDirty = pojo.dnIsDirty();
             final boolean isDeleted = pojo.dnIsDeleted();
-            final boolean isDetached = pojo.dnIsDetached();
-            final boolean isTransactional = pojo.dnIsTransactional();
             if (isDeleted) {
                 return true;
             }