Package org.cyclos.impl.banking
Class AccountHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseNetworkedHandlerImpl
-
- org.cyclos.impl.banking.AccountHandlerImpl
-
- All Implemented Interfaces:
AccountHandler
@Component public class AccountHandlerImpl extends BaseNetworkedHandlerImpl implements AccountHandler
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description AccountHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAccountNumber(IAccount account)Returns the masked account number for the given account, if applicable.InternalAccountOwnergetAccountOwner()Returns the account owner of the logged user.
If there is a logged admin, returnsSystemAccountOwner.booleanisSystemAccountOwner(AccountOwner owner)LocateAccountOwnerResultlocate(AccountOwner accountOwner)Locates a non-removed account ownerLocateAccountOwnerResultlocate(AccountOwner accountOwner, boolean allowRemoved)Locates an account owner, using no specific principal types - the same ones used to locate users will be attemptedLocateAccountOwnerResultlocate(AccountOwner accountOwner, boolean allowById, boolean allowContact, boolean allowOperators, boolean allowRemoved, Collection<PrincipalType> principalTypes, PrincipalType defaultPrincipalType, boolean recordFailure)Locate and normalize the specified account owner using the specified principal types (if null then try with all allowed principal types).
This method MUST be invoked before work with any instances of AccountOwner.
If the account owner parameter represents a user it will be located.LocateAccountOwnerResultlocateOrCurrent(AccountOwner accountOwner)Locates a non-removed account ownerLocateAccountOwnerResultlocateOrCurrent(AccountOwner accountOwner, boolean allowRemoved)LikeAccountHandler.locate(AccountOwner), except that if the given owner is null, returns the owner of the logged user.AccountOwnertoAccountOwnerVO(LocateAccountOwnerResult result)Same asAccountHandler.toAccountOwnerVO(LocateAccountOwnerResult, boolean), but never allowing operators.AccountOwnertoAccountOwnerVO(LocateAccountOwnerResult result, boolean allowOperator)If the result represents a user there are two options:
If the user was located then returns aLocatedUserVOIf the user was not located then returns aBasicUserVO(OperatorVOonly if allowOperator is true)
Otherwise returns aSystemAccountOwnerAccountOwnertoAccountOwnerVO(AccountOwner accountOwner)Same asAccountHandler.toAccountOwnerVO(AccountOwner, boolean), but never allowing operators.AccountOwnertoAccountOwnerVO(AccountOwner accountOwner, boolean allowOperator)LikeAccountHandler.toAccountOwnerVO(InternalAccountOwner, boolean)but supportingExternalAccountOwnerInternalAccountOwnertoAccountOwnerVO(InternalAccountOwner accountOwner)Same asAccountHandler.toAccountOwnerVO(InternalAccountOwner, boolean), but never allowing operators.InternalAccountOwnertoAccountOwnerVO(InternalAccountOwner accountOwner, boolean allowOperator)ReturnSystemAccountOwnerorBasicUserVO.-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
getAccountNumber
public String getAccountNumber(IAccount account)
Description copied from interface:AccountHandlerReturns the masked account number for the given account, if applicable. Otherwise, null.- Specified by:
getAccountNumberin interfaceAccountHandler
-
getAccountOwner
public InternalAccountOwner getAccountOwner()
Description copied from interface:AccountHandlerReturns the account owner of the logged user.
If there is a logged admin, returnsSystemAccountOwner. If any other user, returns it. Otherwise, returns null.- Specified by:
getAccountOwnerin interfaceAccountHandler
-
isSystemAccountOwner
public boolean isSystemAccountOwner(AccountOwner owner)
- Specified by:
isSystemAccountOwnerin interfaceAccountHandler- Returns:
- true if the owner parameter is the SystemAccountOwner
-
locate
public LocateAccountOwnerResult locate(AccountOwner accountOwner)
Description copied from interface:AccountHandlerLocates a non-removed account owner- Specified by:
locatein interfaceAccountHandler- See Also:
AccountHandler.locate(AccountOwner, boolean)
-
locate
public LocateAccountOwnerResult locate(AccountOwner accountOwner, boolean allowRemoved)
Description copied from interface:AccountHandlerLocates an account owner, using no specific principal types - the same ones used to locate users will be attempted- Specified by:
locatein interfaceAccountHandlerallowRemoved- whether to allow removed users or not
-
locate
public LocateAccountOwnerResult locate(AccountOwner accountOwner, boolean allowById, boolean allowContact, boolean allowOperators, boolean allowRemoved, Collection<PrincipalType> principalTypes, PrincipalType defaultPrincipalType, boolean recordFailure)
Description copied from interface:AccountHandlerLocate and normalize the specified account owner using the specified principal types (if null then try with all allowed principal types).
This method MUST be invoked before work with any instances of AccountOwner.
If the account owner parameter represents a user it will be located. In case of an admin a result with theSystemAccountOwnerwill be created.- Specified by:
locatein interfaceAccountHandler- Returns:
- a result with a
SystemAccountOwner,ExternalAccountOwneror the user representing the specified owner.
-
locateOrCurrent
public LocateAccountOwnerResult locateOrCurrent(AccountOwner accountOwner)
Description copied from interface:AccountHandlerLocates a non-removed account owner- Specified by:
locateOrCurrentin interfaceAccountHandler- See Also:
AccountHandler.locateOrCurrent(AccountOwner, boolean)
-
locateOrCurrent
public LocateAccountOwnerResult locateOrCurrent(AccountOwner accountOwner, boolean allowRemoved)
Description copied from interface:AccountHandlerLikeAccountHandler.locate(AccountOwner), except that if the given owner is null, returns the owner of the logged user.- Specified by:
locateOrCurrentin interfaceAccountHandlerallowRemoved- whether removed users are allowed or not
-
toAccountOwnerVO
public AccountOwner toAccountOwnerVO(AccountOwner accountOwner)
Description copied from interface:AccountHandlerSame asAccountHandler.toAccountOwnerVO(AccountOwner, boolean), but never allowing operators.- Specified by:
toAccountOwnerVOin interfaceAccountHandler
-
toAccountOwnerVO
public AccountOwner toAccountOwnerVO(AccountOwner accountOwner, boolean allowOperator)
Description copied from interface:AccountHandlerLikeAccountHandler.toAccountOwnerVO(InternalAccountOwner, boolean)but supportingExternalAccountOwner- Specified by:
toAccountOwnerVOin interfaceAccountHandler
-
toAccountOwnerVO
public InternalAccountOwner toAccountOwnerVO(InternalAccountOwner accountOwner)
Description copied from interface:AccountHandlerSame asAccountHandler.toAccountOwnerVO(InternalAccountOwner, boolean), but never allowing operators.- Specified by:
toAccountOwnerVOin interfaceAccountHandler
-
toAccountOwnerVO
public InternalAccountOwner toAccountOwnerVO(InternalAccountOwner accountOwner, boolean allowOperator)
Description copied from interface:AccountHandler- Specified by:
toAccountOwnerVOin interfaceAccountHandler
-
toAccountOwnerVO
public AccountOwner toAccountOwnerVO(LocateAccountOwnerResult result)
Description copied from interface:AccountHandlerSame asAccountHandler.toAccountOwnerVO(LocateAccountOwnerResult, boolean), but never allowing operators.- Specified by:
toAccountOwnerVOin interfaceAccountHandler
-
toAccountOwnerVO
public AccountOwner toAccountOwnerVO(LocateAccountOwnerResult result, boolean allowOperator)
Description copied from interface:AccountHandlerIf the result represents a user there are two options:
- If the user was located then returns a
LocatedUserVO - If the user was not located then returns a
BasicUserVO(OperatorVOonly if allowOperator is true)
SystemAccountOwner- Specified by:
toAccountOwnerVOin interfaceAccountHandler
- If the user was located then returns a
-
-