All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.commerce.Transaction

java.lang.Object
   |
   +----semper.commerce.Transaction

public abstract class Transaction
extends Object
implements Serializable, Transferable, Containable
This class encapsulates the common features of all commerce transactions. This class cannot be instantiated directly. Instead, a number of subclasses have been defined for each type of commerce transaction supported by SEMPER.

The commerce layers considers a transaction to consist of a number of predefined attributes defined by the transaction type and some free format text generated by the business application describing the transaction. The business application may add additional attributes to a transaction by subclassing, but these attributes will not be considered by the commerce layer. It is the fixed attributes and the text that define the transaction and will be signed etc.

Note that when a transaction object is retrieved from a deal the returned object is only a "snapshot" of the real object. The returned object will not automatically be updated to reflect any changes in the transaction object such as a reference to a new transaction referencing this object. To get an updated transaction object a new snapshot must be retrieved from the deal.

Implementation note A number of the methods defined by this class restricts access by requiring a suitable access control capability to be presented. The functionality for verifying the access control capability is not yet implemented and a null access control handle can be specified.

Version:
$Id: Transaction.java,v 1.21 1998/10/02 12:20:03 semper Exp $
Author:
Rolf Michelsen, Stig Mj�lsnes
See Also:
GenericTransaction, PaymentTransaction, StatementTransaction, ExchangeTransaction

Variable Index

 o REQUEST_ABORTED
Status code for a transaction that has been aborted.
 o REQUEST_INDICATION
Status code for a transaction indication.
 o REQUEST_NOT
Status code for a transaction that has not yet been requested.
 o REQUEST_OK
Status code for a transaction that has successfully been requested.
 o REQUEST_PENDING
Status code for a transaction that has been requested but the request has not yet succeeded.

Method Index

 o equals(Object)
Compares two transaction objects for equality.
 o getDescription()
Returns the transaction description.
 o getDescriptionHTML()
Returns a HTML description of the transaction.
 o getID()
Returns the transaction identifier.
 o getQualityHTML(boolean)
Returns a textual description of the service quality settings for the transaction.
 o getQualityText(boolean)
Returns a textual description of the service quality settings in effect for the transaction.
 o getReferenced()
Returns the transaction referenced by this transaction.
 o getReferencing()
Returns an array of all transactions referencing this transaction.
 o getRequestDate()
Returns the date and time associated with the transaction.
 o getSignature()
Returns the non-repudiation information for the transaction.
 o getTransferTransaction()
Returns a TX transfer object suitable for transfering the commerce transaction object.
 o isNonRepudiable()
Returns a value indicating whether non repudiation is available for this transaction.
 o makeDescription()
Generates the transaction description.
 o registerContainer(Container)
Invoked by the TX layer container containing this object to pass a reference to the container object.
 o request(AccessControlHandle)
Requests a transaction.
 o requestAbort()
Tries to abort a requested transaction.
 o requestStatus()
Returns information about the status of the transaction request.
 o toString()
Returns a string representation of the object.
 o validate()
Verifies the validity of the transaction.

Variables

 o REQUEST_NOT
 public static final int REQUEST_NOT
Status code for a transaction that has not yet been requested. This status code may be returned by the method requestStatus.

 o REQUEST_OK
 public static final int REQUEST_OK
Status code for a transaction that has successfully been requested. This status code may be returned by the method requestStatus.

 o REQUEST_ABORTED
 public static final int REQUEST_ABORTED
Status code for a transaction that has been aborted. This status code may be returned by the method requestStatus.

 o REQUEST_PENDING
 public static final int REQUEST_PENDING
Status code for a transaction that has been requested but the request has not yet succeeded. This status code may be returned by the method requestStatus.

 o REQUEST_INDICATION
 public static final int REQUEST_INDICATION
Status code for a transaction indication. This status code may be returned by the method requestStatus.

Methods

 o getID
 public final TransactionID getID()
Returns the transaction identifier. The transaction identifier is unique for a transaction entry in a deal. The same transaction identifier identifies the corresponding transaction in the peer deal.

Returns:
The transaction identifier.
 o getDescription
 public final synchronized Description getDescription()
Returns the transaction description. The transaction description is generated by the business application based on the transaction attributes and the context in which the transaction is done. The description is not generated until the transaction is requested. null will be returned if the description has not yet been requested.

Note that this method does not return a full formatted description of the transaction but only the semantical description provided by the transaction type. For a full transaction description see getDescriptionHTML.

Returns:
The transaction description.
See Also:
getDescriptionHTML
 o getReferenced
 public final synchronized Transaction getReferenced() throws TransactionException
Returns the transaction referenced by this transaction. null is returned for a top level transaction.

Returns:
The transaction referenced by this transaction.
Throws: TransactionException
Thrown if an error occurs while handling a transaction object. This method will throw this exception if an error occurs while attempting to retrieve a transaction object from persistent storage in the archive.
 o getReferencing
 public final synchronized Transaction[] getReferencing() throws TransactionException
Returns an array of all transactions referencing this transaction. null is returned if no transaction refers to this transaction.

Returns:
All transaction entries referencing this transaction.
Throws: TransactionException
Thrown if an error occurs while handling a transaction object. This method will throw this exception if an error occurs while attempting to retrieve a transaction object from persistent storage in the archive.
 o getRequestDate
 public final synchronized Date getRequestDate()
Returns the date and time associated with the transaction. The date corresponds to the time when the transaction was requested. null will be returned for transaction objects that have not been requested yet.

Returns:
The date and time of the transaction.
 o makeDescription
 public abstract Description makeDescription()
Generates the transaction description. This method will be invoked by the commerce layer when the transaction description is needed. A business application must provide an implementation of this method by subclassing Transaction. Default implementations exist for the base transaction types.

Returns:
A description of the transaction.
 o request
 public abstract void request(AccessControlHandle ach) throws AssociationException, TransactionException
Requests a transaction. This transaction request will result in a corresponding transaction indication to the peer. This is an unconfirmed service, and successful invocation of this method does not confirm that the transaction is successfull or even that it has taken place. Use the method requestStatus to inquire about the status of a transaction.

This method may validate the transaction according to validation procedures defined by the transaction types. The user may also be asked to authorise the transaction. This authorisation can be bypassed by giving the proper access control capabilities as an argument to this method.

Parameters:
ach - Access control handle to capabilities for bypassing user authorisation of transaction.
Throws: AssociationException
Thrown if something wrong with the assication prevents the transaction request.
Throws: TransactionException
Thrown if an error occurs while handling the transaction object.
See Also:
requestStatus, requestAbort
 o requestStatus
 public final synchronized int requestStatus()
Returns information about the status of the transaction request. The return value will indicate whether the transaction request has completed or not. The value REQUEST_INDICATION will be returned for transaction indications.

Returns:
A status code indicating the status of the transaction request. Status codes are defined as symbolic constants by this class.
See Also:
request, requestAbort
 o requestAbort
 public synchronized boolean requestAbort()
Tries to abort a requested transaction. This method can only be invoked for a transaction that has already been requested. It will never succeed for a completed transaction, and it is not even guaranteed to succeed for a transaction that is still in progress.

Returns:
true is returned if the transaction was successfully aborted.
See Also:
request, requestStatus
 o validate
 public boolean validate()
Verifies the validity of the transaction. This method returns a boolean value indicating whether the transaction is valid according to any validation rules defined by the transaction type. This method will typically be overridden by subclasses. The default implementation always returns true.

Note that this method does not request user authorisation for the transaction.

Returns:
true if the transaction is valid.
 o registerContainer
 public final boolean registerContainer(Container container)
Invoked by the TX layer container containing this object to pass a reference to the container object. This method is defined by the Containable interface. We don't need this reference as we will never talk to the container so this method does nothing.

Parameters:
container - The container object containing this transaction object.
Returns:
Always returns true indicating success.
See Also:
Containable
 o getTransferTransaction
 public final TransferTransaction getTransferTransaction()
Returns a TX transfer object suitable for transfering the commerce transaction object. This method is defined by the Transferable interface.

Returns:
A TX transfer object suitable for transfering this object.
See Also:
Transferable
 o isNonRepudiable
 public final boolean isNonRepudiable()
Returns a value indicating whether non repudiation is available for this transaction. For a requested transaction the value will be true if a receipt has been received. For an indicated transaction the value will be true if the transaction itself was signed by the requester.

Returns:
true if a non repudiation token is available for this transaction.
 o getSignature
 public final TransactionNRData getSignature()
Returns the non-repudiation information for the transaction. For a requested transaction the receipt will be returned. For an indicated transaction the requester's signature will be returned. null is returned if the transaction does not offer non-repudiation.

 o getDescriptionHTML
 public final synchronized String getDescriptionHTML()
Returns a HTML description of the transaction. The encoding uses HTML 1.0. The formatting is based on the description in Activity Paper 242ST011. This method returns null if the transaction has not yet been requested.

This method is declared final to prevent an untrusted subclass to override it.

Returns:
A HTML description of the transaction.
 o toString
 public String toString()
Returns a string representation of the object. This string representation consists of the text string "Transaction" and the string representation of the transaction identifier.

Returns:
A string representation of the object.
Overrides:
toString in class Object
 o equals
 public final boolean equals(Object trans)
Compares two transaction objects for equality. This test just compares the transaction type and transaction identifiers.

Parameters:
trans - Transaction to compare with.
Returns:
true if the transactions are equal, false otherwise.
Overrides:
equals in class Object
 o getQualityHTML
 public final String getQualityHTML(boolean shortFmt)
Returns a textual description of the service quality settings for the transaction. HTML 1.0 is used for the formatting of the description, and it can be embedded in other HTML documents.

Parameters:
shortFmt - If set, a short description will be returned.
Returns:
A textual description of the transaction quality settings.
See Also:
getQualityHTML
 o getQualityText
 public final String getQualityText(boolean shortFmt)
Returns a textual description of the service quality settings in effect for the transaction. Plain text is used for the formatting of the description.

Parameters:
shortFmt - If set, a short description will be returned.
Returns:
A textual description of the transaction quality settings.
See Also:
getQualityText

All Packages  Class Hierarchy  This Package  Previous  Next  Index