Examples of Article


Examples of org.objectweb.speedo.pobjects.inheritance.filterOutOfPK.rdbsequence.Article

    pm.currentTransaction().begin();
    Catalogue cat = null;
    int nbCat = 0;
    Marche mar= null;
    int nbMar = 0;
    Article a;
    for(int idArt=0; idArt<NB_ARTICLE; idArt++) {
      if ((idArt / CATLAOGUE_SIZE) == nbCat) {
        cat = new Catalogue();
        pm.makePersistent(cat);
        nbCat ++;
      }
      if ((idArt / MARCHE_SIZE) == nbMar) {
        mar = new Marche();
        pm.makePersistent(mar);
        nbMar ++;
      }
      if ((idArt % 2) == 0) { //even
        a = new Service(idArt);
      } else { //uneven
        a = new Materiel(idArt);
      }
      pm.makePersistent(a);
      a.setCatalogue(cat);
      mar.getArticles().add(a);
    }
    pm.currentTransaction().commit();

    a = null;
    cat = null;
    mar = null;
    pm.evictAll();

    Extent extent = pm.getExtent(Catalogue.class, true);
    Iterator it = extent.iterator();
    while(it.hasNext()) {
      cat = (Catalogue) it.next();
      logger.log(BasicLevel.DEBUG, "Catalogue " + cat.getId());
      Collection arts = cat.getArticles();
      Iterator articles = arts.iterator();
      while(articles.hasNext()) {
        a = (Article) articles.next();
        logger.log(BasicLevel.DEBUG, "\tArticle " + a.getId());
        Collection mars = a.getMarches();
        Iterator marches = mars.iterator();
        while (marches.hasNext()) {
          mar = (Marche) marches.next();
          logger.log(BasicLevel.DEBUG, "\t\tMarche " + mar.getId());
          Collection m2as = mar.getArticles();
          assertTrue("The article '" + a.getId()
            + "' is not in the collection marche(" + mar.getId()
            + ").articles", m2as.contains(a));
        }
      }
    }
    extent.closeAll();

    a = null;
    cat = null;
    mar = null;
    pm.currentTransaction().begin();
    extent = pm.getExtent(Article.class, true);
    it = extent.iterator();
    while (it.hasNext()) {
      a = (Article) it.next();
      cat = a.getCatalogue();
      if (cat != null) {
        pm.deletePersistent(cat);
      }
      pm.deletePersistentAll(a.getMarches());
      pm.deletePersistent(a);
    }
    pm.currentTransaction().commit();
    pm.close();
  }
View Full Code Here

Examples of org.objectweb.speedo.pobjects.relations.ni_ejboo.Article

        pm.currentTransaction().begin();
        Catalogue cat = null;
        int nbCat = 0;
        Marche mar= null;
        int nbMar = 0;
        Article a;
        for(int idArt=0; idArt<NB_ARTICLE; idArt++) {
            if ((idArt / CATLAOGUE_SIZE) == nbCat) {
                cat = new Catalogue();
                pm.makePersistent(cat);
                nbCat ++;
            }
            if ((idArt / MARCHE_SIZE) == nbMar) {
                mar = new Marche();
                pm.makePersistent(mar);
                nbMar ++;
            }
            a = new Article(idArt);
            pm.makePersistent(a);
            a.setCatalogue(cat);
            mar.getArticles().add(a);
        }
        pm.currentTransaction().commit();

        a = null;
        cat = null;
        mar = null;
        pm.evictAll();

        Extent extent = pm.getExtent(Catalogue.class, true);
        Iterator it = extent.iterator();
        while(it.hasNext()) {
            cat = (Catalogue) it.next();
            logger.log(BasicLevel.DEBUG, "Catalogue " + cat.getId());
            Collection arts = cat.getArticles();
            Iterator articles = arts.iterator();
            while(articles.hasNext()) {
                a = (Article) articles.next();
                logger.log(BasicLevel.DEBUG, "\tArticle " + a.getId());
                Collection mars = a.getMarches();
                Iterator marches = mars.iterator();
                while (marches.hasNext()) {
                    mar = (Marche) marches.next();
                    logger.log(BasicLevel.DEBUG, "\t\tMarche " + mar.getId());
                    Collection m2as = mar.getArticles();
                    assertTrue("The article '" + a.getId()
                        + "' is not in the collection marche(" + mar.getId()
                        + ").articles", m2as.contains(a));
                }
            }
        }
        extent.closeAll();

        pm.currentTransaction().begin();
        Query q = pm.newQuery(Catalogue.class);
        q.setResult("distinct this");
        q.setFilter("articles.contains(a) && a.marches.contains(m) && m.id==MID");
        q.declareParameters("long MID");
        q.declareVariables("Marche m;Article a");
        Collection c = (Collection) q.execute(new Long(mar.getId()));
        Collection expectedResults = Collections.singletonList(cat);
        assertSameCollection("Collection of results is not the one expected", expectedResults, c);
        q.closeAll();
        pm.currentTransaction().commit();
       
        a = null;
        cat = null;
        mar = null;
        pm.currentTransaction().begin();
        extent = pm.getExtent(Article.class, true);
        it = extent.iterator();
        while (it.hasNext()) {
            a = (Article) it.next();
            cat = a.getCatalogue();
            if (cat != null) {
                pm.deletePersistent(cat);
            }
            pm.deletePersistentAll(a.getMarches());
            pm.deletePersistent(a);
        }
        pm.currentTransaction().commit();
        pm.close();
    }   
View Full Code Here

Examples of org.objectweb.speedo.pobjects.sequence.id.inheritance.Article

      pm.getObjectIdClass(Article.class);
      //  get the sequence
      Sequence s = pm.getSequence(ARTICLE_SEQ);
      assertNotNull("Sequence " + ARTICLE_SEQ + " should not be null.", s);
      s.allocate(ADDITIONAL);
      Article articles[] = new Article[ADDITIONAL];
      for (int i = 0; i < ADDITIONAL; i++) {
        if (i%2 == 0) {
          articles[i] = new Service();
        } else {
          articles[i] = new Materiel();
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.demo.ancient.demo.invoice.model.Article

    final Customer customer =
        new Customer("Will", "Snowman", "Mr.", "12 Federal Plaza",
            "12346", "AnOtherTown", "Lilliput");
    final Advertising ad = new Advertising(customer, new Date(), "A-000-0123");

    final Article mainboard = new Article("MB.A02", "ZUSE Z0001 Mainboard", 1299.50f);
    final Article hardDisk = new Article
        ("HD.201", "Sillicium Core HDD", 99.50f,
            "Even the babylonians used stone for long term document archiving, so why shouldn't you?");
    final Article memory = new Article("MEM.30", "ferrit core memory", 119.99f);
    final Article operatingSystem = new Article
        ("OS.36", "Windows XP", 259.99f, "Experience the world of tomorrow by spreading trojans today.");
    ad.addArticle(mainboard, 999.99d);
    ad.addArticle(hardDisk, 79.50);
    ad.addArticle(memory, 99.99f);
    ad.addArticle(operatingSystem, 199.99);
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.demo.ancient.demo.invoice.model.Article

  public Object getValueAt(final int rowIndex, final int columnIndex)
  {
    // just make sure we can access the advertisings by the array
    fillCache();
    final Advertising inv = adPerRow[rowIndex];
    final Article art = articlesPerRow[rowIndex];

    switch (columnIndex)
    {
      case 0:
        return inv;
      case 1:
        return inv.getCustomer().getFirstName();
      case 2:
        return inv.getCustomer().getLastName();
      case 3:
        return inv.getCustomer().getStreet();
      case 4:
        return inv.getCustomer().getTown();
      case 5:
        return inv.getCustomer().getPostalCode();
      case 6:
        return inv.getCustomer().getCountry();
      case 7:
        return inv.getCustomer().getSalutation();
      case 8:
        return inv.getDate();
      case 9:
        return inv.getAdNumber();
      case 10:
        return art.getName();
      case 11:
        return art.getArticleNumber();
      case 12:
        return art.getArticleDetails();
      case 13:
        return new Float(art.getPrice());
      case 14:
        return new Double(reducedPricePerRow[rowIndex]);
    }
    throw new IndexOutOfBoundsException("ColumnIndex");
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.demo.ancient.demo.invoice.model.Article

        new Customer("Will", "Snowman", "Mr.", "12 Federal Plaza",
            "12346", "AnOtherTown", "Lilliput");
    final GregorianCalendar gc = new GregorianCalendar(2000, 10, 23);
    final Invoice invoice = new Invoice(customer, gc.getTime(), "A-000-0123");

    final Article mainboard = new Article("MB.001", "Ancient Mainboard", 199.50f);
    final Article hardDisk = new Article
        ("HD.201", "Very Slow Harddisk", 99.50f, "No warranty");
    final Article memory = new Article("MEM.36", "Dusty RAM modules", 59.99f);
    final Article operatingSystem = new Article
        ("OS.36", "QDOS with C/PM compatibility module", 259.99f, "Serial #44638-444-123");
    invoice.addArticle(mainboard);
    invoice.addArticle(hardDisk);
    invoice.addArticle(memory);
    invoice.addArticle(memory);
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.demo.ancient.demo.invoice.model.Article

  public Object getValueAt(final int rowIndex, final int columnIndex)
  {
    // just make sure we can access the invoices by the array
    fillCache();
    final Invoice inv = invoicePerRow[rowIndex];
    final Article art = articlesPerRow[rowIndex];

    switch (columnIndex)
    {
      case 0:
        return inv;
      case 1:
        return inv.getCustomer().getFirstName();
      case 2:
        return inv.getCustomer().getLastName();
      case 3:
        return inv.getCustomer().getStreet();
      case 4:
        return inv.getCustomer().getTown();
      case 5:
        return inv.getCustomer().getPostalCode();
      case 6:
        return inv.getCustomer().getCountry();
      case 7:
        return inv.getCustomer().getSalutation();
      case 8:
        return inv.getDate();
      case 9:
        return inv.getInvoiceNumber();
      case 10:
        return art.getName();
      case 11:
        return art.getArticleNumber();
      case 12:
        return art.getArticleDetails();
      case 13:
        return new Float(art.getPrice());
      case 14:
        return new Integer(articleCountPerRow[rowIndex]);
    }
    throw new IndexOutOfBoundsException("ColumnIndex is invalid: " + columnIndex);
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.demo.ancient.demo.invoice.model.Article

  private InvoiceTableModel initInvoiceData(final Customer customer)
  {
    final GregorianCalendar gc = new GregorianCalendar(2000, 10, 23);
    final Invoice invoice = new Invoice(customer, gc.getTime(), "A-000-0123");

    final Article mainboard = new Article("MB.001", "Ancient Mainboard", 199.50f);
    final Article hardDisk = new Article
        ("HD.201", "Very Slow Harddisk", 99.50f, "No warranty");
    final Article memory = new Article("MEM.36", "Dusty RAM modules", 59.99f);
    final Article operatingSystem = new Article
        ("OS.36", "QDOS with C/PM compatibility module", 259.99f, "Serial #44638-444-123");
    invoice.addArticle(mainboard);
    invoice.addArticle(hardDisk);
    invoice.addArticle(memory);
    invoice.addArticle(memory);
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.demo.ancient.demo.invoice.model.Article

  private AdvertisingTableModel initAdData(final Customer customer)
  {
    final GregorianCalendar gc = new GregorianCalendar(2000, 10, 23);
    final Advertising ad = new Advertising(customer, gc.getTime(), "A-000-0123");

    final Article mainboard = new Article("MB.A02", "ZUSE Z0001 Mainboard", 1299.50f);
    final Article hardDisk = new Article
        ("HD.201", "Sillicium Core HDD", 99.50f,
            "Even the babylonians used stone for long term document archiving, so why shouldn't you?");
    final Article memory = new Article("MEM.30", "ferrit core memory", 119.99f);
    final Article operatingSystem = new Article
        ("OS.36", "Windows XP", 259.99f, "Experience the world of tomorrow by spreading trojans today.");
    ad.addArticle(mainboard, 999.99d);
    ad.addArticle(hardDisk, 79.50);
    ad.addArticle(memory, 99.99f);
    ad.addArticle(operatingSystem, 199.99);
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.demo.ancient.demo.invoice.model.Article

  private InvoiceTableModel initInvoiceData(final Customer customer)
  {
    final GregorianCalendar gc = new GregorianCalendar(2000, 10, 23);
    final Invoice invoice = new Invoice(customer, gc.getTime(), "A-000-0123");

    final Article mainboard = new Article("MB.001", "Ancient Mainboard", 199.50f);
    final Article hardDisk = new Article
        ("HD.201", "Very Slow Harddisk", 99.50f, "No warranty");
    final Article memory = new Article("MEM.36", "Dusty RAM modules", 59.99f);
    final Article operatingSystem = new Article
        ("OS.36", "QDOS with C/PM compatibility module", 259.99f, "Serial #44638-444-123");
    invoice.addArticle(mainboard);
    invoice.addArticle(hardDisk);
    invoice.addArticle(memory);
    invoice.addArticle(memory);
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.