Examples of News


Examples of com.echonest.api.v4.News

        }

        System.out.println(" =========  news ======== ");
        List<News> newsList = artist.getNews();
        for (int i = 0; i < newsList.size(); i++) {
            News news = newsList.get(i);
            news.dump();
        }

        System.out.println(" =========  reviews ======== ");
        List<Review> reviews = artist.getReviews();
        for (int i = 0; i < reviews.size(); i++) {
View Full Code Here

Examples of com.fusesource.examples.activemq.websocket.marketdata.News

                    }
                }

                Iterator<News> ii = newsList.iterator();
                while (ii.hasNext()) {
                    News news = ii.next();
                    Message msg = createNewsMessage(session, news);
                    msg.setStringProperty("symbol", news.getSymbol());
                    newsProducer.send(msg);
                    try {
                        Thread.sleep(500);
                    } catch (InterruptedException e) {
                    }
View Full Code Here

Examples of com.gracevallorani.jpa.entities.News

      Model model,
      @RequestParam(value = "id", required = false, defaultValue = "0") int id) {
    form.setId(id);
   
    if (id != 0) {
      News news;
     
      IJpaFactory<News> strategy = new NewsFactory(new J2eeConfig());
     
      try {
        news = strategy.get(id);           
      } finally {
        strategy.close();
      }

      form.setBrowseout(news.isBrowseout());
      form.setContent(news.getContent());
      form.setStamp(news.getStamp());
      form.setTitle(news.getTitle());
      form.setUrl(news.getUrl());
    }
   
    return JSP_EDIT;
  }
View Full Code Here

Examples of com.lgx8.management.entities.News

  public ModelAndView newsDel(HttpServletRequest request,HttpServletResponse response){
    //准备删除新闻公告规则
        String[] newsIds = this.getKeyStoreArray(request);
        if (newsIds.length > 0) {
        for (int i = 0 ; i < newsIds.length ; i++) {
          News news = newsDao.findById(StrUtil.parseInt(newsIds[i]));
          newsDao.delete(news);
        }
      }
    this.clearKeyStore(request);
    return null;
View Full Code Here

Examples of com.multysite.entity.News

      throws IOException {
    try {
      String action = request.getParameter("action");
      if (action != null && action.equals("delete")) {
        String alias = request.getParameter("alias");
        News obj = NewsModel.getById(alias);
        if (obj != null) {
          NewsModel.delete(obj);
          response.getWriter().println("Done");
        } else {
          response.getWriter().println("This News is not exits");
View Full Code Here

Examples of com.multysite.entity.News

      throws IOException {
    try {
      resp.setCharacterEncoding("utf-8");
      if (!NamespaceManager.get().equals(Setting.getGeneralNamespace())) {
        String alias = req.getParameter("alias");
        News obj = NewsModel.getById(alias);

        if (obj != null) {
          CategoryModel cateModel = new CategoryModel();
          cateModel.prepareAll();
          if (cateModel.getListResult().size() == 0) {
View Full Code Here

Examples of com.multysite.entity.News

    BlobstoreService blobService = BlobstoreServiceFactory
        .getBlobstoreService();
    ImagesService imageService = ImagesServiceFactory.getImagesService();
    try {
      String alias = req.getParameter("alias");
      News obj = NewsModel.getById(alias);
      if (obj != null) {
        String action = req.getParameter("action");
        String title = req.getParameter("title");
        String content = req.getParameter("content");
        String source = req.getParameter("source");
        String category = req.getParameter("category");
        String tags = req.getParameter("tags");
        if (action != null && action.equals("edit")) {
          obj.setTitle(title);
          obj.setAlias(StringHelper.replaceVietnamese(title));
          obj.setContent(content);
          obj.setSource(source);

          /*
           * process thumb image
           */
          try {
            Map<String, List<BlobKey>> blobs = blobService
                .getUploads(req);
            List<BlobKey> blobKeys = blobs.get("img");
            if (blobKeys != null && blobKeys.size() > 0) {
              for (BlobKey blobKey : blobKeys) {
                byte[] arr = blobService.fetchData(blobKey, 0,
                    20);
                if (arr.length > 0) {
                  obj.setThumb(imageService
                      .getServingUrl(blobKey));
                }
              }
            }
          } catch (Exception e) {

          }

          /*
           * process category
           */
          Category cate = CategoryModel.getById(category);
          if (cate != null) {
            obj.setCategory(cate.getTitle());
            obj.setCategoryAlias(cate.getAlias());
          }
          /*
           * process tag
           */
          try {
            ArrayList<String> listTag = new ArrayList<String>();
            String[] splitTag = tags.split(",");
            for (String string : splitTag) {
              String tagAlias = StringHelper
                  .replaceVietnamese(string.trim());
              Tag tag = TagModel.getById(tagAlias);
              if (tag != null) {
                List<News> listNews = tag.recoverListNews();
                for (int i = 0; i < listNews.size(); i++) {
                  if (listNews.get(i).getAlias()
                      .equals(obj.getAlias())) {
                    listNews.remove(i);
                  }
                }
                listNews.add(obj);
                tag.tranformListNews(listNews);
                TagModel.insert(tag);
              } else {
                tag = new Tag();
                tag.setAlias(tagAlias);
                tag.setTitle(string);
                List<News> listNews = new ArrayList<News>();
                listNews.add(obj);
                tag.tranformListNews(listNews);
                TagModel.insert(tag);
              }
              String objTag = tagAlias + "," + string;
              listTag.add(objTag);
            }
            obj.setTags(listTag);
          } catch (Exception e) {

          }
          NewsModel.insert(obj);
          resp.sendRedirect("/admin/news/edit?alias="
              + obj.getAlias());
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

Examples of com.multysite.entity.News

      throws IOException {
    try {
      resp.setContentType("text/html");
      resp.setCharacterEncoding("utf-8");

      News obj = new News();
      String title = req.getParameter("post[title]");
      String category = req.getParameter("post[tag]");
      String content = req.getParameter("post[content]");

      // title + alias
      obj.setTitle(title);
      obj.setAlias(StringHelper.replaceVietnamese(title));

      // category + category Alias
      Document doc = Jsoup.parse(content);
      if (category.equals("")) {
        obj.setCategory("Uncategory");
        obj.setCategoryAlias("uncategory");
      } else {
        category = category.replaceAll(",[\\w\\W]$", "");
        String cateAlias = StringHelper.replaceVietnamese(category);
        Category cate = CategoryModel.getById(cateAlias);
        if (cate == null) {
          cate = new Category();
          cate.setTitle(category);
          cate.setAlias(cateAlias);
          cate.setLevel(1);
          cate.setParentAlias("");
          cate.setDescription("");
          CategoryModel.insert(cate);
        }
        obj.setCategory(cate.getTitle());
        obj.setCategoryAlias(cate.getAlias());
      }

      // source
      String source = "";
      try {
        source = doc.select("a").last().attr("href");
      } catch (Exception e) {

      }
      obj.setSource(source);

      // thumb image
      Elements elements = doc.select("img");
      String thumb = "/images/thumb.png";
      String ct = doc.select("body").html().trim();
      if (elements.size() > 0) {
        for (int i = 0; i < elements.size(); i++) {
          ct = ct.replace(elements.get(i).toString(),
              "<div class='image'>" + elements.get(i).toString()
                  + "</div>");
        }
        thumb = elements.get(0).attr("src");
      }
      obj.setThumb(thumb);

      // tag
      String strTag = StringHelper.keyword(doc.text());
      try {
        ArrayList<String> listTag = new ArrayList<String>();
        String[] splitTag = strTag.split(",");
        for (String string : splitTag) {
          String tagAlias = StringHelper.replaceVietnamese(string
              .trim());
          Tag tag = TagModel.getById(tagAlias);
          if (tag != null) {
            List<News> listNews = tag.recoverListNews();
            for (int i = 0; i < listNews.size(); i++) {
              if (listNews.get(i).getAlias()
                  .equals(obj.getAlias())) {
                listNews.remove(i);
              }
            }
            listNews.add(obj);
            tag.tranformListNews(listNews);
            TagModel.insert(tag);
          } else {
            tag = new Tag();
            tag.setAlias(tagAlias);
            tag.setTitle(string);
            List<News> listNews = new ArrayList<News>();
            listNews.add(obj);
            tag.tranformListNews(listNews);
            TagModel.insert(tag);
          }
          String objTag = tagAlias + "," + string;
          listTag.add(objTag);
        }
        obj.setTags(listTag);
      } catch (Exception e) {

      }

      // content
      obj.setContent(StringHelper.cleanContent(ct));
      NewsModel.insert(obj);
      resp.getWriter().println("1");
    } catch (Exception e) {
      resp.getWriter().println("Invalid Url");
      e.printStackTrace(System.err);
View Full Code Here

Examples of com.multysite.entity.News

        if (treeCache.containsKey(alias)) {
          log.warning("-------detail cached -----");
          resp.getWriter().print(treeCache.get(alias));
        } else {
          log.warning("-------detail no cache -----");
          News obj = NewsModel.getById(alias);
          if (obj != null) {
            CategoryModel cateModel = new CategoryModel();
            cateModel.prepareAll();
            TagModel tagModel = new TagModel();
            tagModel.prepareList();
View Full Code Here

Examples of com.multysite.entity.News

        cateModel.prepareAllParrentList();
        req.setAttribute("listParentCategory",
            cateModel.getListResult());
        req.setAttribute("action", "add");
        req.setAttribute("obj", new News());
        req.getRequestDispatcher("/admin/pages/news-form.jsp").forward(
            req, resp);
      } else {
        resp.getWriter().println("Invalid Url");
      }
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.