#461 - ENH: Add @Draftable support - API sans transaction

This commit is contained in:
Robin Bygrave
2015-11-24 01:01:14 +13:00
parent 5d3da60828
commit 555e5ba6fd
3 changed files with 45 additions and 0 deletions
@@ -1832,6 +1832,19 @@ public interface EbeanServer {
*/
<T> T publish(Class<T> beanType, Object id, Transaction transaction);
/**
* Publish a single bean given its type and id returning the resulting live bean.
* This will use the current transaction or create one if required.
* <p>
* The values are published from the draft to the live bean.
* </p>
*
* @param <T> the type of the entity bean
* @param beanType the type of the entity bean
* @param id the id of the entity bean
*/
<T> T publish(Class<T> beanType, Object id);
/**
* Publish the beans that match the query returning the resulting published beans.
* <p>
@@ -1844,4 +1857,16 @@ public interface EbeanServer {
*/
<T> List<T> publish(Query<T> query, Transaction transaction);
/**
* Publish the beans that match the query returning the resulting published beans.
* This will use the current transaction or create one if required.
* <p>
* The values are published from the draft beans to the live beans.
* </p>
*
* @param <T> the type of the entity bean
* @param query the query used to select the draft beans to publish
*/
<T> List<T> publish(Query<T> query);
}
@@ -1641,6 +1641,16 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
}
}
@Override
public <T> T publish(Class<T> beanType, Object id) {
return publish(beanType, id, null);
}
@Override
public <T> List<T> publish(Query<T> query) {
return publish(query, null);
}
@Override
public <T> T publish(Class<T> beanType, Object id, Transaction transaction) {