Equinox Users Helper

The EquinoxUsersHelper 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 EquinoxUsersHelper controller No-any params required

Properties

Link copied to clipboard
protected val _DROP_COLUMN_: String = " DROP COLUMN "
_DROP_COLUMN_ 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_USER_VALUES_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
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> arrangeQuery(queryBuilder: StringBuilder, list: List<E>, escape: Boolean)
Method 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: List<List<out Any>>, columns: Array<String>)
Method to execute a batch delete of a list of data simultaneously
Link copied to clipboard
protected open fun batchInsert(command: EquinoxItemsHelper.InsertCommand, table: String, values: List<out Any>, batchQuery: EquinoxItemsHelper.BatchQuery, columns: Array<String>)
Method to execute a batch insert of a list of data simultaneously
Link copied to clipboard
open fun changeEmail(newEmail: String, userId: String)
Method to change the email of the EquinoxUser
Link copied to clipboard
open fun changeLanguage(newLanguage: String, userId: String)
Method to change the language of the EquinoxUser
Link copied to clipboard
open fun changePassword(newPassword: String, userId: String)
Method to change the password of the EquinoxUser
Link copied to clipboard
open fun changeProfilePic(profilePic: MultipartFile, userId: String): String
Method to change the profile pic of the EquinoxUser
Link copied to clipboard
open fun createProfileResource(resource: MultipartFile, resourceId: String): String
Method to create the pathname for a profile pic
Link copied to clipboard
open fun createResource(resource: MultipartFile, resourcesDirectory: String, resourceId: String): String
Method to create the pathname of a resource file
Link copied to clipboard
Method to delete a profile pic
Link copied to clipboard
open fun deleteResource(resourcesDirectory: String, resourceId: String): Boolean
Method to delete a resource file
Link copied to clipboard
open fun deleteUser(id: String)
Method to delete a user
Link copied to clipboard
protected open fun getQueryValuesKeys(): List<String>
Method to get the list of keys to use in the BASE_SIGN_UP_QUERY No-any params required
Link copied to clipboard
open fun getSuffixResource(resource: MultipartFile): String
Method to get the suffix of a resource file
Link copied to clipboard
protected open fun hash(secret: String): String
Method to hash a sensitive user data
Link copied to clipboard
open fun saveResource(resource: MultipartFile, path: String)
Method to save a resource file
Link copied to clipboard
open fun signInUser(email: String, password: String, custom: Array<Any>): T
Method 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 to sign up a new user in the system
Link copied to clipboard
protected open fun <V> syncBatch(container: EquinoxItemsHelper.SyncBatchContainer, table: String, targetId: String, updatedData: List<V>, batchQuery: EquinoxItemsHelper.BatchQuery)
Method to execute a batch synchronization of a list of data simultaneously
Link copied to clipboard
protected open fun validateSignIn(user: T, password: String, custom: Array<Any>): Boolean
Method to validate the sign in request