Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.Tube


    try {
      String strIds = (String) request.getParameter("ids");
      String[] ids = strIds.split(",");
      for (int i = 0; i < ids.length; i++) {
        if (!ids[i].isEmpty()) {
          Tube tube = TubeModel.getById(ids[i], false);
          if (tube != null) {
            TubeModel.delete(tube);
          } else {
            TubeSearchEngine.remove(ids[i]);
          }
View Full Code Here


  }

  private String delete(HttpSession session, HttpServletRequest request) {
    try {
      String strId = (String) request.getParameter("id");
      Tube tube = TubeModel.getById(strId, false);
      if (tube != null) {
        TubeModel.delete(tube);
        return "";
      } else {
        return "Action fails ! Tube's not exits or have been deleted !";
View Full Code Here

  }

  private String bump(HttpSession session, HttpServletRequest request) {
    String strId = (String) request.getParameter("id");
    Tube tube = TubeModel.getById(strId, false);
    if (tube != null) {
      tube.setBumpPoint(Calendar.getInstance().getTimeInMillis() / 1000);
      TubeModel.insert(tube);
      return "";
    } else {
      return "Action fails ! Tube's not exits or have been deleted !";
    }
View Full Code Here

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

  @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

        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

        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

            .build(queryString.toString());
        System.out.println(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

        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

        query = Query.newBuilder().setOptions(options)
            .build(queryString.toString());
        docResult = INDEX.search(query);
        if (docResult.getNumberFound() > 0) {
          Tube obj = new Tube();
          for (ScoredDocument scoredDocument : docResult) {
            obj = TubeSearchEngine
                .documentToObjectByReflection(scoredDocument);
            listResult.add(obj);
          }
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.