TOBOUserServiceProvider
class provides a implementation of the caplin.trading.service.TOBOUserService
which uses the caplin.trading.service.TOBOUserPermissionServiceListener and the provided
caplin.trading.service.TradePermissionService to get the permissions of the currently logged-in
user, which users he can trade on behalf of, and which of there TOBO users' accounts can be used to this
end.
The TOBOUserServiceProvider maintains a state consisting of the logged-in user's type (TRADER or SALES) selected TOBO user and account, and the list of available TOBO users and accounts for the selected TOBO user, if any. (SALES users are allowed to trade on behalf of other users whereas TRADER users are not.) This state is kept up-to-date by the permission listener. It also keeps track of the number of trades started by the logged-in user, locking all listeners if at least one trade is started.
The TOBOUserServiceProvider also acts as a caplin.trading.trademodel.TradeOnBehalfOfListener, suspending trading while TOBO user changes are occurring in the application.
Attributes | Name and Description |
---|---|
|
caplin.trading.service.TOBOUserServiceProvider(caplin.trading.trademodel.TradeOnBehalfOf oTradeOnBehalfOf)
Constructs an instance of |
Attributes | Name and Description |
---|---|
|
void
addListener(caplin.trading.service.TOBOUserServiceListener oListener)
Add a listener to the TOBOUserServiceProvider to be notified of changes in the selected TOBO user, user type and account, the list of available TOBO users and accounts and the TOBO user service lock. |
|
boolean
canPerformTrade()
Returns true if the logged-in user can trade on behalf of other users and has selected a TOBO user to trade on behalf of. |
|
boolean
canTradeOnBehalfOf()
This method can be used to query whether the logged-in user can trade on behalf of other users. |
|
String
getAccount()
Returns the account of the currently selected TOBO user which is being used by the logged-in user. |
|
String
getTradeOnBehalfOfUser()
Returns the TOBO user whom the logged-in user is trading on behalf of. |
|
String
getUserType()
Returns the type of the logged-in user. |
|
void
removeListener(caplin.trading.service.TOBOUserServiceListener oListener)
Remove a listener of the TOBOUserServiceProvider. |
|
void
setAccount(String sAccount)
Sets the current TOBO user's account to be used for trading by the logged-in user. |
|
void
setTradeOnBehalfOfUser(String sUser)
This method sets the TOBO user and updates the account list with the accounts available for the new TOBO user. |
|
void
tradeFinished()
This method is called by the trading components. |
|
void
tradeOnBehalfOfChangeFailed( sReason)
A pending "trade on behalf of" change has failed, and any subsequent prices are from the old tier. |
|
void
tradeOnBehalfOfChangeInitiated( sPermissionable)
A "trade on behalf of" change has been initiated, and we are currently awaiting prices for the new tier. |
|
void
tradeOnBehalfOfUserChanged( sPermissionable)
A "trade on behalf of" change has been completed, and any subsequent prices are from the new tier. |
|
void
tradeStarted()
This method is called by the trading components, triggering caplin.trading.service.TOBOUserServiceListener#onLockChanged on all the TOBOUserService's listeners, enabling them to 'lock' their behaviour. |
►
caplin.trading.service.TOBOUserServiceProvider(caplin.trading.trademodel.TradeOnBehalfOf oTradeOnBehalfOf)
Constructs an instance of caplin.trading.service.TOBOUserServiceProvider
.
caplin.trading.trademodel.TradeOnBehalfOf | oTradeOnBehalfOf | The trade-on-behalf-of object. |
►
void
addListener(caplin.trading.service.TOBOUserServiceListener oListener)
Add a listener to the TOBOUserServiceProvider to be notified of changes in the selected TOBO user, user type and account, the list of available TOBO users and accounts and the TOBO user service lock.
caplin.trading.service.TOBOUserServiceListener | oListener | Listener object. |
►
boolean
canPerformTrade()
Returns true if the logged-in user can trade on behalf of other users and has selected a TOBO user to trade on behalf of.
►
boolean
canTradeOnBehalfOf()
This method can be used to query whether the logged-in user can trade on behalf of other users.
►
String
getAccount()
Returns the account of the currently selected TOBO user which is being used by the logged-in user.
►
String
getTradeOnBehalfOfUser()
Returns the TOBO user whom the logged-in user is trading on behalf of.
►
String
getUserType()
Returns the type of the logged-in user.
►
void
removeListener(caplin.trading.service.TOBOUserServiceListener oListener)
Remove a listener of the TOBOUserServiceProvider.
caplin.trading.service.TOBOUserServiceListener | oListener | Listener object. |
►
void
setAccount(String sAccount)
Sets the current TOBO user's account to be used for trading by the logged-in user. caplin.trading.service.TOBOUserServiceListener#onTOBOAccountChanged is called on all the TOBOUserService's listeners.
String | sAccount | The account name. |
►
void
setTradeOnBehalfOfUser(String sUser)
This method sets the TOBO user and updates the account list with the accounts available for the new TOBO user. caplin.trading.service.TOBOUserServiceListener#onTOBOUserChanged is called on all the TOBOUserService's listeners.
String | sUser | The TOBO user's userName. |
►
void
tradeFinished()
This method is called by the trading components. If the TOBOUserService detects that no more trades are executing, the caplin.trading.service.TOBOUserServiceListener#onLockChanged is called on all the TOBOUserService's listeners, enabling them to 'unlock' their behaviour.
►
void
tradeOnBehalfOfChangeFailed( sReason)
A pending "trade on behalf of" change has failed, and any subsequent prices are from the old tier.
sReason | {String} A string description of the reason for failure. |
►
void
tradeOnBehalfOfChangeInitiated( sPermissionable)
A "trade on behalf of" change has been initiated, and we are currently awaiting prices for the new tier. Any existing prices should be considered stale.
sPermissionable | {String} A string representing the permissionable item that we are going to "trade on behalf of". |
►
void
tradeOnBehalfOfUserChanged( sPermissionable)
A "trade on behalf of" change has been completed, and any subsequent prices are from the new tier.
sPermissionable | {String} A string representing the permissionable item that we are now "trading on behalf of". |
►
void
tradeStarted()
This method is called by the trading components, triggering caplin.trading.service.TOBOUserServiceListener#onLockChanged on all the TOBOUserService's listeners, enabling them to 'lock' their behaviour.