Class InTransaction<T extends Serializable>

java.lang.Object
com.lexmark.saperion.remote.common.operations.AbstractOperation<T,SaBasicException,LegacyConnection>
com.saperion.operations.LegacyOperation<T>
com.saperion.operations.InTransaction<T>
Type Parameters:
T -
All Implemented Interfaces:
com.lexmark.saperion.remote.common.operations.Operation<T,SaBasicException,LegacyConnection>, Serializable

public class InTransaction<T extends Serializable> extends LegacyOperation<T>
Invokes the given Operation in a transaction. Useful in combination with ApplyBatch.
See Also:
  • Constructor Details

    • InTransaction

      public InTransaction(com.lexmark.saperion.remote.common.operations.Operation<T,SaBasicException,LegacyConnection> toInvoke)
      Creates a new instance of InTransaction that invokes the given Operation inside a new database transaction.
      Parameters:
      toInvoke - The Operation to invoke. Use ApplyBatch as parameter to apply a batch in a transaction.
  • Method Details

    • invoke

      public T invoke() throws SaBasicException
      Throws:
      SaBasicException
    • startTransaction

      public void startTransaction() throws RemoteException
      Must be called if the caller calls with an operation take requires to open JniConnector, before calling invoke. It's because the InTransaction isn't capable of closing the connector which will be opened by the operation it is invoking SECM-2085 ClassicConnector: invoke method creates a warning in combination with InTransaction and applyBatch
      Throws:
      RemoteException
    • finishTransaction

      public void finishTransaction() throws RemoteException
      Must be called if the caller calls with an operation take requires to open JniConnector, before calling invoke. It's because the InTransaction isn't capable of closing the connector which will be opened by the operation it is invoking SECM-2085 ClassicConnector: invoke method creates a warning in combination with InTransaction and applyBatch
      Throws:
      RemoteException
    • afterInvoke

      public void afterInvoke(Object result, LegacyConnection connection)
      Specified by:
      afterInvoke in interface com.lexmark.saperion.remote.common.operations.Operation<T extends Serializable,SaBasicException,LegacyConnection>
      Overrides:
      afterInvoke in class com.lexmark.saperion.remote.common.operations.AbstractOperation<T extends Serializable,SaBasicException,LegacyConnection>
    • getResult

      public T getResult()
      Specified by:
      getResult in interface com.lexmark.saperion.remote.common.operations.Operation<T extends Serializable,SaBasicException,LegacyConnection>
      Overrides:
      getResult in class com.lexmark.saperion.remote.common.operations.AbstractOperation<T extends Serializable,SaBasicException,LegacyConnection>