public void execute() throws Exception, SQLException {
XWConnection xwconn = null;
List<String> titleList = new ArrayList<String>();
ConnectionManager connectionManager = new ConnectionManager();
WorkFlowBean workFlowBean = null;
Titles titlesPage = new Titles();
LookupBean lookupBean = null;
try {
workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
lookupBean = (LookupBean) modelMap.get("lookupBean");
xwconn = connectionManager.getConnection(workFlowBean.getArchiveLookup());
QueryResult qr = null;
String startPage = "";
String keyCountQuery = MyRequest.getParameter("inputPerPage", "10", parameterMap);
System.out.println("keyCountQuery keyCountQuery " + keyCountQuery);
System.out.println("ENTRATO QUI " + (String) modelMap.get("selId"));
System.out.println("ENTRATO selId " + MyRequest.getParameter("selId", parameterMap));
if (!(MyRequest.getParameter("selId", parameterMap).trim()).equals("")) {
qr = xwconn.getQRFromSelId(MyRequest.getParameter("selId", parameterMap));
System.out.println("Lookup.execute()1111" + qr);
} else {
// System.out.println("ENTRATO QUA " + getQrSelId());
qr = find(xwconn, "singoloTermine", keyCountQuery, lookupBean);
System.out.println("Lookup.execute()2222" + qr);
}
System.out.println("Lookup.execute() " + qr);
if (!MyRequest.getParameter("flagXML", parameterMap).equals("true")) {
if (!lookupBean.getInputTitleRule().trim().equals("")) {
xwconn.setTitleRule(xwconn.connection, workFlowBean.getArchiveLookup().getAlias(), lookupBean.getInputTitleRule());
}
System.out.println("Lookup.execute()333333" + qr);
int totElements = qr.elements;
// setQrSelId(qr.id);
// System.out.println("PIPPETTO " + qr.elements + " FINE");
if (!MyRequest.getParameter("startPage", parameterMap).equals("")) {
startPage = MyRequest.getParameter("startPage", parameterMap);
}
if (startPage.equals("")) {
titlesPage.setPages(Integer.parseInt(keyCountQuery), totElements);
} else {
titlesPage.setPages(Integer.parseInt(keyCountQuery), totElements, Integer.parseInt(startPage));
}
int ilPrimo = titlesPage.getFirstElement() - 1;
for (int x = 0; x < Integer.parseInt(keyCountQuery); x++) {
if (x + ilPrimo < totElements) {
Title titolo = xwconn.getTitle(xwconn.connection, workFlowBean.getArchiveLookup().getAlias(), qr, x + ilPrimo);
System.out.println(titolo.getTitle());
titleList.add(titolo.getTitle());
}
}
System.out.println("Lookup.execute()44444" + qr);
modelMap.put("selId", qr.id);
System.out.println("Lookup.execute()6666666" + qr);
} else if (MyRequest.getParameter("flagXML", parameterMap).equals("true")) {
lookupBean.setInputTitleRule("");
int totElements = qr.elements;
// setQrSelId(qr.id);
System.out.println("PIPPETTO " + qr.elements + " FINE");
if (!MyRequest.getParameter("startPage", parameterMap).equals("")) {
startPage = MyRequest.getParameter("startPage", parameterMap);
}
if (startPage.equals("")) {
titlesPage.setPages(Integer.parseInt(keyCountQuery), totElements);
} else {
titlesPage.setPages(Integer.parseInt(keyCountQuery), totElements, Integer.parseInt(startPage));
}
int ilPrimo = titlesPage.getFirstElement() - 1;
StringBuffer buffer = new StringBuffer();
for (int x = 0; x < Integer.parseInt(keyCountQuery); x++) {
if (x + ilPrimo < totElements) {
int numDoc = xwconn.getNumDocFromQRElement(qr, x + ilPrimo);
String strXml = xwconn.getSingleXMLFromQr(qr, x + ilPrimo, false);