if(search == null || !search.isSet()) {
payload.getStatus().addMsg(search == null ? "No search criteria specified" : "Unset search criteria",
MsgLevel.ERROR, MsgAttr.STATUS.flag);
}
else {
IEntity e = null;
IEntityType et = null;
if(search instanceof PrimaryKeySearch) {
final PrimaryKeySearch pks = (PrimaryKeySearch) search;
e = loadEntityByPrimaryKey(pks, payload.getStatus());
et = pks.getKey().getEntityType();
}
else if(search instanceof BusinessKeySearch) {
final BusinessKeySearch bks = (BusinessKeySearch) search;
e = loadEntityByBusinesKey(bks, payload.getStatus());
et = bks.getEntityType();
}
else if(search instanceof EntityNameSearch) {
final EntityNameSearch ens = (EntityNameSearch) search;
e = loadEntityByName(ens, payload.getStatus());
et = ens.getEntityType();
}
else {
// override
loadImpl(search, payload);
return;
}
if(e != null) {
assert et != null;
try {
final Model m = entityToModel(et, e);
payload.setModel(m);
payload.getStatus().addMsg(e.descriptor() + " loaded.", MsgLevel.INFO, MsgAttr.STATUS.flag);
}
catch(final Exception ex) {
RpcServlet.exceptionToStatus(ex, payload.getStatus());
}
}