public class SchemaValidationUtils extends Object
Modifier | Constructor and Description |
---|---|
|
SchemaValidationUtils()
Constructor with a default schema filename
|
protected |
SchemaValidationUtils(String schema)
Constructor with a specified schema filename
|
|
SchemaValidationUtils(String schema,
boolean external)
Constructor with a specified schema filename or an external json schema as a string
|
Modifier and Type | Method and Description |
---|---|
List<String> |
extractFieldsFromSchema(String schemaJsonAsString)
Get fields list declared in schema
|
SchemaValidationStatus |
validateInsertOrUpdateUnit(com.fasterxml.jackson.databind.JsonNode archiveUnit)
Validate a json for insert or update with a schema
|
protected SchemaValidationStatus |
validateJson(com.fasterxml.jackson.databind.JsonNode jsonNode)
Validate a json with a schema
|
SchemaValidationStatus |
validateJson(com.fasterxml.jackson.databind.JsonNode jsonNode,
String collectionName)
Validate the json against the schema of the specified collectionName
|
SchemaValidationStatus |
validateUnit(com.fasterxml.jackson.databind.JsonNode archiveUnit)
Validate a json with the schema archive-unit-schema
|
void |
verifyAndReplaceFields(com.fasterxml.jackson.databind.JsonNode node,
Map<String,OntologyModel> ontologyModelMap,
List<String> errors)
Verify and replace fields.
|
public static final String ARCHIVE_UNIT_SCHEMA_FILENAME
public static final String ACCESS_CONTRACT_SCHEMA_FILENAME
public static final String ACCESSION_REGISTER_DETAIL_SCHEMA_FILENAME
public static final String ACCESSION_REGISTER_SUMMARY_SCHEMA_FILENAME
public static final String AGENCIES_SCHEMA_FILENAME
public static final String ARCHIVE_UNIT_PROFILE_SCHEMA_FILENAME
public static final String CONTEXT_SCHEMA_FILENAME
public static final String FILE_FORMAT_SCHEMA_FILENAME
public static final String FILE_RULES_SCHEMA_FILENAME
public static final String INGEST_CONTRACT_SCHEMA_FILENAME
public static final String PROFILE_SCHEMA_FILENAME
public static final String SECURITY_PROFILE_SCHEMA_FILENAME
public static final String TAG_SCHEMA_VALIDATION
public static final String TAG_ONTOLOGY_FIELDS
public static final String ONTOLOGY_SCHEMA_FILENAME
public SchemaValidationUtils() throws FileNotFoundException, com.github.fge.jsonschema.core.exceptions.ProcessingException, InvalidParseOperationException
FileNotFoundException
com.github.fge.jsonschema.core.exceptions.ProcessingException
InvalidParseOperationException
protected SchemaValidationUtils(String schema) throws FileNotFoundException, com.github.fge.jsonschema.core.exceptions.ProcessingException, InvalidParseOperationException
schema
- schemaFilename or external json schema as a stringFileNotFoundException
com.github.fge.jsonschema.core.exceptions.ProcessingException
InvalidParseOperationException
public SchemaValidationUtils(String schema, boolean external) throws FileNotFoundException, com.github.fge.jsonschema.core.exceptions.ProcessingException, InvalidParseOperationException
schema
- schemaFilename or external json schema as a stringexternal
- true if the schema is provided as a stringFileNotFoundException
com.github.fge.jsonschema.core.exceptions.ProcessingException
InvalidParseOperationException
public SchemaValidationStatus validateJson(com.fasterxml.jackson.databind.JsonNode jsonNode, String collectionName) throws FileNotFoundException, InvalidParseOperationException, com.github.fge.jsonschema.core.exceptions.ProcessingException
jsonNode
- collectionName
- SchemaValidationStatus
)FileNotFoundException
- if no schema has been found fot the specified collectionnameInvalidParseOperationException
com.github.fge.jsonschema.core.exceptions.ProcessingException
protected SchemaValidationStatus validateJson(com.fasterxml.jackson.databind.JsonNode jsonNode)
jsonNode
- the json to be validatedSchemaValidationStatus
)public SchemaValidationStatus validateUnit(com.fasterxml.jackson.databind.JsonNode archiveUnit)
archiveUnit
- the json to be validatedSchemaValidationStatus
)public SchemaValidationStatus validateInsertOrUpdateUnit(com.fasterxml.jackson.databind.JsonNode archiveUnit)
archiveUnit
- the json to be validatedSchemaValidationStatus
)public List<String> extractFieldsFromSchema(String schemaJsonAsString) throws InvalidParseOperationException
schemaJsonAsString
- InvalidParseOperationException
public void verifyAndReplaceFields(com.fasterxml.jackson.databind.JsonNode node, Map<String,OntologyModel> ontologyModelMap, List<String> errors)
node
- to modifyontologyModelMap
- where are ontologieserrors
- of replacementCopyright © 2018 Vitam. All rights reserved.