Package org.xdams.user.bean

Examples of org.xdams.user.bean.Archive


      userBean.setFatherAccountRef(xmlUsers.valoreNodo("/root/user[@id='" + username + "' and @account='" + account + "']/@fatherAccount"));
      userBean.setPwd(xmlUsers.valoreNodo("/root/user[@id='" + username + "' and @account='" + account + "']/@pwd"));
      userBean.setRole(xmlUsers.valoreNodo("/root/user[@id='" + username + "' and @account='" + account + "']/@role"));
      int countArchiveUser = xmlUsers.contaNodi("/root/user[@id='" + username + "' and @account='" + account + "']/archive");
      for (int i = 0; i < countArchiveUser; i++) {
        Archive archive = new Archive();
        String archAliasUser = xmlUsers.valoreNodo("/root/user[@id='" + username + "' and @account='" + account + "']/archive[" + (i + 1) + "]/@alias");
        String archAlias = xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAliasUser + "']/@alias");
        if (archAlias.equals(archAliasUser)) {
          String archGrp = xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup[child::archive/@alias='" + archAlias + "']/@name");
          archive.setGroupName(archGrp);
          archive.setRole(xmlUsers.valoreNodo("/root/user[@id='" + username + "' and @account='" + account + "']/archive[@alias='" + archAlias + "']/@role"));
          archive.setArchiveDescr(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/text()"));
          archive.setAlias(archAlias);
          archive.setHost(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@host"));
          archive.setIco(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@ico"));
          archive.setPne(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@pne"));
          archive.setPort(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@port"));
          archive.setWebapp(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@webapp"));
          archive.setType(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@type"));
          userBean.putArchives(archAlias, archive);
          userBean.addArchives(archive);
        }
      }
      Account accountBean = new Account();
View Full Code Here


    List<Archive> archives = new ArrayList<Archive>();
    try {
      Pattern patternArchive = Pattern.compile("((?i)<archive\\s*([^>]+)>(.+?)</archive>)", Pattern.DOTALL);
      Matcher matcherArchive = patternArchive.matcher(myUser);
      while (matcherArchive.find()) {
        Archive archive = new Archive();
        String archiveStr = matcherArchive.group(1);
        String archiveAttribute = matcherArchive.group(2).replaceAll("\\s*=\\s*[^\\\"]", "=");
        archive.setAlias(valueAttribute(archiveAttribute, "alias"));
        archive.setRole(valueAttribute(archiveAttribute, "role"));
        // System.out.println("archive: " + archive);
        archives.add(archive);
//        System.out.println("#################################################");
      }
    } catch (Exception e) {
View Full Code Here

           
            // System.out.println("matcherArchiveGroup.group(1): " + matcherArchiveGroup.group(1));
//            System.out.println("archiveGroupStr: " + archiveGroupStr);
            Matcher matcherArchive = patternArchive.matcher(archiveGroupStr);
            while (matcherArchive.find()) {
              Archive archive = new Archive();
             
              String archiveStr = matcherArchive.group(1);
              String archiveAttributeStr = matcherArchive.group(2).replaceAll("\\s*=\\s*[^\\\"]", "=");
              String archiveTextStr = matcherArchive.group(3);
//              System.out.println("archiveTextStr: " + archiveTextStr);
              archive.setGroupName(groupName);
              archive.setAlias(valueAttribute(archiveAttributeStr, "alias"));
              archive.setHost(valueAttribute(archiveAttributeStr, "host"));
              archive.setIco(valueAttribute(archiveAttributeStr, "ico"));
              archive.setArchiveDescr(archiveTextStr);
              archive.setPne(valueAttribute(archiveAttributeStr, "pne"));
              archive.setPort(valueAttribute(archiveAttributeStr, "port"));
              archive.setWebapp(valueAttribute(archiveAttributeStr, "webapp"));
              archive.setType(valueAttribute(archiveAttributeStr, "type"));
              archivesMap.put(archive.getAlias(), archive);
//              System.out.println("archive: " + archive);
             
            }
//            System.out.println("#################################################");
          }
View Full Code Here

      userBean.setRole(valueAttribute(myUserAttribute, "role"));

      for (Archive archive : archiveUserList) {
        String archAlias = archive.getAlias();
        if (archiveAllMap.containsKey(archAlias)) {
          Archive archiveNew = archiveAllMap.get(archAlias);
          archiveNew.setRole(archive.getRole());
          userBean.putArchives(archAlias, archiveNew);
          userBean.addArchives(archiveNew);
        }
      }
      userBean.setAccount(accountBean);
View Full Code Here

          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++;
                            modifyAutherBean.addErrorMsg("Errore in proietta authority per il documento numero " + numDoc + " in  " + descrArchive + " " + e.getMessage());
                            e.printStackTrace();
                          }
                        }
                      }

                    }
                    autherBean.setArchivioAlias(archiveBean.getAlias());
                    autherBean.setArchivioDescr(descrArchive);
                    elementToFindBean.setNumTotXPathToChange(modificatiXPathToChange);
                    autherBean.setElementToFindBean(elementToFindBean);
                    autherBean.setQuery(query);
                    autherBean.setNumElementi(qr.elements);
View Full Code Here

    List<Archive> archives = new ArrayList<Archive>();
    try {

      int countArchiveUser = xmlUsers.contaNodi("/root/user[@id='" + username + "' and @account='" + account + "']/archive");
      for (int i = 0; i < countArchiveUser; i++) {
        Archive archive = new Archive();
        String archAliasUser = xmlUsers.valoreNodo("/root/user[@id='" + username + "' and @account='" + account + "']/archive[" + (i + 1) + "]/@alias");
        String archAlias = xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAliasUser + "']/@alias");
        if (archAlias.equals(archAliasUser)) {
          String archGrp = xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup[child::archive/@alias='" + archAlias + "']/@name");
          archive.setGroupName(archGrp);
          archive.setRole(xmlUsers.valoreNodo("/root/user[@id='" + username + "' and @account='" + account + "']/archive[@alias='" + archAlias + "']/@role"));
          archive.setArchiveDescr(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/text()"));
          archive.setAlias(archAlias);
          archive.setHost(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@host"));
          archive.setIco(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@ico"));
          archive.setPne(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@pne"));
          archive.setPort(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@port"));
          archive.setWebapp(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@webapp"));
          archive.setType(xmlArchives.valoreNodo("/root/account[@id='" + account + "']/archiveGroup/archive[@alias='" + archAlias + "']/@type"));
         
          archives.add(archive);
        }
      }
    } catch (Exception e) {
View Full Code Here

      }
    }
  }

  public static Archive getArchive(UserBean userBean, String alias) throws Exception {
    Archive archive = userBean.getArchivesMap().get(alias);
    if (archive == null) {
      throw new Exception("utente non abilitato sull'archivio o archivio non presente");
    }
    return archive;
  }
View Full Code Here

        // System.out.println("INSERT RECORD archiviBean.getDescrArchivio() " + archiviBean.getDescrArchivio());
        String archivioDaCuiInserisce = "";
        String archivioAbbreviatoDaCuiInserisce = "";

        if (!MyRequest.getParameter("srcArchive", parameterMap).equals("")) {
          Archive srcArchive = ServiceUser.getArchive(userBean, MyRequest.getParameter("srcArchive", parameterMap));
          archivioAbbreviatoDaCuiInserisce = srcArchive.getArchiveDescr();
          archivioDaCuiInserisce = srcArchive.getAlias();
        }

        // gestione di processinfo
        theXML = theXML.replaceAll("@coluiCheInserisce@", nomeCompilatoreCMPN);
        theXML = theXML.replaceAll("@quandoColuiInserisce@", dataCompilatoreCMPN);
View Full Code Here

TOP

Related Classes of org.xdams.user.bean.Archive

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.