Examples of UserService


Examples of com.google.appengine.api.users.UserService

  @Override
  public void service(HttpServletRequest req, HttpServletResponse resp)
  throws IOException, ServletException {


    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    //  logEnvironment();

    String knowledgeBaseFile = req.getParameter(PARAM_KNOWLEDGE_BASE);
    String excelFile = req.getParameter(PARAM_EXCEL_DATA_FILE);


    //Identify where the rules are stored
    RuleSource ruleSource = new RuleSource();
    ruleSource.setKnowledgeBaseLocation(knowledgeBaseFile);
    log.info("Using knowledgeBaseFile"+knowledgeBaseFile);

    if ((user != null)&&(knowledgeBaseFile!=null)&&!knowledgeBaseFile.equals("")&&(excelFile!=null)&&!excelFile.equals("")) {

      resp.setContentType("application/vnd.ms-excel");
      resp.setHeader("Content-Disposition",
      "attachment; filename=result.xls");

      //Check the RUL
      RedSecurityManager.checkUrl(knowledgeBaseFile);
      RedSecurityManager.checkUrl(excelFile);

      log.info("Using Excel File"+excelFile);


      URL url = new URL(excelFile);

      HSSFWorkbook wb;
      try {
        wb = commonSpreadsheetUtils.callRules(url,ruleSource, RedConstants.EXCEL_LOG_WORKSHEET_NAME);




        SpreadSheetOutputter.outputToStream(wb, resp.getOutputStream());
      } catch (Exception e) {

        log.warning(e.getMessage());
        throw new ServletException(e);
      }

    } else {

      resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));
    }
  }
View Full Code Here

Examples of com.google.appengine.api.users.UserService

  @Override
  public void service(HttpServletRequest req, HttpServletResponse resp)
  throws IOException, ServletException {


    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    logEnvironment();

    //Identify where the rules are stored
    RuleSource ruleSource = new RuleSource();
    //ruleSource.setRulesLocation(RULES_FILES);
    ruleSource.setKnowledgeBaseLocation(KNOWLEDGE_BASE_FILE);

    if (user != null) {

      resp.setContentType("application/vnd.ms-excel");
      resp.setHeader("Content-Disposition",
      "attachment; filename=result.xls");

      //Get the URL
      URL url = new URL(EXCEL_DATA_FILE);

      HSSFWorkbook wb;
      try {
        wb = commonSpreadsheetUtils.callRules(url,ruleSource, getExcelLogWorksheetName());

        SpreadSheetOutputter.outputToStream(wb, resp.getOutputStream());
      } catch (Exception e) {

        log.warning(e.getMessage());
        throw new ServletException(e);
      }

    } else {

      resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));
    }
  }
View Full Code Here

Examples of com.google.appengine.api.users.UserService

   */
  @RequestMapping(value = "/connect.*", method = RequestMethod.GET)
  public String doConnexion(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {

    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();

    if (user == null) {
      resp.sendRedirect(userService.createLoginURL("/account.htm"));
      return null;
    }

    // redirection page d'accueil
    return "redirect:/account.htm";
View Full Code Here

Examples of com.google.appengine.api.users.UserService

   * @throws IOException
   */
  @RequestMapping(value = "/disconnect.*", method = RequestMethod.GET)
  public String deconnexion(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {
    UserService userService = UserServiceFactory.getUserService();

    resp.addCookie(new Cookie("username", null));

    resp.sendRedirect(userService.createLogoutURL("/index.htm"));

    return null;

  }
View Full Code Here

Examples of com.google.appengine.api.users.UserService

  @RequestMapping(value = "/account.*", method = RequestMethod.GET)
  public ModelAndView account(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {

    ModelAndView mav = new ModelAndView("page/account");
    UserService userService = UserServiceFactory.getUserService();
    User googleUser = userService.getCurrentUser();

    if (googleUser == null) {
      resp.sendRedirect(userService.createLoginURL("/account.htm"));
      return null;
    }

    resp.addCookie(new Cookie("username", googleUser.getEmail()));
   
View Full Code Here

Examples of com.google.appengine.api.users.UserService

  @RequestMapping(value = "/ajax/unsubscribe.*", method = RequestMethod.GET)
  public void ajaxUnsubscribe(HttpServletRequest req,
      HttpServletResponse resp, long id) throws Exception {
    System.out.println(id);

    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();

    if (user != null) {

      UserManager serv = new UserManager();
      serv.removeUserSubscription(user.getEmail(), id);
View Full Code Here

Examples of com.google.appengine.api.users.UserService

   
    email = req.getParameter("jid");
   
    if (email == null){
   
      UserService userService = UserServiceFactory.getUserService();
      User user = userService.getCurrentUser();
     
      if (user != null) {
        email = user.getEmail();
        method = "gtalk";
      } else {
        //redirection
        resp.sendRedirect(userService.createLoginURL("/inviteme.htm"));
        return null;
      }
    } else {
      method = "jabber";
    }
View Full Code Here

Examples of com.google.appengine.api.users.UserService

   * @TODO: make this alot better.
   */
  @SuppressWarnings("unchecked")
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
       throws IOException {
  UserService userService = UserServiceFactory.getUserService();
    if (userService.getCurrentUser() != null) {
      if (userService.isUserAdmin()) {
      String user = userService.getCurrentUser().getEmail();
      if (req.getParameter("action") != null) {
        String action = req.getParameter("action");
        if (action.equalsIgnoreCase("flushTokens")) {
          PersistenceManager pm = PMF.get().getPersistenceManager();
          try {
View Full Code Here

Examples of com.google.appengine.api.users.UserService

  /**
   * Retrieves a new, unsaved, document.
   */
  @Override
  public DocumentServiceEntry getNewDocument() {
    UserService userService = UserServiceFactory.getUserService();
    DocumentServiceEntry doc = new DocumentServiceEntry();
    doc.setTitle("Untitled Document");
    doc.setIdentifier(doc.getTitle().replaceAll("[^a-zA-Z0-9_\\-\\.]", ""));
    doc.setAuthor(userService.getCurrentUser().getEmail());
    doc.setEditor(userService.getCurrentUser().getNickname());
    return doc;
  }
View Full Code Here

Examples of com.google.appengine.api.users.UserService

  /**
   * Retrieves the currently signed on user.
   */
  @Override
  public DocumentUser getUser() {
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    if (user != null){
      String email = user.getEmail();
      AuthenticationToken at = AuthenticationToken.getUserToken(email);
      if (at != null) {
        DocumentUser docUser = new DocumentUser();
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.