if (body == null) {
// When FindRelatedBusinesses objects are embedded in other find calls, null is allowed.
if (nullAllowed)
return;
else
throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
}
if ((body.getBusinessKey() == null || body.getBusinessKey().length() == 0 ) &&
(body.getFromKey() == null || body.getFromKey().length() == 0) &&
(body.getToKey() == null || body.getToKey().length() == 0))
throw new FatalErrorException(new ErrorMessage("errors.findrelatedbusiness.NoInput"));
boolean businessKeyExists = false;
boolean fromKeyExists = false;
if (body.getBusinessKey() != null && body.getBusinessKey().length() > 0) {
businessKeyExists = true;
// Per section 4.4: keys must be case-folded
body.setBusinessKey(body.getBusinessKey().toLowerCase());
}
if (body.getFromKey() != null && body.getFromKey().length() > 0) {
fromKeyExists = true;
if (businessKeyExists)
throw new FatalErrorException(new ErrorMessage("errors.findrelatedbusiness.MultipleInput"));
// Per section 4.4: keys must be case-folded
body.setFromKey(body.getFromKey().toLowerCase());
}
if (body.getToKey() != null && body.getToKey().length() > 0) {
if (businessKeyExists || fromKeyExists)
throw new FatalErrorException(new ErrorMessage("errors.findrelatedbusiness.MultipleInput"));
// Per section 4.4: keys must be case-folded
body.setToKey(body.getToKey().toLowerCase());
}