Examples of Order


Examples of com.zesped.model.Order

      errors.add("selectedProduct", new LocalizableError("com.zesped.action.BuyCredits.noCreditsSpecified"))
    }
  }

  public Resolution buy() {
      Order order = new Order();
      try {
        connect();
        AtrilSession oSes = getSession();
        Dms oDms = oSes.getDms();
        CustomerAccount cacc = new CustomerAccount(oDms, getSessionAttribute("customer_account_docid"));
        order = cacc.createOrder(oSes);
        order.put("user_id", getSessionAttribute("user_docid"));
        order.put("credits_bought", selectedProduct.getCredits());
        order.save(oSes);

        Log.out.info("Created order "+order.getString("order_id")+" for customer "+getSessionAttribute("customer_acount"));
       
        OrderLine line = order.addLine(oSes, selectedProduct);

        Log.out.info("Added order line for product "+selectedProduct.getString("product_name"));

        order.put("base_price", line.getString("base_price"));
        order.put("taxes", line.getString("taxes"));
        order.put("taxespct", line.getString("taxespct"));
        order.put("total_price", line.getString("subtotal_price"));
        order.put("currency", line.getString("currency"));
        order.save(oSes);
       
        DAO.log(oSes, order.getDocument(), Order.class, "CREATE ORDER", AtrilEvent.Level.INFO, order.getDocument().id()+";"+getSessionAttribute("customer_acount")+";"+selectedProduct.getString("product_name"));

        cacc.restoreCredits(oSes, new BigDecimal(selectedProduct.getCredits().longValue()));

        Log.out.info("Added "+selectedProduct.getCredits().toString()+" credits to customer "+getSessionAttribute("customer_acount"));
        DAO.log(oSes, cacc.getDocument(), CustomerAccount.class, "UPDATE CREDITS", AtrilEvent.Level.INFO, cacc.getDocument().id()+";"+cacc.get("credits_left"));
View Full Code Here

Examples of cuke4duke.annotation.Order

            public int compare(Method m1, Method m2) {
                return order(m1) - order(m2);
            }

            private int order(Method m) {
                Order order = m.getAnnotation(Order.class);
                return (order == null) ? Integer.MAX_VALUE : order.value();
            }
        });
        return sortedMethods;
    }
View Full Code Here

Examples of cz.muni.fi.pa165.stis.entity.Order

    }
   
    @Test
    public void testCreate() {
        orderService.create(orderTO);
        final Order o = order;
        verify(dao).create(argThat(new BaseMatcher<Order>() {

            @Override
            public boolean matches(Object item) {
                if (!(item instanceof Order)) {
                    return false;
                }
               
                Order no = (Order) item;
                if (!Objects.equals(no.getCarType(), o.getCarType())) {
                    return false;
                }
                if (!Objects.equals(no.getCustomer(), o.getCustomer())) {
                    return false;
                }
                if (!Objects.equals(no.getOrderNewDate(), o.getOrderNewDate())) {
                    return false;
                }
                if (!Objects.equals(no.getOrderPaidDate(), o.getOrderPaidDate())) {
                    return false;
                }
                if (!Objects.equals(no.getOrderServicedDate(), o.getOrderServicedDate())) {
                    return false;
                }
                if (!Objects.equals(no.getTotalPrice(), o.getTotalPrice())) {
                    return false;
                }
                if (!(no.getExtraServices().containsAll(o.getExtraServices()) && o.getExtraServices().containsAll(no.getExtraServices()))) {
                    return false;
                }
                if (no.getTyres() == null || o.getTyres() == null) {
                    if (no.getTyres() != null || o.getTyres() != null) {
                        return false;
                    }
                }
                if (no.getTyres().size() != o.getTyres().size()) {
                    return false;
                }
                for (Map.Entry<TyrePosition, Tyre> me : no.getTyres().entrySet()) {
                    Tyre t = o.getTyres().get(me.getKey());
                    if (!Objects.equals(t, me.getValue())) {
                        return false;
                    }
                }
View Full Code Here

Examples of de.forsthaus.backend.model.Order

  }

  @Test
  @Transactional
  public void getCustomerByOrder() {
    Order anOrder = getOrderDAO().getOrderById(new Long(40));
    Customer result = getCustomerDAO().getCustomerByOrder(anOrder);
    Assert.assertEquals("Not the expected result", "MUELLER", result.getKunMatchcode());
  }
View Full Code Here

Examples of de.zalando.sprocwrapper.example.Order

    @Test
    public void testMonetaryValue() {
        BigDecimal b = new BigDecimal("123.124");
        int i = exampleSProcService.createOrder("order2", new OrderMonetaryAmountImpl(b, "EUR"));

        Order o = exampleSProcService.getOrders(i);

        assertEquals(o.amount.getAmount().compareTo(b), 0);
    }
View Full Code Here

Examples of demoapp.domain.Order

            boolean emitted = false;
            Currency eur = Currency.obtain("EUR", dao), usd = Currency.obtain("USD", dao);
            int count = 0;
            for (int i = 0; i < (30 + Math.round(Math.random() * 20)); i++) {
              emitted = !emitted;
                Order o = new Order();
                o.setAmount(new Amount());
                double aux = Math.random();
                try {
                    o.setIdentifier(new I18nText());
                    for (Locale l : supportedLocales) o.getIdentifier().add(l, l + ":" + StringUtils.SHA1(String.valueOf(aux)));
              } catch (Exception e) {};
                o.getAmount().setAmount(aux * 1024 * 1024);
                o.getAmount().setCurrency(aux > 0.5 ? usd : eur);
                o.setOrderNumber(num++);
                o.setPriority(new Rating());
                o.getPriority().setRating(Double.valueOf(Math.round(aux * 10) % 5));
                o.setEmitted(emitted);
                calendar.add(Calendar.DATE, (int) Math.round(aux * 10));
                o.setEmissionDate(calendar.getTime());
                try {
                    o.setClient(aux > 0.5 ? m : f);
                    dao.create(o, false);
                    if (count++ % 25 == 0) {
                        dao.flush();
                        dao.clear();
                    }
                } catch (Exception e) {
                    logger.debug("Failed to add an order: " + o);
                }
            }
            Order o = dao.first(Order.class);
            Document approved = new Document();
            approved.setIdentifier("Seal of approval");
            approved.setMimeType("image/jpeg");
            approved.setCreation(new Date());
            approved.setWidth(300);
            approved.setHeight(315);
            approved.setTemporal(false);
            approved.setLastModified(approved.getCreation());
            try {
                approved.setContents(FileCopyUtils.copyToByteArray(getClass().getResourceAsStream("/seal_approved.jpg")));
                o.setSeal(approved);
                dao.update(o);
            } catch (IOException ex) {
                if (logger.isInfoEnabled()) logger.info("Could not save seal of approval image (thumbnail demo): " + ex.getMessage());
            }
        }
View Full Code Here

Examples of edu.harvard.fas.zfeledy.fiximulator.core.Order

        return executions.getCount();
    }

    public Object getValueAt(int row, int column) {
        Execution execution = executions.getExecution(row);
        Order order = execution.getOrder();
        if (column == 0) return execution.getID();       
        if (column == 1) return order.getClientID();
        if (column == 2) return order.getSide();
        if (column == 3) return order.getSymbol();
        if (column == 4) return execution.getLastShares();
        if (column == 5) return execution.getLastPx();
        if (column == 6) return execution.getCumQty();
        if (column == 7) return execution.getAvgPx();
        if (column == 8) return order.getOpen();
        if (column == 9) return execution.getExecType();
        if (column == 10) return execution.getExecTranType();
        if (column == 11) return execution.getRefID();
        if (column == 12) return execution.isDKd();
        return "";
View Full Code Here

Examples of eu.stratosphere.api.common.operators.Order

        if (this.ordering.getFieldNumber(i) != o.getFieldNumber(i)) {
          return false;
        }
       
        // if this one request no order, everything is good
        final Order oo = o.getOrder(i);
        final Order to = this.ordering.getOrder(i);
        if (oo != Order.NONE) {
          if (oo == Order.ANY) {
            // if any order is requested, any not NONE order is good
            if (to == Order.NONE) {
              return false;
View Full Code Here

Examples of example.model.Order

    @Test
    public void test() throws IOException, SAXException {
        Smooks smooks = new Smooks("smooks-config.xml");
        Pojo pojo = new Pojo(smooks);
        Order order = pojo.filter("input-message.xml");

        assertNotNull(order);
        assertNotNull(order.getHeader());
        assertNotNull(order.getOrderItems());
        assertEquals(2, order.getOrderItems().size());

        assertEquals(1163616328000L, order.getHeader().getDate().getTime());
        assertEquals("Joe", order.getHeader().getCustomerName());
        assertEquals(new Long(123123), order.getHeader().getCustomerNumber());

        OrderItem orderItem = order.getOrderItems().get(0);
        assertEquals(111, orderItem.getProductId());
        assertEquals(new Integer(2), orderItem.getQuantity());

        orderItem = order.getOrderItems().get(1);
        assertEquals(222, orderItem.getProductId());
        assertEquals(new Integer(7), orderItem.getQuantity());
    }
View Full Code Here

Examples of example.srcmodel.Order

    public void test() throws IOException, SAXException {
        byte[] expected_res = StreamUtils.readStream(getClass().getResourceAsStream("expected.txt"));
        Main smooksMain = new Main();
        LineOrder lineOrder;

        lineOrder = smooksMain.runSmooksTransform(new Order());
        assertTrue("Expected:\n" + new String(expected_res) + ". \nGot:\n" + lineOrder, StreamUtils.compareCharStreams(new ByteArrayInputStream(expected_res), new ByteArrayInputStream(lineOrder.toString().getBytes())));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.