What were you thinking of for the LiveAPIQueryClass? I was thinking of
moving all of the methods to construct a query string, make a query, and
parse out the JSON into a LiveUtils class used by all the LiveDaos. This
would leave the individual LiveDao classes responsible for the things that
can't be shared between them, including passing in parameters for the query
and creating the appropriate object (link, page, etc.) out of the parsed
JSON.


On Fri, Nov 8, 2013 at 4:47 PM, Shilad Sen <notifications@github.com> wrote:

> In
> wikAPIdia-core/src/main/java/org/wikapidia/core/dao/live/LocalCategoryMemberLiveDao.java:
>
> > +        Collection<Integer> articleIds = getCategoryMemberIds(localCategory);
> > +        LocalArticleLiveDao dao = new LocalArticleLiveDao();
> > +        return dao.getByIds(localCategory.getLanguage(), articleIds);
> > +    }
> > +
> > +    /**
> > +     *
> > +     * @param language the language of the article
> > +     * @param articleId the articles's ID
> > +     * @return a collection of categoryids of all the categories this article belongs to
> > +     * @throws DaoException
> > +     */
> > +    public Collection<Integer> getCategoryIds(Language language, int articleId) throws DaoException {
> > +        String http = new String("http://");
> > +        String host = new String(".wikipedia.org");
> > +        String query = new String("/w/api.php?action=query&prop=categories&format=json&pageids=");
>
> I've been thinking more about this. A better design is to create a
> LiveAPIQuery class that uses a builder pattern, and shift the logic into
> that class. Right now the logic you have is simple, but it *will* become
> more complex in the future. It's also almost always better to consolidate
> redundant code.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/shilad/wikAPIdia/pull/109/files#r7541302>
> .
>