-
Notifications
You must be signed in to change notification settings - Fork 1
Server Base Templates
Home / Developer / Server Tier / Base Templates
PxStat Application Server Side Base Template definitions, Properties, Methods and Abstract Methods.
The available API classes generally call BSO classes in order to Create, Read,Update, Delete and other functions. Because most of the BSO classes share a great deal of functionality, it is useful to confine these common functions to base classes and allow the individual BSO classes to inherit them. The Base Template class is defined as a Generic in order for it to use a variety of DTO and Validator objects, and the inheriting classes use similar generics in order to inject the DTO and Validator objects.
All of the other Base Template classes inherit this class.
Properties:
- Ado - An instance of the ADO class to enable database interaction.
- Username - The username invoking the API.
- Response - The ADO output.
- Validator - The validator class (injected in the constructor).
- Request - The Request delivered with the API call (injected in the constructor).
- DTO - An object representing the parameters used in the API call.
- cDTO - An object containing metadata for cache operations.
- DTOValidationResult - A FluentValidation validation result.
Methods:
- Constructor - initialize the properties, Create the Trace.
- Dispose - Disposes any objects that need disposing.
- IsModerator - Indicates if the user is a Moderator.
- IsPowerUser - Indicates if the user is a Power User.
- IsAdministrator - Indicates if the user is an Administrator.
- IsApprover - Indicates if the user is an Approver (not implemented).
- HasUserPrivilege - Indicates if the user is an Administrator OR the inheriting class HasPrivilege() function returns true.
Abstract Methods (to be inherited):
- OnExecutionSuccess.
- OnExecutionError.
- HasPrivilege.
Default Methods.
- GetDTO - Returns the DTO.
- OnDTOValidationError.
- OnPrivilegeError.
- OnAuthenticationSuccessful.
- OnAuthenticationFailed.
- OnPrivilegeSuccess.
- HasUserToBeAuthenticated.
- IsUserAuthenticated.
Inherits the Base Template. Inherited by BSO_Read classes.
Methods:
- Constructor - Checks authentication, cleans the parameters, gets the DTO, Sanitizes the DTO, runs validation, creates analytics (if required), reads cache (if required), catches errors and disposes.
Inherits the Base Template. Inherited by BSO_Create classes.
Methods:
- Constructor - Checks authentication, cleans the parameters, gets the DTO, Sanitizes the DTO, runs validation, flushes cache if necessary, manages transaction, catches errors and disposes.
Inherits the Base Template. Inherited by BSO_Update classes.
Methods:
- Constructor - Checks authentication, cleans the parameters, gets the DTO, Sanitizes the DTO, runs validation, flushes cache if necessary, manages transaction, catches errors and disposes.
Inherits the Base Template. Inherited by BSO_Delete classes.
Methods:
- Constructor - Checks authentication, cleans the parameters, gets the DTO, Sanitizes the DTO, runs validation, flushes cache if necessary, manages transaction, catches errors and disposes.