Package com.openbravo.basic

Examples of com.openbravo.basic.BasicException


    }

    // Utilidades
    public final List fetchAll(DataResultSet SRS) throws BasicException {
        if (SRS == null) {
            throw new BasicException(LocalRes.getIntString("exception.nodataset"));
        }
       
        List aSO = new ArrayList();
        while (SRS.next()) {
            aSO.add(SRS.getCurrent());
View Full Code Here


   
    // Utilidades
    public final List fetchPage(DataResultSet SRS, int offset, int length) throws BasicException {
       
        if (SRS == null) {
            throw new BasicException(LocalRes.getIntString("exception.nodataset"));
       
       
        if (offset < 0 || length < 0) {
            throw new BasicException(LocalRes.getIntString("exception.nonegativelimits"));
        }
        
        // Skip los primeros que no me importan
        while (offset > 0 && SRS.next()) {
            offset--;
View Full Code Here

    }
   
    public final Object fetchOne(DataResultSet SRS) throws BasicException {
                      
        if (SRS == null) {
            throw new BasicException(LocalRes.getIntString("exception.nodataset"));
        }
       
        if (SRS.next()) {
            return SRS.getCurrent()
        } else {
View Full Code Here

                // transformo tickets en ordenes
                Order[] orders = transformTickets(ticketlist);

                //uploads orders and return boolean as a result
                if(!externalsales.uploadOrders(orders))
                    throw new BasicException(AppLocal.getIntString("message.returnnull"));

                // actualizo los tickets como subidos
                dlintegration.execTicketUpdate();

                return new MessageInf(MessageInf.SGN_SUCCESS, AppLocal.getIntString("message.syncordersok"), AppLocal.getIntString("message.syncordersinfo", orders.length));
            }

        } catch (ServiceException e) {           
            throw new BasicException(AppLocal.getIntString("message.serviceexception"), e);
        } catch (RemoteException e){
            throw new BasicException(AppLocal.getIntString("message.remoteexception"), e);
        } catch (MalformedURLException e){
            throw new BasicException(AppLocal.getIntString("message.malformedurlexception"), e);
        }
    } 
View Full Code Here

                    }
                }
            }

        } catch (ServiceException e) {
            throw new BasicException(AppLocal.getIntString("message.serviceexception"), e);
        } catch (RemoteException e) {
            throw new BasicException(AppLocal.getIntString("message.remoteexception"), e);
        } catch (MalformedURLException e) {
            throw new BasicException(AppLocal.getIntString("message.malformedurlexception"), e);
        }

// DELETE OLD RETURNED TICKETS
//        if (WSInfo.isWsdeletert()) {
//            try {
View Full Code Here

        AltEncrypter cypher = new AltEncrypter("cypherkey" + user);
        try {
            String password = cypher.decrypt(WSInfo.getWspassword().substring(6));
            wsLogin.setPassword(password);
        } catch (NullPointerException npe) {
            throw new BasicException(AppLocal.getIntString("message.propsnotdefined"));
        }

        if (wsPosid == null || wsPosid.equals("")) {
            throw new BasicException(AppLocal.getIntString("message.propsnotdefined"));
        } else {

            if (wsURL.equals("") || wsURL == null) {
                throw new BasicException(AppLocal.getIntString("message.urlnotdefined"));
            } else {
            }
        }

        categoriesProxy = new VM_CategoriesProxy(wsURL + CategoriesURL);
View Full Code Here

           
            Product[] products = externalsales.getProductsCatalog();
            Customer[] customers = externalsales.getCustomers();

            if (products == null || customers == null){
                throw new BasicException(AppLocal.getIntString("message.returnnull"));
            }    
           
            if (products.length > 0){
               
                dlintegration.syncProductsBefore();
               
                Date now = new Date();
               
                for (Product product : products) {
                   
                    // Synchonization of taxcategories
                    TaxCategoryInfo tc = new TaxCategoryInfo(product.getTax().getId(), product.getTax().getName());
                    dlintegration.syncTaxCategory(tc);
                   
                    // Synchonization of taxes
                    TaxInfo t = new TaxInfo(
                            product.getTax().getId(),
                            product.getTax().getName(),
                            tc.getID(),
                            null,
                            null,
                            product.getTax().getPercentage() / 100,
                            false,
                            0);
                    dlintegration.syncTax(t);
                  
                    // Synchonization of categories
                    CategoryInfo c = new CategoryInfo(product.getCategory().getId(), product.getCategory().getName(), null);
                    dlintegration.syncCategory(c);

                    // Synchonization of products
                    ProductInfoExt p = new ProductInfoExt();
                    p.setID(product.getId());
                    p.setReference(product.getId());
                    p.setCode(product.getEan() == null || product.getEan().equals("") ? product.getId() : product.getEan());
                    p.setName(product.getName());
                    p.setCom(false);
                    p.setScale(false);
                    p.setPriceBuy(product.getPurchasePrice());
                    p.setPriceSell(product.getListPrice());
                    p.setCategoryID(c.getID());
                    p.setTaxCategoryID(tc.getID());
                    p.setImage(ImageUtils.readImage(product.getImageUrl()));
                    dlintegration.syncProduct(p)
                   
                    // Synchronization of stock         
                    if (product instanceof ProductPlus) {
                       
                        ProductPlus productplus = (ProductPlus) product;
                       
                        double diff = productplus.getQtyonhand() - dlsales.findProductStock(warehouse, p.getID(), null);
                       
                        Object[] diary = new Object[7];
                        diary[0] = UUID.randomUUID().toString();
                        diary[1] = now;
                        diary[2] = diff > 0.0
                                ? MovementReason.IN_MOVEMENT.getKey()
                                : MovementReason.OUT_MOVEMENT.getKey();
                        diary[3] = warehouse;
                        diary[4] = p.getID();
                        diary[5] = new Double(diff);
                        diary[6] = new Double(p.getPriceBuy());                               
                        dlsales.getStockDiaryInsert().exec(diary);  
                    }
                }
               
                // datalogic.syncProductsAfter();
            }
           
            if (customers.length > 0 ) {
               
                dlintegration. syncCustomersBefore();
               
                for (Customer customer : customers) {                   
                    CustomerInfoExt cinfo = new CustomerInfoExt(customer.getId());
                    cinfo.setSearchkey(customer.getSearchKey());
                    cinfo.setName(customer.getName());         
                    cinfo.setNotes(customer.getDescription());
                    // TODO: Finish the integration of all fields.
                    dlintegration.syncCustomer(cinfo);
                }
            }
           
            if (products.length == 0 && customers.length == 0) {
                return new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.zeroproducts"));              
            } else {
                return new MessageInf(MessageInf.SGN_SUCCESS, AppLocal.getIntString("message.syncproductsok"), AppLocal.getIntString("message.syncproductsinfo", products.length, customers.length));
            }
               
        } catch (ServiceException e) {           
            throw new BasicException(AppLocal.getIntString("message.serviceexception"), e);
        } catch (RemoteException e){
            throw new BasicException(AppLocal.getIntString("message.remoteexception"), e);
        } catch (MalformedURLException e){
            throw new BasicException(AppLocal.getIntString("message.malformedurlexception"), e);
        }
    }  
View Full Code Here

         
        // BEGIN TRANSACTION
        TicketInfo ticket = dlReceipts.getSharedTicket(id);
        if (ticket == null)  {
            // Does not exists ???
            throw new BasicException(AppLocal.getIntString("message.noticket"));
        } else {
            dlReceipts.deleteSharedTicket(id);
            m_sCurrentTicket = id;
            m_panelticket.setActiveTicket(ticket, null);
        }
View Full Code Here

           } else {
             return new MessageInf(MessageInf.SGN_SUCCESS, AppLocal.getIntString("message.syncusersok"), AppLocal.getIntString("message.syncusersinfo", npCustomers));
           }
          
        } catch (ServiceException e) {           
            throw new BasicException(AppLocal.getIntString("message.serviceexception"), e);
        } catch (RemoteException e){
            throw new BasicException(AppLocal.getIntString("message.remoteexception"), e);
        } catch (MalformedURLException e){
            throw new BasicException(AppLocal.getIntString("message.malformedurlexception"), e);
        }
    }
View Full Code Here

                remoteUsers = externalsales.getUsersBySteps(step);
//                remoteUsers = externalsales.getUsers();
                step++;
     
          if (remoteUsers == null){
              throw new BasicException(AppLocal.getIntString("message.returnnull")+" > Customers null");
          }
         
          // if it found users
          if (remoteUsers.length > 0 ) {
View Full Code Here

TOP

Related Classes of com.openbravo.basic.BasicException

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.