Package org.xdams.xml.builder

Examples of org.xdams.xml.builder.XMLBuilder


      confBean = (ConfBean) modelMap.get("confBean");
      WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
      httpSession = workFlowBean.getRequest().getSession(false);

      MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
      editingManager.setTheXML(new XMLBuilder("root"));
      confBean = editingManager.rewriteMultipleConf(confControl);

      // mettere queryBean
      System.out.println("QueryParserCommand.execute() workFlowBean.getAlias() " + workFlowBean.getAlias());
      System.out.println("QueryParserCommand.execute() aReq.getParameter(\"fromId\") " + workFlowBean.getRequest().getParameter("fromId") + "aaaaaaa");

      xwconn = connectionManager.getConnection(workFlowBean.getArchive());

      XMLBuilder builder = confBean.getTheXMLConfTitle();
      titleRole = builder.valoreNodo("/root/titleManager/sezione[@name='title']/titleRole/text()", false);
      System.out.println("QueryParserCommand.execute()" + titleRole);
      try {
        if (!titleRole.trim().equals("")) {
          xwconn.setTitleRole(titleRole);
        }
View Full Code Here


      UserBean userBean = (UserBean) modelMap.get("userBean");
      confBean = (ConfBean) modelMap.get("confBean");
      WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
      httpSession = workFlowBean.getRequest().getSession(false);
      xwconn = connectionManager.getConnection(workFlowBean.getArchive());
      XMLBuilder theXMLDoc = null;
      if (!applyTo.equals("fromQuery")) {
        managingBean.setPhysDoc(Integer.parseInt(physDoc));
        String docXML = xwconn.getSingleXMLFromNumDoc(managingBean.getPhysDoc());
        managingBean.setDocXML(docXML);
        theXMLDoc = new XMLBuilder(managingBean.getDocXML(), "ISO-8859-1");
      } else {
        theXMLDoc = new XMLBuilder("root");
      }
      MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
      editingManager.setTheXML(theXMLDoc);
      confBean = editingManager.rewriteMultipleConf(confControl);
      XSLDir = findXSLPath(userBean, workFlowBean);
View Full Code Here

      confBean = (ConfBean) modelMap.get("confBean");
      workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");

      xwconn = connectionManager.getConnection(workFlowBean.getArchive());
      MultiEditingManager editingManager = new MultiEditingManager(req.getParameterMap(), confBean, userBean, workFlowBean);
      editingManager.setTheXML(new XMLBuilder(xwconn.getSingleXMLFromNumDoc(Integer.parseInt(physDoc)), "ISO-8859-1"));
      confBean = editingManager.rewriteMultipleConf(confControl);

      if (MyRequest.getParameter("calcButtons", req.getParameterMap()).equals("true")) {
        calcolaBottoni(xwconn, ajaxBean, physDoc);
        return ajaxBean;
View Full Code Here

      MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
      // prendo i riferimenti al record
      if (!physDoc.equals("") && makeAction.equals("")) {
        xwconn = connectionManager.getConnection(workFlowBean.getArchive());
        managingBean.setPhysDoc(Integer.parseInt(physDoc));
        editingManager.setTheXML(new XMLBuilder(xwconn.getSingleXMLFromNumDoc(managingBean.getPhysDoc()), "ISO-8859-1"));
        confBean = editingManager.rewriteMultipleConf(confControl);
        managingBean.setDocLowerBrother(xwconn.getNumDocNextBrother(managingBean.getPhysDoc()));
        managingBean.setDocUpperBrother(xwconn.getNumDocPreviousBrother(managingBean.getPhysDoc()));

        it.highwaytech.db.QueryResult qrHier = xwconn.getQRFromHier(managingBean.getPhysDoc(), true);
        managingBean.setNumElementiHier(qrHier.elements);

        if (!selid.equals("")) {
          it.highwaytech.db.QueryResult qr = xwconn.getQRFromSelId(selid);
          managingBean.setNumElementi(qr.elements);
        }

        managingBean.setTitle((xwconn.getTitle(xwconn.connection, xwconn.getTheDb(), managingBean.getPhysDoc())).getTitle());
        managingBean.setDispatchView("eraseMenu");
        if (httpSession.getAttribute(workFlowBean.getManagingBeanName()) != null) {
          ArrayList listDocs = ((ManagingBean) httpSession.getAttribute(workFlowBean.getManagingBeanName())).getListPhysDoc();
          if (listDocs != null && listDocs.size() > 0) {
            managingBean.setListPhysDoc(listDocs);
          }
        }

      } else if (!physDoc.equals("") && makeAction.equals("true")) { // DO
        xwconn = connectionManager.getConnection(workFlowBean.getArchive());
        managingBean.setPhysDoc(Integer.parseInt(physDoc));
        editingManager.setTheXML(new XMLBuilder(xwconn.getSingleXMLFromNumDoc(managingBean.getPhysDoc()), "ISO-8859-1"));
        confBean = editingManager.rewriteMultipleConf(confControl);
        ArrayList elementiNum = new ArrayList();
        if (applyTo.equals("selected") || applyTo.equals("prevSibling") || applyTo.equals("nextSibling")) {
          if (applyTo.equals("nextSibling")) {
            int theBrother = managingBean.getPhysDoc();
View Full Code Here

        // System.out.println("PreInsertPageCommand.execute() INIZIO CARICAMENTO DOCUMENTO SELEZIONATO");
        preInsertBean.setPhysDocSelected(Integer.parseInt(physDoc));
        String docXML = xwconn.getSingleXMLFromNumDoc(preInsertBean.getPhysDocSelected());
        preInsertBean.setDocXmlSelected(docXML);
        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()));

      modelMap.put("confBean", confBean);
      modelMap.put("preInsertBean", preInsertBean);

    } catch (Exception e) {
View Full Code Here

          String xmlUsers = ConfManager.getConfString(account + "-security/users.xml");
          String xmlArchives = ConfManager.getConfString(account + "-security/accounts.xml");
          String xmlrole = ConfManager.getConfString(account + "-security/role.xml");
          userBean = LoadUserSpeedUp.loadUserByString(xmlUsers, xmlArchives, xmlrole, username, account);
        } else {
          XMLBuilder xmlUsers = ConfManager.getConfXML(account + "-security/users.xml");
          XMLBuilder xmlArchives = ConfManager.getConfXML(account + "-security/accounts.xml");
          XMLBuilder xmlrole = ConfManager.getConfXML(account + "-security/role.xml");
          userBean = LoadUser.loadUser(xmlUsers, xmlArchives, xmlrole, username, account);
        }

        if (userBean == null)
          throw new UsernameNotFoundException("user not found");
View Full Code Here

      }
      editingBean = new EditingBean();
      editingBean.setPhysDoc(Integer.parseInt(physDoc));
      xwconn = connectionManager.getConnection(workFlowBean.getArchive());
      editingBean.setDocXml(xwconn.getSingleXMLFromNumDoc(editingBean.getPhysDoc()));
      XMLBuilder theXMLDoc = new XMLBuilder(editingBean.getDocXml(), "ISO-8859-1");
      editingBean.setXmlBuilder(theXMLDoc);

      MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
      editingManager.setTheXML(editingBean.getXmlBuilder());
      confBean = editingManager.rewriteMultipleConf(confControl);
View Full Code Here

      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");
          try {
            String dbToFind = entrySet.getKey();
            List<ElementToFindBean> arrElmToFind = hashDbToFind.get(dbToFind);
            // Enumeration elementi = myRequest.getHttpServletRequest().getParameterNames();
            boolean processArch = false;
            System.out.println("ModifyAuther.execute() - SONO IN MODIFICA AUTH 3");
            // while (elementi.hasMoreElements()) {
            for (Entry<String, String[]> entry : parameterMap.entrySet()) {
              String nome = entry.getKey();
              if (nome.indexOf("theArchiveToProcess_") != -1) {
                String tmpArch = MyRequest.getParameter(nome, parameterMap);
                if (tmpArch.indexOf(dbToFind) != -1) {
                  // out.println(theArch+"vado a processare i record <br>");
                  processArch = true;
                  break;
                }
              }
            }

            System.out.println("ModifyAuther.execute() - SONO IN MODIFICA AUTH 3 processArch " + processArch);
            if (processArch) {
              if(userBean.getArchivesMap().get(dbToFind)==null){
                continue;
              }
              Archive archiveBean = userBean.getArchivesMap().get(dbToFind);
              System.out.println("ModifyAuther.execute() - SONO IN MODIFICA AUTH 4 archiviBean " + archiveBean);
              String descrArchive = archiveBean.getArchiveDescr();
              System.out.println("ModifyAuther.execute() - SONO IN MODIFICA AUTH 5 descrArchive " + descrArchive);

              for (int z = 0; z < arrElmToFind.size(); z++) {
                ElementToFindBean elementToFindBean = (ElementToFindBean) arrElmToFind.get(z);
                String strQuery = elementToFindBean.getStrQuery();
                String strPrefix = elementToFindBean.getStrPrefix();
                String strCode = elementToFindBean.getStrCode();
                String xPathToChange = elementToFindBean.getXPathToChange();
                String isTextNode = elementToFindBean.getIsTextNode();

                String query = "(" + strQuery + "=" + codeToFind + ")";
                System.out.println("ModifyAuther.execute() - SONO IN MODIFICA AUTH 6 strQuery " + strQuery);
                System.out.println("ModifyAuther.execute() - SONO IN MODIFICA AUTH su Archivio  " + archiveBean.getAlias());
                QueryResult qr = null;
                XWConnection xwconn = null;
                try {
                  xwconn = connectionManager.getConnection(archiveBean);
                  qr = xwconn.getQRfromPhrase(query);
                  if (qr.elements > 0) {
                    ModifyAutherBean autherBean = new ModifyAutherBean();
                    for (int a = 0; a < qr.elements; a++) {
                      boolean modificato = false;
                      int numDoc = xwconn.getNumDocFromQRElement(qr, a);
                      XMLBuilder builder = new XMLBuilder(xwconn.getSingleXMLFromNumDoc(numDoc), "ISO-8859-1");
                      // out.println("strPrefix "+strPrefix+"<br>");
                      if (elementToFindBean.isAdvEditing()) {
                        MappingAdv mappingAdv = new MappingAdv();
                        List<Element> list = mappingAdv.extractMapping(elementToFindBean.getConfigurationXMLReader().getObjects(), null, new HashMap<String, String>());
                        ArrayList<Element> arrayList = new ArrayList<Element>(list);
                        for (Element element : arrayList) {
                          List<Element> arrayListA = new ArrayList<Element>();
                          arrayListA.add(element);
                          mappingAdv.buildXML(arrayListA, builder, null, null, new GenericInterface<XMLBuilder>() {
                            public void invoke(XMLBuilder builder, Element element) {
                              try {
                                if (!nameToChange.equals(element.getFieldValue())) {
                                  System.out.println(element.getFieldValue());
                                }
                              } catch (Exception e) {
                                e.printStackTrace();
                              }
                            }
                          });
                        }
                        System.out.println("###############################");
                        System.out.println("###############################");
                        System.out.println("###############(elementToFindBean.isAdvEditing()################");
                        System.out.println("###############################");
                        System.out.println("###############################");
                        System.out.println("###############################");

                      } else {
                        int countPrefix = builder.contaNodi(strPrefix);
                        for (int x = 0; x < countPrefix; x++) {
                          String newXPathToChange = strPrefix + "[" + (x + 1) + "]" + xPathToChange.substring(xPathToChange.indexOf(strPrefix) + strPrefix.length());
                          String newXpathCode = "";
                          if (isTextNode.equals("true")) {
                            newXpathCode = newXPathToChange.substring(0, newXPathToChange.lastIndexOf("/") + 1) + strCode;
                          } else {
                            System.out.println("ModifyAuther.execute() CI SONO UN PREFIX strCode.indexOf(strPrefix)!=-1 " + strPrefix.contains(strCode));
                            System.out.println("ModifyAuther.execute() CI SONO UN PREFIX strPrefix " + strPrefix);
                            System.out.println("ModifyAuther.execute() CI SONO UN PREFIX strCode " + strCode);
                            if (strCode.indexOf(strPrefix) != -1) {
                              System.out.println("ModifyAuther.execute() CI SONO UN PREFIX DIDIDIDIDI");
                              newXpathCode = strPrefix + "[" + (x + 1) + "]" + StringUtils.difference(strPrefix, strCode);
                              System.out.println("ModifyAuther.execute() CI SONO UN PREFIX DIDIDIDIDI" + newXpathCode);
                              // newXpathCode = newXPathToChange.substring(0, newXPathToChange.lastIndexOf("/") + 1) + "@" + strCode;
                            } else {
                              if (strCode.indexOf("@") != -1) {
                                newXpathCode = newXPathToChange.substring(0, newXPathToChange.lastIndexOf("/") + 1) + strCode;
                              } else {
                                newXpathCode = newXPathToChange.substring(0, newXPathToChange.lastIndexOf("/") + 1) + "@" + strCode;
                              }

                            }

                          }
                          System.out.println("ModifyAuther.execute() newXpathCode " + newXpathCode);
                          String ilValoreCode = builder.valoreNodo(newXpathCode);
                          System.out.println("ModifyAuther.execute() ilValoreCode " + ilValoreCode);
                          System.out.println("ModifyAuther.execute() newXpathCode " + newXpathCode);
                          System.out.println("ModifyAuther.execute() newXpathCode " + newXpathCode);
                          System.out.println("ModifyAuther.execute() ilValoreCode " + ilValoreCode);
                          String ilValoreText = builder.valoreNodo(newXPathToChange);
                          System.out.println("ModifyAuther.execute() ilValoreText " + ilValoreText);
                          System.out.println("ModifyAuther.execute() ilValoreText " + ilValoreText);
                          System.out.println("ModifyAuther.execute() ilValoreText " + ilValoreText);
                          System.out.println("ModifyAuther.execute() ilValoreText " + ilValoreText);
                          System.out.println("ModifyAuther.execute() ilValoreText " + ilValoreText);

                          if (ilValoreCode.indexOf(codeToFind) != -1 && !ilValoreText.equals(nameToChange)) {
                            modificato = true;
                            builder.insertValueAt(newXPathToChange, nameToChange);
                            modificatiXPathToChange++;
                          }
                        }
                        if (modificato) {
                          // String rootElement = (builder.getDomDocument().getDocumentElement()).getNodeName();
                          // // out.println("rootElement "+rootElement+"<br>");
                          // if (rootElement.equals("c")) {
                          // int numProcessInfo = builder.contaNodi("/" + rootElement + "/processinfo/list/item");
                          // numProcessInfo++;
                          // builder.insertValueAt("/" + rootElement + "/processinfo/list/item[" + numProcessInfo + "]/persname/text()", myRequest.getParameter(".persona"));
                          // builder.insertValueAt("/" + rootElement + "/processinfo/list/item[" + numProcessInfo + "]/text()", myRequest.getParameter(".action"));
                          // builder.insertValueAt("/" + rootElement + "/processinfo/list/item[" + numProcessInfo + "]/date/text()", myRequest.getParameter(".data"));
                          // } else {
                          // int numProcessInfo = builder.contaNodi("/" + rootElement + "/eacheader/mainhistory/mainevent");
                          // numProcessInfo++;
                          // builder.insertValueAt("/" + rootElement + "/eacheader/mainhistory/mainevent[" + numProcessInfo + "]/name/text()", myRequest.getParameter(".persona"));
                          // builder.insertValueAt("/" + rootElement + "/eacheader/mainhistory/mainevent[" + numProcessInfo + "]/@maintype", myRequest.getParameter(".action"));
                          // builder.insertValueAt("/" + rootElement + "/eacheader/mainhistory/mainevent[" + numProcessInfo + "]/maindate/text()", myRequest.getParameter(".data"));
                          // }

                          modificatiTotali++;
                          String docXML = builder.getXML("ISO-8859-1");
                          docXML = XMLCleaner.clearXwXML(docXML, true);
                          try {
                            xwconn.executeUpdateByDocNumber(docXML, numDoc);
                          } catch (Exception e) {
                            erroriTotali++;
View Full Code Here

        managingBean = (ManagingBean) httpSession.getAttribute(workFlowBean.getManagingBeanName());
      }

      xwconn = connectionManager.getConnection(workFlowBean.getArchive());
      MultiEditingManager editingManager = new MultiEditingManager(req.getParameterMap(), confBean, userBean, workFlowBean);
      editingManager.setTheXML(new XMLBuilder(xwconn.getSingleXMLFromNumDoc(Integer.parseInt(physDoc)), "ISO-8859-1"));
      confBean = editingManager.rewriteMultipleConf(confControl);

      if (actionType.equals("cut") || actionType.equals("paste") || actionType.equals("no_rel") || actionType.equals("only_hier")) {
        TitleManager titleManager = new TitleManager(confBean.getTheXMLConfTitle());
      //  System.out.println("AjaxCutPasteCopyCommand.execute() getTheXMLConfTitle " + confBean.getTheXMLConfTitle().getXML("ISO-8859-1"));
        try {
          managingBean.setCutPhysDoc(Integer.parseInt(physDoc));
          String titoloDoc = xwconn.getTitleFromNumDoc(Integer.parseInt(physDoc));
          System.out.println("AjaxCutPasteCopyCommand.execute() titoloDoc " + titoloDoc);
          managingBean.setCutTitle(titoloDoc);
        } catch (Exception e) {
          e.printStackTrace();
        }
        String azioneDescr = "";
        if (actionType.equals("cut")) {
          azioneDescr = "tagliato";
        } else if (actionType.equals("paste")) {
          azioneDescr = "copiato";
        } else if (actionType.equals("no_rel")) {
          azioneDescr = "copiato";
        } else if (actionType.equals("only_hier")) {
          azioneDescr = "copiato";
        }

        String contenitoreIni = "\n<div class=\"cont_ul2\"><ul class=\"bottoniMenu\">";
        String string0 = "";
        String string1 = "";
        String string2 = "";
        if (!actionType.equals("no_rel")) {
          string0 = "<li><a href=\"#\" target=\"\" onclick=\"ajaxSetSessionDocsToCut('" + managingBean.getCutPhysDoc() + "','@@physDocToPaste@@','" + actionType + "_as_son','" + workFlowBean.getAlias() + "');\" >INC.FIGLIO</a></li>";
          string1 = "<li><a href=\"#\" target=\"\" onclick=\"ajaxSetSessionDocsToCut('" + managingBean.getCutPhysDoc() + "','@@physDocToPaste@@','" + actionType + "_as_before','" + workFlowBean.getAlias() + "');\" >INC.PRIMA</a></li>";
          string2 = "<li><a href=\"#\" target=\"\" onclick=\"ajaxSetSessionDocsToCut('" + managingBean.getCutPhysDoc() + "','@@physDocToPaste@@','" + actionType + "_as_after','" + workFlowBean.getAlias() + "');\" >INC.DOPO</a></li>";
        }

        String string3 = "";
        // if(actionType.equals("paste") || actionType.equals("no_rel")){
        if (actionType.equals("no_rel")) {
          actionType = "paste";
          string3 = "<li><a href=\"#\" target=\"\" onclick=\"ajaxSetSessionDocsToCut('" + managingBean.getCutPhysDoc() + "','@@physDocToPaste@@','" + actionType + "_as_norel','" + workFlowBean.getAlias() + "');\" >NO REL</a></li>";
        }

        String string4 = "<li><a href=\"#\" target=\"\" onclick=\"ajaxSetSessionDocsToCut('" + managingBean.getCutPhysDoc() + "','@@physDocToPaste@@','" + actionType + "_delete','" + workFlowBean.getAlias() + "');\" >ANNULLA</a></li>";
        String contenitoreEnd = "</ul></div><div class=\"cutPasteClazz\">elemento " + azioneDescr + " " + (titleManager.defaultParsedTitle(managingBean.getCutTitle(), "hierTitle")) + "</div>";
        String string = contenitoreIni + string0 + string1 + string2 + string3 + string4 + contenitoreEnd;
        ajaxBean.setStrXmlOutput(string);
        managingBean.setCutHtmlOutput(string);
        // managingBean.setCutHtmlOutput(managingBean.getCutHtmlOutput(String.valueOf(managingBean.getCutPhysDoc())));
      }

      boolean cutTest = true;
      boolean pasteTest = true;
      try {
        if (actionType.startsWith("cut_as")) {
          HierPath hierPath = xwconn.getHierPath(Integer.parseInt(physDocToPaste));
          int numeroLivelli = hierPath.depth();
          for (int i = 1; i < numeroLivelli; i++) {
            int theFatherTemp = hierPath.docNumber(i);
            if (theFatherTemp == Integer.parseInt(physDoc) || Integer.parseInt(physDoc) == Integer.parseInt(physDocToPaste)) {
              cutTest = false;
              break;
            }
          }
        }
      } catch (Exception e) {
        cutTest = false;
      }

      if (!cutTest) {
        ajaxBean.setStrXmlOutput("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<error>" + StringEscapeUtils.escapeXml("Attenzione:\nNon e possibile effettuare l'operazione richiesta") + "</error>");
      }

      if (actionType.equals("cut_as_son")) {
        // elemento da tagliare physDoc
        if (cutTest) {
          xwconn.cut_paste(Integer.parseInt(physDoc), Integer.parseInt(physDocToPaste), it.highwaytech.broker.ServerCommand.navigarel_FIGLIOPADRE);
          ajaxBean.setStrXmlOutput("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<succes>reloadLocation()</succes>");
        }
        // elemento in cui spostare il documento tagliato physDocToPaste
      } else if (actionType.equals("cut_as_before")) {
        // elemento da tagliare physDoc
        if (cutTest) {
          xwconn.cut_paste(Integer.parseInt(physDoc), Integer.parseInt(physDocToPaste), it.highwaytech.broker.ServerCommand.navigarel_MINOREMAGGIORE);
          ajaxBean.setStrXmlOutput("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<succes>reloadLocation()</succes>");
        }
        // elemento in cui spostare il documento tagliato physDocToPaste
      } else if (actionType.equals("cut_as_after")) {
        // elemento da tagliare physDoc
        if (cutTest) {
          xwconn.cut_paste(Integer.parseInt(physDoc), Integer.parseInt(physDocToPaste), it.highwaytech.broker.ServerCommand.navigarel_MAGGIOREMINORE);
          ajaxBean.setStrXmlOutput("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<succes>reloadLocation()</succes>");
        }
        // elemento in cui spostare il documento tagliato physDocToPaste
      } else if (actionType.equals("cut_delete")) {
        managingBean.setCutTitle("");
        managingBean.setCutHtmlOutput("<div id=\"scriviQui\"></div>");
        ajaxBean.setStrXmlOutput("<div id=\"scriviQui\"></div>");
        managingBean.setCutPhysDoc(-1);
      } else if (actionType.equals("paste_as_son")) {
        // elemento da tagliare physDoc
        String xmlDoc = xwconn.getSingleXMLFromNumDoc(Integer.parseInt(physDoc));
        String newXML = XMLCopy.xmlCopy(confBean.getTheXMLConfEditing(), new XMLBuilder(xmlDoc, "ISO-8859-1"), userBean);
        int recordNum = xwconn.insert(newXML);
        int toPaste = -1;
        try {
          toPaste = Integer.parseInt(physDocToPaste);
        } catch (Exception e) {
          toPaste = Integer.parseInt(physDoc);
        }
        System.out.println("AjaxCutPasteCopyCommand.execute() " + newXML);
        int esitoAzione = xwconn.docRelInsert(xwconn.connection, xwconn.getTheDb(), it.highwaytech.broker.ServerCommand.navigarel_FIGLIOPADRE, recordNum, toPaste);
        ajaxBean.setStrXmlOutput("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<succes>reloadLocation()</succes>");
        // elemento in cui spostare il documento tagliato physDocToPaste
      } else if (actionType.equals("paste_as_before")) {
        // elemento da tagliare physDoc
        String xmlDoc = xwconn.getSingleXMLFromNumDoc(Integer.parseInt(physDoc));
        String newXML = XMLCopy.xmlCopy(confBean.getTheXMLConfEditing(), new XMLBuilder(xmlDoc, "ISO-8859-1"), userBean);
        int recordNum = xwconn.insert(newXML);
        int toPaste = -1;
        try {
          toPaste = Integer.parseInt(physDocToPaste);
        } catch (Exception e) {
          toPaste = Integer.parseInt(physDoc);
        }
        int esitoAzione = xwconn.docRelInsert(xwconn.connection, xwconn.getTheDb(), it.highwaytech.broker.ServerCommand.navigarel_MINOREMAGGIORE, recordNum, toPaste);
        ajaxBean.setStrXmlOutput("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<succes>reloadLocation()</succes>");
        // elemento in cui spostare il documento tagliato physDocToPaste
      } else if (actionType.equals("paste_as_after")) {
        // elemento da tagliare physDoc
        String xmlDoc = xwconn.getSingleXMLFromNumDoc(Integer.parseInt(physDoc));
        String newXML = XMLCopy.xmlCopy(confBean.getTheXMLConfEditing(), new XMLBuilder(xmlDoc, "ISO-8859-1"), userBean);
        int recordNum = xwconn.insert(newXML);
        int toPaste = -1;
        try {
          toPaste = Integer.parseInt(physDocToPaste);
        } catch (Exception e) {
          toPaste = Integer.parseInt(physDoc);
        }
        System.out.println("AjaxCutPasteCopyCommand.execute() " + newXML);
        int esitoAzione = xwconn.docRelInsert(xwconn.connection, xwconn.getTheDb(), it.highwaytech.broker.ServerCommand.navigarel_MAGGIOREMINORE, recordNum, toPaste);
        ajaxBean.setStrXmlOutput("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<succes>reloadLocation()</succes>");
        // elemento in cui spostare il documento tagliato physDocToPaste
      } else if (actionType.equals("paste_as_norel")) {
        // elemento da tagliare physDoc
        String xmlDoc = xwconn.getSingleXMLFromNumDoc(Integer.parseInt(physDoc));
        String newXML = XMLCopy.xmlCopy(confBean.getTheXMLConfEditing(), new XMLBuilder(xmlDoc, "ISO-8859-1"), userBean);
        int recordNum = xwconn.insert(newXML);
        /*
         * int toPaste = -1; try { toPaste = Integer.parseInt(physDocToPaste); } catch (Exception e) { toPaste = Integer.parseInt(physDoc); } System.out.println("AjaxCutPasteCopyCommand.execute() " + newXML); int esitoAzione = xwconn.docRelInsert(xwconn.connection, xwconn.getTheDb(),
         * it.highwaytech.broker.ServerCommand.navigarel_MAGGIOREMINORE, recordNum, toPaste);
         */
 
View Full Code Here

      UserBean userBean = (UserBean) modelMap.get("userBean");
      confBean = (ConfBean) modelMap.get("confBean");
      WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
      treeBean = new TreeBean();
      MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
      editingManager.setTheXML(new XMLBuilder("root"));
      confBean = editingManager.rewriteMultipleConf(confControl);
      xwconn = connectionManager.getConnection(workFlowBean.getArchive());
      if (MyRequest.getParameter("docStart", parameterMap) != null && !MyRequest.getParameter("docStart", parameterMap).equals("")) {
        treeBean.setDocStart(Integer.parseInt(MyRequest.getParameter("docStart", parameterMap)));
        String docXML = xwconn.getSingleXMLFromNumDoc(treeBean.getDocStart());
        editingManager.setTheXML(new XMLBuilder(docXML, "ISO-8859-1"));
        confBean = editingManager.rewriteMultipleConf(confControl);
      } else {
        confBean = editingManager.rewriteMultipleConf(confControl);
      }
      if (modelMap.get("pageName") != null && modelMap.get("pageName").equals("tree")) {
        System.out.println("HierBrowserPageCommand.execute()");
        XMLBuilder builder = confBean.getTheXMLConfTitle();
        titleRole = builder.valoreNodo("/root/titleManager/sezione[@name='hierBrowser']/titleRole/text()", false);
        System.out.println("HierBrowserPageCommand.execute()" + titleRole);
        try {
          if (!titleRole.trim().equals("")) {
            xwconn.setTitleRole(titleRole);
          }
View Full Code Here

TOP

Related Classes of org.xdams.xml.builder.XMLBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.