protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
String requestStr = request.getParameter("clientrequested");
if (requestStr == null || requestStr.isEmpty()) {
return new ModelAndView("redirect:/operator/request/index.htm");
}
UserRequest userRequest = null;
try {
userRequest = CH.get(getDao(), UserRequest.class, requestStr);
} catch (Exception ex) {
}
if (userRequest == null) {
return new ModelAndView("redirect:/operator/request/index.htm");
}
ClientData data = new ClientData();
data.surname = userRequest.getSurname() != null ? userRequest.getSurname().trim() : "";
data.name = userRequest.getName() != null ? userRequest.getName().trim() : "";
data.patron = userRequest.getPatronymic() != null ? userRequest.getPatronymic().trim() : "";
List<Client> clientList = getDao().findOutClientsByData(data);
List<ClientData> clients = new LinkedList<ClientData>();
for (Client client : clientList) {
ClientData clientData = new ClientData();
clientData.client = client;
Address address = null;
if (client.getAddressID() != null) {
address = getDao().getById(Address.class, client.getAddressID());
}
clientData.address = address != null ? address.getAsStringShort() : "";
clientData.born = Converter.dateToString(client.getBorn());
clients.add(clientData);
}
HashMap model = new HashMap();
ClientRequestedData requestedData = new ClientRequestedData();
requestedData.requested = userRequest;
Address address = userRequest.getAddress();
if (address != null && address.getAddressObject() != null) {
requestedData.address = address.getAsStringShort();
}
model.put("userrequest", requestedData);