polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject zest-java git commit: Better toString(). Fixed Identity Prefixing in Restlet CRUD system.
Date Mon, 09 Nov 2015 15:46:26 GMT
Repository: zest-java
Updated Branches:
  refs/heads/develop 5d8ce05fe -> b9e71e7b4


Better toString(). Fixed Identity Prefixing in Restlet CRUD system.


Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/b9e71e7b
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/b9e71e7b
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/b9e71e7b

Branch: refs/heads/develop
Commit: b9e71e7b46028b13d3649468d15e169a908020bb
Parents: 5d8ce05
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Mon Nov 9 23:46:16 2015 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Mon Nov 9 23:46:16 2015 +0800

----------------------------------------------------------------------
 .../zest/library/restlet/ZestEntityRestlet.java       |  3 +--
 .../restlet/repository/SmallCrudRepositoryMixin.java  | 14 +++++++-------
 .../restlet/resource/DefaultResourceFactoryImpl.java  |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/b9e71e7b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZestEntityRestlet.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZestEntityRestlet.java
b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZestEntityRestlet.java
index 54ac385..5ee575f 100644
--- a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZestEntityRestlet.java
+++ b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/ZestEntityRestlet.java
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.function.Consumer;
-
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.entity.EntityComposite;
 import org.apache.zest.api.entity.Identity;
@@ -306,6 +305,6 @@ public class ZestEntityRestlet<T extends Identity> extends Restlet
     @Override
     public String toString()
     {
-        return "ZestRestlet[" + identityType.getSimpleName() + ", " + resourceFactory +"]";
+        return "ZestRestlet[" + ( identityType == null ? "<null>" : identityType.getSimpleName()
) + ", " + resourceFactory + "]";
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b9e71e7b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java
b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java
index 5a92e98..00162f4 100644
--- a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java
+++ b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/repository/SmallCrudRepositoryMixin.java
@@ -58,17 +58,17 @@ public class SmallCrudRepositoryMixin<T extends Identity>
     }
 
     @Override
-    public void create( String identity )
+    public void create( String idOrName )
     {
         UnitOfWork uow = uowf.currentUnitOfWork();
-        uow.newEntity( entityType, identity );
+        uow.newEntity( entityType, identityManager.generate( entityType, idOrName ) );
     }
 
     @Override
-    public T get( String id )
+    public T get( String idOrName )
     {
         UnitOfWork uow = uowf.currentUnitOfWork();
-        return uow.get( entityType, id );
+        return uow.get( entityType, identityManager.generate( entityType, idOrName ) );
     }
 
     @Override
@@ -83,9 +83,9 @@ public class SmallCrudRepositoryMixin<T extends Identity>
     }
 
     @Override
-    public void delete( String nameToDelete )
+    public void delete( String idOrName )
     {
-        String id = identityManager.generate( entityType, nameToDelete );
+        String id = identityManager.generate( entityType, idOrName );
         UnitOfWork uow = uowf.currentUnitOfWork();
         try
         {
@@ -94,7 +94,7 @@ public class SmallCrudRepositoryMixin<T extends Identity>
         }
         catch( NoSuchEntityException | EntityTypeNotFoundException e )
         {
-            throw new IllegalArgumentException( "Entity  '" + nameToDelete + "' doesn't exist."
);
+            throw new IllegalArgumentException( "Entity  '" + idOrName + "' doesn't exist."
);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b9e71e7b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/DefaultResourceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/DefaultResourceFactoryImpl.java
b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/DefaultResourceFactoryImpl.java
index eae8460..c12fac5 100644
--- a/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/DefaultResourceFactoryImpl.java
+++ b/libraries/restlet/src/main/java/org/apache/zest/library/restlet/resource/DefaultResourceFactoryImpl.java
@@ -96,6 +96,6 @@ public class DefaultResourceFactoryImpl<K extends Identity, T extends
ServerReso
     @Override
     public String toString()
     {
-        return "factory[" + resourceType +"]";
+        return "factory[" + ( resourceType == null ? "<null>" : resourceType.getSimpleName())
+ "]";
     }
 }


Mime
View raw message