QueryT - The type of the query to execute.QueryResultT - The type of the result to return.public class JCoTransaction<QueryT extends AbstractRemoteFunctionQuery<QueryT,QueryResultT>,QueryResultT extends AbstractRemoteFunctionQueryResult<QueryT,QueryResultT>> extends Object implements Transaction<QueryT,QueryResultT>
Transaction interface to be used for JCo queries.| Constructor and Description |
|---|
JCoTransaction(String destinationName,
Supplier<QueryResultT> queryResultFactory)
Constructs a
JCoTransaction for the given destinationName and queryResultFactory. |
| Modifier and Type | Method and Description |
|---|---|
void |
after()
This method gets called *in any case* after the transactional calls are done.
|
void |
before(ErpConfigContext configContext,
QueryT query)
This method gets called before anything else gets called in the
RemoteFunctionQueryExecutor. |
void |
commit(ErpConfigContext configContext,
QueryT query)
If
Transaction.execute(ErpConfigContext, AbstractRemoteFunctionQuery) succeeded, this method is called to actually
commit the changes. |
QueryResultT |
execute(ErpConfigContext configContext,
QueryT query)
The actual logic to be executed.
|
protected List<com.sap.cloud.sdk.s4hana.connectivity.rfc.AbstractRemoteFunctionQueryResult.Result> |
getReturnParameterResults(QueryResultT result) |
void |
rollback(ErpConfigContext configContext,
QueryT query)
If there was a problem with
Transaction.execute(ErpConfigContext, AbstractRemoteFunctionQuery) or
Transaction.commit(ErpConfigContext, AbstractRemoteFunctionQuery) this method will get called to rollback any
unwanted changes. |
public JCoTransaction(@Nonnull String destinationName, @Nonnull Supplier<QueryResultT> queryResultFactory) throws RemoteFunctionException
JCoTransaction for the given destinationName and queryResultFactory.destinationName - Name of the destination to be used. Otherwise, it would not be clear which destination name to use
from the ErpConfigContextqueryResultFactory - Provider to be used to create a QueryResultT object.RemoteFunctionException - If there was an error while getting the actual destionation for the given destinationName.public void before(@Nonnull ErpConfigContext configContext, @Nonnull QueryT query)
TransactionRemoteFunctionQueryExecutor.before in interface Transaction<QueryT extends AbstractRemoteFunctionQuery<QueryT,QueryResultT>,QueryResultT extends AbstractRemoteFunctionQueryResult<QueryT,QueryResultT>>configContext - The ErpConfigContext of this call.query - The AbstractRemoteFunctionQuery going to be executed.@Nonnull public QueryResultT execute(@Nonnull ErpConfigContext configContext, @Nonnull QueryT query) throws RemoteFunctionException
Transactionexecute in interface Transaction<QueryT extends AbstractRemoteFunctionQuery<QueryT,QueryResultT>,QueryResultT extends AbstractRemoteFunctionQueryResult<QueryT,QueryResultT>>configContext - The ErpConfigContext of this call.query - The AbstractRemoteFunctionQuery going to execute.AbstractRemoteFunctionQueryResult created by the query.RemoteFunctionExceptionprotected List<com.sap.cloud.sdk.s4hana.connectivity.rfc.AbstractRemoteFunctionQueryResult.Result> getReturnParameterResults(QueryResultT result)
public void commit(@Nonnull ErpConfigContext configContext, @Nonnull QueryT query) throws QueryExecutionException
TransactionTransaction.execute(ErpConfigContext, AbstractRemoteFunctionQuery) succeeded, this method is called to actually
commit the changes.commit in interface Transaction<QueryT extends AbstractRemoteFunctionQuery<QueryT,QueryResultT>,QueryResultT extends AbstractRemoteFunctionQueryResult<QueryT,QueryResultT>>configContext - The ErpConfigContext of this call.query - The AbstractRemoteFunctionQuery that was executed.QueryExecutionException - If an exception occurred during the commit implementation.public void rollback(@Nonnull ErpConfigContext configContext, @Nonnull QueryT query) throws QuerySerializationException, QueryExecutionException
TransactionTransaction.execute(ErpConfigContext, AbstractRemoteFunctionQuery) or
Transaction.commit(ErpConfigContext, AbstractRemoteFunctionQuery) this method will get called to rollback any
unwanted changes.rollback in interface Transaction<QueryT extends AbstractRemoteFunctionQuery<QueryT,QueryResultT>,QueryResultT extends AbstractRemoteFunctionQueryResult<QueryT,QueryResultT>>configContext - The ErpConfigContext of this call.query - The AbstractRemoteFunctionQuery that was executed.QueryExecutionException - If an exception occurred during the rollback implementation.QuerySerializationExceptionpublic void after()
throws RemoteFunctionException
Transactionafter in interface Transaction<QueryT extends AbstractRemoteFunctionQuery<QueryT,QueryResultT>,QueryResultT extends AbstractRemoteFunctionQueryResult<QueryT,QueryResultT>>RemoteFunctionException - If an exception occurred during the after implementation.Copyright © 2020 SAP SE. All rights reserved.