Class ProfileManagementServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.ProfileManagementServiceImpl
-
- All Implemented Interfaces:
ProfileManagementService
@Service public class ProfileManagementServiceImpl extends java.lang.Object implements ProfileManagementService
-
-
Field Summary
Fields Modifier and Type Field Description private org.springframework.context.ApplicationContext
appContext
private com.fasterxml.jackson.databind.ObjectMapper
mapper
private org.springframework.data.mongodb.core.MongoTemplate
mongoTemplate
private ProfileRepository
profileRepository
private SequenceGeneratorService
sequenceGenerator
private MongoStorageService
storageService
private UserManagementService
userManagementService
-
Constructor Summary
Constructors Constructor Description ProfileManagementServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Optional<Profile>
createProfile(Profile profile)
This method creates a database entity.java.util.Optional<Profile>
createProfile(java.util.LinkedHashMap<java.lang.String,java.lang.Object> profileAsMap)
This method creates a database entity.void
deactivateProfile(java.lang.String profileId)
This method updates database entity.java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
getGenders()
This method retrieves a map, which can be processed in a templates.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.ProfileRepository
getRepository()
boolean
isProfileBelongsToLoggedUser(java.lang.String profileId)
Checks if the provided profile ID belongs to the logged-in user.void
removeProfileAndClean(java.lang.String profileId)
This method removes a database entity and clean all relationships from another entities.void
removeProfilesByIds(java.util.ArrayList<java.lang.String> profilesIds)
This method removes a list of database entities.java.util.Optional<Profile>
saveProfile(Profile profile)
This method saves a database entity.java.util.Optional<Profile>
saveProfile(java.util.LinkedHashMap<java.lang.String,java.lang.Object> profileAsMap)
This method saves database entity.java.util.LinkedHashSet<Profile>
searchProfiles(java.lang.String requestJson)
This method does search requests and returns data as list.java.util.List<Profile>
searchProfiles(java.lang.String query, int from, int to)
Deprecated.org.springframework.data.domain.Page<Profile>
searchProfilesPaged(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
-
storageService
@Autowired private MongoStorageService storageService
-
appContext
@Autowired private org.springframework.context.ApplicationContext appContext
-
profileRepository
@Autowired private ProfileRepository profileRepository
-
userManagementService
@Autowired private UserManagementService userManagementService
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
mapper
private final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
getRepository
public ProfileRepository getRepository()
- Specified by:
getRepository
in interfaceProfileManagementService
-
getPaginationFilter
public java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>> getPaginationFilter(java.lang.String requestJson)
Description copied from interface:ProfileManagementService
This method does calculation for a pages based on the request.- Specified by:
getPaginationFilter
in interfaceProfileManagementService
- Parameters:
requestJson
- JSON-object of request contains an instructions for search queries- Returns:
- map-representation of data
-
searchProfiles
public java.util.LinkedHashSet<Profile> searchProfiles(java.lang.String requestJson)
Description copied from interface:ProfileManagementService
This method does search requests and returns data as list.- Specified by:
searchProfiles
in interfaceProfileManagementService
- Parameters:
requestJson
- search request- Returns:
- data transport entities as list
-
searchProfilesPaged
public org.springframework.data.domain.Page<Profile> searchProfilesPaged(java.lang.String requestJson)
Description copied from interface:ProfileManagementService
This method does search requests and returns data as pages.- Specified by:
searchProfilesPaged
in interfaceProfileManagementService
- Parameters:
requestJson
- JSON-object of request contains an instructions for search queries- Returns:
- database entities separated to pages
-
searchProfiles
@Deprecated public java.util.List<Profile> searchProfiles(java.lang.String query, int from, int to)
Deprecated.Description copied from interface:ProfileManagementService
This method does search requests and returns data as list.- Specified by:
searchProfiles
in interfaceProfileManagementService
- Parameters:
query
- search queryfrom
- field which filter and returned itemsto
- field which filter and returned items- Returns:
- database entities as list
-
createProfile
@Transactional public java.util.Optional<Profile> createProfile(java.util.LinkedHashMap<java.lang.String,java.lang.Object> profileAsMap)
Description copied from interface:ProfileManagementService
This method creates a database entity.- Specified by:
createProfile
in interfaceProfileManagementService
- Parameters:
profileAsMap
- map-representation of database entity- Returns:
- optional value to externally interaction
-
createProfile
@Transactional public java.util.Optional<Profile> createProfile(Profile profile)
Description copied from interface:ProfileManagementService
This method creates a database entity.- Specified by:
createProfile
in interfaceProfileManagementService
- Parameters:
profile
- database entity- Returns:
- optional value to externally interaction
-
saveProfile
@Transactional public java.util.Optional<Profile> saveProfile(java.util.LinkedHashMap<java.lang.String,java.lang.Object> profileAsMap)
Description copied from interface:ProfileManagementService
This method saves database entity.- Specified by:
saveProfile
in interfaceProfileManagementService
- Parameters:
profileAsMap
- map-representation of database entity- Returns:
- saved instance of database entity
-
saveProfile
@Transactional public java.util.Optional<Profile> saveProfile(Profile profile)
Description copied from interface:ProfileManagementService
This method saves a database entity.- Specified by:
saveProfile
in interfaceProfileManagementService
- Parameters:
profile
- database entity- Returns:
- saved instance of database entity
-
removeProfileAndClean
@Transactional public void removeProfileAndClean(java.lang.String profileId)
Description copied from interface:ProfileManagementService
This method removes a database entity and clean all relationships from another entities.- Specified by:
removeProfileAndClean
in interfaceProfileManagementService
- Parameters:
profileId
- identification for database entity which will be removed
-
removeProfilesByIds
@Transactional public void removeProfilesByIds(java.util.ArrayList<java.lang.String> profilesIds)
Description copied from interface:ProfileManagementService
This method removes a list of database entities.- Specified by:
removeProfilesByIds
in interfaceProfileManagementService
- Parameters:
profilesIds
- the list of database entities which will be removed
-
getGenders
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getGenders()
Description copied from interface:ProfileManagementService
This method retrieves a map, which can be processed in a templates.- Specified by:
getGenders
in interfaceProfileManagementService
- Returns:
- map-representation of data
-
deactivateProfile
public void deactivateProfile(java.lang.String profileId)
Description copied from interface:ProfileManagementService
This method updates database entity.- Specified by:
deactivateProfile
in interfaceProfileManagementService
- Parameters:
profileId
- identification for database entity which will be find and deactivate their profiles
-
isProfileBelongsToLoggedUser
public boolean isProfileBelongsToLoggedUser(java.lang.String profileId)
Description copied from interface:ProfileManagementService
Checks if the provided profile ID belongs to the logged-in user.- Specified by:
isProfileBelongsToLoggedUser
in interfaceProfileManagementService
- Parameters:
profileId
- The ID of the profile to be checked.- Returns:
true
if the profile ID belongs to the logged-in user,false
otherwise.
-
-