System.out.println(" ---- ERROR ---- QueryParserCommand (xwconn.setTitleRole(titleRole)), title to parse: " + titleRole);
xwconn.restoreTitleRole();
}
if (MyRequest.getParameter("fromId", parameterMap).equals("")) {
FindDocumentCommand findDocumentCommand = null;
try {
findDocumentCommand = new FindDocumentCommand(parameterMap, modelMap);
queryResult = findDocumentCommand.execute(workFlowBean, xwconn);
// mi setto il selid per le operazioni di raffinamento
workFlowBean.getRequest().setAttribute("qrId", queryResult.id);
QueryBean queryBean = new QueryBean();
queryBean.setDb(workFlowBean.getAlias());
System.out.println("findDocumentCommand.getLaFrase() " + findDocumentCommand.getLaFrase());
queryBean.setQuery(findDocumentCommand.getLaFrase());
queryBean.setTot(String.valueOf(queryResult.elements));
if (httpSession.getAttribute(workFlowBean.getQueryBeanName()) == null) {
ArrayList arrQueryBean = new ArrayList();
arrQueryBean.add(queryBean);
httpSession.setAttribute(workFlowBean.getQueryBeanName(), arrQueryBean);
} else {
ArrayList arrQueryBean = (ArrayList) httpSession.getAttribute(workFlowBean.getQueryBeanName());
boolean insert = true;
int indexQr = 0;
for (int i = 0; i < arrQueryBean.size(); i++) {
QueryBean ilBean = (QueryBean) arrQueryBean.get(i);
if (ilBean.getQuery().equals(queryBean.getQuery())) {
insert = false;
arrQueryBean.remove(i);
arrQueryBean.add(queryBean);
break;
}
}
if (insert) {
arrQueryBean.add(queryBean);
httpSession.setAttribute(workFlowBean.getQueryBeanName(), arrQueryBean);
}
}
} catch (Exception e) {
queryResult = new QueryResult();
workFlowBean.getRequest().setAttribute("qrId", queryResult.id);
}
System.out.println("QueryParserCommand.execute() " + findDocumentCommand.getLaFrase());
} else {
queryResult = xwconn.getQRFromSelId(MyRequest.getParameter("qrId", parameterMap));
workFlowBean.getRequest().setAttribute("qrId", queryResult.id);
}