Package org.hibernate.criterion

Examples of org.hibernate.criterion.DetachedCriteria.createAlias()


            final Boolean isCompleted, final Boolean isScheduled,
            final Boolean isFavourite, final Boolean isPublished,
            final String keyword, final String period, final Date initDate) {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPoll.class);
        criteria.createAlias("tweetOwner", "tweetOwner");
        criteria.add(Restrictions.eq("tweetOwner", account));
        criteria.add(Restrictions.between("createDate", initDate,
             getNextDayMidnightDate()));
        advancedTweetPollSearchOptions(criteria, isCompleted, isScheduled, isFavourite,
                isPublished, keyword, period);
View Full Code Here


            final Boolean isCompleted, final Boolean isScheduled,
            final Boolean isFavourite, final Boolean isPublished,
            final String keyword, final String period) {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPoll.class);
        criteria.createAlias("tweetOwner", "tweetOwner");
        criteria.add(Restrictions.eq("tweetOwner", account));
        advancedTweetPollSearchOptions(criteria, isCompleted, isScheduled, Boolean.TRUE,
                isPublished, keyword, period);
        return (List<TweetPoll>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

            final Boolean isCompleted, final Boolean isScheduled,
            final Boolean isFavourite, final Boolean isPublished,
            final String keyword, final String period) {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPoll.class);
        criteria.createAlias("tweetOwner", "tweetOwner");
        criteria.add(Restrictions.eq("tweetOwner.uid", userId));
        // To retrieve all and only scheduled Tweetpoll period should be = ALLTIME
        advancedTweetPollSearchOptions(criteria, isCompleted, isScheduled, isFavourite,
                isPublished, keyword, period);
        return (List<TweetPoll>) filterByMaxorStart(criteria, maxResults, start);
View Full Code Here

    @SuppressWarnings("unchecked")
    public List<TweetPoll> retrievePublishedUnpublishedTweetPoll(final Account account,
            final Integer maxResults, final Integer start, final Boolean isPublished) {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPoll.class);
        criteria.createAlias("tweetOwner", "tweetOwner");
        criteria.add(Restrictions.eq("publishTweetPoll", isPublished));
        criteria.add(Restrictions.eq("tweetOwner", account));
        return (List<TweetPoll>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public List<TweetPoll> retrieveCompletedTweetPoll(final Account account,
            final Integer maxResults, final Integer start, final Boolean isComplete) {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPoll.class);
        criteria.createAlias("tweetOwner", "tweetOwner");
        criteria.add(Restrictions.eq("publishTweetPoll", Boolean.TRUE));
        criteria.add(Restrictions.eq("tweetOwner", account));
        criteria.add(Restrictions.eq("completed",isComplete));
        return (List<TweetPoll>) filterByMaxorStart(criteria, maxResults, start);
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public TweetPoll getTweetPollByIdandSlugName(final Long tweetPollId,
            final String slugName) throws UnsupportedEncodingException {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPoll.class);
        criteria.createAlias("question", "q");
        criteria.add(Restrictions.eq("tweetPollId", tweetPollId));
        criteria.add(Restrictions.eq("q.slugQuestion",
                     RestFullUtil.encodeUTF8(slugName)));
        return (TweetPoll) DataAccessUtils.uniqueResult(getHibernateTemplate()
                .findByCriteria(criteria));
View Full Code Here

            final TypeSearchResult itemType,
            final List<SocialProvider> splist,
            final List<SocialAccount> socialAccounts) {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPollSavedPublishedStatus.class);
        criteria.createAlias("socialAccount", "socialAccount");
        if (itemType.equals(TypeSearchResult.TWEETPOLL)) {
            criteria.add(Restrictions.eq("tweetPoll", tweetPoll));
            criteria.add(Restrictions.isNotNull("tweetId"));
            criteria.add(Restrictions.eq("status", Status.SUCCESS));
            if (splist.size() > 0) {
View Full Code Here

    @SuppressWarnings("unchecked")
    public List searchSocialLinksbyType(
            final TweetPoll tweetPoll, final Poll poll, final TypeSearchResult itemType, final List<SocialProvider> splist, final List<SocialAccount> socialAccounts) {
        final DetachedCriteria criteria = DetachedCriteria
                .forClass(TweetPollSavedPublishedStatus.class);
        criteria.createAlias("socialAccount", "socialAccount");

        if (itemType.equals(TypeSearchResult.TWEETPOLL)) {
            criteria.add(Restrictions.eq("tweetPoll", tweetPoll));
            // Revisar bien estos valores porque sino encuentra nada va a evaluarlos y regresara valores
            criteriaSearchSocialLinksByType(criteria, splist, socialAccounts);
View Full Code Here

     * (java.lang.Long, java.util.Date, java.util.Date)
     */
    public Long getMaxTweetPollLikeVotesbyUser(final Long userId) {
        DetachedCriteria criteria = DetachedCriteria.forClass(TweetPoll.class);
        criteria.setProjection(Projections.max("likeVote"));
        criteria.createAlias("editorOwner", "editorOwner");
        criteria.add(Restrictions.eq("editorOwner.uid", userId));
        @SuppressWarnings("unchecked")
        List results = getHibernateTemplate().findByCriteria(criteria);
        return (Long) (results.get(0) == null ? 0 : results.get(0));
    }
View Full Code Here

                .forClass(TweetPollSavedPublishedStatus.class);
        criteria.setProjection(Projections.rowCount());
        if (itemType.equals(TypeSearchResult.TWEETPOLL)) {
            criteria.add(Restrictions.eq("tweetPoll", tweetPoll));
        } else if (itemType.equals(TypeSearchResult.SURVEY)) {
            criteria.createAlias("survey", "survey");
            criteria.add(Restrictions.eq("survey", survey));
            // criteria.addOrder(Order.desc("survey.createdAt"));
        } else if (itemType.equals(TypeSearchResult.POLL)) {
            criteria.add(Restrictions.eq("poll", poll));
            // criteria.addOrder(Order.desc("poll.createdAt"));
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.