public void logDebug() { getErrors().forEach(LOGGER::debug); }
public void logWarns() { getErrors().forEach(LOGGER::warn); }
public void logTrace() { getErrors().forEach(LOGGER::trace); }
public void logErrors() { getErrors().forEach(LOGGER::error); }
public void logInfo() { getErrors().forEach(LOGGER::info); }
@JsonIgnore public String getErrorString() { return "Validation errors: " + System.lineSeparator() + StringUtils.join(getErrors(), System.lineSeparator()); }
public void add(final ValidationResult validationResult, final String errorMessage) { if (!validationResult.isValid()) { isValid = false; if (null == errors) { errors = new LinkedHashSet<>(validationResult.getErrors()); } else { errors.addAll(validationResult.getErrors()); } if (null != errorMessage) { errors.add(errorMessage); } } }
@Override public void validateGraph(final Store store, final String graphId, final Schema schema, final StoreProperties storeProperties, final List<String> parentSchemaIds, final String parentStorePropertiesId, final Pair<Schema, StoreProperties> existingGraphPair) { ValidationResult result = super.validate(store, graphId, schema, storeProperties, parentSchemaIds, parentStorePropertiesId, existingGraphPair, new ValidationResult()); Set<String> errors = result.getErrors(); result.getErrors().removeIf(s -> s.equals(String.format(CANT_BOTH_BE_NULL, SCHEMA_STRING, PARENT_SCHEMA_IDS)) || s.equals(String.format(CANT_BOTH_BE_NULL, STORE_PROPERTIES_STRING, PARENT_STORE_PROPERTIES_ID))); result = new ValidationResult(); for (final String error : errors) { result.addError(error); } if (graphId.equals(store.getGraphId())) { result.addError(String.format(CANNOT_EXPORT_TO_THE_SAME_GRAPH_S, graphId)); } if (!result.isValid()) { throw new IllegalArgumentException(result.getErrorString()); } }
ValidationResult result = super.validate(store, graphId, schema, storeProperties, parentSchemaIds, parentStorePropertiesId, existingGraphPair, new ValidationResult()); Set<String> errors = result.getErrors(); result.getErrors().removeIf(s -> s.equals(String.format(S_CANNOT_BE_USED_WITHOUT_A_GRAPH_LIBRARY, PARENT_SCHEMA_IDS)) || s.equals(String.format(GRAPH_ID_S_CANNOT_BE_CREATED_WITHOUT_DEFINED_KNOWN_S, graphId, SCHEMA_STRING)) || s.equals(String.format(GRAPH_ID_S_CANNOT_BE_CREATED_WITHOUT_DEFINED_KNOWN_S, graphId, STORE_PROPERTIES_STRING)));