/**
   * Get edges inside a bbox.
   *
   * @return
   */
  @Secured({"ROLE_USER"})
  @GET
  @Path("/edges")
  @Produces({MediaType.APPLICATION_JSON})
  public Object getEdges(
      @QueryParam("lowerLeft") String lowerLeft,
      @QueryParam("upperRight") String upperRight,
      @QueryParam("exactClass") String className,
      @QueryParam("skipTransit") boolean skipTransit,
      @QueryParam("skipStreets") boolean skipStreets,
      @QueryParam("skipNoGeometry") boolean skipNoGeometry) {

    initIndexes();

    Envelope envelope = getEnvelope(lowerLeft, upperRight);

    EdgeSet out = new EdgeSet();
    Graph graph = graphService.getGraph();

    @SuppressWarnings("unchecked")
    List<Edge> query = edgeIndex.query(envelope);
    out.edges = new ArrayList<WrappedEdge>();
    for (Edge e : query) {
      if (skipStreets && (e instanceof StreetEdge)) continue;
      if (skipTransit && !(e instanceof StreetEdge)) continue;
      if (skipNoGeometry && e.getGeometry() == null) continue;
      if (className != null && !e.getClass().getName().endsWith("." + className)) continue;
      out.edges.add(new WrappedEdge(e, graph.getIdForEdge(e)));
    }
    return out.withGraph(graph);
  }
 public void addEdges(Collection<Edge> newEdges, Graph graph) {
   if (edges == null) {
     edges = new ArrayList<WrappedEdge>();
   }
   for (Edge edge : newEdges) {
     edges.add(new WrappedEdge(edge, graph.getIdForEdge(edge)));
   }
 }
 private void applyObjectToAnnotation(Graph graph, AnnotationObject annotation, Object o) {
   if (o instanceof Edge) {
     annotation.edge = graph.getIdForEdge((Edge) o);
   } else if (o instanceof Vertex) {
     annotation.vertex = ((Vertex) o).getLabel();
   } else if (o instanceof String) {
     annotation.message = (String) o;
   } else if (o instanceof IdentityBean) {
     IdentityBean<?> bean = (IdentityBean<?>) o;
     Object id = bean.getId();
     applyObjectToAnnotation(graph, annotation, id);
   } else if (o instanceof AgencyAndId) {
     AgencyAndId id = (AgencyAndId) o;
     annotation.agency = id.getAgencyId();
     annotation.id = id.getId();
   } else if (o instanceof Collection) {
     Collection<?> collection = (Collection<?>) o;
     if (collection.isEmpty()) return;
     Object first = collection.iterator().next();
     applyObjectToAnnotation(graph, annotation, first);
   }
 }