Package org.openbravo.erpCommon.utility

Examples of org.openbravo.erpCommon.utility.OBError


  }

  private OBError processButton(VariablesSecureApp vars, String strKey, String strInvoice,
      String windowId) {
    int i = 0;
    OBError myError = null;
    Connection conn = null;
    try {
      conn = getTransactionConnection();
      CopyFromInvoiceData[] data = CopyFromInvoiceData.select(conn, this, strInvoice, Utility
          .getContext(this, vars, "#User_Client", windowId), Utility.getContext(this, vars,
          "#User_Org", windowId));
      if (data != null && data.length != 0) {
        for (i = 0; i < data.length; i++) {
          String strSequence = SequenceIdData.getUUID();
          try {
            CopyFromInvoiceData.insert(conn, this, strSequence, strKey, vars.getClient(), vars
                .getOrg(), vars.getUser(), data[i].cInvoicelineId);
          } catch (ServletException ex) {
            myError = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
            releaseRollbackConnection(conn);
          }
        }
      }
      releaseCommitConnection(conn);
    } catch (Exception e) {
      try {
        releaseRollbackConnection(conn);
      } catch (Exception ignored) {
      }
      log4j.warn("Rollback in transaction", e);
      myError = new OBError();
      myError.setType("Error");
      myError.setTitle(Utility.messageBD(this, "Error", vars.getLanguage()));
      myError.setMessage(Utility.messageBD(this, "ProcessRunError", vars.getLanguage()));
      return myError;
    }
    myError = new OBError();
    myError.setType("Success");
    myError.setTitle(Utility.messageBD(this, "Success", vars.getLanguage()));
    myError.setMessage(Utility.messageBD(this, "RecordsCopied", vars.getLanguage()) + " " + i);
    return myError;
  }
View Full Code Here


      xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
    {
      OBError myMessage = vars.getMessage("ReportCashJR");
      vars.removeMessage("ReportCashJR");
      if (myMessage != null) {
        xmlDocument.setParameter("messageType", myMessage.getType());
        xmlDocument.setParameter("messageTitle", myMessage.getTitle());
        xmlDocument.setParameter("messageMessage", myMessage.getMessage());
      }
    }

    xmlDocument.setParameter("calendar", vars.getLanguage().substring(0, 2));
    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
View Full Code Here

      String strWindowPath = Utility.getTabURL(this, strTab, "R");
      if (strWindowPath.equals(""))
        strWindowPath = strDefaultServlet;

      OBError myMessage = processButton(vars, tl.getFieldProvider(), strKey, strWindow);
      vars.setMessage(strTab, myMessage);
      printPageClosePopUp(response, vars, strWindowPath);
    } else
      pageErrorPopUp(response);
  }
View Full Code Here

      pageErrorPopUp(response);
  }

  OBError processButton(VariablesSecureApp vars, FieldProvider[] dataLineas, String strTestId,
      String windowId) {
    OBError myMessage = null;
    Connection conn = null;
    if (dataLineas == null) {
      return Utility.translateError(this, vars, vars.getLanguage(), "ProcessRunError");
    }
    String strCommandId = "";
    String strType = "C";
    String strLineId = "";
    int intSeqNo = 10;
    try {
      conn = getTransactionConnection();
      if (!TestInData.countLines(this, strTestId).equals("0")) {
        return Utility.translateError(this, vars, vars.getLanguage(), "ProcessRunError");
      }
      for (int i = 0; i < dataLineas.length; i++) {
        strCommandId = dataLineas[i].getField("comando");
        if (strCommandId != null) {
          TestInData[] datacomando = TestInData.select(conn, this, strCommandId);
          strLineId = SequenceIdData.getUUID();
          try {
            TestInData.insert(conn, this, strLineId, vars.getClient(), vars.getOrg(), vars
                .getUser(), strTestId, strCommandId, String.valueOf(intSeqNo), dataLineas[i]
                .getField("arg1"), dataLineas[i].getField("arg2"), dataLineas[i].getField("arg3"),
                strType, datacomando[0].argno, datacomando[0].arghelp1, datacomando[0].arghelp2,
                datacomando[0].arghelp3);
          } catch (ServletException ex) {
            myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
            releaseRollbackConnection(conn);
            return myMessage;
          }
          intSeqNo = intSeqNo + 10;
        }
      }

      myMessage = new OBError();
      myMessage.setType("Success");
      myMessage.setTitle("");
      myMessage.setMessage(Utility.messageBD(this, "Success", vars.getLanguage()));
    } catch (Exception e) {
      e.printStackTrace();
      log4j.warn("Rollback in transaction");
      myMessage = Utility.translateError(this, vars, vars.getLanguage(), "ProcessRunError");
    }
View Full Code Here

      FieldProvider[] rows = null;
      String strSeparator = FileImportData.selectSeparator(this, strAdImpformatId);
      if (strSeparator.equalsIgnoreCase("F"))
        rows = FileImportData.select(this, strAdImpformatId);
      fieldsData = new FileLoadData(vars, "inpFile", firstRowHeaders, strSeparator, rows);
      OBError myMessage = importarFichero(vars, fieldsData.getFieldProvider(), request, response,
          strAdImpformatId);
      vars.setMessage("FileImport", myMessage);
      printPageResult(response, vars, "", "SAVE");
    } else
      pageError(response);
View Full Code Here

    Connection con = null;
    StringBuffer strFields = new StringBuffer("");
    StringBuffer strValues = new StringBuffer("");
    FileImportData[] data = null;
    int constant = 0;
    OBError myMessage = null;
    int i = 0;

    try {
      con = getTransactionConnection();
      data = FileImportData.select(this, strAdImpformatId);
      String strTable = FileImportData.table(this, strAdImpformatId);
      for (i = 0; i < data2.length; i++) {
        // create a basic row with uuid to be updated in the next step
        String sequence = SequenceIdData.getUUID();
        try {
          FileImportData.insert(con, this, strTable, (strTable + "_ID"), sequence,
              vars.getClient(), vars.getOrg(), vars.getUser());
        } catch (ServletException ex) {
          myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
          releaseRollbackConnection(con);
          return myMessage;
        }
        // generate the updated row information and update the basic row already created.
        int jj = 0;
        for (int j = 0; j < data.length; j++) {
          if ((data2[i].getField(String.valueOf(j - constant)) == null || data2[i].getField(
              String.valueOf(j - constant)).equals(""))
              && data[j].constantvalue.equals(""))
            continue;
          if (jj > 0)
            strFields.append(",");
          jj++;
          strFields.append(data[j].columnname).append(" = ");
          strValues.append("'");
          if ((data[j].datatype.equals("C")) && (!data[j].constantvalue.equals(""))) {
            strValues.append(data[j].constantvalue);
            constant = constant + 1;
          } else
            strValues.append(parseField(data2[i].getField(String.valueOf(j - constant)),
                data[j].fieldlength, data[j].datatype, data[j].dataformat, data[j].decimalpoint));
          strValues.append("'");
          strFields.append(strValues);
          strValues.delete(0, strValues.length());
        }
        constant = 0;
        if (log4j.isDebugEnabled())
          log4j.debug("##########iteration - " + (i + 1) + " - strFields = " + strFields);
        try {
          FileImportData.update(con, this, strTable, strFields.toString(), (strTable + "_id = '"
              + sequence + "'"));
        } catch (ServletException ex) {
          myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
          if (i == 0 && !firstRowHeaders) {
            myMessage.setTitle(Utility.messageBD(this,
                "Error while inserting data. Please check if the CSV file contains a header", vars
                    .getLanguage()));
          } else {
            myMessage.setTitle(Utility.messageBD(this, "Error while inserting data", vars
                .getLanguage()));
          }
          String strMessage = myMessage.getMessage();
          myMessage.setMessage("<strong>" + Utility.messageBD(this, "Line", vars.getLanguage())
              + "&nbsp;</strong>" + (i + 1) + "<br><strong>"
              + Utility.messageBD(this, "Inserting data", vars.getLanguage())
              + ":&nbsp;&nbsp;</strong>" + strFields + "<br><strong>"
              + Utility.messageBD(this, "Error", vars.getLanguage()) + "&nbsp;&nbsp;</strong>"
              + strMessage);
          releaseRollbackConnection(con);
          return myMessage;
        }
        strFields.delete(0, strFields.length());
      }

      releaseCommitConnection(con);
      myMessage = new OBError();
      myMessage.setType("Success");
      myMessage.setTitle(Utility.messageBD(this, "Success", vars.getLanguage()));
      myMessage.setMessage(Utility.messageBD(this, "Records inserted in the temporary table", vars
          .getLanguage())
          + ": " + i);
    } catch (Exception e) {
      try {
        releaseRollbackConnection(con);
View Full Code Here

      throw new ServletException(ex);
    }

    xmlDocument.setParameter("theme", vars.getTheme());
    {
      OBError myMessage = vars.getMessage("FileImport");
      vars.removeMessage("FileImport");
      if (myMessage != null) {
        xmlDocument.setParameter("messageType", myMessage.getType());
        xmlDocument.setParameter("messageTitle", myMessage.getTitle());
        xmlDocument.setParameter("messageMessage", myMessage.getMessage());
      }
    }

    if (log4j.isDebugEnabled())
      log4j.debug("3");
View Full Code Here

      xmlDocument.setParameter("leftTabs", lBar.manualTemplate());
    } catch (Exception ex) {
      throw new ServletException(ex);
    }
    {
      OBError myMessage = vars.getMessage("CreateTaxReport");
      vars.removeMessage("CreateTaxReport");
      if (myMessage != null) {
        xmlDocument.setParameter("messageType", myMessage.getType());
        xmlDocument.setParameter("messageTitle", myMessage.getTitle());
        xmlDocument.setParameter("messageMessage", myMessage.getMessage());
      }
    }

    // //----
View Full Code Here

    } else if (vars.commandIn("SAVE")) {
      String strKey = vars.getRequiredStringParameter("inpmInoutId");
      String strWindowId = vars.getStringParameter("inpWindowId");
      String strSOTrx = vars.getStringParameter("inpissotrx");
      String strTabId = vars.getStringParameter("inpTabId");
      OBError myMessage = saveMethod(vars, strKey, strWindowId, strSOTrx);

      String strWindowPath = Utility.getTabURL(this, strTabId, "R");
      if (strWindowPath.equals(""))
        strWindowPath = strDefaultServlet;
View Full Code Here

public class KillSession implements Process {

  @Override
  public void execute(ProcessBundle bundle) throws Exception {
    String sessionId = (String) bundle.getParams().get("AD_Session_ID");
    OBError msg = new OBError();
    if (bundle.getContext().getDbSessionID().equals(sessionId)) {
      // do not kill current session
      msg.setType("Error");
      msg.setMessage("@NotAllowedToKillCurrentSession@");
      bundle.setResult(msg);
    } else {
      Session session = OBDal.getInstance().get(Session.class, sessionId);
      session.setSessionActive(false);
      msg.setType("Success");
      msg.setMessage("@Success@");
    }
    bundle.setResult(msg);

  }
View Full Code Here

TOP

Related Classes of org.openbravo.erpCommon.utility.OBError

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.