productValidator = new ProductValidator(dataObject);
boolean valid = productValidator.validateProduct();
if (valid) {
try {
productManager = new ProductManager();
ErrorList errorList = productManager.create(dataObject);
for (int i = 0; i < errorList.length(); i++) {
Logger.getLogger(ProductTester.class.getName()).log(Level.INFO, errorList.getErrorMessage(i));
}
} catch (AppException ex) {
Logger.getLogger(ProductTester.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
ErrorList errorList = productValidator.getErrors();
if (errorList.hasError()) {
for (int i = 0; i < errorList.length(); i++) {
Logger.getLogger(ProductTester.class.getName()).log(Level.SEVERE, errorList.getErrorMessage(i));
}
}
}
productManager = null;