@Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { for (AtlasClassificationType superType : superTypes) { ret = superType.validateValue(obj, objName, messages) && ret; } ret = super.validateValue(obj, objName, messages) && ret; } return ret; }
@Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { for (AtlasClassificationType superType : superTypes) { ret = superType.validateValue(obj, objName, messages) && ret; } ret = validateTimeBoundaries(obj, messages) && ret; ret = super.validateValue(obj, objName, messages) && ret; } return ret; }
@Test public void testClassificationTypeValidateValue() { List<String> messages = new ArrayList<>(); for (Object value : validValues) { assertTrue(classificationType.validateValue(value, "testObj", messages)); assertEquals(messages.size(), 0, "value=" + value); } for (Object value : invalidValues) { assertFalse(classificationType.validateValue(value, "testObj", messages)); assertTrue(messages.size() > 0, "value=" + value); messages.clear(); } }
private void validateAndNormalize(AtlasClassification classification) throws AtlasBaseException { AtlasClassificationType type = typeRegistry.getClassificationTypeByName(classification.getTypeName()); if (type == null) { throw new AtlasBaseException(AtlasErrorCode.CLASSIFICATION_NOT_FOUND, classification.getTypeName()); } List<String> messages = new ArrayList<>(); type.validateValue(classification, classification.getTypeName(), messages); if (!messages.isEmpty()) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, messages); } type.getNormalizedValue(classification); }
private void validateAndNormalize(AtlasClassification classification) throws AtlasBaseException { AtlasClassificationType type = typeRegistry.getClassificationTypeByName(classification.getTypeName()); if (type == null) { throw new AtlasBaseException(AtlasErrorCode.CLASSIFICATION_NOT_FOUND, classification.getTypeName()); } List<String> messages = new ArrayList<>(); type.validateValue(classification, classification.getTypeName(), messages); if (!messages.isEmpty()) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, messages); } type.getNormalizedValue(classification); }