Package com.simpletwitter.common

Examples of com.simpletwitter.common.SimpleTwitterCriteria


  public static Set<TwitterUser> getAllUserList(TwitterUser currentUser) {
    Set<TwitterUser> result = null;
    if (currentUser != null) {
      DatabaseManager da = DatabaseManager.getInstance();
      SimpleTwitterCriteria criteria = SimpleTwitterCriteria.instance();
      criteria.add(SimpleTwitterCriterion.ne("objId",
          currentUser.getObjId()));
      List<TwitterUser> allObjects = da.getAllObjects(TwitterUser.class,
          criteria);
      result = new HashSet<TwitterUser>(allObjects);
    }
View Full Code Here


    da.updateObject(user);
  }

  public static int getTweetCount(TwitterUser user) {
    DatabaseManager da = DatabaseManager.getInstance();
    SimpleTwitterCriteria criteria = SimpleTwitterCriteria.instance();
    criteria.add(SimpleTwitterCriterion.eq("twitterUser.objId",
        user.getObjId()));
    List<Tweet> allObjects = da.getAllObjects(Tweet.class, criteria);

    return new HashSet<Tweet>(allObjects).size();
  }
View Full Code Here

  }

  public static Set<Tweet> getTweetStream(Long userId,
      Set<TwitterUser> followingIds) {
    DatabaseManager da = DatabaseManager.getInstance();
    SimpleTwitterCriteria criteria = SimpleTwitterCriteria.instance();

    SimpleTwitterCriterion[] criterionList = new SimpleTwitterCriterion[(followingIds
        .size() + 1)];
    criterionList[0] = SimpleTwitterCriterion.eq("twitterUser.objId",
        userId);
    int i = 1;
    for (TwitterUser fuser : followingIds) {
      criterionList[i] = SimpleTwitterCriterion.eq("twitterUser.objId",
          fuser.getObjId());
      i++;
    }
    criteria.add(SimpleTwitterCriterion.or(criterionList));
    List<Tweet> allObjects = da.getAllObjects(Tweet.class, criteria);
    Collections.sort(allObjects, new Comparator<Tweet>() {
      @Override
      public int compare(Tweet o1, Tweet o2) {
        return o2.getDateCreated().compareTo(o1.getDateCreated());
View Full Code Here

  @Test
  public void testcriteria() {
    DatabaseManager da = DatabaseManager.getInstance();
    TwitterUser user = TwitterUserService.getUser(3L);
    SimpleTwitterCriteria criteria = SimpleTwitterCriteria.instance();
    criteria.add(SimpleTwitterCriterion.ne("objId", user.getObjId()));

    List<TwitterUser> allObjects = da.getAllObjects(TwitterUser.class,
        criteria);
    for (TwitterUser twitterUser : allObjects) {
      System.out.println(twitterUser);
View Full Code Here

TOP

Related Classes of com.simpletwitter.common.SimpleTwitterCriteria

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.