Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.Tube


  @SuppressWarnings("unchecked")
  public static Tube getById(String id) {
    try {
      initCache();
      String prefix = cachePrefix + "id_" + id;
      Tube obj = new Tube();
      if (cache != null && cache.containsKey(prefix)) {
        obj = (Tube) cache.get(prefix);
      } else {
        QueryOptions options = QueryOptions.newBuilder().setLimit(1)
            .build();
        Query query = Query.newBuilder().setOptions(options)
            .build("id:\"" + id + "\"");
        Results<ScoredDocument> docResult = INDEX.search(query);
        if (docResult.getNumberFound() > 0) {
          for (ScoredDocument scoredDocument : docResult) {
            obj = TubeSearchEngine
                .documentToObjectByReflection(scoredDocument);
          }
        }
        if (obj != null && obj.getId().length() > 0) {
          cache.put(prefix, obj);
        } else {
          obj = null;
        }
      }
View Full Code Here


          .build(queryString.toString());
      Results<ScoredDocument> docResult = INDEX.search(query);
      totalResult = (int) docResult.getNumberReturned();
      totalReturn = (int) docResult.getNumberReturned();
      if (docResult.getNumberFound() > 0) {
        Tube obj = new Tube();
        for (ScoredDocument scoredDocument : docResult) {
          obj = TubeSearchEngine
              .documentToObjectByReflection(scoredDocument);
          listResult.add(obj);
        }
View Full Code Here

      query = Query.newBuilder().setOptions(options)
          .build(queryString.toString());
      docResult = INDEX.search(query);
      totalReturn = (int) docResult.getNumberReturned();
      if (docResult.getNumberFound() > 0) {
        Tube obj = new Tube();
        for (ScoredDocument scoredDocument : docResult) {
          obj = TubeSearchEngine
              .documentToObjectByReflection(scoredDocument);
          listResult.add(obj);
        }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Tube getById(String id, boolean fromCache) {
    try {
      init();
      Tube obj = new Tube();
      String prefix = cachePrefix + "id_" + id;
      if (cache != null && cache.containsKey(prefix) && fromCache) {
        obj = (Tube) cache.get(prefix);
      } else {
        try {
View Full Code Here

            if (i == (itemPerPage + startPoint)) {
              break;
            }
            String id = tag.getListTubeId().get(i).getValue();
            System.out.println(id);
            Tube tub = TubeModel.getByTubeId(id);
            if (tub != null) {
              result.add(tub);
            }
          }
        } else {
          page = 1;
          for (int i = 0; i < tag.getListTubeId().size(); i++) {
            if (i == itemPerPage) {
              break;
            }
            String id = tag.getListTubeId().get(i).getValue();
            Tube tub = TubeModel.getByTubeId(id);
            if (tub != null) {
              result.add(tub);
            }
          }
        }
View Full Code Here

    service.setConnectTimeout(2000);
    VideoFeed videoFeed;
    try {
      videoFeed = service.getFeed(new URL(feedUrl), VideoFeed.class);
      for (VideoEntry videoEntry : videoFeed.getEntries()) {
        Tube tub = new Tube();
        tub.transformHalfVideoEntry(videoEntry);
        tub.setStatus(2);
        tub.setUpdated(Calendar.getInstance().getTime());
        listTube.add(new Text(tub.toString()));
        System.out.println(tub.getTubeId());
        if (TubeModel.getByTubeId(tub.getTubeId()) == null) {
          listSave2DB.add(tub);
          System.out.println(tub.getTitle() + " ready to save !");
        }
       
      }
      if (listSave2DB.size() > 0) {
        TubeModel.addAll(listSave2DB);
View Full Code Here

      result = new ArrayList<Tube>();
      List<String> cachedTubes = (List<String>) cache
          .get("cachedMostViewToday");
      if (cachedTubes.size() > 0) {
        for (String stringChannel : cachedTubes) {
          Tube tub = new Tube();
          tub.transformString(stringChannel);
          result.add(tub);
        }
      }
    }
    return result;
View Full Code Here

      result = new ArrayList<Tube>();
      List<String> cachedTubes = (List<String>) cache
          .get("cachedMostViewAllTime");
      if (cachedTubes.size() > 0) {
        for (String stringChannel : cachedTubes) {
          Tube tub = new Tube();
          tub.transformString(stringChannel);
          result.add(tub);
        }
      }
    }
    return result;
View Full Code Here

      result = new ArrayList<Tube>();
      List<String> cachedTubes = (List<String>) cache
          .get("cachedPopular");
      if (cachedTubes.size() > 0) {
        for (String stringChannel : cachedTubes) {
          Tube tub = new Tube();
          tub.transformString(stringChannel);
          result.add(tub);
        }
      }
    }
    return result;
View Full Code Here

    if (cache != null && cache.containsKey("cachedRecent")) {
      result = new ArrayList<Tube>();
      List<String> cachedTubes = (List<String>) cache.get("cachedRecent");
      if (cachedTubes.size() > 0) {
        for (String stringChannel : cachedTubes) {
          Tube tub = new Tube();
          tub.transformString(stringChannel);
          result.add(tub);
        }
      }
    }
    return result;
View Full Code Here

TOP

Related Classes of com.tubeonfire.entity.Tube

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.