private com.relteq.sirius.jaxb.Roads restoreRoads(Links db_link) throws TorqueException { @SuppressWarnings("unchecked") List<LinkName> db_lname_l = db_link.getLinkNames(); if (db_lname_l.isEmpty()) return null; com.relteq.sirius.jaxb.Roads roads = factory.createRoads(); for (LinkName db_lname : db_lname_l) { com.relteq.sirius.jaxb.Road road = factory.createRoad(); road.setName(db_lname.getName()); roads.getRoad().add(road); } return roads; }
private static String format(Links links) { return format(Arrays.asList(links.toArray())); }
private com.relteq.sirius.jaxb.Link restoreLink(Links db_link) throws TorqueException { com.relteq.sirius.jaxb.Link link = factory.createLink(); link.setId(id2str(db_link.getId())); // begin node com.relteq.sirius.jaxb.Begin begin = factory.createBegin(); begin.setNodeId(id2str(db_link.getBegNodeId())); link.setBegin(begin); // end node com.relteq.sirius.jaxb.End end = factory.createEnd(); end.setNodeId(id2str(db_link.getEndNodeId())); link.setEnd(end); link.setRoads(restoreRoads(db_link)); // TODO link.setDynamics(); link.setShape(db_link.getGeom()); // TODO revise: geometry -> shape LinkLanes db_llanes = LinkLanesPeer.retrieveByPK(db_link.getId(), db_link.getNetworkId()); link.setLanes(db_llanes.getLanes()); @SuppressWarnings("unchecked") List<LinkLaneOffset> db_lloffset_l = db_link.getLinkLaneOffsets(); if (!db_lloffset_l.isEmpty()) { link.setLaneOffset(db_lloffset_l.get(0).getDisplayLaneOffset()); if (1 < db_lloffset_l.size()) logger.warn( "Found " + db_lloffset_l.size() + " lane offsets for link[id=" + db_link.getId() + "]"); } link.setLength(db_link.getLength()); LinkType db_linktype = LinkTypePeer.retrieveByPK(db_link.getId(), db_link.getNetworkId()); link.setType(db_linktype.getType()); link.setInSynch(db_link.getInSynch()); return link; }
private com.relteq.sirius.jaxb.Output restoreOutput(Links db_link) { com.relteq.sirius.jaxb.Output output = factory.createOutput(); output.setLinkId(id2str(db_link.getId())); return output; }
private com.relteq.sirius.jaxb.Input restoreInput(Links db_link) { com.relteq.sirius.jaxb.Input input = factory.createInput(); input.setLinkId(id2str(db_link.getId())); return input; }
@GET public Response viewLinks() { Links links = new Links(); links.add(new Link("create-books", "/books", "POST")); return Response.ok(links).build(); }