Package org.xdams.page.view.bean

Examples of org.xdams.page.view.bean.ManagingBean


  public AjaxBean execute() throws Exception {
    AjaxBean ajaxBean = new AjaxBean();
    HttpSession httpSession = null;
    String actionType = MyRequest.getParameter("action", req.getParameterMap());
    String physDoc = MyRequest.getParameter("physDoc", req.getParameterMap());
    ManagingBean managingBean = null;
    String valori = "";
    ConnectionManager connectionManager = new ConnectionManager();
    XWConnection xwconn = null;
    ConfBean confBean = null;
    WorkFlowBean workFlowBean = null;
View Full Code Here


  public ManagingBean execute() throws Exception {
    XWConnection xwconn = null;
    ConnectionManager connectionManager = new ConnectionManager();
    ConfBean confBean = null;
    ManagingBean managingBean = null;
    String physDoc = MyRequest.getParameter("physDoc", parameterMap);
    String selid = MyRequest.getParameter("selid", parameterMap);
    String makeAction = MyRequest.getParameter("makeAction", parameterMap);
    String applyTo = MyRequest.getParameter("applyTo", parameterMap);
    String pos = MyRequest.getParameter("pos", parameterMap);
 
    HttpSession httpSession = null;
    List<String> confControl = new ArrayList<String>();
    confControl.add("titleManager");
    confControl.add("valoriControllati");
    confControl.add("managing");
    try {
      // ManagingBean esiste in sessione ma io uso uno nuovo per le funzioni di gestione
      managingBean = new ManagingBean();
      UserBean userBean = (UserBean) modelMap.get("userBean");
      confBean = (ConfBean) modelMap.get("confBean");
      WorkFlowBean workFlowBean = (WorkFlowBean) modelMap.get("workFlowBean");
      httpSession = workFlowBean.getRequest().getSession(false);
      managingBean.setSelid(selid);
      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();
            while (theBrother > 0) {
              theBrother = xwconn.getNumDocNextBrother(theBrother);
              if (theBrother > 0) {
                elementiNum.add(new Integer(theBrother));
              }
            }
          } else if (applyTo.equals("prevSibling")) {
            int theBrother = managingBean.getPhysDoc();
            while (theBrother > 0) {
              theBrother = xwconn.getNumDocPreviousBrother(theBrother);
              if (theBrother > 0) {
                elementiNum.add(new Integer(theBrother));
              }
            }
          } else {// DA SELEZIONE MULTIPLA
            elementiNum = ((ManagingBean) httpSession.getAttribute(workFlowBean.getManagingBeanName())).getListPhysDoc();
          }

        } else {
          it.highwaytech.db.QueryResult qr = null;
          if (applyTo.equals("selid")) {
            qr = xwconn.getQRFromSelId(selid);
            for (int z = 0; z < qr.elements; z++) {
              int theNumber = xwconn.getNumDocFromQRElement(qr, z);
              elementiNum.add(new Integer(theNumber));
            }
          } else if (applyTo.equals("hier") || applyTo.equals("hierfalse")) {
            boolean includeFather = true;
            if (applyTo.equals("hierfalse")) {
              includeFather = false;
            }
            qr = xwconn.getQRFromHier(managingBean.getPhysDoc(), includeFather);
            managingBean.setNumElementi(qr.elements);
            xwconn.deleteHier(managingBean.getPhysDoc());
            managingBean.setDocSuccessi(-100);
            managingBean.setDocErrori(-100);
          }

        }
        if (!applyTo.equals("hier") && !applyTo.equals("hierfalse")) {
          for (int i = 0; i < elementiNum.size(); i++) {
            QueryResult qrTemp = null;
            try {
              qrTemp = xwconn.getQRFromHier(((Integer) elementiNum.get(i)).intValue(), false);
            } catch (Exception e) {
              qrTemp = xwconn.getQRFromHier(Integer.parseInt((String) elementiNum.get(i)), false);
            }
            if (qrTemp != null && qrTemp.elements > 0) {
              for (int z = 0; z < qrTemp.elements; z++) {
                int theNumber = xwconn.getNumDocFromQRElement(qrTemp, z);
                elementiNum.add(new Integer(theNumber));
              }
            }
          }
          managingBean.setNumElementi(elementiNum.size());
          int totElementi = elementiNum.size();
          int processati = 0;
          int errori = 0;

          for (int i = 0; i < totElementi; i++) {
            int docCorrente = 0;
            try {
              docCorrente = ((Integer) elementiNum.get(i)).intValue();
            } catch (Exception e) {
              docCorrente = (Integer.parseInt((String) elementiNum.get(i)));
            }
            try {
              xwconn.delete(docCorrente);
              processati++;
            } catch (Exception e) {
              managingBean.addErrorMsg(e.getMessage());
              errori++;
            }
          }
          managingBean.setDocSuccessi(processati);
          managingBean.setDocErrori(errori);
        }
        managingBean.setTitle("");
        managingBean.setDispatchView("eraseResult");
        if (httpSession.getAttribute(workFlowBean.getManagingBeanName()) != null) {
          ManagingBean sessionMenaging = (ManagingBean) httpSession.getAttribute(workFlowBean.getManagingBeanName());
          sessionMenaging.setListPhysDoc(new ArrayList()); // SVUOTO GLI ELEMENTI SELEZIONATI
          httpSession.setAttribute(workFlowBean.getManagingBeanName(), sessionMenaging);
        }
      }
//      aReq.setAttribute("confBean", confBean);
//      aReq.setAttribute("userBean", userBean);
View Full Code Here

TOP

Related Classes of org.xdams.page.view.bean.ManagingBean

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.