Examples of StandardArticle


Examples of com.salas.bb.domain.StandardArticle

//                    e.printStackTrace();
//                }
//            }
//        }

        StandardArticle newArticle = new StandardArticle(html);
        newArticle.setAuthor(article.getAuthor());
        newArticle.setFeed(article.getFeed());
        newArticle.setID(article.getID());
        newArticle.setLink(article.getLink());
        newArticle.setPublicationDate(article.getPublicationDate());
        newArticle.setTitle(article.getTitle());

        return newArticle;
    }
View Full Code Here

Examples of com.salas.bb.domain.StandardArticle

    public void testCaseInsensitiveMatching()
    {
        DirectFeed feed = new DirectFeed();
        feed.setBaseTitle("The Title");

        StandardArticle article = new StandardArticle("");
        article.setTitle("some article");

        feed.appendArticle(article);

        assertTrue(FeedTitleProperty.INSTANCE.match(article, StringContainsCO.INSTANCE, "title"));
    }
View Full Code Here

Examples of com.salas.bb.domain.StandardArticle

    /**
     * Tests matching today's articles
     */
    public void testMatchingTodaysArticles()
    {
        StandardArticle todaysArticle = createTodaysArticle();
        StandardArticle yesterdaysArticle = createYesterdaysArticle();

        assertTrue(articleDateProperty.match(todaysArticle, DateMatchCO.INSTANCE,
            IDates.VALUE_TODAY));
        assertFalse(articleDateProperty.match(yesterdaysArticle, DateMatchCO.INSTANCE,
            IDates.VALUE_TODAY));
View Full Code Here

Examples of com.salas.bb.domain.StandardArticle

    /**
     * Tests matching yesterday's articles
     */
    public void testMatchingYesterdayArticles()
    {
        StandardArticle todaysArticle = createTodaysArticle();
        StandardArticle yesterdaysArticle = createYesterdaysArticle();

        assertFalse(articleDateProperty.match(todaysArticle, DateMatchCO.INSTANCE,
            IDates.VALUE_YESTERDAY));
        assertTrue(articleDateProperty.match(yesterdaysArticle, DateMatchCO.INSTANCE,
            IDates.VALUE_YESTERDAY));
View Full Code Here

Examples of com.salas.bb.domain.StandardArticle

            IDates.VALUE_YESTERDAY));
    }

    public void testBeforeToday()
    {
        StandardArticle todaysArticle = createTodaysArticle();
        StandardArticle yesterdaysArticle = createYesterdaysArticle();

        assertFalse(articleDateProperty.match(todaysArticle, DateBeforeCO.INSTANCE,
            IDates.VALUE_TODAY));
        assertTrue(articleDateProperty.match(yesterdaysArticle, DateBeforeCO.INSTANCE,
            IDates.VALUE_TODAY));
View Full Code Here

Examples of com.salas.bb.domain.StandardArticle

        return createArticle(System.currentTimeMillis());
    }

    private StandardArticle createArticle(long time)
    {
        StandardArticle todaysArticle = new StandardArticle("");
        todaysArticle.setPublicationDate(new Date(time));
        return todaysArticle;
    }
View Full Code Here

Examples of com.salas.bb.domain.StandardArticle

        DirectFeed feed = new DirectFeed();
        feed.setCustomTitle("F1 <b>Title</b>");
        feed.setXmlURL(new URL("http://f 1/"));

        // Sample article
        StandardArticle a1 = article(feed, 1, date);
        StandardArticle a2 = article(feed, 2, date);

        // Sample single-article set
        LinkedHashSet<IArticle> set = new LinkedHashSet<IArticle>();
        set.add(a1);
        singleArticle = set;
View Full Code Here

Examples of com.salas.bb.domain.StandardArticle

     * @throws MalformedURLException if URL is invalid (never).
     */
    private StandardArticle article(DirectFeed feed, int id, Date date)
        throws MalformedURLException
    {
        StandardArticle a = new StandardArticle("A" + id + " <i>Text</i>");
        a.setTitle("A" + id + " <b>Title</b>");
        a.setPublicationDate(date);
        a.setLink(new URL("http://a " + id + "/"));
        feed.appendArticle(a);
        return a;
    }
View Full Code Here

Examples of com.salas.bb.domain.StandardArticle

        if (feed == null) throw new IllegalStateException(MSG_NO_FEED);
        if (feed.getID() == -1L) throw new IllegalStateException(MSG_TRANSIENT_FEED);
        if (!(article instanceof StandardArticle))
            throw new IllegalArgumentException(MSG_UNSUPPORTED_TYPE);

        StandardArticle standardArticle = (StandardArticle)article;
        PreparedStatement stmt = context.getPreparedStatement(
            "INSERT INTO ARTICLES (AUTHOR, TEXT, PLAINTEXT, SIMPLEMATCHKEY, PUBLICATIONDATE, TITLE, " +
                "SUBJECT, READ, PINNED, LINK, FEEDID) " +
            "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

        try
        {
            stmt.setString(1, standardArticle.getAuthor());
            stmt.setString(2, standardArticle.getText());
            stmt.setString(3, standardArticle.getPlainText());
            stmt.setString(4, standardArticle.getSimpleMatchKey());
            Date publicationDate = standardArticle.getPublicationDate();
            stmt.setLong(5, publicationDate == null ? -1L : publicationDate.getTime());
            stmt.setString(6, standardArticle.getTitle());
            stmt.setString(7, standardArticle.getSubject());
            stmt.setBoolean(8, standardArticle.isRead());
            stmt.setBoolean(9, standardArticle.isPinned());
            URL link = standardArticle.getLink();
            stmt.setString(10, link == null ? null : link.toString());
            stmt.setLong(11, feed.getID());
            stmt.executeUpdate();

            // Get ID
View Full Code Here

Examples of com.salas.bb.domain.StandardArticle

        // NOTE: We intentionally don't update text and plaintext fields because
        // a) they never change
        // b) there's the deadlock between LazyArticle.getPlainText() and AbstractArticle.setRead()
        //    being called from different threads
        StandardArticle standardArticle = (StandardArticle)article;
        PreparedStatement stmt = context.getPreparedStatement("UPDATE ARTICLES SET " +
            "AUTHOR=?, SIMPLEMATCHKEY=?, PUBLICATIONDATE=?, TITLE=?, SUBJECT=?, READ=?," +
            "PINNED=?, LINK=? WHERE ID=?");

        try
        {
            stmt.setString(1, standardArticle.getAuthor());
            stmt.setString(2, standardArticle.getSimpleMatchKey());
            Date publicationDate = standardArticle.getPublicationDate();
            stmt.setLong(3, publicationDate == null ? -1L : publicationDate.getTime());
            stmt.setString(4, standardArticle.getTitle());
            stmt.setString(5, standardArticle.getSubject());
            stmt.setBoolean(6, standardArticle.isRead());
            stmt.setBoolean(7, standardArticle.isPinned());
            URL link = standardArticle.getLink();
            stmt.setString(8, link == null ? null : link.toString());
            stmt.setLong(9, article.getID());

            int rows = stmt.executeUpdate();
            if (rows == 0)
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.