org.tolven.core.entity
Class AccountExchange

java.lang.Object
  extended by org.tolven.core.entity.AccountExchange
All Implemented Interfaces:
java.io.Serializable

public class AccountExchange
extends java.lang.Object
implements java.io.Serializable

This entity represents allowable points of exchange between accounts. There are two types of objects due to the boundary between accounts. These two types of entries generally work in pairs. Both sides must have active entries for a message to exchange. A sender must be willing to send to a receiving account and a receiver must be willing to receive from a sending account. Further, the roles may, but are not required, to be reversed. If the reverse is not provided, then all communication between two parties will be one way. Example of a complete, two-way channel:

This entity has a separate id. This allows, over time, entries to be added and then subsequently discontinued. In that case, a new agreement is a new row in the table. But only one row for each account/otherAccount/direction combination should exist at a time with a status of active.

Author:
John Churin
See Also:
Serialized Form

Nested Class Summary
static class AccountExchange.Direction
           
 
Constructor Summary
AccountExchange()
           
 
Method Summary
 Account getAccount()
          The account that owns this exchange
 AccountExchange.Direction getDirection()
          The direction of the exchange (SEND or RECEIVE)
 java.util.Date getEffectiveTime()
          The effective time of this exchange agreement
 java.util.Date getExpirationTime()
          The effective time of this exchange agreement
 long getId()
          Unique id of this exchange record
 java.lang.String getName()
          The name of the connection.
 Account getOtherAccount()
          The distal account.
 java.lang.String getStatus()
          NEW means an exchange is pending.
 void setAccount(Account account)
           
 void setDirection(AccountExchange.Direction direction)
           
 void setEffectiveTime(java.util.Date effectiveTime)
           
 void setExpirationTime(java.util.Date expirationTime)
           
 void setId(long id)
           
 void setName(java.lang.String name)
           
 void setOtherAccount(Account otherAccount)
           
 void setStatus(java.lang.String status)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccountExchange

public AccountExchange()
Method Detail

getAccount

public Account getAccount()
The account that owns this exchange

Returns:

setAccount

public void setAccount(Account account)

getDirection

public AccountExchange.Direction getDirection()
The direction of the exchange (SEND or RECEIVE)

Returns:

setDirection

public void setDirection(AccountExchange.Direction direction)

getEffectiveTime

public java.util.Date getEffectiveTime()
The effective time of this exchange agreement

Returns:

setEffectiveTime

public void setEffectiveTime(java.util.Date effectiveTime)

getExpirationTime

public java.util.Date getExpirationTime()
The effective time of this exchange agreement

Returns:

setExpirationTime

public void setExpirationTime(java.util.Date expirationTime)

getId

public long getId()
Unique id of this exchange record

Returns:

setId

public void setId(long id)

getOtherAccount

public Account getOtherAccount()
The distal account. In the case of SEND, the account we want to send to. In the case of RECEIVE, the account we will allow to send to us.

Returns:

setOtherAccount

public void setOtherAccount(Account otherAccount)

getStatus

public java.lang.String getStatus()
NEW means an exchange is pending. ACTIVE means the exchange agreement is active. This does not make any assumption about the other party. For example, while Account A says it is willing to receive from Account B, Account B may not be willing to send information to Account A. The status of the "other" end point can change independently of this account. Any other status suggests an exchange that is no longer ACTIVE and thus is not considered for exchange.

Returns:

setStatus

public void setStatus(java.lang.String status)

getName

public java.lang.String getName()
The name of the connection.

Returns:

setName

public void setName(java.lang.String name)