Package org.agoncal.training.javaee6

Examples of org.agoncal.training.javaee6.Item


    Document doc = _docBuilder.newDocument();
    Element elem = doc.createElement("item-notes");
    Text textValue = doc.createTextNode("SalesID# 3445");
    elem.appendChild(textValue);
   
    Item item = pBuilder.createShoppingItem(itemName, itemDesc, quantity,
      unitPrice, null, currency, elem);
   
    assertEquals(itemName, item.getItemName());
    assertEquals(itemDesc, item.getItemDescription());
    assertEquals(quantity, item.getQuantity());
    assertEquals(4999.99F, item.getUnitPrice().getValue().floatValue());
    assertEquals(currency, item.getUnitPrice().getCurrency());
    assertEquals(elem, item.getMerchantPrivateItemData().getAny());
  }
View Full Code Here


    String[] itemDescs = new String[] {"mp3 player", "podcast subscription"};
    int[] quantities = new int[] {2, 1};
    float[] prices = new float[] {249.99F, 3.99F};
    List<Item> itemList = new ArrayList<Item>();
    for (int i = 0; i < itemNames.length; i++) {
      Item cartItem = pBuilder.createShoppingItem(itemNames[i], itemDescs[i],
        quantities[i], prices[i], null, null, null);
      itemList.add(cartItem);
    }
   
    return itemList;
View Full Code Here

  public Item createShoppingItem(String itemName, String itemDesc,
      int quantity, float unitPrice, String currency,
      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
    Money money = createMoney(unitPrice, currency);
    Item item = _objectFact.createItem();
    item.setItemName(itemName);
    item.setItemDescription(itemDesc);
    item.setQuantity(quantity);
    item.setUnitPrice(money);

    if (taxTableSelector != null) {
      item.setTaxTableSelector(taxTableSelector);
    }
   
    if (privateItemData != null) {
      AnyType anyType = _objectFact.createAnyType();
      anyType.setAny(privateItemData);
      item.setMerchantPrivateItemData(anyType);
    }
   
    return item;
  }
View Full Code Here

      String taxTableSelector, Element privateItemData)
      throws ProtocolException {
   
    try {
      Money money = createMoney(unitPrice, currency);
      Item item = _objectFact.createItem();
      item.setItemName(itemName);
      item.setItemDescription(itemDesc);
      item.setQuantity(quantity);
      item.setUnitPrice(money);
 
      if (taxTableSelector != null) {
        item.setTaxTableSelector(taxTableSelector);
      }
     
      if (privateItemData != null) {
        AnyType anyType = _objectFact.createAnyType();
        anyType.setAny(privateItemData);
        item.setMerchantPrivateItemData(anyType);
      }
     
      return item;
    } catch (JAXBException jaxbEx) {
      throw new ProtocolException(jaxbEx.getMessage());
View Full Code Here

    Document doc = _docBuilder.newDocument();
    Element elem = doc.createElement("item-notes");
    Text textValue = doc.createTextNode("SalesID# 3445");
    elem.appendChild(textValue);
   
    Item item = pBuilder.createShoppingItem(itemName, itemDesc, quantity,
      unitPrice, null, currency, elem);
   
    assertEquals(itemName, item.getItemName());
    assertEquals(itemDesc, item.getItemDescription());
    assertEquals(quantity, item.getQuantity());
    assertEquals(4999.99F, item.getUnitPrice().getValue().floatValue(), 0);
    assertEquals(currency, item.getUnitPrice().getCurrency());
    assertEquals(elem, item.getMerchantPrivateItemData().getAny());
  }
View Full Code Here

    String[] itemDescs = new String[] {"mp3 player", "podcast subscription"};
    int[] quantities = new int[] {2, 1};
    float[] prices = new float[] {249.99F, 3.99F};
    List itemList = new ArrayList();
    for (int i = 0; i < itemNames.length; i++) {
      Item cartItem = pBuilder.createShoppingItem(itemNames[i], itemDescs[i],
        quantities[i], prices[i], null, null, null);
      itemList.add(cartItem);
    }
   
    return itemList;
View Full Code Here

      FilePersistenceTooBigForSerializationException {

    IFilePersistence filePersistence = createFilePersistence(true);
    IDataAccessSession session = filePersistence.createDataAccessSession();
    session.open();
    Item item = new Item(0, "value");
    session.setObject("key", item);
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();

    filePersistence = createFilePersistence(false);
    session = filePersistence.createDataAccessSession();
    session.open();
    item = (Item) session.getObject("key");
    assertEquals("bad state", 0, item.getIdentifier());
    assertEquals("bad state", "value", item.getValue());
    session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
    filePersistence.close();
  }
View Full Code Here

    // ======================================
    // =          Business methods          =
    // ======================================

    private void createBooks() {
        itemEJB.createBook(new Book("The Hitchhiker's Guide to the Galaxy", 23.99f, "Science fiction comedy book", 354, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("Harry Potter and the Goblet of Fire", 19.79f, "Science fiction (Book 4)", 734, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("The Elements of Style", 6.64f, "A masterpiece in the art of clear and concise writing.", 105, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("Harry Potter And The Order Of The Phoenix", 9.35f, "Science fiction (Book 1)", 870, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("The Difference Between God and Larry Ellison", 11.99f, "God Doesn't Think He's Larry Ellison", 420, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("The Children of Hurin", 17.16f, "The first complete book by J.R.R. Tolkien in three decades", 313, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("The Da Vinci Code", 17.79f, "Thriller", 454, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("La carte et le territoire", 24.99f, "Prix Goncourt 2010", 428, Boolean.FALSE, Language.FRENCH));
        itemEJB.createBook(new Book("Une forme de vie", 18.99f, "Amelie Nothomb", 168, Boolean.FALSE, Language.FRENCH));
        itemEJB.createBook(new Book("To Kill a Mockingbird", 5.99f, "American classic", 281, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("Fahrenheit 451", 7.99f, "Science fiction", 208, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("Lolita", 14.99f, "Nabovok masterpiece", 368, Boolean.TRUE, Language.RUSSIAN));
        itemEJB.createBook(new Book("A Midsummer Night's Dream", 14.99f, "Shakespeare masterpiece", 288, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("I bastioni del coraggio", 18.99f, "Anno domini 1548. Una grande storia d'amore, ...", 457, Boolean.FALSE, Language.ITALIAN));
        itemEJB.createBook(new Book("Harjunpaa ja pahan pappi", 32.49f, "Finns read crime novels", 300, Boolean.FALSE, Language.FINISH));
        itemEJB.createBook(new Book("El ingenioso hidalgo don Quijote de la Mancha", 13.99f, "Classical Don Quijote", 108, Boolean.TRUE, Language.SPANISH));
        itemEJB.createBook(new Book("The Lord of the Rings", 50.4f, "Science fiction comedy book", 1216, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("Java EE 6 with GlassFish 3", 31.49f, "Java!", 354, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("Heidis Lehr- und Wanderjahre", 68f, "Inhalt: Die Heidi-Bucher erzahlen...", 160, Boolean.TRUE, Language.DEUTSCH));
        itemEJB.createBook(new Book("l Nome della Rosa", 34.99f, "Science fiction comedy book", 354, Boolean.FALSE, Language.ITALIAN));
        logger.info("&&&&&&&&&&&&&& Inserted " + itemEJB.findAllBooks().size() + " Books");
    }
View Full Code Here

    public String doCreateBook() {
        logger.fine("ItemController.doCreateBook():" + book);
        book.setTags(transformToList(tags));
        itemEJB.createBook(book);
        bookList = itemEJB.findAllBooks();
        book = new Book();
        return "newBook.xhtml";
    }
View Full Code Here

    // ======================================
    // =          Business methods          =
    // ======================================

    private void createBooks() {
        itemEJB.createBook(new Book("The Hitchhiker's Guide to the Galaxy", 23.99f, "Science fiction comedy book", 354, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("Harry Potter and the Goblet of Fire", 19.79f, "Science fiction (Book 4)", 734, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("The Elements of Style", 6.64f, "A masterpiece in the art of clear and concise writing.", 105, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("Harry Potter And The Order Of The Phoenix", 9.35f, "Science fiction (Book 1)", 870, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("The Difference Between God and Larry Ellison", 11.99f, "God Doesn't Think He's Larry Ellison", 420, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("The Children of Hurin", 17.16f, "The first complete book by J.R.R. Tolkien in three decades", 313, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("The Da Vinci Code", 17.79f, "Thriller", 454, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("La carte et le territoire", 24.99f, "Prix Goncourt 2010", 428, Boolean.FALSE, Language.FRENCH));
        itemEJB.createBook(new Book("Une forme de vie", 18.99f, "Amelie Nothomb", 168, Boolean.FALSE, Language.FRENCH));
        itemEJB.createBook(new Book("To Kill a Mockingbird", 5.99f, "American classic", 281, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("Fahrenheit 451", 7.99f, "Science fiction", 208, Boolean.FALSE, Language.ENGLISH));
        itemEJB.createBook(new Book("Lolita", 14.99f, "Nabovok masterpiece", 368, Boolean.TRUE, Language.RUSSIAN));
        itemEJB.createBook(new Book("A Midsummer Night's Dream", 14.99f, "Shakespeare masterpiece", 288, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("I bastioni del coraggio", 18.99f, "Anno domini 1548. Una grande storia d'amore, ...", 457, Boolean.FALSE, Language.ITALIAN));
        itemEJB.createBook(new Book("Harjunpaa ja pahan pappi", 32.49f, "Finns read crime novels", 300, Boolean.FALSE, Language.FINISH));
        itemEJB.createBook(new Book("El ingenioso hidalgo don Quijote de la Mancha", 13.99f, "Classical Don Quijote", 108, Boolean.TRUE, Language.SPANISH));
        itemEJB.createBook(new Book("The Lord of the Rings", 50.4f, "Science fiction comedy book", 1216, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("Java EE 6 with GlassFish 3", 31.49f, "Java!", 354, Boolean.TRUE, Language.ENGLISH));
        itemEJB.createBook(new Book("Heidis Lehr- und Wanderjahre", 68f, "Inhalt: Die Heidi-Bucher erzahlen...", 160, Boolean.TRUE, Language.DEUTSCH));
        itemEJB.createBook(new Book("l Nome della Rosa", 34.99f, "Science fiction comedy book", 354, Boolean.FALSE, Language.ITALIAN));
        logger.info("&&&&&&&&&&&&&& Inserted " + itemEJB.findAllBooks().size() + " Books");
    }
View Full Code Here

TOP

Related Classes of org.agoncal.training.javaee6.Item

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.