public class ProfileValidationUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static Set<String> |
SYSTEM_GENERATED_FIELD_NAMES |
| Modifier and Type | Method and Description |
|---|---|
static void |
validate(String profileSection,
Map<String,ProfileFieldRule> requiredFields,
Map<String,String> fields)
Validates the
fields against a set of requiredFields and their constrained values. |
static void |
validate(String profileSection,
Map<String,ProfileFieldRule> requiredFields,
Path tag)
Validates a
tag file against a set of requiredFields and their constrained values. |
static String |
validateManifest(Set<gov.loc.repository.bagit.domain.Manifest> manifests,
Set<String> required,
Set<String> allowed,
String type)
Validate that a
manifests found in a Bag are allowed according to
both the required and allowed sets from a BagProfile. |
static void |
validateTagIsAllowed(Path tag,
Set<String> allowedTags)
Check if a given tag file is part of the allowed tags.
|
protected static final Set<String> SYSTEM_GENERATED_FIELD_NAMES
public static void validate(String profileSection, Map<String,ProfileFieldRule> requiredFields, Path tag) throws ProfileValidationException, IOException
tag file against a set of requiredFields and their constrained values.profileSection - describes the section of the profile that is being validated.requiredFields - the required fields and associated ruletag - the path to the info file to readIOException - when the tag file cannot be readProfileValidationException - when the fields do not pass muster. The exception message contains a
description of all validation errors found.public static void validate(String profileSection, Map<String,ProfileFieldRule> requiredFields, Map<String,String> fields) throws ProfileValidationException
fields against a set of requiredFields and their constrained values. This is
intended to be used in conjunction with BagConfig and will filter on certain fields defined by the
SYSTEM_GENERATED_FIELD_NAMES constant.profileSection - describes the section of the profile that is being validated.requiredFields - the required fields and associated rulefields - the key value pairs to be validatedProfileValidationException - when the fields do not pass muster. The exception message contains a
description of all validation errors found.public static String validateManifest(Set<gov.loc.repository.bagit.domain.Manifest> manifests, Set<String> required, Set<String> allowed, String type)
manifests found in a Bag are allowed according to
both the required and allowed sets from a BagProfile.manifests - the manifests found in a Bagrequired - the set of required manifest algorithmsallowed - the set of allowed manifest algorithmstype - the type of manifest being processed, normally 'tag' or 'payload'manifestspublic static void validateTagIsAllowed(Path tag, Set<String> allowedTags) throws ProfileValidationException
tag - the tag file to checkallowedTags - the list of allowed tag files, with unix style globbing allowedProfileValidationException - when a tag file is not in the set of allowed tag filenamesCopyright © 2020. All rights reserved.