Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IAttachment


      ICategory category = fFactory.createCategory(null, news4);
      category.setName("Roberts");

      /* Attachment Content */
      INews news5 = createNews(feed, "hungry", "http://www.news.com/news5.html", State.NEW);
      IAttachment attachment = fFactory.createAttachment(null, news5);
      attachment.setLink(new URI("http://www.attachment.com/att1news2.file"));
      attachment.setType("Hasselhoff");

      DynamicDAO.save(feed);

      /* Wait for Indexer */
      waitForIndexer();
View Full Code Here


    INews news2 = createNews(feed, "", "http://www.news.com/news2.html", State.READ);
    INews news3 = createNews(feed, "", "http://www.news.com/news3.html", State.READ);
    createNews(feed, "Hello", "http://www.news.com/news4.html", State.READ); //Used to validate count of results == 1
    createNews(feed, "World", "http://www.news.com/news5.html", State.READ); //Used to validate count of results == 1

    IAttachment attachment1 = fFactory.createAttachment(null, news1);
    IAttachment attachment2 = fFactory.createAttachment(null, news2);
    IAttachment attachment3 = fFactory.createAttachment(null, news3);

    attachment1.setType("hello.mp3");
    attachment2.setType("hello.doc");
    attachment3.setType("foobar.mp3");

    DynamicDAO.save(feed);
    waitForIndexer();

    ISearchField allField = fFactory.createSearchField(IEntity.ALL_FIELDS, fNewsEntityName);
View Full Code Here

    INews news1 = fFactory.createNews(null, feed, new Date());

    assertFalse(CoreUtils.hasAttachment(news1, null));
    assertFalse(CoreUtils.hasAttachment(news1, URI.create("rssowl.org")));

    IAttachment att = fFactory.createAttachment(null, news1);
    att.setLink(URI.create("rssowl.org"));

    assertTrue(CoreUtils.hasAttachment(news1, URI.create("rssowl.org")));
  }
View Full Code Here

  public void testGetAttachmentLinks() throws Exception {
    IFeed feed = fFactory.createFeed(null, new URI("http://www.rssowl.org"));
    INews news1 = fFactory.createNews(null, feed, new Date());
    INews news2 = fFactory.createNews(null, feed, new Date());

    IAttachment att = fFactory.createAttachment(null, news2);

    att = fFactory.createAttachment(null, news2);
    att.setLink(new URI("foobar"));

    INews news3 = fFactory.createNews(null, feed, new Date());

    att = fFactory.createAttachment(null, news3);
    att.setLink(new URI("http://www.rssowl.org/download1.mp3"));

    att = fFactory.createAttachment(null, news3);
    att.setLink(new URI("/download2.mp3"));

    att = fFactory.createAttachment(null, news3);
    att.setLink(new URI("download3.mp3"));

    List<INews> news = new ArrayList<INews>();
    news.add(news1);
    news.add(news2);
    news.add(news3);
View Full Code Here

    boolean root = isRoot(template);
    boolean merged = isMerged(template);
    if (entity instanceof INews) {
      modelEvent = createNewsEvent((INews) entity, template, root, merged);
    } else if (entity instanceof IAttachment) {
      IAttachment attachment = (IAttachment) entity;
      modelEvent = new AttachmentEvent(attachment, root);
    } else if (entity instanceof ICategory) {
      ICategory category = (ICategory) entity;
      modelEvent = new CategoryEvent(category, root);
    } else if (entity instanceof IFeed) {
View Full Code Here

    return news;
  }

  private IAttachment getAttachment(INews news, String link, String type, int length) {
    IAttachment attachment = fFactory.createAttachment(null, news);
    attachment.setLink(URI.create(link));
    attachment.setType(type);
    attachment.setLength(length);

    return attachment;
  }
View Full Code Here

    return getAttachmentDownloadRequest(link, type, length, folder, name, null);
  }

  private DownloadService.DownloadRequest getAttachmentDownloadRequest(String link, String type, int length, File folder, String name, Date date) {
    INews news = getNews("", date);
    IAttachment attachment = getAttachment(news, link, type, length);

    return DownloadService.DownloadRequest.createAttachmentDownloadRequest(attachment, URI.create(link), folder, false, name);
  }
View Full Code Here

    assertEquals(sourceLink, news.getSource().getLink());
  }

  private INews createNews(IFeed feed) {
    INews news = fTypesFactory.createNews(null, feed, createDate());
    IAttachment attachment = fTypesFactory.createAttachment(null, news);
    attachment.setLink(createURI("http://attachmenturi.com"));
    ICategory category = fTypesFactory.createCategory(null, news);
    category.setName("Category name #1");
    news.setAuthor(createPersonMary(news));
    news.setBase(createURI("http://www.someuri.com"));
    news.setComments("One comment");
View Full Code Here

            }
          }

          /* Attachment */
          else if (element instanceof IAttachment) {
            IAttachment attachment = (IAttachment) element;
            URI link = attachment.getLink();
            if (link != null) {
              str.append(i > 0 ? "\n" : "").append(link); //$NON-NLS-1$ //$NON-NLS-2$
              i++;
            }
          }
View Full Code Here

      List<Action> openActions = new ArrayList<Action>(1);
      Set<String> downloadLocations = getDownloadLocations();

      /* Offer Download Action for each */
      for (final Pair<IAttachment, URI> attachmentPair : attachments) {
        IAttachment attachment = attachmentPair.getFirst();
        final String fileName = URIUtils.getFile(attachmentPair.getSecond(), OwlUI.getExtensionForMime(attachment.getType()));
        String size = OwlUI.getSize(attachment.getLength());

        Action action = new Action(size != null ? (NLS.bind(Messages.ApplicationActionBarAdvisor_FILE_SIZE, fileName, size)) : (fileName)) {
          @Override
          public void run() {
            FileDialog dialog = new FileDialog(shellProvider.getShell(), SWT.SAVE);
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.IAttachment

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.