Class ValidatorsRestController
- java.lang.Object
-
- org.neotropic.kuwaiba.northbound.rest.aem.ValidatorsRestController
-
- All Implemented Interfaces:
ValidatorsRestOpenApi
@RestController @RequestMapping("/v2.1.1/configuration-validators/") public class ValidatorsRestController extends Object implements ValidatorsRestOpenApi
The definition of the Validator Rest Controller.- Author:
- Mauricio Ruiz Beltrán <mauricio.ruiz@kuwaiba.org>
-
-
Constructor Summary
Constructors Constructor Description ValidatorsRestController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
createValidatorDefinition(String name, String description, String className, String script, boolean enabled, String userName, String sessionId)
Creates a validator definition.void
deleteValidatorDefinition(long id, String userName, String sessionId)
Deletes a validator definition.List<ValidatorDefinition>
getAllValidatorDefinitions(String sessionId)
Gets all validator definitions, no matter what class they are related to.List<ValidatorDefinition>
getValidatorDefinitionsForClass(String className, String sessionId)
Retrieves all the validator definitions in the system.List<Validator>
runValidationsForObject(String className, long id, String sessionId)
Runs the existing validations for the class associated to the given object.void
updateValidatorDefinition(long id, String name, String description, String className, String script, boolean enabled, String userName, String sessionId)
Updates the properties of a validator.
-
-
-
Field Detail
-
PATH
public static final String PATH
Path that includes the Kuwaiba version and the module id- See Also:
- Constant Field Values
-
-
Method Detail
-
createValidatorDefinition
@RequestMapping(method=POST, value="createValidatorDefinition/{name}/{description}/{className}/{script}/{enabled}/{userName}/{sessionId}", produces="application/json") public long createValidatorDefinition(@PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("className") String className, @PathVariable("script") String script, @PathVariable("enabled") boolean enabled, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Creates a validator definition.- Specified by:
createValidatorDefinition
in interfaceValidatorsRestOpenApi
- Parameters:
name
- The name of the validator. It's recommended to use camel case notation (for example thisIsAName). This field is mandatorydescription
- The optional description of the validator.className
- The class or super class of the classes whose instances will be checked against this validator.script
- The groovy script containing the logic of the validator , that is, the.enabled
- If this validador should be applied or not.userName
- The session token user name.sessionId
- The session token id.- Returns:
- The id of the newly created validator definition.
-
updateValidatorDefinition
@RequestMapping(method=PUT, value="updateValidatorDefinition/{id}/{name}/{description}/{className}/{script}/{enabled}/{userName}/{sessionId}", produces="application/json") public void updateValidatorDefinition(@PathVariable("id") long id, @PathVariable("name") String name, @PathVariable("description") String description, @PathVariable("className") String className, @PathVariable("script") String script, @PathVariable("enabled") boolean enabled, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Updates the properties of a validator. The null values will be ignored.- Specified by:
updateValidatorDefinition
in interfaceValidatorsRestOpenApi
- Parameters:
id
- The id of teh validator definition to be updated.name
- The new name, if any, null otherwise.description
- The new description, if any, null otherwise.className
- The new class to be associated to this validator, if any, null otherwise.script
- The new script, if any, null otherwise.enabled
- If the validator should be enabled or not, if any, null otherwise.userName
- The session token user name.sessionId
- The session token id.
-
getValidatorDefinitionsForClass
@RequestMapping(method=GET, value="getValidatorDefinitionsForClass/{className}/{sessionId}", produces="application/json") public List<ValidatorDefinition> getValidatorDefinitionsForClass(@PathVariable("className") String className, @PathVariable("sessionId") String sessionId)
Retrieves all the validator definitions in the system.- Specified by:
getValidatorDefinitionsForClass
in interfaceValidatorsRestOpenApi
- Parameters:
className
- The class to retrieve the validator definitions from.sessionId
- The session token id.- Returns:
- The list of validator definitions.
-
getAllValidatorDefinitions
@RequestMapping(method=GET, value="getAllValidatorDefinitions/{sessionId}", produces="application/json") public List<ValidatorDefinition> getAllValidatorDefinitions(@PathVariable("sessionId") String sessionId)
Gets all validator definitions, no matter what class they are related to.- Specified by:
getAllValidatorDefinitions
in interfaceValidatorsRestOpenApi
- Parameters:
sessionId
- The session token id.- Returns:
- The list of validators.
-
runValidationsForObject
@RequestMapping(method=POST, value="runValidationsForObject/{className}/{id}/{sessionId}", produces="application/json") public List<Validator> runValidationsForObject(@PathVariable("className") String className, @PathVariable("id") long id, @PathVariable("sessionId") String sessionId)
Runs the existing validations for the class associated to the given object. Validators set to enabled = false will be ignored.- Specified by:
runValidationsForObject
in interfaceValidatorsRestOpenApi
- Parameters:
className
- The class of the object.id
- The id of the object.sessionId
- The session token id.- Returns:
- The list of validators associated to the object and its class.
-
deleteValidatorDefinition
@RequestMapping(method=DELETE, value="deleteValidatorDefinition/{id}/{userName}/{sessionId}", produces="application/json") public void deleteValidatorDefinition(@PathVariable("id") long id, @PathVariable("userName") String userName, @PathVariable("sessionId") String sessionId)
Deletes a validator definition.- Specified by:
deleteValidatorDefinition
in interfaceValidatorsRestOpenApi
- Parameters:
id
- The id of the validator to be deleted.userName
- The session token user name.sessionId
- The session token id.
-
-