Package com.dotmarketing.beans

Examples of com.dotmarketing.beans.Clickstream


        }




        Clickstream clickstream = (Clickstream) request.getSession().getAttribute("clickstream");
        if(clickstream != null &&  UtilMethods.isSet(clickstream.getInitialReferrer())){
          parameters.put("Initial Referer", clickstream.getInitialReferrer());
        }

        parameters.remove("options");
        parameters.remove("structure");
        parameters.remove("dispatch");
View Full Code Here


    if(request.getRequestURI().indexOf("edit") > -1){
     
      Identifier _edit_mode_id = new Identifier();
      _edit_mode_id.setURI("/");
      try{
        Clickstream clickstream = (Clickstream) request.getSession().getAttribute("clickstream");
        String pageId= clickstream.getLastPageId();
        _edit_mode_id = (Identifier) HibernateUtil.load(Identifier.class, pageId);
         
        if(_edit_mode_id.getAssetType().equals("contentlet")){
          com.dotmarketing.portlets.contentlet.model.Contentlet cont =  APILocator.getContentletAPI().findContentletByIdentifier(_edit_mode_id.getId(), false, APILocator.getLanguageAPI().getDefaultLanguage().getId(), APILocator.getUserAPI().getSystemUser(), false);
          _edit_mode_id.setURI(cont.getMap().get("URL_MAP_FOR_CONTENT").toString());
View Full Code Here

    }
  }

  public static Clickstream getClickstream(String clickstreamId) {
    HibernateUtil dh = new HibernateUtil(Clickstream.class);
    Clickstream clickStream = new Clickstream();
    try {
      dh.setQuery("from clickstream in class " + Clickstream.class.getName() + " where clickstream_id = ?");
      dh.setParam(Integer.parseInt(clickstreamId));
      clickStream = (Clickstream) dh.load();
    } catch (NumberFormatException e) {
View Full Code Here

  public static void setClickStreamUser(String userId, HttpServletRequest request) {
    if (!UtilMethods.isSet(userId))
      return;

    HttpSession session = ((HttpServletRequest) request).getSession();
    Clickstream clickstream = null;
    if (session.getAttribute("clickstream") == null) {
      clickstream = new Clickstream();
    } else {
      clickstream = (Clickstream) session.getAttribute("clickstream");
    }

    // overwrite if user is not already set
    if (!UtilMethods.isSet(clickstream.getUserId())) {
      clickstream.setUserId(userId);
    }
    session.setAttribute("clickstream", clickstream);
  }
View Full Code Here

      }
      clickstream404.setRequestURI(uri);
      clickstream404.setQueryString(queryString);

      clickstream404.setHostId(host.getIdentifier());
      Clickstream clickstream = (Clickstream) request.getSession().getAttribute("clickstream");
      if(clickstream==null){
        clickstream = addRequest(request, response, host);
      }
      if (user != null && clickstream.getUserId() == null) {
        clickstream404.setUserId(user.getUserId());
      }
      clickstream404.setTimestamp(clickstream.getLastRequest());
      clickstream.addClickstream404(clickstream404);
    }

  }
View Full Code Here

    public void sessionCreated(HttpSessionEvent hse) {
      if(Config.getBooleanProperty("ENABLE_CLICKSTREAM_TRACKING", false)){
          HttpSession session = hse.getSession();
          Logger.debug(this, "Session " + session.getId() + " was created, adding a new clickstream.");
          Clickstream clickstream = new Clickstream();
          session.setAttribute("clickstream", clickstream);
          clickstreams.put(session.getId(), clickstream);
      }
    }
View Full Code Here

      if(Config.getBooleanProperty("ENABLE_CLICKSTREAM_TRACKING", false)){
          HttpSession session = hse.getSession();
          Logger.debug(this, "Session " + session.getId() + " was destroyed, logging the clickstream and removing it.");
          try {
           
              Clickstream clickstream = (Clickstream) clickstreams.get(session.getId());
              ClickstreamFactory.flushClickStream(clickstream);
        clickstreams.remove(session.getId());
             
          } catch (Exception e) {
              Logger.error(this, "An error as ocurred when saving the clickstream");
View Full Code Here

    request.setAttribute("CLICKSTREAM_RECORDED", true);

    String pointer = request.getRequestURI();

    HttpSession session = request.getSession();
    Clickstream clickstream = (Clickstream) request.getSession().getAttribute("clickstream");
    if (clickstream == null) {
      clickstream = new Clickstream();
      session.setAttribute("clickstream", clickstream);
    }

    String associatedIdentifier = request.getParameter("id");
    if (!UtilMethods.isSet(associatedIdentifier)) {
      associatedIdentifier = (String) request.getAttribute(WebKeys.CLICKSTREAM_IDENTIFIER_OVERRIDE);
    }
    if (!UtilMethods.isSet(associatedIdentifier)) {
      associatedIdentifier = APILocator.getIdentifierAPI().find(host, pointer ).getInode();
    }

    if (UtilMethods.isSet(associatedIdentifier)) {
      clickstream.setLastPageId(associatedIdentifier);
      clickstream.setLastRequest(new Date());
    }

    if (clickstream.getHostname() == null) {
      clickstream.setHostname(request.getRemoteHost());
    }
    if (clickstream.getRemoteAddress() == null) {
      clickstream.setRemoteAddress(request.getRemoteAddr());
    }

    // if this is the first request in the click stream
    if (clickstream.getClickstreamRequests().size() == Config.getIntProperty("MIN_CLICKSTREAM_REQUESTS_TO_SAVE", 2)) {
      // setup initial referrer
      if (request.getHeader("Referer") != null) {
        clickstream.setInitialReferrer(request.getHeader("Referer"));
      } else {
        clickstream.setInitialReferrer("");
      }

      if (request.getHeader("User-Agent") != null) {
        clickstream.setUserAgent(request.getHeader("User-Agent"));
      } else {
        clickstream.setUserAgent("");
      }
      BrowserSniffer bs = new BrowserSniffer(request.getHeader("User-Agent"));
      session.setAttribute("browserSniffer", bs);
      clickstream.setBrowserName(bs.getBrowserName());
      clickstream.setOperatingSystem(bs.getOS());
      clickstream.setBrowserVersion(bs.getBrowserVersion());
      clickstream.setMobileDevice(bs.isMobile());
      clickstream.setBot(BotChecker.isBot(request));
      clickstream.setFirstPageId(associatedIdentifier);
      clickstream.setHostId(host.getIdentifier());

    }

    // Set the cookie id to the long lived cookie
    if (!UtilMethods.isSet(clickstream.getCookieId())) {

      String _dotCMSID = "";
      if(!UtilMethods.isSet(UtilMethods.getCookieValue(request.getCookies(),
          com.dotmarketing.util.WebKeys.LONG_LIVED_DOTCMS_ID_COOKIE))) {
        Cookie idCookie = CookieUtil.createCookie();

      }
      _dotCMSID = UtilMethods.getCookieValue(request.getCookies(),
          com.dotmarketing.util.WebKeys.LONG_LIVED_DOTCMS_ID_COOKIE);
      clickstream.setCookieId(_dotCMSID);
    }

    // set the user if we have it
    if (session.getAttribute(WebKeys.CMS_USER) != null && clickstream.getUserId() == null) {
      User user = (User) session.getAttribute(WebKeys.CMS_USER);
      setClickStreamUser(user.getUserId(), request);
    }

    ClickstreamRequest cr = ClickstreamRequestFactory.getClickstreamRequest(request, clickstream.getLastRequest());
    clickstream.setNumberOfRequests(clickstream.getNumberOfRequests() + 1);
    cr.setRequestOrder(clickstream.getNumberOfRequests());


    cr.setHostId(host.getIdentifier());
    cr.setAssociatedIdentifier(associatedIdentifier);


    // prevent dupe entries into the clickstream table - just retun if the user is on the same page
    if(clickstream.getClickstreamRequests() != null &&clickstream.getClickstreamRequests().size()>0){
      ClickstreamRequest last = clickstream.getClickstreamRequests().get(clickstream.getClickstreamRequests().size()-1);
      if(last != null && cr.getAssociatedIdentifier().equals( last.getAssociatedIdentifier())){
        return clickstream;
      }
    }

    clickstream.addClickstreamRequest(cr);
    return clickstream;



  }
View Full Code Here

      viewUser = APILocator.getUserAPI().loadUserById(userClickId,APILocator.getUserAPI().getSystemUser(),false);
    }catch(Exception e){
          Logger.warn(this, e.toString(), e);
    }
    req.setAttribute("viewUser",viewUser);
    Clickstream clickstream = null;

    Logger.debug(this, "Inside _detail ViewUserClicksAction user_id=" + req.getParameter("user_click_id"));

    try{
      clickstream = (Clickstream) ClickstreamFactory.getClickstream(clickstreamId);
View Full Code Here

TOP

Related Classes of com.dotmarketing.beans.Clickstream

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.