125126127128129130131132133134135
for (org.onebusaway.gtfs.model.Agency gtfsAgency : reader.getAgencies()) { if(!agencyIdMap.containsKey(gtfsAgency.getId())) { Agency agency = new Agency(gtfsAgency); agency.save(); agencyIdMap.put(agency.gtfsAgencyId, BigInteger.valueOf(agency.id)); primaryAgencyId = BigInteger.valueOf(agency.id);
190191192193194195196197198199200
Logger.info("Center: " + centroid.getCoordinate().y + ", " + centroid.getCoordinate().x); primaryAgency.defaultLat = centroid.getCoordinate().y; primaryAgency.defaultLon = centroid.getCoordinate().x; primaryAgency.save(); GtfsSnapshotMergeTask tripShapeTask = new GtfsSnapshotMergeTask(snapshotMerge); tripShapeTask.startTask(); // import points
93949596979899100101102103
public static void createAgency() { Agency agency; try { agency = mapper.readValue(params.get("body"), Agency.class); agency.save(); // check if gtfsAgencyId is specified, if not create from DB id if(agency.gtfsAgencyId == null) { agency.gtfsAgencyId = "AGENCY_" + agency.id.toString(); agency.save();
9899100101102103104105106107108
agency.save(); // check if gtfsAgencyId is specified, if not create from DB id if(agency.gtfsAgencyId == null) { agency.gtfsAgencyId = "AGENCY_" + agency.id.toString(); agency.save(); } renderJSON(Api.toJson(agency, false)); } catch (Exception e) { e.printStackTrace();
123124125126127128129130131132133
// check if gtfsAgencyId is specified, if not create from DB id if(agency.gtfsAgencyId == null) agency.gtfsAgencyId = "AGENCY_" + agency.id.toString(); Agency updatedAgency = Agency.em().merge(agency); updatedAgency.save(); renderJSON(Api.toJson(updatedAgency, false)); } catch (Exception e) { e.printStackTrace(); badRequest();
102103104105106107108109110111112
Agency agency = new Agency(gtfsId, name, url, timezone, language, phone); agency.defaultLat = defaultLat; agency.defaultLon = defaultLon; agency.save(); Bootstrap.index(); } // helper bootstap function for updating from GeoServer-centric db versions