Equinox Controller

@RestController
@RequestMapping(value = "/api/v1/" )
abstract class EquinoxController<T : EquinoxUser?, R : EquinoxUsersRepository<T>?, H : EquinoxUsersHelper<T, R>?>

The EquinoxController class is useful to give the base behavior of the Equinox's controllers

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

<H>

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

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
protected open var jsonHelper: JsonHelper
jsonHelper helper to work with JSON values
Link copied to clipboard
protected val mantis: Mantis
mantis the translations manager
Link copied to clipboard
protected open var me: T
me user representing the user who made a request on the server
Link copied to clipboard
val NOT_AUTHORIZED_OR_WRONG_DETAILS_MESSAGE: String = "not_authorized_key"
NOT_AUTHORIZED_OR_WRONG_DETAILS_MESSAGE message to use when the request is by a not authorized user or tried to fetch wrong details
Link copied to clipboard
resourcesProvider the resources provider and manager
Link copied to clipboard
val RESPONSE_SUCCESSFUL_MESSAGE: String = "operation_executed_successfully_key"
RESPONSE_SUCCESSFUL_MESSAGE message to use when the request has been successful
Link copied to clipboard
protected open var serverProtector: ServerProtector
protector the instance to launch the server protector to manage the server accesses
Link copied to clipboard
@Autowired(required = false )
protected open var usersRepository: R
usersRepository instance for the user repository
Link copied to clipboard
val WRONG_PROCEDURE_MESSAGE: String = "wrong_procedure_key"
WRONG_PROCEDURE_MESSAGE message to use when the procedure is wrong

Functions

Link copied to clipboard
@PostConstruct
private open fun checkEnvironmentStatus()
Method to check if the status of the environment has been set up correctly based on the use or not of the usersRepository No-any params required
Link copied to clipboard
protected open fun failedResponse(error: String): String
Method to get the payload for a failed response
Link copied to clipboard
Method to generate an identifier of an item No-any params required
Link copied to clipboard
open fun initEquinoxEnvironment(storagePath: String, saveMessage: String, context: Class<out Any>, args: Array<String>, customSubDirectories: Array<String>)
Method to init the serverProtector and create the resources directories correctly
Link copied to clipboard
protected open fun isMe(id: String, token: String): Boolean
Method to check whether the user who made a request is an authorized user If the user is authorized the me instance is loaded
Link copied to clipboard
protected open fun loadJsonHelper(payload: String)
protected open fun <V> loadJsonHelper(payload: Map<String, V>)
Method to load the jsonHelper
Link copied to clipboard
private open fun plainResponse(responseCode: SocketManager.StandardResponseCode, message: String): String
Method to assemble the payload for a response
Link copied to clipboard
private open fun setBasicResourcesConfiguration(context: Class<out Any>, customSubDirectories: Array<String>)
Method to configure the resources folders required by the Equinox's environment and the beans classes to correctly serve the static resources and set the CORS policy
Link copied to clipboard
protected open fun successResponse(): String
Method to get the payload for a successful response No-any params required
protected open fun <V> successResponse(value: V): HashMap<String, V>
protected open fun successResponse(message: JSONObject): String
Method to get the payload for a successful response