Class UserManagementServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.UserManagementServiceImpl
-
- All Implemented Interfaces:
UserManagementService
@Service public class UserManagementServiceImpl extends java.lang.Object implements UserManagementService
-
-
Field Summary
Fields Modifier and Type Field Description private org.springframework.context.ApplicationContextappContextprivate CommonPropertiescommonPropertiesprivate com.fasterxml.jackson.databind.ObjectMappermapperprivate org.springframework.data.mongodb.core.MongoTemplatemongoTemplateprivate SequenceGeneratorServicesequenceGeneratorprivate MongoStorageServicestorageServiceprivate UserRepositoryuserRepository
-
Constructor Summary
Constructors Constructor Description UserManagementServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangePassword(User user, java.lang.String password)This method update and save password from database entity (user).java.util.Optional<User>createUser(User user)This method creates a database entity.java.util.Optional<User>createUser(java.util.LinkedHashMap<java.lang.String,java.lang.Object> userAsMap)This method creates a database entity.UsergetLoggedUser()This method does return database entity which logged in system.java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>>getPaginationFilter(java.lang.String requestJson)This method does calculation for a pages based on the request.UserPrincipalgetPrincipal()This method returns user principal object from context.UserRepositorygetRepository()booleanisLogged()This method does check is database entity logged in system.booleanisNotLogged()This method does check is not database entity logged in system.booleanisSuperUser()This method does check is database entity had super status.booleanisUserPermissionAll()This method does check is database entity had all permissions.booleanisUserPermissionApplication()This method does check is database entity had application permission.voidremoveUserAndClean(java.lang.String userId)This method removes a database entity and clean all relationships from another entities.voidremoveUsersByIds(java.util.ArrayList<java.lang.String> userIds)This method removes a list of database entities.java.util.Optional<User>revertPasswordToSaved(java.lang.String userId)This method does revert and save database entity field valuevoidsaveSavedPassword(java.lang.String userId)This method update and save password from database entity (user).java.util.Optional<User>saveUser(User user)This method saves a database entity.java.util.Optional<User>saveUser(java.util.LinkedHashMap<java.lang.String,java.lang.Object> userAsMap)This method saves database entity.java.util.LinkedHashSet<User>searchUsers(java.lang.String requestJson)This method does search requests and returns data as list.java.util.List<User>searchUsers(java.lang.String query, int from, int to)This method does search requests and returns data as list.org.springframework.data.domain.Page<User>searchUsersPaged(java.lang.String requestJson)This method does search requests and returns data as pages.
-
-
-
Field Detail
-
mongoTemplate
@Autowired private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
-
appContext
@Autowired private org.springframework.context.ApplicationContext appContext
-
userRepository
@Autowired private UserRepository userRepository
-
commonProperties
@Autowired private CommonProperties commonProperties
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
storageService
@Autowired private MongoStorageService storageService
-
mapper
private final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
getRepository
public UserRepository getRepository()
- Specified by:
getRepositoryin interfaceUserManagementService
-
getPaginationFilter
public java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>> getPaginationFilter(java.lang.String requestJson)
Description copied from interface:UserManagementServiceThis method does calculation for a pages based on the request.- Specified by:
getPaginationFilterin interfaceUserManagementService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- map-representation of data
-
searchUsers
public java.util.LinkedHashSet<User> searchUsers(java.lang.String requestJson)
Description copied from interface:UserManagementServiceThis method does search requests and returns data as list.- Specified by:
searchUsersin interfaceUserManagementService- Parameters:
requestJson- search request- Returns:
- data transport entities as list
-
searchUsersPaged
public org.springframework.data.domain.Page<User> searchUsersPaged(java.lang.String requestJson)
Description copied from interface:UserManagementServiceThis method does search requests and returns data as pages.- Specified by:
searchUsersPagedin interfaceUserManagementService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- database entities separated to pages
-
getPrincipal
public UserPrincipal getPrincipal()
Description copied from interface:UserManagementServiceThis method returns user principal object from context.- Specified by:
getPrincipalin interfaceUserManagementService- Returns:
- user principal object
-
getLoggedUser
public User getLoggedUser()
Description copied from interface:UserManagementServiceThis method does return database entity which logged in system.- Specified by:
getLoggedUserin interfaceUserManagementService- Returns:
- database entity
-
isSuperUser
public boolean isSuperUser()
Description copied from interface:UserManagementServiceThis method does check is database entity had super status.- Specified by:
isSuperUserin interfaceUserManagementService- Returns:
- value as boolean
-
isLogged
public boolean isLogged()
Description copied from interface:UserManagementServiceThis method does check is database entity logged in system.- Specified by:
isLoggedin interfaceUserManagementService- Returns:
- value as boolean
-
isNotLogged
public boolean isNotLogged()
Description copied from interface:UserManagementServiceThis method does check is not database entity logged in system.- Specified by:
isNotLoggedin interfaceUserManagementService- Returns:
- value as boolean
-
searchUsers
public java.util.List<User> searchUsers(java.lang.String query, int from, int to)
Description copied from interface:UserManagementServiceThis method does search requests and returns data as list.- Specified by:
searchUsersin interfaceUserManagementService- Parameters:
query- search queryfrom- field which filter and returned itemsto- field which filter and returned items- Returns:
- database entities as list
-
createUser
@Transactional public java.util.Optional<User> createUser(java.util.LinkedHashMap<java.lang.String,java.lang.Object> userAsMap)
Description copied from interface:UserManagementServiceThis method creates a database entity.- Specified by:
createUserin interfaceUserManagementService- Parameters:
userAsMap- map-representation of database entity- Returns:
- optional value to externally interaction
-
createUser
public java.util.Optional<User> createUser(User user)
Description copied from interface:UserManagementServiceThis method creates a database entity.- Specified by:
createUserin interfaceUserManagementService- Parameters:
user- database entity- Returns:
- optional value to externally interaction
-
saveUser
@Transactional public java.util.Optional<User> saveUser(java.util.LinkedHashMap<java.lang.String,java.lang.Object> userAsMap)
Description copied from interface:UserManagementServiceThis method saves database entity.- Specified by:
saveUserin interfaceUserManagementService- Parameters:
userAsMap- map-representation of database entity- Returns:
- saved instance of database entity
-
saveUser
@Transactional public java.util.Optional<User> saveUser(User user)
Description copied from interface:UserManagementServiceThis method saves a database entity.- Specified by:
saveUserin interfaceUserManagementService- Parameters:
user- database entity- Returns:
- saved instance of database entity
-
removeUserAndClean
@Transactional public void removeUserAndClean(java.lang.String userId)
Description copied from interface:UserManagementServiceThis method removes a database entity and clean all relationships from another entities.- Specified by:
removeUserAndCleanin interfaceUserManagementService- Parameters:
userId- identification for database entity which will be removed
-
removeUsersByIds
@Transactional public void removeUsersByIds(java.util.ArrayList<java.lang.String> userIds)
Description copied from interface:UserManagementServiceThis method removes a list of database entities.- Specified by:
removeUsersByIdsin interfaceUserManagementService- Parameters:
userIds- the list of database entities which will be removed
-
changePassword
@Transactional public void changePassword(User user, java.lang.String password)
Description copied from interface:UserManagementServiceThis method update and save password from database entity (user).- Specified by:
changePasswordin interfaceUserManagementService- Parameters:
user- the database entity which will be updatedpassword- the database entity field which will be saved
-
revertPasswordToSaved
public java.util.Optional<User> revertPasswordToSaved(java.lang.String userId)
Description copied from interface:UserManagementServiceThis method does revert and save database entity field value- Specified by:
revertPasswordToSavedin interfaceUserManagementService- Parameters:
userId- identification for database entity which will be updated- Returns:
- saved instance of database entity
-
saveSavedPassword
public void saveSavedPassword(java.lang.String userId)
Description copied from interface:UserManagementServiceThis method update and save password from database entity (user).- Specified by:
saveSavedPasswordin interfaceUserManagementService- Parameters:
userId- identification for database entity which will be updated
-
isUserPermissionAll
public boolean isUserPermissionAll()
Description copied from interface:UserManagementServiceThis method does check is database entity had all permissions.- Specified by:
isUserPermissionAllin interfaceUserManagementService- Returns:
- value as boolean
-
isUserPermissionApplication
public boolean isUserPermissionApplication()
Description copied from interface:UserManagementServiceThis method does check is database entity had application permission.- Specified by:
isUserPermissionApplicationin interfaceUserManagementService- Returns:
- value as boolean
-
-