Package com.tubeonfire.entity

Examples of com.tubeonfire.entity.Page


      .getName());

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    try {
      Page obj = new Page();
      req.setAttribute("obj", obj);
      req.setAttribute("action", "add");
      req.getRequestDispatcher("/admin/form_page.jsp").forward(req, resp);
    } catch (Exception e) {
      log.warning(e.toString());
View Full Code Here


      HttpSession session = req.getSession();
      String pageTitle = (String) req.getParameter("pageTitle");
      String pageDescription = (String) req
          .getParameter("pageDescription");
      String pageContent = (String) req.getParameter("pageContent");
      Page obj = new Page();
      obj.setTitle(pageTitle);
      obj.setAlias(StringHelper.getAliasByLanguage(pageTitle));
      obj.setDescription(pageDescription);
      obj.setContent(pageContent);
      obj.setStatus(1);
      obj.setId(IdUniqueHelper.getId());
      PageModel.insert(obj);     
      session.setAttribute("success", "Action success !");
      resp.sendRedirect("/admin/page/add");
    } catch (Exception e) {
      log.warning(e.toString());
View Full Code Here

      if (splitted.length == 4) {
        id = splitted[2];
      } else {
        resp.sendRedirect("/home");
      }
      Page obj = PageModel.getById(id);
      if (obj != null) {
        if (obj.getType() == 1) {
          req.setAttribute("obj", obj);
          req.setAttribute("url", req.getRequestURL().toString());
          req.getRequestDispatcher("/page_content.jsp").forward(req,
              resp);
        } else {
View Full Code Here

  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    try {
      HttpSession session = req.getSession();
      String id = req.getParameter("id");
      Page obj = PageModel.getById(id);
      if (obj != null) {
        req.setAttribute("obj", obj);
        req.setAttribute("action", "edit");
        req.getRequestDispatcher("/admin/form_page.jsp").forward(req,
            resp);
View Full Code Here

  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    try {
      HttpSession session = req.getSession();
      String id = req.getParameter("id");
      Page obj = PageModel.getById(id);
      if (obj != null) {
        String pageTitle = (String) req.getParameter("pageTitle");
        String pageDescription = (String) req
            .getParameter("pageDescription");
        String pageContent = (String) req.getParameter("pageContent");
        obj.setTitle(pageTitle);
        obj.setAlias(StringHelper.getAliasByLanguage(pageTitle));
        obj.setDescription(pageDescription);
        obj.setContent(pageContent);
        PageModel.insert(obj);
        session.setAttribute("success", "Action success !");
        resp.sendRedirect("/admin/page/edit?id=" + id);
      } else {
        session.setAttribute("error",
View Full Code Here

      throws IOException {
    String action = request.getParameter("action");
    if (action != null && action.equals("delete")) {
      try {
        String id = request.getParameter("id");
        Page obj = PageModel.getById(id);
        if (obj != null) {
          PageModel.delete(obj);
          response.getWriter().print("");
        } else {
          response.getWriter()
              .print("Action fails ! Page's not exits or has been deleted !");
        }
      } catch (Exception e) {
        response.getWriter().print("Action fails ! Please try again !");
      }

    } else if (action != null && action.equals("deactive")) {
      try {
        String id = request.getParameter("id");
        Page obj = PageModel.getById(id);
        if (obj != null) {
          obj.setUpdated(Calendar.getInstance().getTime());
          obj.setStatus(2);
          PageModel.insert(obj);
          response.getWriter().print("");
        } else {
          response.getWriter()
              .print("Action fails ! Page's not exits or has been deleted !");
        }
      } catch (Exception e) {
        response.getWriter().print("Action fails ! Please try again !");
      }

    } else if (action != null && action.equals("active")) {
      try {
        String id = request.getParameter("id");
        Page obj = PageModel.getById(id);
        if (obj != null) {
          obj.setUpdated(Calendar.getInstance().getTime());
          obj.setStatus(1);
          PageModel.insert(obj);
          response.getWriter().print("");
        } else {
          response.getWriter()
              .print("Action fails ! Page's not exits or has been deleted !");
        }
      } catch (Exception e) {
        response.getWriter().print("Action fails ! Please try again !");
      }

    } else if (action != null && action.equals("delete-all")) {
      try {
        String strIds = (String) request.getParameter("ids");
        String[] ids = strIds.split(",");
        for (int i = 0; i < ids.length; i++) {
          if (!ids[i].isEmpty()) {
            Page obj = PageModel.getById(ids[i]);
            if (obj != null) {
              PageModel.delete(obj);
            }
          }
        }
View Full Code Here

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

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

TOP

Related Classes of com.tubeonfire.entity.Page

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.