Пример #1
0
  protected List<ErrorWarningEvent> getEwesFromMaps(TimelineResult data) {
    List<ErrorWarningEvent> result = new ArrayList<ErrorWarningEvent>();

    for (TimelineRecord record : data) {
      Map<String, String> map = record.getData();

      HashMap<String, Object> ctx = new HashMap<String, Object>();

      for (String key : map.keySet()) {
        if (key.startsWith(CTX_PREFIX)) {
          ctx.put(key.substring(4), map.get(key));
        }
      }

      ErrorWarningEvent evt =
          new ErrorWarningEvent(
              getEventDate(map), map.get(ACTION), map.get(MESSAGE), map.get(STACK_TRACE));

      evt.addEventContext(ctx);

      result.add(evt);
    }

    return result;
  }
Пример #2
0
  protected List<NexusArtifactEvent> getAisFromMaps(TimelineResult data) {
    List<NexusArtifactEvent> result = new ArrayList<NexusArtifactEvent>();

    for (TimelineRecord record : data) {
      Map<String, String> map = record.getData();

      NexusItemInfo ai = new NexusItemInfo();

      ai.setRepositoryId(map.get(REPOSITORY));

      ai.setPath(map.get(REPOSITORY_PATH));

      ai.setRemoteUrl(map.get(REMOTE_URL));

      HashMap<String, String> ctx = new HashMap<String, String>();
      HashMap<String, String> atr = new HashMap<String, String>();

      for (String key : map.keySet()) {
        if (key.startsWith(CTX_PREFIX)) {
          ctx.put(key.substring(4), map.get(key));
        } else if (key.startsWith(ATR_PREFIX)) {
          atr.put(key.substring(4), map.get(key));
        }
      }

      NexusArtifactEvent nae =
          new NexusArtifactEvent(getEventDate(map), map.get(ACTION), map.get(MESSAGE), ai);

      // NEXUS-4038: backward compatibility
      // Before this fix, nae had NO attributes separately stored, but only ctx map existed with ctx
      // + atr content
      // overlayed
      // After fix we have two separate maps. To handle well "old" timeline records, when we detect
      // there is no
      // atr map (atr map is empty which will never be after fix), we "emulate" and lift all the ctx
      // map into atr
      // map instead.

      if (atr.isEmpty()) {
        nae.addItemAttributes(ctx);
      } else {
        nae.addEventContext(ctx);
        nae.addItemAttributes(atr);
      }

      result.add(nae);
    }

    return this.feedArtifactEventFilter.filterArtifactEventList(result);
  }
Пример #3
0
  protected List<SystemEvent> getSesFromMaps(TimelineResult data) {
    List<SystemEvent> result = new ArrayList<SystemEvent>();

    for (TimelineRecord record : data) {
      Map<String, String> map = record.getData();

      HashMap<String, Object> ctx = new HashMap<String, Object>();

      for (String key : map.keySet()) {
        if (key.startsWith(CTX_PREFIX)) {
          ctx.put(key.substring(4), map.get(key));
        }
      }

      SystemEvent se = new SystemEvent(getEventDate(map), map.get(ACTION), map.get(MESSAGE));

      se.addEventContext(ctx);

      result.add(se);
    }

    return result;
  }