EquinoxUsersService

The EquinoxUsersService class is useful to manage all the user database operations

Author

N7ghtm4r3 - Tecknobit

Since

1.0.1

Parameters

<T>

The type of the EquinoxUser used in the system, is generic to avoid manual casts if it has been customized

<R>

The type of the EquinoxUsersRepository used in the system, is generic to avoid manual casts if it has been customized

See also

Constructors

Link copied to clipboard
constructor()
Constructor to init the EquinoxUsersService controller

Properties

Link copied to clipboard
protected val _DROP_COLUMN_: String = " DROP COLUMN "
_DROP_COLUMN_ query command
Link copied to clipboard
protected val _FROM_: String = " FROM "
_FROM_ query command
Link copied to clipboard
private val _IN_CLAUSE_: String = " IN "
IN_CLAUSE in clause query part
Link copied to clipboard
val _VALUES_: String = " VALUES "
VALUES values query part
Link copied to clipboard
val _WHERE_: String = " WHERE "
WHERE where query part
Link copied to clipboard
protected val ALTER_TABLE_: String = "ALTER TABLE "
ALTER_TABLE_ query command
Link copied to clipboard
protected val BASE_SIGN_UP_QUERY: String = "INSERT INTO users("
BASE_SIGN_UP_QUERY base part of the insertion query
Link copied to clipboard
CLOSED_ROUND_BRACKET closed round bracket character
Link copied to clipboard
val COMMA: String = ","
COMMA comma character
Link copied to clipboard
DEFAULT_DYNAMIC_ACCOUNT_DATA_KEYS the default keys of the values to retrieve with the getDynamicAccountData method
Link copied to clipboard
DEFAULT_USER_SIGN_UP_KEYS the default keys of the values to use in the BASE_SIGN_UP_QUERY
Link copied to clipboard
val DELETE_FROM_: String = "DELETE FROM "
DELETE_FROM_ delete from query command
Link copied to clipboard
protected open var discriminatorValue: String
discriminatorValue value of the discriminator to use to save the users in the related table
Link copied to clipboard
protected open var entityManager: EntityManager
entityManager entity manager helper
Link copied to clipboard
OPENED_ROUND_BRACKET opened round bracket character
Link copied to clipboard
val PROFILES_DIRECTORY: String = "profiles"
PROFILES_DIRECTORY the folder where the profile pics will be saved
Link copied to clipboard
QUESTION_MARK question mark character
Link copied to clipboard
val RESOURCES_KEY: String = "resources"
RESOURCES_KEY the key of the resources folder where the resources will be saved
Link copied to clipboard
val RESOURCES_PATH: String = "resources/"
RESOURCES_PATH the folder where the resources will be saved
Link copied to clipboard
protected val SELECT_: String = "SELECT "
SELECT_ query command
Link copied to clipboard
val SINGLE_QUOTE: String = "'"
SINGLE_QUOTE single quote character
Link copied to clipboard
@Autowired
protected open var usersRepository: R
usersRepository instance for the users repository
Link copied to clipboard
protected val VALUES_QUERY_PART: String = " VALUES ("
VALUES_QUERY_PART values query part

Functions

Link copied to clipboard
private open fun <E> arrangeDynamicDataQuery(queryBuilder: StringBuilder, list: List<E>)
Method used to arrange the dynamic data query to execute by the getDynamicAccountData method
Link copied to clipboard
private open fun <E> arrangeQuery(queryBuilder: StringBuilder, list: List<E>, escape: Boolean)
Method used to arrange the BASE_SIGN_UP_QUERY with dynamic list of values to use in that query
Link copied to clipboard
protected open fun batchDelete(table: String, values: Collection<out Any>, @NotNull columns: Array<@NotNull String>)
Method used to execute a batch delete of a single list of data simultaneously
Link copied to clipboard
protected open fun <V> batchInsert(    command: EquinoxItemsHelper.InsertCommand,     table: String,     batchQuery: EquinoxItemsHelper.BatchQuery<V>)
Method used to execute a batch insert of a list of data simultaneously
Link copied to clipboard
open fun changeEmail(newEmail: String, userId: String)
Method used to change the email of the EquinoxUser
Link copied to clipboard
open fun changeLanguage(newLanguage: String, userId: String)
Method used to change the language of the EquinoxUser
Link copied to clipboard
open fun changePassword(newPassword: String, userId: String)
Method used to change the password of the EquinoxUser
Link copied to clipboard
open fun changeProfilePic(profilePic: MultipartFile, userId: String): String
Method used to change the profile pic of the EquinoxUser
Link copied to clipboard
open fun createProfileResource(resource: MultipartFile, resourceId: String): String
Method used to create the pathname for a profile pic
Link copied to clipboard
open fun createResource(resource: MultipartFile, resourcesDirectory: String, resourceId: String): String
Method used to create the pathname of a resource file
Link copied to clipboard
Method used to delete a profile pic
Link copied to clipboard
open fun deleteResource(resourcesDirectory: String, resourceId: String): Boolean
Method used to delete a resource file
Link copied to clipboard
open fun deleteUser(id: String)
Method used to delete a user
Link copied to clipboard
open fun getDynamicAccountData(userId: String): JSONObject
Method used to get the dynamic data of the user to correctly update in all the devices where the user is connected
Link copied to clipboard
protected open fun getDynamicAccountDataKeys(): List<String>
Method used to get the list of keys to use in the getDynamicAccountData method
Link copied to clipboard
protected open fun getSignUpKeys(): List<String>
Method used to get the list of keys to use in the BASE_SIGN_UP_QUERY
Link copied to clipboard
open fun getSuffixResource(resource: MultipartFile): String
Method used to get the suffix of a resource file
Link copied to clipboard
protected open fun hash(secret: String): String
Method used to hash a sensitive user data
Link copied to clipboard
open fun saveResource(resource: MultipartFile, path: String)
Method used to save a resource file
Link copied to clipboard
open fun signInUser(email: String, password: String, custom: Array<Any>): T
Method used to sign in an existing user
Link copied to clipboard
open fun signUpUser(id: String, token: String, name: String, surname: String, email: String, password: String, language: String, custom: Array<Any>)
Method used to sign up a new user in the system
Link copied to clipboard
protected open fun <V> syncBatch(model: EquinoxItemsHelper.SyncBatchModel, table: String, batchQuery: EquinoxItemsHelper.BatchQuery<V>)
protected open fun <V> syncBatch(    model: EquinoxItemsHelper.SyncBatchModel,     command: EquinoxItemsHelper.InsertCommand,     table: String,     batchQuery: EquinoxItemsHelper.BatchQuery<V>)
Method used to execute a batch synchronization of a list of data simultaneously
Link copied to clipboard
open fun userExists(userId: String): Boolean
Method used to get whether the user is present in the database
Link copied to clipboard
protected open fun validateSignIn(user: T, password: String, custom: Array<Any>): Boolean
Method used to validate the sign in request