コード例 #1
0
  private Library createSimpleLibrary() {
    SourceanalysatorFactory factory = SourceanalysatorFactory.eINSTANCE;
    Library library = factory.createLibrary();

    // create sources
    spiegel = factory.createGeneralSource();
    spiegel.setName("Spiegel");
    library.getGeneralSources().add(spiegel);

    guardian = factory.createGeneralSource();
    guardian.setName("Guardian");
    library.getGeneralSources().add(guardian);

    Source spiegel1 = factory.createSource();
    spiegel1.setUrl("http://www.spon.de/crap");
    spiegel1.setGeneralSource(spiegel);
    library.getSources().add(spiegel1);

    Source spiegel2 = factory.createSource();
    spiegel2.setUrl("http://www.spiegel.de/trash");
    spiegel2.setGeneralSource(spiegel);
    library.getSources().add(spiegel2);

    Source guardian1 = factory.createSource();
    guardian1.setUrl("http://www.guardian.com/article1");
    guardian1.setGeneralSource(guardian);
    library.getSources().add(guardian1);

    // create articles
    Article article1 = factory.createArticle();
    article1.setTitle("F**k the system");
    article1.getSources().add(spiegel1);
    article1.getSources().add(spiegel2);
    article1.getSources().add(guardian1);
    library.getArticles().add(article1);

    Article article2 = factory.createArticle();
    article2.setTitle(ARTICLE_TITLE);
    article2.getSources().add(spiegel2);
    article2.getSources().add(guardian1);
    library.getArticles().add(article2);

    return library;
  }