categoryValidator = new CategoryValidator(dataObject);
boolean valid = categoryValidator.validateCategory();
if (valid) {
try {
categoryManager = new CategoryManager();
ErrorList errorList = categoryManager.create(dataObject);
for (int i = 0; i < errorList.length(); i++) {
Logger.getLogger(CategoryTester.class.getName()).log(Level.INFO, errorList.getErrorMessage(i));
}
} catch (AppException ex) {
Logger.getLogger(CategoryTester.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
ErrorList errorList = categoryValidator.getErrors();
if (errorList.hasError()) {
for (int i = 0; i < errorList.length(); i++) {
Logger.getLogger(CategoryTester.class.getName()).log(Level.SEVERE, errorList.getErrorMessage(i));
}
}
}
categoryManager = null;