Ejemplo n.º 1
0
  private void putSingleEvent(Map<String, List<DBObject>> eventMap, Event event) {
    String eventCollection;
    eventCollection = dbName + NAMESPACE_SEPARATOR + collectionName;
    if (!eventMap.containsKey(eventCollection)) {
      eventMap.put(eventCollection, new ArrayList<DBObject>());
    }

    List<DBObject> docs = eventMap.get(eventCollection);
    addEventToList(docs, event);
  }
Ejemplo n.º 2
0
  private void putDynamicEvent(Map<String, List<DBObject>> eventMap, Event event) {
    String eventCollection;
    Map<String, String> headers = event.getHeaders();
    String eventDb = headers.get(DB_NAME);
    eventCollection = headers.get(COLLECTION);

    if (!StringUtils.isEmpty(eventDb)) {
      eventCollection = eventDb + NAMESPACE_SEPARATOR + eventCollection;
    } else {
      eventCollection = dbName + NAMESPACE_SEPARATOR + eventCollection;
    }

    if (!eventMap.containsKey(eventCollection)) {
      eventMap.put(eventCollection, new ArrayList<DBObject>());
    }

    List<DBObject> documents = eventMap.get(eventCollection);
    addEventToList(documents, event);
  }