String customName = lng.generateName(o);
if (validateField(fieldName, customName)) {
return customName;
}
else {
throw new MisoNamingException("Custom naming generator '"+lng.getGeneratorName()+"' supplied for entity field '"+fieldName+"' generated an invalid name according to the validation scheme '"+validationMap.get(fieldName)+"'");
}
}
else {
if (DefaultMisoEntityPrefix.get(o.getClass().getSimpleName()) == null) {
for (Class<?> i : LimsUtils.getAllInterfaces(o.getClass())) {
if (DefaultMisoEntityPrefix.get(i.getSimpleName()) != null) {
log.info("Generating name based on interface :: " + DefaultMisoEntityPrefix.get(i.getSimpleName()).name() + o.getId());
return DefaultMisoEntityPrefix.get(i.getSimpleName()).name() + o.getId();
}
}
throw new MisoNamingException("Cannot generate a MISO name from an object of type: " + o.getClass().getSimpleName());
}
log.info("Generating name :: " + DefaultMisoEntityPrefix.get(o.getClass().getSimpleName()).name() + o.getId());
return DefaultMisoEntityPrefix.get(o.getClass().getSimpleName()).name() + o.getId();
}
}