Package org.cyclos.impl.users
Class OperatorServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.CRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
- org.cyclos.impl.users.OperatorServiceImpl
-
- All Implemented Interfaces:
CRUDServiceLocal<Operator,OperatorDTO,OperatorData,OperatorDataParams>,OperatorServiceLocal,CRUDService<OperatorDTO,OperatorData,OperatorDataParams>,CRUDWithConfirmationPasswordService<OperatorDTO,OperatorData,OperatorDataParams>,Service,OperatorService
@Service public class OperatorServiceImpl extends CRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams> implements OperatorServiceLocal
Implementation forOperatorService
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.CRUDServiceImpl
$, ATTR_CURRENT_COPY, cacheHandler, dtoClass, entityClass, extensionPointService, idPath, internalNamePath, namePath, ownerEntityIdPath, ownerEntityPath, ownerEntityPropertyName, passwordHandler, richTextHandler, withConfirmationPassword
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, transactionHandler, translationHandler
-
Fields inherited from interface org.cyclos.impl.users.OperatorServiceLocal
op
-
-
Constructor Summary
Constructors Constructor Description OperatorServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OperatorGroupAccountAccessaccountAccess(Account account)If the logged user is a restricted operator, returns his access over the given account (never null).protected voidaddCustomNameValidations(Property name, OperatorDTO dto)This method may be overridden to add custom validations for the NAME property.booleancanViewOperators(User user)Returns true if the logged user can view the operators of the given user.protected voiddoRemove(Operator operator, boolean flush)May be overridden in order to perform logical removing, instead of physical removing, or to remove some extra relationships as wellprotected OperatorDatagetData(Operator operator)Returns details data for the given entityprotected CreateDeviceConfirmationParamsgetDeviceConfirmationParams(OperatorDTO dto, Operator operator, CRUDOperation operation)If the confirmation password must be checked then subclasses must overwrite this method to return a no-nullCreateDeviceConfirmationParamsobject.Object[]getExcludedPropertiesToEntity()Same as thegetExcludedPropertiesToEntity()method from theCRUDServiceImplbut for all dto's instances.protected Object[]getExcludedPropertiesToEntity(OperatorDTO dto)May be overridden in order to exclude properties when converting the given DTO to entityOperatorsSearchDatagetSearchData(UserLocatorVO locator)Returns data for searching operators of the given userprotected Pair<DBQuery<?>,String>getUniqueNameQuery(OperatorDTO dto)This method may be overridden to customize the default global unique validation for the name property.ViewOperatorProfileDatagetViewProfileData(UserLocatorVO locator)Returns data for viewing an operator profilebooleanhasOperators(User user)Returns whether the user even had operatorsprotected booleanisNameRequired(OperatorDTO dto)By default, the name is always requiredcom.mysema.commons.lang.CloseableIterator<Operator>iterateOperatorsToNotify(BasicUser destination, UserNotificationType type, boolean aliasesOnly)Returns either all or only alias operators from the given owner that chose to receive the given notification type.com.mysema.commons.lang.CloseableIterator<BasicUser>iteratePossibleAuthorizers(Operator operator, PaymentTransferType type)Returns all basic users that can authorize payments of the given type, excluding the given operator.List<Operator>list(User user)Lists all operators for the given userList<Operator>listAliases(User user)Lists the alias operators of the given user.OperatornewEntity(OperatorDataParams params)Should be implemented in order to instantiate a new entity based on the given context parametersprotected voidonAfterSave(Operator operator, Operator currentCopy, Object dataFromOnBeforeSave)May be overridden in order to perform custom logic after saving an entityprotected voidonBeforeRemove(Operator operator)May be overridden in order to perform custom logic before removing an entityprotected ObjectonBeforeSave(Operator operator, Operator currentCopy)May be overridden in order to perform custom logic before saving an entity.voidonRegistrationValidation(Operator operator)Performs additional actions when an operator registration is validatedUserRegistrationResultregister(OperatorRegistrationDTO dto)Registers an operator, returning the status and generated dataprotected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkvoidremoveAll(User user, boolean purge)Removes all operators from the given userprotected ExtensionPointAccessorresolveExtensionPointAccessor(CRUDOperation operation, Operator operator)Should be overridden by subclasses which have extension pointsprotected ValidatorresolveValidator(OperatorDTO dto)Page<OperatorWithFieldsVO>search(OperatorQuery params)Searches for operators according to the given criteriaprotected booleanshouldCheckConfirmationPassword(Operator operator, CRUDOperation operation)Controls whether confirmation password should be checked for the given entity and operation.OperatorDTOtoDTO(Operator entity)Converts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses-
Methods inherited from class org.cyclos.impl.CRUDServiceImpl
addCustomInternalNameValidations, checkConfirmationPassword, find, findAll, from, getConfirmationPasswordInput, getConfirmationPasswordInputForRemove, getData, getDataForNew, getEntityClass, getEntityInternalNameKey, getExcludedPropertiesToDTO, getNameLabel, getUniqueInternalNameQuery, isEntityInternalNameRequired, load, logEntity, onAfterRemove, preProcessCurrentCopy, remove, remove, removeAll, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveDTOType, resolveEntityType, save, saveOrder, saveSkippingEntityLog, saveWithConfirmationPassword, subClassMappings, toEntity, validate
-
Methods inherited from class org.cyclos.impl.BaseServiceImpl
initializeNetworkMappings
-
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, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.services.CRUDService
getData, getDataForNew, load, remove, removeAll, save
-
Methods inherited from interface org.cyclos.impl.CRUDServiceLocal
find, findAll, getEntityClass, remove, removeAll, saveEntity, saveSkippingEntityLog, toEntity, validate
-
Methods inherited from interface org.cyclos.services.CRUDWithConfirmationPasswordService
getConfirmationPasswordInputForRemove, removeAllWithConfirmationPassword, removeWithConfirmationPassword, saveWithConfirmationPassword
-
-
-
-
Method Detail
-
accountAccess
public OperatorGroupAccountAccess accountAccess(Account account)
Description copied from interface:OperatorServiceLocalIf the logged user is a restricted operator, returns his access over the given account (never null). If not a restricted operator, returns null.- Specified by:
accountAccessin interfaceOperatorServiceLocal
-
canViewOperators
public boolean canViewOperators(User user)
Description copied from interface:OperatorServiceLocalReturns true if the logged user can view the operators of the given user.- Specified by:
canViewOperatorsin interfaceOperatorServiceLocal
-
getExcludedPropertiesToEntity
public Object[] getExcludedPropertiesToEntity()
Description copied from interface:OperatorServiceLocalSame as thegetExcludedPropertiesToEntity()method from theCRUDServiceImplbut for all dto's instances.- Specified by:
getExcludedPropertiesToEntityin interfaceOperatorServiceLocal
-
getSearchData
public OperatorsSearchData getSearchData(UserLocatorVO locator) throws FrameworkException
Description copied from interface:OperatorServiceReturns data for searching operators of the given user- Specified by:
getSearchDatain interfaceOperatorService- Throws:
FrameworkException
-
getViewProfileData
public ViewOperatorProfileData getViewProfileData(UserLocatorVO locator) throws FrameworkException
Description copied from interface:OperatorServiceReturns data for viewing an operator profile- Specified by:
getViewProfileDatain interfaceOperatorService- Throws:
FrameworkException
-
hasOperators
public boolean hasOperators(User user)
Description copied from interface:OperatorServiceLocalReturns whether the user even had operators- Specified by:
hasOperatorsin interfaceOperatorServiceLocal
-
iterateOperatorsToNotify
public com.mysema.commons.lang.CloseableIterator<Operator> iterateOperatorsToNotify(BasicUser destination, UserNotificationType type, boolean aliasesOnly)
Description copied from interface:OperatorServiceLocalReturns either all or only alias operators from the given owner that chose to receive the given notification type. If the destination is an operator, he won't be included in the result.- Specified by:
iterateOperatorsToNotifyin interfaceOperatorServiceLocal
-
iteratePossibleAuthorizers
public com.mysema.commons.lang.CloseableIterator<BasicUser> iteratePossibleAuthorizers(Operator operator, PaymentTransferType type)
Description copied from interface:OperatorServiceLocalReturns all basic users that can authorize payments of the given type, excluding the given operator. The member is always returned, as well as any alias operators, plus all operators that have permission to authorize the given payment type.- Specified by:
iteratePossibleAuthorizersin interfaceOperatorServiceLocal
-
list
public List<Operator> list(User user) throws FrameworkException
Description copied from interface:OperatorServiceLocalLists all operators for the given user- Specified by:
listin interfaceOperatorServiceLocal- Throws:
FrameworkException
-
listAliases
public List<Operator> listAliases(User user) throws FrameworkException
Description copied from interface:OperatorServiceLocalLists the alias operators of the given user. Aliases are operators without a group- Specified by:
listAliasesin interfaceOperatorServiceLocal- Throws:
FrameworkException
-
newEntity
public Operator newEntity(OperatorDataParams params)
Description copied from class:CRUDServiceImplShould be implemented in order to instantiate a new entity based on the given context parameters- Specified by:
newEntityin interfaceCRUDServiceLocal<Operator,OperatorDTO,OperatorData,OperatorDataParams>- Specified by:
newEntityin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
onRegistrationValidation
public void onRegistrationValidation(Operator operator)
Description copied from interface:OperatorServiceLocalPerforms additional actions when an operator registration is validated- Specified by:
onRegistrationValidationin interfaceOperatorServiceLocal
-
register
public UserRegistrationResult register(OperatorRegistrationDTO dto) throws FrameworkException
Description copied from interface:OperatorServiceRegisters an operator, returning the status and generated data- Specified by:
registerin interfaceOperatorService- Throws:
FrameworkException
-
removeAll
public void removeAll(User user, boolean purge)
Description copied from interface:OperatorServiceLocalRemoves all operators from the given user- Specified by:
removeAllin interfaceOperatorServiceLocal
-
search
public Page<OperatorWithFieldsVO> search(OperatorQuery params) throws FrameworkException
Description copied from interface:OperatorServiceSearches for operators according to the given criteria- Specified by:
searchin interfaceOperatorService- Throws:
FrameworkException
-
toDTO
public OperatorDTO toDTO(Operator entity)
Description copied from class:CRUDServiceImplConverts the given entity in a DTO, handling theCRUDServiceImpl.subClassMappings()mappings for subclasses- Specified by:
toDTOin interfaceCRUDServiceLocal<Operator,OperatorDTO,OperatorData,OperatorDataParams>- Overrides:
toDTOin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
addCustomNameValidations
protected void addCustomNameValidations(Property name, OperatorDTO dto)
Description copied from class:CRUDServiceImplThis method may be overridden to add custom validations for the NAME property.- Overrides:
addCustomNameValidationsin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
doRemove
protected void doRemove(Operator operator, boolean flush)
Description copied from class:CRUDServiceImplMay be overridden in order to perform logical removing, instead of physical removing, or to remove some extra relationships as well- Overrides:
doRemovein classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
getData
protected OperatorData getData(Operator operator)
Description copied from class:CRUDServiceImplReturns details data for the given entity- Specified by:
getDatain classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
getDeviceConfirmationParams
protected CreateDeviceConfirmationParams getDeviceConfirmationParams(OperatorDTO dto, Operator operator, CRUDOperation operation)
Description copied from class:CRUDServiceImplIf the confirmation password must be checked then subclasses must overwrite this method to return a no-nullCreateDeviceConfirmationParamsobject. This object is required to validate the confirmation when the operation was confirmed with a device.- Overrides:
getDeviceConfirmationParamsin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>- Parameters:
dto- , it can be null, subclasses must take it into account. E.g: to disable a mobile phone for SMS, the confirmation password must be check and for this case there is no DTO instance.operator- never null, represents the current value (i.e before apply the dto).
-
getExcludedPropertiesToEntity
protected Object[] getExcludedPropertiesToEntity(OperatorDTO dto)
Description copied from class:CRUDServiceImplMay be overridden in order to exclude properties when converting the given DTO to entity- Overrides:
getExcludedPropertiesToEntityin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
getUniqueNameQuery
protected Pair<DBQuery<?>,String> getUniqueNameQuery(OperatorDTO dto)
Description copied from class:CRUDServiceImplThis method may be overridden to customize the default global unique validation for the name property. Also it must return a string with the context to be included in the key used for the lock (LockKey#LockType)- Overrides:
getUniqueNameQueryin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
isNameRequired
protected boolean isNameRequired(OperatorDTO dto)
Description copied from class:CRUDServiceImplBy default, the name is always required- Overrides:
isNameRequiredin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
onAfterSave
protected void onAfterSave(Operator operator, Operator currentCopy, Object dataFromOnBeforeSave)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic after saving an entity- Overrides:
onAfterSavein classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
onBeforeRemove
protected void onBeforeRemove(Operator operator)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic before removing an entity- Overrides:
onBeforeRemovein classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
onBeforeSave
protected Object onBeforeSave(Operator operator, Operator currentCopy)
Description copied from class:CRUDServiceImplMay be overridden in order to perform custom logic before saving an entity. Any returned value will be passed to theCRUDServiceImpl.onAfterSave(BaseEntity, BaseEntity, Object)method- Overrides:
onBeforeSavein classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
registerNetworkMappings
protected void registerNetworkMappings(NetworkPathRegistry networkPathRegistry)
Description copied from class:BaseServiceImplNeeds to be overridden by subclasses to register the path up to the network- Specified by:
registerNetworkMappingsin classBaseServiceImpl
-
resolveExtensionPointAccessor
protected ExtensionPointAccessor resolveExtensionPointAccessor(CRUDOperation operation, Operator operator)
Description copied from class:CRUDServiceImplShould be overridden by subclasses which have extension points- Overrides:
resolveExtensionPointAccessorin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
resolveValidator
protected Validator resolveValidator(OperatorDTO dto)
- Specified by:
resolveValidatorin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
shouldCheckConfirmationPassword
protected boolean shouldCheckConfirmationPassword(Operator operator, CRUDOperation operation)
Description copied from class:CRUDServiceImplControls whether confirmation password should be checked for the given entity and operation. By default returns true if this service indirectly implementsCRUDWithConfirmationPasswordService(for example, if the remote service interface extends it).- Overrides:
shouldCheckConfirmationPasswordin classCRUDServiceImpl<Operator,QOperator,OperatorDTO,OperatorData,OperatorDataParams>
-
-