You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/04/17 18:42:48 UTC

[09/28] zest-qi4j git commit: doc: howto-create-entity tutorial updated for 2.0 usage

doc: howto-create-entity tutorial updated for 2.0 usage

Only one change, use Module instead of UnitOfWorkFactory.
We could also reduce the number of files but some parts of the tutorial
should then be rewritten.


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

Branch: refs/heads/develop
Commit: e423ffc73ae33287a729ceaf485bf7e00f4945ac
Parents: 6ab86be
Author: Paul Merlin <pa...@nosphere.org>
Authored: Fri Jan 23 11:38:56 2015 +0100
Committer: Paul Merlin <pa...@nosphere.org>
Committed: Fri Jan 23 11:38:56 2015 +0100

----------------------------------------------------------------------
 manual/src/docs/tutorials/howto-create-entity.txt            | 8 ++++----
 .../manual/recipes/createEntity/CarEntityFactoryMixin.java   | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/e423ffc7/manual/src/docs/tutorials/howto-create-entity.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-create-entity.txt b/manual/src/docs/tutorials/howto-create-entity.txt
index 11d8035..3541c1e 100644
--- a/manual/src/docs/tutorials/howto-create-entity.txt
+++ b/manual/src/docs/tutorials/howto-create-entity.txt
@@ -151,11 +151,11 @@ source=manual/src/main/java/org/qi4j/manual/recipes/createEntity/CarEntityFactor
 tag=carFactoryMixin1
 -----------
 
-And doing that, first of all we need to request Qi4j runtime to give us the UnitOfWorkFactory associated with the Module
+And doing that, first of all we need to request Qi4j runtime to give us the Module
 that our code belongs to, and the UnitOfWork current context the execution is happening in.
 
 Injections that are related to the Visibility rules are handled by the @Structure annotation. And the easiest way for us
-to obtain a UnitOfWorkFactory is simply to;
+to obtain a Module is simply to;
 
 [snippet,java]
 -----------
@@ -163,7 +163,7 @@ source=manual/src/main/java/org/qi4j/manual/recipes/createEntity/CarEntityFactor
 tag=carFactoryMixin2
 -----------
 
-Here Qi4j will inject the member uowf with the correct UnitOfWorkFactory. In case we only need the UnitOfWorkFactory
+Here Qi4j will inject the member module with the correct Module. In case we only need the Module
 during the construction, we can also request it in the same manner as constructor argument.
 
 [snippet,java]
@@ -222,7 +222,7 @@ tag=assembler2
 
 == The UnitOfWork ==
 
-If you notice, there is a couple of calls to UnitOfWorkFactory.currentUnitOfWork(), but what is current UnitOfWork, and
+If you notice, there is a couple of calls to Module.currentUnitOfWork(), but what is current UnitOfWork, and
 who is setting that up?
 
 Well, the domain layer should not worry about UoW, it is probably the responsibility of the application/service layer

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/e423ffc7/manual/src/main/java/org/qi4j/manual/recipes/createEntity/CarEntityFactoryMixin.java
----------------------------------------------------------------------
diff --git a/manual/src/main/java/org/qi4j/manual/recipes/createEntity/CarEntityFactoryMixin.java b/manual/src/main/java/org/qi4j/manual/recipes/createEntity/CarEntityFactoryMixin.java
index 6242339..a04c4a2 100644
--- a/manual/src/main/java/org/qi4j/manual/recipes/createEntity/CarEntityFactoryMixin.java
+++ b/manual/src/main/java/org/qi4j/manual/recipes/createEntity/CarEntityFactoryMixin.java
@@ -2,8 +2,8 @@ package org.qi4j.manual.recipes.createEntity;
 
 import org.qi4j.api.entity.EntityBuilder;
 import org.qi4j.api.injection.scope.Structure;
+import org.qi4j.api.structure.Module;
 import org.qi4j.api.unitofwork.UnitOfWork;
-import org.qi4j.api.unitofwork.UnitOfWorkFactory;
 
 // START SNIPPET: carFactoryMixin2
 // START SNIPPET: carFactoryMixin1
@@ -13,10 +13,10 @@ public class CarEntityFactoryMixin
 
 // END SNIPPET: carFactoryMixin1
     @Structure
-    UnitOfWorkFactory uowf;
+    Module module;
 // END SNIPPET: carFactoryMixin2
 // START SNIPPET: carFactoryMixin3
-    public CarEntityFactoryMixin( @Structure UnitOfWorkFactory uowf )
+    public CarEntityFactoryMixin( @Structure Module module )
     {
     }
 
@@ -24,7 +24,7 @@ public class CarEntityFactoryMixin
 // START SNIPPET: createCar
     public Car create(Manufacturer manufacturer, String model)
     {
-        UnitOfWork uow = uowf.currentUnitOfWork();
+        UnitOfWork uow = module.currentUnitOfWork();
         EntityBuilder<Car> builder = uow.newEntityBuilder( Car.class );
 
         Car prototype = builder.instance();