Skip to content

Instantly share code, notes, and snippets.

@ksiwonia
Created February 20, 2013 09:40
Show Gist options
  • Save ksiwonia/4994306 to your computer and use it in GitHub Desktop.
Save ksiwonia/4994306 to your computer and use it in GitHub Desktop.
public boolean clearEanOnCopy(final DataDefinition dataDefinition, final Entity product) {
if (product == null) {
return true;
}
product.setField(EAN, null);
return true;
}
public boolean checkIfEanValueIsNumerical(final DataDefinition productDD, final Entity product) {
String eanCode = product.getStringField(EAN);
if (StringUtils.isNumeric(eanCode) || eanCode == null) {
return true;
} else {
product.addError(productDD.getField(EAN), "basic.product.ean.onlyNumericValue");
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment