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:58 UTC
[19/28] zest-qi4j git commit: API UnitOfWork - Javadocs
API UnitOfWork - Javadocs
Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/118928a5
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/118928a5
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/118928a5
Branch: refs/heads/develop
Commit: 118928a5e64b138618312000116732db0c35b77f
Parents: e4eecac
Author: Paul Merlin <pa...@nosphere.org>
Authored: Wed Mar 25 15:08:16 2015 +0100
Committer: Paul Merlin <pa...@nosphere.org>
Committed: Wed Mar 25 15:08:16 2015 +0100
----------------------------------------------------------------------
.../org/qi4j/api/unitofwork/UnitOfWork.java | 55 ++++++++++----------
1 file changed, 27 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/118928a5/core/api/src/main/java/org/qi4j/api/unitofwork/UnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/unitofwork/UnitOfWork.java b/core/api/src/main/java/org/qi4j/api/unitofwork/UnitOfWork.java
index 8af1db2..a0ea959 100644
--- a/core/api/src/main/java/org/qi4j/api/unitofwork/UnitOfWork.java
+++ b/core/api/src/main/java/org/qi4j/api/unitofwork/UnitOfWork.java
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2007, Rickard Öberg. All Rights Reserved.
- * Copyright (c) 2007, Niclas Hedhman. All Rights Reserved.
- * Copyright (c) 2013, Paul Merlin. All Rights Reserved.
+ * Copyright (c) 2007-2011, Rickard Öberg. All Rights Reserved.
+ * Copyright (c) 2007-2012, Niclas Hedhman. All Rights Reserved.
+ * Copyright (c) 2013-2014, Paul Merlin. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package org.qi4j.api.unitofwork;
+import org.qi4j.api.composite.AmbiguousTypeException;
import org.qi4j.api.entity.EntityBuilder;
import org.qi4j.api.entity.LifecycleException;
import org.qi4j.api.query.Query;
@@ -24,7 +25,8 @@ import org.qi4j.api.usecase.Usecase;
/**
* All operations on entities goes through an UnitOfWork.
- * <p>A UnitOfWork allows you to access
+ * <p>
+ * A UnitOfWork allows you to access
* Entities and work with them. All modifications to Entities are recorded by the UnitOfWork,
* and at the end they may be sent to the underlying EntityStore by calling complete(). If the
* UoW was read-only you may instead simply discard() it.
@@ -73,7 +75,8 @@ import org.qi4j.api.usecase.Usecase;
* uow.complete();
* }
* </pre>
- * <p>It has the very same effect than the template above but is shorter.</p>
+ * <p>
+ * It has the very same effect than the template above but is shorter.</p>
*/
public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
{
@@ -116,13 +119,12 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
*
* @return a new Entity
*
- * @throws NoSuchEntityException if no EntityComposite type of the given mixin type has been registered
- * @throws org.qi4j.api.entity.LifecycleException
- * if the entity cannot be created
- * @throws EntityTypeNotFoundException
+ * @throws EntityTypeNotFoundException if no EntityComposite type of the given mixin type has been registered
+ * @throws AmbiguousTypeException If several mixins implement the given type
+ * @throws LifecycleException if the entity cannot be created
*/
<T> T newEntity( Class<T> type )
- throws EntityTypeNotFoundException, LifecycleException;
+ throws EntityTypeNotFoundException, AmbiguousTypeException, LifecycleException;
/**
* Create a new Entity which implements the given mixin type. An EntityComposite
@@ -135,12 +137,12 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
*
* @return a new Entity
*
- * @throws NoSuchEntityException if no EntityComposite type of the given mixin type has been registered
+ * @throws EntityTypeNotFoundException if no EntityComposite type of the given mixin type has been registered
+ * @throws AmbiguousTypeException If several mixins implement the given type
* @throws LifecycleException if the entity cannot be created
- * @throws EntityTypeNotFoundException
*/
<T> T newEntity( Class<T> type, String identity )
- throws EntityTypeNotFoundException, LifecycleException;
+ throws EntityTypeNotFoundException, AmbiguousTypeException, LifecycleException;
/**
* Create a new EntityBuilder for an EntityComposite which implements the given mixin type. An EntityComposite
@@ -150,14 +152,13 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
*
* @param type the mixin type that the EntityComposite must implement
*
- * @return a new Entity
+ * @return a new EntityBuilder
*
- * @throws NoSuchEntityException if no EntityComposite type of the given mixin type has been registered
- * @throws LifecycleException
- * @throws EntityTypeNotFoundException
+ * @throws EntityTypeNotFoundException if no EntityComposite type of the given mixin type has been registered
+ * @throws AmbiguousTypeException If several mixins implement the given type
*/
<T> EntityBuilder<T> newEntityBuilder( Class<T> type )
- throws EntityTypeNotFoundException;
+ throws EntityTypeNotFoundException, AmbiguousTypeException;
/**
* Create a new EntityBuilder for an EntityComposite which implements the given mixin type. An EntityComposite
@@ -168,14 +169,13 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
* @param type the mixin type that the EntityComposite must implement
* @param identity the identity of the new Entity
*
- * @return a new Entity
+ * @return a new EntityBuilder
*
- * @throws NoSuchEntityException if no EntityComposite type of the given mixin type has been registered
- * @throws LifecycleException
- * @throws EntityTypeNotFoundException
+ * @throws EntityTypeNotFoundException if no EntityComposite type of the given mixin type has been registered
+ * @throws AmbiguousTypeException If several mixins implement the given type
*/
<T> EntityBuilder<T> newEntityBuilder( Class<T> type, String identity )
- throws EntityTypeNotFoundException;
+ throws EntityTypeNotFoundException, AmbiguousTypeException;
/**
* Find an Entity of the given mixin type with the give identity. This
@@ -187,7 +187,7 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
* @return the entity
*
* @throws EntityTypeNotFoundException if no entity type could be found
- * @throws NoSuchEntityException
+ * @throws NoSuchEntityException if the entity could not be found
*/
<T> T get( Class<T> type, String identity )
throws EntityTypeNotFoundException, NoSuchEntityException;
@@ -220,9 +220,8 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
* Complete this UnitOfWork. This will send all the changes down to the underlying
* EntityStore's.
*
- * @throws UnitOfWorkCompletionException if the UnitOfWork could not be completed
- * @throws ConcurrentEntityModificationException
- * if entities have been modified by others
+ * @throws UnitOfWorkCompletionException if the UnitOfWork could not be completed
+ * @throws ConcurrentEntityModificationException if entities have been modified by others
*/
void complete()
throws UnitOfWorkCompletionException, ConcurrentEntityModificationException;
@@ -243,7 +242,7 @@ public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
*/
@Override
public void close();
-
+
/**
* Check if the UnitOfWork is open. It is closed after either complete() or discard()
* methods have been called successfully.