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();
}