String jspDispatchMenu = MyRequest.getParameter("jspDispatchMenu", "updateAutherMenu", parameterMap);
String jspDispatchResult = MyRequest.getParameter("jspDispatchResult", "updateAutherResult", parameterMap);
final String nameToChange = MyRequest.getParameter("nameToChange", parameterMap);
ConnectionManager connectionManager = new ConnectionManager();
BuildElementToFindBean buildElementToFindBean = new BuildElementToFindBean();
ConfBean confBean = null;
ModifyAutherBean modifyAutherBean = new ModifyAutherBean();
WorkFlowBean workFlowBean = null;
// questa lista pu� essere presa da un file di configurazione
List<String> confControl = new ArrayList<String>();
confControl.add("titleManager");
confControl.add("docEdit");
try {
UserBean userBean = (UserBean) modelMap.get("userBean");
confBean = (ConfBean) modelMap.get("confBean");
workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
XWConnection xwconnone = connectionManager.getConnection(workFlowBean.getArchive());
MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
editingManager.setTheXML(new XMLBuilder(xwconnone.getSingleXMLFromNumDoc(Integer.parseInt(physDoc)), "ISO-8859-1"));
confBean = editingManager.rewriteMultipleConf(confControl);
connectionManager.closeConnection(xwconnone);
XMLBuilder theXMLconf = confBean.getTheXMLConfEditing();
if (!codeToFind.equals("") && makeAction.equals("")) {
Map<String, List<ElementToFindBean>> hashDbToFind = buildElementToFindBean.buildElementToFindBean(theXMLconf, workFlowBean.getAlias());
System.out.println("ModifyAuther.execute() (hashDbToFind) " + (hashDbToFind));
int contaArchProc = 0;
String archivioCorrente = "";
QueryResult qr = null;
for (Entry<String, List<ElementToFindBean>> entrySet : hashDbToFind.entrySet()) {
String dbToFind = entrySet.getKey();
List<ElementToFindBean> arrElmToFind = hashDbToFind.get(dbToFind);
archivioCorrente = dbToFind;
if(userBean.getArchivesMap().get(dbToFind)==null){
continue;
}
Archive archiveBean = userBean.getArchivesMap().get(dbToFind);
String descrArchive = archiveBean.getArchiveDescr();
List<String> listCtrlModAuther = new ArrayList<String>();
if (!archiveBean.getAlias().equals("")) {
for (int a = 0; a < arrElmToFind.size(); a++) {
ModifyAutherBean autherBean = new ModifyAutherBean();
ElementToFindBean elementToFindBean = (ElementToFindBean) arrElmToFind.get(a);
System.out.println("ModifyAuther.execute() elementToFindBean.getStrQuery()" + elementToFindBean.getStrQuery() + "AAAA");
if (elementToFindBean.getStrQuery() != null && !elementToFindBean.getStrQuery().equals("null")) {
String query = "(" + elementToFindBean.getStrQuery() + "=" + codeToFind + ")";
System.out.println("query " + query + "<br>");
System.out.println("archivioCorrente " + archivioCorrente + "<br>");
XWConnection xwconn = null;
try {
xwconn = connectionManager.getConnection(archiveBean);
qr = xwconn.getQRfromPhrase(query);
System.out.println("ModifyAuther.execute() qr " + qr.elements);
} catch (Exception e) {
// throw new Exception("ERRORE NELLA CONNESSIONE CON IL DATABASE " + archiviBean.getTheArch());
} finally {
connectionManager.closeConnection(xwconn);
}
// System.out.println("<span style=\"background:#fff;\"><b>" + archivioCorrente + "</b>" + query + " occorrenze=" + qr.elements + "</span><br>");
autherBean.setArchivioAlias(archivioCorrente);
autherBean.setArchivioDescr(descrArchive);
autherBean.setElementToFindBean(elementToFindBean);
autherBean.setQuery(query);
autherBean.setNumElementi(qr.elements);
// escludere per ArchivioAlias e query
if (!listCtrlModAuther.contains(archivioCorrente + query)) {
modifyAutherBean.addArrModifyAutherBean(autherBean);
listCtrlModAuther.add(archivioCorrente + query);
}
}
}
}
}
modifyAutherBean.setDispatchView(jspDispatchMenu);
} else if (!codeToFind.equals("") && makeAction.equals("true")) {
System.out.println("ModifyAuther.execute() - SONO IN MODIFICA AUTH 1");
Map<String, List<ElementToFindBean>> hashDbToFind = buildElementToFindBean.buildElementToFindBean(theXMLconf, workFlowBean.getAlias());
int modificatiTotali = 0;
int erroriTotali = 0;
int modificatiXPathToChange = 0;
for (Entry<String, List<ElementToFindBean>> entrySet : hashDbToFind.entrySet()) {
System.out.println("ModifyAuther.execute() - SONO IN MODIFICA AUTH 2");