private RouteNodeInstance determineStartNode(
     Collection<RouteNodeInstance> activeNodes, MovePoint movePoint)
     throws InvalidActionTakenException {
   RouteNodeInstance startNodeInstance = null;
   for (RouteNodeInstance nodeInstance : activeNodes) {
     if (nodeInstance.getName().equals(movePoint.getStartNodeName())) {
       if (startNodeInstance != null) {
         throw new InvalidActionTakenException(
             "More than one active node exists with the given name:  "
                 + movePoint.getStartNodeName());
       }
       startNodeInstance = nodeInstance;
     }
   }
   if (startNodeInstance == null) {
     throw new InvalidActionTakenException(
         "Could not locate an active node with the given name: " + movePoint.getStartNodeName());
   }
   return startNodeInstance;
 }
Ejemplo n.º 2
0
  public String getRouteLevelName() {
    // this is for backward compatibility of requests which have not been converted
    if (CompatUtils.isRouteLevelRequest(this)) {
      int routeLevelInt = getRouteLevel();
      if (routeLevelInt == KewApiConstants.EXCEPTION_ROUTE_LEVEL) {
        return "Exception";
      }

      List<RouteNode> routeLevelNodes =
          CompatUtils.getRouteLevelCompatibleNodeList(
              KEWServiceLocator.getRouteHeaderService()
                  .getRouteHeader(documentId)
                  .getDocumentType());
      if (!(routeLevelInt < routeLevelNodes.size())) {
        return "Not Found";
      }
      return ((RouteNode) routeLevelNodes.get(routeLevelInt)).getRouteNodeName();
    } else {
      return (nodeInstance == null ? "Exception" : nodeInstance.getName());
    }
  }