HierPath hierPath = xwconn.getHierPath(Integer.parseInt(physDoc));
XMLBuilder theXMLDoc = new XMLBuilder(preInsertBean.getDocXmlSelected(), "ISO-8859-1");
preInsertBean.setXmlBuilderSelected(theXMLDoc);
preInsertBean.setDepthSelected(hierPath.depth());
preInsertBean.setTitleSelected((xwconn.getTitle(xwconn.connection, xwconn.getTheDb(), Integer.parseInt(physDoc))).getTitle());
MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
editingManager.setTheXML(theXMLDoc);
confBean = editingManager.rewriteMultipleConf(confControl);
// System.out.println("PreInsertPageCommand.execute() FINE CARICAMENTO DOCUMENTO SELEZIONATO");
// prendo il documento padre ma controllo che non sono il padre stesso...
String ilPath = "/hierValues";
preInsertBean.setXPathHierValues(ilPath);
// System.out.println("aaaaaaaaaa " + "/" + ilPath + "/macroarea");
int numeroMacroarea = (confBean.getTheXMLConfEditing()).contaNodi("/" + ilPath + "/macroarea");
// System.out.println("numeroMacroarea " + numeroMacroarea);
if (numeroMacroarea > 0) {
int iLivelli = Integer.parseInt((confBean.getTheXMLConfEditing()).valoreNodo("/" + ilPath + "/@level"));
int docFather = Integer.parseInt(physDoc);
if (iLivelli > 0) {
for (int i = 0; i < iLivelli; i++) {
if (xwconn.getNumDocFather(docFather) > 0) {
docFather = xwconn.getNumDocFather(docFather);
}
}
}
// System.out.println("PreInsertPageCommand.execute() INIZIO CARICAMENTO DOCUMENTO PADRE");
preInsertBean.setPhysDocFather(docFather);
docXML = xwconn.getSingleXMLFromNumDoc(preInsertBean.getPhysDocFather());
preInsertBean.setDocXmlFather(docXML);
theXMLDoc = new XMLBuilder(preInsertBean.getDocXmlFather(), "ISO-8859-1");
preInsertBean.setXmlBuilderFather(theXMLDoc);
preInsertBean.setDepthFather(hierPath.depth() - 1);
preInsertBean.setTitleFather((xwconn.getTitle(xwconn.connection, xwconn.getTheDb(), preInsertBean.getPhysDocFather())).getTitle());
// System.out.println("PreInsertPageCommand.execute() FINE CARICAMENTO DOCUMENTO PADRE");
}
// prendo il documento root dell'archivio quello con detph==1
if ((hierPath.depth()) - (hierPath.depth() - 1) == 1) {
// System.out.println("PreInsertPageCommand.execute() INIZIO CARICAMENTO DOCUMENTO ROOT");
preInsertBean.setPhysDocRoot(hierPath.docNumber(1));
docXML = xwconn.getSingleXMLFromNumDoc(preInsertBean.getPhysDocRoot());
preInsertBean.setDocXmlRoot(docXML);
theXMLDoc = new XMLBuilder(preInsertBean.getDocXmlRoot(), "ISO-8859-1");
preInsertBean.setXmlBuilderRoot(theXMLDoc);
preInsertBean.setDepthRoot(1);
preInsertBean.setTitleRoot((xwconn.getTitle(xwconn.connection, xwconn.getTheDb(), preInsertBean.getPhysDocRoot())).getTitle());
// System.out.println("PreInsertPageCommand.execute() FINE CARICAMENTO DOCUMENTO ROOT");
}
} else {
// in caso di nuovo documento senza il phisDoc, come ad esempio un inserimento da lookup
MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
XMLBuilder builder = new XMLBuilder("root");
editingManager.setTheXML(builder);
confBean = editingManager.rewriteMultipleConf(confControl);
preInsertBean.setXmlBuilderSelected(builder);
preInsertBean.setXmlBuilderFather(builder);
}
// TODO DA VALUTARE introdotto per adv-editing
preInsertBean.setXmlBuilderEmpty(new XMLBuilder(workFlowBean.getAlias()));