Package org.xdams.xml.builder

Examples of org.xdams.xml.builder.XMLBuilder


    try {
      return getInstance().getConfigurationXML(fullPath);
    } catch (Exception e) {
      System.err.println("file non trovato " + fullPath);
      try {
        return new XMLBuilder("root");
      } catch (XMLException e1) {
        return null;
      }
      // if (e instanceof RuntimeException)
      // throw (RuntimeException) e;
View Full Code Here


    String realPath = this.getClass().getClassLoader().getResource(fullPath).getPath();
    // System.out.println("loading "+realPath);
    if (realPath.indexOf("%20") != -1) {
      realPath = realPath.replaceAll("%20", " ");
    }
    XMLBuilder builder = null;

    if (presentInCache(realPath, XMLBuilder.class)) {
      builder = (XMLBuilder) (getResource(realPath, XMLBuilder.class).confResource);
    } else {
      builder = new XMLBuilder(loadString(realPath), false);
      Resource res = new Resource(builder, realPath, lastModified(realPath));
      setResource(realPath, res);
    }

    return builder;
View Full Code Here

  private XMLBuilder getConfigurationXML(String fullPath, ServletContext servletContext) throws FileNotFoundException, IOException, XMLException {
    String realPath = getRealPath(fullPath, servletContext);
    if (realPath.indexOf("%20") != -1) {
      realPath = realPath.replaceAll("%20", " ");
    }
    XMLBuilder builder = null;

    if (presentInCache(realPath, XMLBuilder.class)) {
      builder = (XMLBuilder) (getResource(realPath, XMLBuilder.class).confResource);
    } else {
      builder = new XMLBuilder(loadString(realPath), false);
      Resource res = new Resource(builder, realPath, lastModified(realPath));
      setResource(realPath, res);
    }

    return builder;
View Full Code Here

      UserBean userBean = (UserBean) modelMap.get("userBean");
      confBean = (ConfBean) modelMap.get("confBean");
      WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
      xwconn = connectionManager.getConnection(workFlowBean.getArchive());
      MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
      editingManager.setTheXML(new XMLBuilder(xwconn.getSingleXMLFromNumDoc(Integer.parseInt(physDoc)), "ISO-8859-1"));
      confBean = editingManager.rewriteMultipleConf(confControl);
      LoadUploadBean.loadUploadBean(uploadBean, confBean.getTheXMLConfUpload(), modelMap);
      System.out.println(uploadBean);
      // da prendere dentro workflowBean
      String archiveName = workFlowBean.getAlias();
View Full Code Here

      if (!(myRequest.getParameter("thePne")).equals("")) {
        thePne = myRequest.getParameter("thePne");
      }
      String[] nomiRequest = MyRequest.ordinaRequest(request, "." + thePne + ".");
      xwconn = connectionManager.getConnection(workFlowBean.getArchive());
      XMLBuilder builder = new XMLBuilder(thePne);
      for (int i = 0; i < nomiRequest.length; i++) {
        boolean isCDATA = false;
        String ilNome = nomiRequest[i].replace('.', '/');
        String ilValore = (request.getParameter(nomiRequest[i])).trim();
        if (ilNome.endsWith("/@cdata")) {
          ilNome = StringUtils.chomp(ilNome, "/@cdata");
          isCDATA = true;
        }
        if (!ilValore.equals("")) {
          if (isCDATA) {
            builder.insertNode(ilNome, ilValore, true);
          } else {
            builder.insertNode(ilNome, ilValore);
          }
        }
      }
      String theXML = builder.getXML("ISO-8859-1", false);
//      System.out.println(theXML);
      xwconn.executeUpdateByDocNumber(XMLCleaner.clearXwXML(theXML, false), Integer.parseInt(request.getParameter("physDoc")));
    } catch (Throwable e) {
      e.printStackTrace();
      throw new Exception(e.toString());
View Full Code Here

      UserBean userBean = (UserBean) modelMap.get("userBean");
      confBean = (ConfBean) modelMap.get("confBean");
      WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
      xwconn = connectionManager.getConnection(workFlowBean.getArchive());
      MultiEditingManager editingManager = new MultiEditingManager(parameterMap, confBean, userBean, workFlowBean);
      editingManager.setTheXML(new XMLBuilder(xwconn.getSingleXMLFromNumDoc(Integer.parseInt(physDoc)), "ISO-8859-1"));
      confBean = editingManager.rewriteMultipleConf(confControl);
      LoadUploadBean.loadUploadBean(uploadBean, confBean.getTheXMLConfUpload(), modelMap);
       if (!pathToView.equals("")) {
        File file = new File(pathToView);
        File[] files = file.listFiles();
View Full Code Here

    try {
      ConfBean confBean = (ConfBean) pageContext.findAttribute("confBean");
      UserBean userBean = (UserBean) pageContext.findAttribute("userBean");
      JspWriter out = pageContext.getOut();
      // media.conf.xml
      XMLBuilder theXMLConfMedia = confBean.getTheXMLConfMedia();
      MediaBean mediaBean = new MediaBean();
      //System.out.println("AttachmentViewer.doStartTag() "+getMediaBuilder().getXML("ISO-8859-1"));
      //System.out.println("AttachmentViewer.doStartTag() "+theXMLConfMedia.getXML("ISO-8859-1"));
      mediaBean.setPhysDoc(getPhysDoc());
      mediaBean.setClipBoardType(getMediaBuilder().valoreNodo("/elemento/@clipBoardType"));
View Full Code Here

    List<String> confControl = customPageBean.getConfControl();
    try {
      MultiEditingManager editingManager = new MultiEditingManager(request.getParameterMap(), confBean, userBean, workFlowBean);
      if (customPageBean.getPhysDoc() != null && !customPageBean.getPhysDoc().equals("")) {
        xwconn = connectionManager.getConnection(workFlowBean.getArchive());
        customPageBean.setXmlBuilder(new XMLBuilder(XMLCleaner.clearXwXML(xwconn.getSingleXMLFromNumDoc(Integer.parseInt(customPageBean.getPhysDoc())), true), "ISO-8859-1"));
        editingManager.setTheXML(customPageBean.getXmlBuilder());
      } else {
        editingManager.setTheXML(new XMLBuilder("root"));
      }

      confBean = editingManager.rewriteMultipleConf(confControl);
    } catch (Exception e) {
      throw e;
View Full Code Here

        editingManager.setTheXML(editingBean.getXmlBuilder());
      } else if (viewBean != null) {
        editingManager.setTheXML(viewBean.getXmlBuilder());
      }

      XMLBuilder builderManaging = null;
      if (getConfFile().equals("bar-vis")) {
        List<String> confControl = new ArrayList<String>();
        confControl.add(getConfFile());
        confBean = editingManager.rewriteMultipleConf(confControl);
        builderManaging = confBean.getTheXMLConfBarVis();
      } else if (getConfFile().equals("bar-query")) {
        List<String> confControl = new ArrayList<String>();
        confControl.add(getConfFile());
        confBean = editingManager.rewriteMultipleConf(confControl);
        builderManaging = confBean.getTheXMLConfBarQuery();
      } else if (getConfFile().equals("bar-preinsert")) {
        List<String> confControl = new ArrayList<String>();
        confControl.add(getConfFile());
        confBean = editingManager.rewriteMultipleConf(confControl);
        builderManaging = confBean.getTheXMLConfBarPreInsert();
      } else if (getConfFile().equals("bar-nav")) {
        List<String> confControl = new ArrayList<String>();
        confControl.add(getConfFile());
        confBean = editingManager.rewriteMultipleConf(confControl);
        builderManaging = confBean.getTheXMLConfBarNav();
      } else if (getConfFile().equals("bar-managing")) {
        List<String> confControl = new ArrayList<String>();
        confControl.add(getConfFile());
        confBean = editingManager.rewriteMultipleConf(confControl);
        builderManaging = confBean.getTheXMLConfBarManaging();
      } else if (getConfFile().equals("bar-edt")) {
        List<String> confControl = new ArrayList<String>();
        confControl.add(getConfFile());
        confBean = editingManager.rewriteMultipleConf(confControl);
        builderManaging = confBean.getTheXMLConfBarEdt();
      } else if (getConfFile().equals("bar-docedit")) {
        List<String> confControl = new ArrayList<String>();
        confControl.add(getConfFile());
        confBean = editingManager.rewriteMultipleConf(confControl);
        builderManaging = confBean.getTheXMLConfBarDocEdit();
      } else {
        builderManaging = new XMLBuilder("root");
      }

      // System.out.println(ExpressionEvaluationUtils.evaluateString(builderManaging.getXML("ISO-8859-1"), builderManaging.getXML("ISO-8859-1"), pageContext));

      // XMLBuilder builderManaging = editingManager.genericMultipleConf(getConfFile(), getTheMultiEditingPath());
      // List<String> confControl = new ArrayList<String>();
      // confControl.add("titleManager");
      // confControl.add("query");
      // editingManager.rewriteMultipleConf(confControl);

      // System.out.println(getConfFile());
      // System.out.println(getTheMultiEditingPath());
      int contaNodi = builderManaging.contaNodi("/root/managing/user/element");
      for (int i = 0; i < contaNodi; i++) {
        String functionTxt = "";
        String anchorTxt = "";
        String targetTxt = "";
        String txtAhref = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@value");
        int contaEventJavaScript = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript");
        int contaAnchor = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/anchor");
        String isVisible = "true";

        String testMethod = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@testMethod");
        String testClass = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@testClass");
        String userValue = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@userValue");
        String xPathTest = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@xPathTest");
        // questo lo devo usare quando ho tempo di farlo
        String[] xPathTestSplit = xPathTest.split(";");
        String[] userValueSplit = userValue.split(";");
        // out.println("userValueSplit "+userValueSplit);
        // out.println("userValueSplit "+userValueSplit.length);
        // out.println("userValue "+userValue);
        if (!testMethod.equals("") && !testClass.equals("")) {
          try {
            Class constructorParamDef[] = {};
            Object constructorParam[] = {};
            Class c = Class.forName(testClass);
            Constructor theConstructor = c.getConstructor(constructorParamDef);
            Object myobj = theConstructor.newInstance(constructorParam);
            Method[] m = c.getDeclaredMethods();
            // ClassUtils.getPublicMethod(arg0, arg1, arg2);
            Object objValue = null;
            Object objBean = null;
            if (testClass.toUpperCase().indexOf("VIEWBEAN") != -1) {
              objBean = viewBean;
            } else if (testClass.toUpperCase().indexOf("EDITINGBEAN") != -1) {
              objBean = editingBean;
            } else if (testClass.toUpperCase().indexOf("TESTINGGENERIC") != -1) {
              objBean = null;
            }
            for (int j = 0; j < m.length; j++) {
              // System.out.println("mmmm " + m[j]);
              // System.out.println("mmmm " + m[j].getName());
              if (m[j].getName().equals(testMethod)) {
                if (m[j].getParameterTypes().length > 3) {
                  objValue = m[j].invoke(myobj, new Object[] { objBean, workFlowBean, userValueSplit, xPathTest });
                  break;
                } else {
                  objValue = m[j].invoke(myobj, new Object[] { objBean, workFlowBean, userValueSplit });
                  break;
                }
              }
            }
            if (objValue != null) {
              // out.println("objValue " + objValue);
              isVisible = objValue.toString();
              // out.println("isVisible " + isVisible);
            }
          } catch (Exception e) {
            out.println("ERRORE 1" + e.getMessage());
            isVisible = "false";
          }

        }

        if (isVisible.equals("true")) {
          ReflectionUtil reflectionUtil = new ReflectionUtil();
          if (contaAnchor == 1) {

            for (int j = 0; j < contaAnchor; j++) {
              String anchor = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/@value");
              int contaParamAnchor = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor");
              String interrogativo = "?";
              if (anchor.indexOf("#") != -1 || contaParamAnchor == 0) {
                interrogativo = "";
              }
              if (ExpressionEvaluationUtils.isExpressionLanguage(anchor)) {
                anchor = ExpressionEvaluationUtils.evaluateString(anchor, anchor, pageContext);
              }
              anchorTxt += "href=\"" + anchor + interrogativo;
              for (int k = 0; k < contaParamAnchor; k++) {
                String paramNameAnchor = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor[" + (k + 1) + "]/@name");
                String javaBean = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor[" + (k + 1) + "]/@javaBean");
                String paramValue = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor[" + (k + 1) + "]/@paramValue");
                String methodBean = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor[" + (k + 1) + "]/text()");
                int paramValueNum = paramValue.split(",").length;
                Object[] methodParam = null;
                Object methodValue = null;
                if (!paramValue.equals("") && paramValueNum > 0) {
                  // System.out.println("MenuGestioneJstl.doStartTag() MAGGIORE DI ZEROOOOOOOOOO paramValueNum " + paramValueNum);
                  // System.out.println("MenuGestioneJstl.doStartTag() MAGGIORE DI ZEROOOOOOOOOO paramValue " + paramValue);
                  methodParam = new Object[paramValueNum];
                  for (int index = 0; index < paramValueNum; index++) {
                    // System.out.println("MenuGestioneJstl.doStartTag() paramValue.split(\",\")[index] " + paramValue.split(",")[index]);
                    methodParam[index] = paramValue.split(",")[index];// getObjectFromString("java.lang.String", paramValue.split(",")[index]);
                    // System.out.println("MenuGestioneJstl.doStartTag() methodParam " + methodParam);
                  }
                }
                // methodParam = null;

                if (!javaBean.equals("")) {
                  Class c = null;
                  if (javaBean.toUpperCase().equals("VIEWBEAN")) {
                    methodValue = reflectionUtil.invokeMethod(viewBean, methodBean, methodParam);
                  } else if (javaBean.toUpperCase().equals("CONFBEAN")) {
                    methodValue = reflectionUtil.invokeMethod(confBean, methodBean, methodParam);
                  } else if (javaBean.toUpperCase().equals("USERBEAN")) {
                    methodValue = reflectionUtil.invokeMethod(userBean, methodBean, methodParam);
                  } else if (javaBean.toUpperCase().equals("EDITINGBEAN")) {
                    methodValue = reflectionUtil.invokeMethod(editingBean, methodBean, methodParam);
                  } else if (javaBean.toUpperCase().equals("WORKFLOWBEAN")) {
                    methodValue = reflectionUtil.invokeMethod(workFlowBean, methodBean, methodParam);
                  } else if (javaBean.toUpperCase().equals("REQUEST")) {
                    methodValue = request.getParameter(methodBean);
                  }
                } else {
                  methodValue = methodBean;
                }
                String endCom = "&amp;";
                if (k == contaParamAnchor - 1) {
                  endCom = "";
                }
                anchorTxt += paramNameAnchor + "=" + methodValue + endCom;
                System.out.println("MenuGestioneJstl.doStartTag()anchorTxt anchorTxt " + anchorTxt);
                if (anchorTxt.endsWith("?")) {
                  System.out.println("MenuGestioneJstl.doStartTag()AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
                  anchorTxt = anchorTxt.substring(0, anchorTxt.length() - 1);

                }

              }
              anchorTxt += "\"";
              String target = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/@target");
              if (!target.equals("")) {
                targetTxt = "target=\"" + ExpressionEvaluationUtils.evaluateString(target, target, pageContext) + "\"";
              }

            }
          } else if (contaAnchor == 0 && contaEventJavaScript > 0) {
            anchorTxt = "href=\"javascript:void(0)\"";
          } else {
            throw new Error("Qualcosa e andato storto. Anchor maggiore di uno");
          }

          // out.println("contaEventJavaScript " + contaEventJavaScript);
          for (int j = 0; j < contaEventJavaScript; j++) {
            String eventJavaScript = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/@value");
            // out.println("eventJavaScripty " + eventJavaScript);
            eventJavaScript += "=\"";
            int contaFunctionName = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName");
            for (int k = 0; k < contaFunctionName; k++) {
              String functionName = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/@value");
              // out.println("functionName " + functionName);
              eventJavaScript += functionName + "(";
              int contaParamFunction = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction");
              for (int index = 0; index < contaParamFunction; index++) {
                String javaBean = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction[" + (index + 1) + "]/@javaBean");
                String methodBean = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction[" + (index + 1) + "]/text()");
                String paramValue = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction[" + (index + 1) + "]/@paramValue");
                String escapeSingleApex = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction[" + (index + 1) + "]/@escapeSingleApex");
                // System.out.println("MenuGestioneJstl.doStartTag() MAGGIORE DI ZEROOOOOOOOOO paramValue " + paramValue);
                int paramValueNum = paramValue.split(",").length;
                Object[] methodParam = null;
                Object methodValue = null;
                if (!paramValue.equals("") && paramValueNum > 0) {
View Full Code Here

          String xmlArchives = ConfManager.getConfString(userDetails.getAccount() + "-security/accounts.xml");
          String xmlrole = ConfManager.getConfString(userDetails.getAccount() + "-security/role.xml");
          UserBean userBean = LoadUserSpeedUp.loadUserByString(xmlUsers, xmlArchives, xmlrole, userDetails.getId(), userDetails.getAccount());
          model.addAttribute("userBean", userBean);
        } else {
          XMLBuilder xmlUsers = ConfManager.getConfXML(userDetails.getAccount() + "-security/users.xml");
          XMLBuilder xmlArchives = ConfManager.getConfXML(userDetails.getAccount() + "-security/accounts.xml");
          XMLBuilder xmlrole = ConfManager.getConfXML(userDetails.getAccount() + "-security/role.xml");
          UserBean userBean = LoadUser.loadUser(xmlUsers, xmlArchives, xmlrole, userDetails.getId(), userDetails.getAccount());
          model.addAttribute("userBean", userBean);
        }
      } catch (Exception e) {
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.