Пример #1
0
  private TracedCallAO mapTracedCall(CurrentlyTracedCall useCase, TimeUnit unit) {
    TraceStep root = useCase.getRootStep();
    TracedCallAO ret = new TracedCallAO();
    ret.setName(useCase.getName());
    ret.setCreated(useCase.getCreated());
    ret.setDate(NumberUtils.makeISO8601TimestampString(useCase.getCreated()));

    JourneyCallIntermediateContainer container = new JourneyCallIntermediateContainer();
    fillUseCasePathElementBeanList(container, root, 0, unit);
    ret.setElements(container.getElements());

    // check for duplicates
    List<TracedCallDuplicateStepsAO> dupSteps = new ArrayList<TracedCallDuplicateStepsAO>();
    Map<String, JourneyCallIntermediateContainer.ReversedCallHelper> stepsReversed =
        container.getReversedSteps();
    for (Map.Entry<String, JourneyCallIntermediateContainer.ReversedCallHelper> entry :
        stepsReversed.entrySet()) {
      if (entry.getValue() != null && entry.getValue().getPositions().size() > 1) {
        // duplicate found
        TracedCallDuplicateStepsAO dupStep = new TracedCallDuplicateStepsAO();
        dupStep.setCall(entry.getKey());
        dupStep.setPositions(entry.getValue().getPositions());
        dupStep.setTimespent(entry.getValue().getTimespent());
        dupStep.setDuration(entry.getValue().getDuration());
        dupSteps.add(dupStep);
      }
    }

    ret.setDuplicateSteps(dupSteps);

    return ret;
  }
Пример #2
0
  @Override
  public JourneyAO getJourney(String name) throws APIException {
    JourneyAO ret = new JourneyAO();
    Journey journey;
    try {
      journey = journeyManager.getJourney(name);
    } catch (NoSuchJourneyException e) {
      throw new APIException("Journey not found.");
    }

    ret.setName(journey.getName());
    ret.setActive(journey.isActive());
    ret.setCreatedTimestamp(journey.getCreatedTimestamp());
    ret.setLastActivityTimestamp(journey.getLastActivityTimestamp());

    List<CurrentlyTracedCall> recorded = journey.getTracedCalls();
    List<JourneySingleTracedCallAO> calls =
        new ArrayList<JourneySingleTracedCallAO>(recorded.size());
    for (int i = 0; i < recorded.size(); i++) {
      CurrentlyTracedCall tracedCall = recorded.get(i);
      if (tracedCall == null) {
        // this is a WTF, how could a null get added here in first place.
        log.warn("Unexpected null as tracedCall at position " + i);
        continue;
      }
      JourneySingleTracedCallAO b = new JourneySingleTracedCallAO();
      b.setName(tracedCall.getName());
      b.setDate(NumberUtils.makeISO8601TimestampString(tracedCall.getCreated()));
      b.setContainedSteps(tracedCall.getNumberOfSteps());
      b.setDuration(tracedCall.getRootStep().getDuration());
      calls.add(b);
    }

    ret.setCalls(calls);

    return ret;
  }
Пример #3
0
  @Override
  public List<AnalyzedProducerCallsMapAO> analyzeJourney(String journeyName) throws APIException {
    List<AnalyzedProducerCallsMapAO> callsList = new ArrayList<AnalyzedProducerCallsMapAO>();
    Journey journey = getJourneyByName(journeyName);

    AnalyzedProducerCallsMapAO overallCallsMap =
        new AnalyzedProducerCallsMapAO(journey.getName() + " - TOTAL");
    callsList.add(overallCallsMap);

    List<CurrentlyTracedCall> tracedCalls = journey.getTracedCalls();
    for (CurrentlyTracedCall tc : tracedCalls) {
      if (tc == null) {
        log.warn("TracedCall is null!");
        continue;
      }
      AnalyzedProducerCallsMapAO singleCallMap = new AnalyzedProducerCallsMapAO(tc.getName());
      for (TraceStep step : tc.getRootStep().getChildren()) {
        addStep(step, singleCallMap, overallCallsMap);
      }
      callsList.add(singleCallMap);
    }

    return callsList;
  }