Package org.openbravo.base.exception

Examples of org.openbravo.base.exception.OBException


            HttpServletResponse response, OBQuery<BaseOBObject> obq) {
        try {
            final Order iOrder = createImportOrder(request, obq);
            OBDal.getInstance().save(iOrder);
        } catch (final Exception e) {
            throw new OBException("Error saving Entity into database");
        }
    }
View Full Code Here


        final DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        Date date = null;
        try {
            date = formatter.parse(ti_date);
        } catch (final ParseException e) {
            throw new OBException("Error parsing date " + ti_date);
        }

        iOrder.setOrderDate(date);

        // Payment amount1
View Full Code Here

            final StringBuilder sb = new StringBuilder();
            sb.append("ExternalPOS with ");
            sb.append(" CLIENT_ID=" + clientId);
            sb.append(", ORG_ID=" + orgId);
            sb.append(", POS_ID=" + posId + "not defined");
            throw new OBException(sb.toString());
        } else {
            final StringBuilder sPro = new StringBuilder();
            boolean incPro = false;
            for (final BaseOBObject b : obq1.list()) {
                final ExternalPOS ePos = (ExternalPOS) b;
                warehouseId = ePos.getWarehouse().getId();
                if (ePos.getIncludedProduct().equals("N")) {
                    incPro = true;
                    sPro.append("(''");
                    for (final ExternalPOSProduct p : ePos
                            .getExternalPOSProductList()) {
                        sPro.append(", '" + p.getProduct().getId() + "'");
                    }
                    sPro.append(")");
                }
            }

            final StringBuilder invWhere = new StringBuilder();
            invWhere.append("storageBin.id in (select lo.id from Locator lo");
            invWhere.append(" where lo.warehouse.id='" + warehouseId + "')");
            invWhere.append(" and uOM.id='100'");
            if (incPro) {
                invWhere.append(" and product.id in " + sPro);
            }
            invWhere.append(" and " + defWclause);

            final OBQuery<BaseOBObject> obq2 = OBDal.getInstance().createQuery(
                    "MaterialMgmtStorageDetail", invWhere.toString());
            obq2.setFilterOnReadableClients(false);
            obq2.setFilterOnReadableOrganization(false);
            final List<BaseOBObject> l1 = obq2.list();

            final Map<String, BigDecimal> keyUnits = new HashMap<String, BigDecimal>();
            final List<BaseOBObject> delIndex = new ArrayList<BaseOBObject>();
            final Map<String, String> keyStorageId = new HashMap<String, String>();
            int i = 0;
            for (final BaseOBObject b : l1) {
                final StorageDetail sd = (StorageDetail) b;
                final String proId = sd.getProduct().getId();
                final String attSet = sd.getAttributeSetValue().getId();
                final BigDecimal units = sd.getQuantityOnHand();
                final String key = proId + "_" + attSet;

                if (keyUnits.containsKey(key)) {
                    final BigDecimal sum = units.add(keyUnits.get(key));
                    keyUnits.put(key, sum);
                    delIndex.add(b);
                } else {
                    keyStorageId.put(key, sd.getId());
                    keyUnits.put(key, units);
                }
                i++;
            }

            l1.removeAll(delIndex);

            final StringWriter sw = new StringWriter();
            exc.setOutput(sw);
            exc.process(l1);
            final String xml2 = sw.toString();
            try {
                doc = DocumentHelper.parseText(xml2);
                for (final String s : keyStorageId.keySet()) {
                    final String stoId = keyStorageId.get(s);
                    final Element sel = (Element) doc
                            .selectSingleNode("/ob:Openbravo/MaterialMgmtStorageDetail[@id="
                                    + stoId + "]");
                    sel.element("quantityOnHand").setText(
                            keyUnits.get(s).toString());
                }

            } catch (final DocumentException e) {
                throw new OBException("Error parsing xml " + e.getMessage());
            }

            return doc;
        }
    }
View Full Code Here

              total = saveRecord(vars, myError, 'U');
          else
              total = saveRecord(vars, myError, 'I');
         
          if (!myError.isEmpty() && total == 0)    
            throw new OBException(myError.getMessage());
        }
        vars.setSessionValue(request.getParameter("mappingName") +"|hash", vars.getPostDataHash());
        vars.setSessionValue(tabId + "|Header.view", "EDIT");
       
        return;
View Full Code Here

              total = saveRecord(vars, myError, 'U', strPM_PriceList_ID);
          else
              total = saveRecord(vars, myError, 'I', strPM_PriceList_ID);
         
          if (!myError.isEmpty() && total == 0)    
            throw new OBException(myError.getMessage());
        }
        vars.setSessionValue(request.getParameter("mappingName") +"|hash", vars.getPostDataHash());
        vars.setSessionValue(tabId + "|Header.view", "EDIT");
       
        return;
View Full Code Here

              total = saveRecord(vars, myError, 'U');
          else
              total = saveRecord(vars, myError, 'I');
         
          if (!myError.isEmpty() && total == 0)    
            throw new OBException(myError.getMessage());
        }
        vars.setSessionValue(request.getParameter("mappingName") +"|hash", vars.getPostDataHash());
        vars.setSessionValue(tabId + "|Header.view", "EDIT");
       
        return;
View Full Code Here

              total = saveRecord(vars, myError, 'U');
          else
              total = saveRecord(vars, myError, 'I');
         
          if (!myError.isEmpty() && total == 0)    
            throw new OBException(myError.getMessage());
        }
        vars.setSessionValue(request.getParameter("mappingName") +"|hash", vars.getPostDataHash());
        vars.setSessionValue(tabId + "|Header.view", "EDIT");
       
        return;
View Full Code Here

              total = saveRecord(vars, myError, 'U', strPAD_Workflow_ID);
          else
              total = saveRecord(vars, myError, 'I', strPAD_Workflow_ID);
         
          if (!myError.isEmpty() && total == 0)    
            throw new OBException(myError.getMessage());
        }
        vars.setSessionValue(request.getParameter("mappingName") +"|hash", vars.getPostDataHash());
        vars.setSessionValue(tabId + "|Header.view", "EDIT");
       
        return;
View Full Code Here

              total = saveRecord(vars, myError, 'U', strPMA_Processplan_Version_ID);
          else
              total = saveRecord(vars, myError, 'I', strPMA_Processplan_Version_ID);
         
          if (!myError.isEmpty() && total == 0)    
            throw new OBException(myError.getMessage());
        }
        vars.setSessionValue(request.getParameter("mappingName") +"|hash", vars.getPostDataHash());
        vars.setSessionValue(tabId + "|Header.view", "EDIT");
       
        return;
View Full Code Here

              total = saveRecord(vars, myError, 'U');
          else
              total = saveRecord(vars, myError, 'I');
         
          if (!myError.isEmpty() && total == 0)    
            throw new OBException(myError.getMessage());
        }
        vars.setSessionValue(request.getParameter("mappingName") +"|hash", vars.getPostDataHash());
        vars.setSessionValue(tabId + "|Header.view", "EDIT");
       
        return;
View Full Code Here

TOP

Related Classes of org.openbravo.base.exception.OBException

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.