Beispiel #1
0
 private Journey getJourneyByName(String name) throws APIException {
   Journey journey = null;
   try {
     journey = journeyManager.getJourney(name);
     return journey;
   } catch (NoSuchJourneyException e) {
     throw new APIException("Journey " + name + " not found.");
   }
 }
Beispiel #2
0
  @Override
  public List<JourneyListItemAO> getJourneys() throws APIException {
    List<Journey> journeys = journeyManager.getJourneys();
    List<JourneyListItemAO> beans = new ArrayList<JourneyListItemAO>(journeys.size());

    for (Journey j : journeys) {
      JourneyListItemAO bean = new JourneyListItemAO();

      bean.setName(j.getName());
      bean.setActive(j.isActive());
      bean.setCreated(NumberUtils.makeISO8601TimestampString(j.getCreatedTimestamp()));
      bean.setLastActivity(NumberUtils.makeISO8601TimestampString(j.getLastActivityTimestamp()));
      bean.setNumberOfCalls(j.getTracedCalls().size());
      beans.add(bean);
    }

    return beans;
  }
Beispiel #3
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;
  }
Beispiel #4
0
 @Override
 public void deleteJourney(String journeyName) throws APIException {
   journeyManager.removeJourney(journeyName);
 }