DefaultEquinoxController

The DefaultEquinoxController class is useful to give the base behavior of the Equinox's controllers with the default EquinoxUser class and for a greater clarity during your own implementation:



    
    public SomeCustomController extends EquinoxController<EquinoxUser> {
         // rest of the class
    }

    
    public SomeCustomControllerTwo extends EquinoxController<EquinoxUser> {
         // rest of the class
    }

    // wrap the declaration for a better readability
    
    public SomeCustomController extends DefaultEquinoxController {
         // rest of the class
    }

     // wrap the declaration for a better readability
    
    public SomeCustomControllerTwo extends DefaultEquinoxController {
         // rest of the class
    }

Author

N7ghtm4r3 - Tecknobit

Since

1.0.2

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
configuration the current configuration of the Equinox's backend instance
Link copied to clipboard
protected open var jsonHelper: JsonHelper
jsonHelper helper to work with JSON values
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
@Autowired(required = false)
protected open var messageSource: MessageSource
messageSource the message source used to manage the resources messages bundle
Link copied to clipboard
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"
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_EMAIL_MESSAGE: String = "wrong_email"
WRONG_EMAIL_MESSAGE error message used when the email inserted is not valid
Link copied to clipboard
val WRONG_LANGUAGE_MESSAGE: String = "wrong_language"
WRONG_LANGUAGE_MESSAGE error message used when the language inserted is not valid
Link copied to clipboard
val WRONG_NAME_MESSAGE: String = "wrong_name"
WRONG_NAME_MESSAGE error message used when the name inserted is not valid
Link copied to clipboard
val WRONG_PASSWORD_MESSAGE: String = "wrong_password"
WRONG_PASSWORD_MESSAGE error message used when the password inserted is not valid
Link copied to clipboard
val WRONG_PROCEDURE_MESSAGE: String = "wrong_procedure"
WRONG_PROCEDURE_MESSAGE message to use when the procedure is wrong
Link copied to clipboard
val WRONG_SURNAME_MESSAGE: String = "wrong_surname"
WRONG_SURNAME_MESSAGE error message used when the surname inserted is not valid

Functions

Link copied to clipboard
protected open fun failedResponse(errorKey: String): String
protected open fun failedResponse(errorKey: String, @Nullable args: Array<Any>): String
Method used to get the payload for a failed response
Link copied to clipboard
Method used to generate an identifier of an item
Link copied to clipboard
protected open fun getInternationalizedMessage(messageKey: String): String
protected open fun getInternationalizedMessage(messageKey: String, @Nullable args: Array<Any>): String
Method used to get the international message
Link copied to clipboard
open fun initEquinoxEnvironment(context: Class<out Any>, args: Array<String>)
open fun initEquinoxEnvironment(    storagePath: String,     saveMessage: String,     context: Class<out Any>,     args: Array<String>,     customSubDirectories: Array<String>)
Method used to init the serverProtector and create the resources directories correctly
Link copied to clipboard
protected open fun isMe(id: String, token: String): Boolean
Method used 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>)
protected open fun loadJsonHelper(payload: JSONArray)
protected open fun loadJsonHelper(payload: JSONObject)
Method used to load the jsonHelper
Link copied to clipboard
protected open fun plainResponse(status: ResponseStatus, message: String): String
Method used to assemble the payload for a response
Link copied to clipboard
protected open fun setSessionLocale(locale: String)
protected open fun setSessionLocale(locale: Locale)
Method used to change the current locale of the session
Link copied to clipboard
protected open fun successResponse(): String
protected open fun <V> successResponse(value: V): HashMap<String, V>
protected open fun successResponse(message: String): String
protected open fun successResponse(message: JSONObject): String
protected open fun successResponse(message: String, args: Array<Any>): String
Method used to get the payload for a successful response