Package com.cosmicpush.pub.push

Examples of com.cosmicpush.pub.push.UserEventPush


      add(apiRequest);
    }
  }

  public void add(ApiRequest apiRequest) {
    UserEventPush userEvent = apiRequest.getUserEventPush();
    if (userEvent.isSendStory()) return;

    if (BeanUtils.objectsNotEqual(deviceId, userEvent.getDeviceId())) {
      String msg = String.format("Invalid device id for push %s.", userEvent.getDeviceId());
      throw new IllegalArgumentException(msg);
    }

    UserEventSession session = findSession(userEvent);

    if (session == null) {
      session = new UserEventSession(userEvent);
      sessions.add(session);
    }

    session.add(apiRequest);

    if (userEvent.getCreatedAt().isAfter(this.updatedAt)) {
      this.updatedAt = userEvent.getCreatedAt();
    }
    if (StringUtils.isBlank(this.userName)) {
      this.userName = session.getUserName();
    }
View Full Code Here


  }

  private List<UserEventGroup> toGroups(List<ApiRequest> requests) {
    Map<String,UserEventGroup> sessionsMap = new HashMap<String,UserEventGroup>();
    for (ApiRequest request : requests) {
      UserEventPush userEvent = request.getUserEventPush();
      String deviceId = userEvent.getDeviceId();

      if (sessionsMap.containsKey(deviceId) == false) {
        UserEventGroup group = new UserEventGroup(userEvent);
        sessionsMap.put(deviceId, group);
      } else {
View Full Code Here

      add(request);
    }
  }

  public void add(ApiRequest apiRequest) {
    UserEventPush userEvent = apiRequest.getUserEventPush();
    if (userEvent.isSendStory()) return;

    if (userEvent.getCreatedAt().isAfter(this.updatedAt)) {
      this.updatedAt = userEvent.getCreatedAt();
    }

    if (StringUtils.isBlank(this.userName)) {
      this.userName = userEvent.getUserName();
    }

    if (StringUtils.isBlank(this.ipAddress)) {
      this.ipAddress = userEvent.getIpAddress();
    }

    if (this.userAgent == null) {
      this.userAgent = userEvent.getUserAgent();
    }

    this.apiRequests.add(apiRequest);
    Collections.sort(apiRequests);
  }
View Full Code Here

TOP

Related Classes of com.cosmicpush.pub.push.UserEventPush

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.