Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provided internationalization to tc project #216

Merged
merged 8 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.transitclock.db.structs.AvlReport.AssignmentType;
import io.swagger.client.ApiClient;
import io.swagger.client.api.DefaultApi;
import io.swagger.client.model.Device;
import io.swagger.client.model.Position;
import io.swagger.client.model.User;

Expand All @@ -47,6 +48,7 @@ public class TraccarAVLModule extends PollUrlAvlModule {

private User user = null;
private DefaultApi api = null;


private static StringConfigValue traccarEmail = new StringConfigValue("transitclock.avl.traccar.email", "admin",
"This is the username for the traccar server api.");
Expand All @@ -71,6 +73,7 @@ public TraccarAVLModule(String agencyId) throws Throwable {
client.setPassword(traccarPassword.getValue());
api.setApiClient(client);
user = api.sessionPost(traccarEmail.getValue(), traccarPassword.getValue());
user.getId();
if (user != null)
logger.debug("Traccar login succeeded.");
}
Expand All @@ -79,22 +82,44 @@ public TraccarAVLModule(String agencyId) throws Throwable {
protected void getAndProcessData() throws Exception {

Collection<AvlReport> avlReportsReadIn = new ArrayList<AvlReport>();

List<Device> devices = api.devicesGet(true, user.getId(), null, null);

if (api != null && user != null) {
List<Position> results = api.positionsGet(null, null, null, null);
for (Position result : results) {
logger.debug(result.toString());

AvlReport avlReport = new AvlReport(result.getDeviceId().toString(),
for (Position result : results) {
Device device=findDeviceById(devices, result.getDeviceId());

AvlReport avlReport = null;
// If have device details use name.
if(device!=null && device.getName()!=null && !device.getName().isEmpty())
{
avlReport = new AvlReport(device.getName(),
result.getDeviceTime().toDate().getTime(), result.getLatitude().doubleValue(),
result.getLongitude().doubleValue(), traccarSource.toString());
}
else
{
avlReport = new AvlReport(result.getDeviceId().toString(),
result.getDeviceTime().toDate().getTime(), result.getLatitude().doubleValue(),
result.getLongitude().doubleValue(), traccarSource.toString());

avlReportsReadIn.add(avlReport);
}

}
if(avlReport!=null)
avlReportsReadIn.add(avlReport);
}
forwardAvlReports(avlReportsReadIn);
}
}

private Device findDeviceById(List<Device> devices, Integer id)
{
for(Device device:devices)
{
if(device.getId()==id)
return device;
}
return null;
}

@Override
protected Collection<AvlReport> processData(InputStream in) throws Exception {
// TODO Auto-generated method stub
Expand All @@ -106,4 +131,4 @@ protected void forwardAvlReports(Collection<AvlReport> avlReportsReadIn)
processAvlReports(avlReportsReadIn);
}

}
}
5 changes: 5 additions & 0 deletions transitclockWebapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
<artifactId>transitclockCore</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
<version>1.2.4</version>
</dependency>

</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
hello.label.welcome = Welcome
div.agencies = Agencies
div.maps = Maps
div.reports = Reports
div.api = Api
div.status = Status
div.extensions = Extensions
div.apicalls = Api calls
div.apicallsfor = API Calls for
div.notethisis = Note: This is a only a partial list of the API calls
div.historical = Historical Reports
div.schedule = Schedule Adherence
div.statuspages = Status Pages
div.realtime = Real-time Maps for
div.mapfor = Map for Selected Route
div.mapincluding = Map Including Unassigned Vehicles
div.ScheduleAdherenceMap = Schedule Adherence Map
div.transitimemaps = Transitime Map
div.smartphonemap = Smartphone Map
div.avldata = AVL Data Map
div.prediction = Prediction Accuracy Range Chart
div.PredictionAccuracyIntervalChart = Prediction Accuracy Interval Chart
div.predictionscatter = Prediction Accuracy Scatter Plot
div.csv = Prediction Accuracy CSV Download
div.scheduleroutr = Schedule Adherence by Route
div.earlylate = Schedule Adherence by how Early/Late
div.schedulebystop = Schedule Adherence by Stop
div.avldata = AVL Data in Map by Route
div.datainmap = AVL Data in Map by Vehicle
div.lastgps = Last GPS Report by Vehicle
div.schedulefor = Schedule for Route
div.lastgpsreports = Last GPS Reports for Vehicles
div.SpecifyParameters = Specify Parameters
div.PredictionAccuracy = Prediction Accuracy
div.scgedulareport = Schedule Report
div.acbiveblock = Active Blocks
div.serwerstatus = Server Status
div.spfa = Select Parameters for Agencies API
div.spfb = Select Parameters for Blocks API
div.spfbta = Select Parameters for Blocks Terse API
div.spfgrtua = Select Parameters for GTFS-Realtime Trip Updates API
div.binary = Binary
div.hr = Human Readable
div.spfgrvpa = Select Parameters for GTFS-Realtime Vehicle Positions API
div.spfshsa = Select Parameters for Schedule (Horizontal Stops) API
div.asac = Agency Specific API calls
div.rv = Reset vehicle
div.pbl = Predictions by Location
div.nas = Not Agency Specific
div.sfrsv = Schedule for Route, stops vertical
div.sfrsh = Schedule for Route, stops horizontal
div.ssm = SIRI Stop Monitoring
div.svm = SIRI Vehicle Monitoring
div.grvp = GTFS-realtime Vehicle Positions
div.grtu = GTFS-realtime Trip Updates
div.sic = Service IDs Current
div.si = Service IDs
div.bd = Block Details
div.twtt = Trip With Travel Times
div.pbl = Predictions by Location
div.pbrs = Predictions by Route/Stop
div.vc = Vehicle Configurations
div.vd = Vehicles Details
div.veh = Vehicles
div.roude = Route Details
div.rou = Routes
div.spfpbla = Select Parameters for Predictions by Location API
div.lat = Latitude:
div.lon = Longitude:
div.md = Max Distance:
div.mdf = meters (default is 1500m)
div.np = Number Predictions:
div.dfps = (default is 3 per stop)
div.spfpbla = Select Parameters for Predictions by Location API
div.spfpbrsa = Select Parameters for Predictions by Route/Stop API
div.difps = (default is 3 per stop)
div.stopid = Stop ID:
div.spfrva = Select Parameters for Reset Vehicle API
div.spfra = Select Parameters for routes API
div.spfrda = Select Parameters for routesDetails API
div.spfsia = Select Parameters for Service IDs API
div.spfcsia = Select Parameters for Current Service IDs API
div.spfpbrsa = Select Parameters for Predictions by Route/Stop API
div.spfsvma = Select Parameters for SIRI Vehicle Montitoring API
div.spfta = Select Parameters for Trip API
div.spfvca = Select Parameters for Vehicle Configurations API
div.spfva = Select Parameters for Vehicles API
div.spfvda = Select Parameters for Vehicles Details API
div.spfsvsa = Select Parameters for Schedule (Vertical Stops) API
div.hrf = Historical Reports for
div.pa = Prediction Accuracy
div.ofa = (only for agencies where prediction accuracy stored to database)
div.sar = Schedule Adherence Reports
div.ar = AVL Reports
div.mr = Miscellaneous Reports
div.sfrvss = Schedule for Route (vertical stops)
div.true = True
div.false = False
div.bd = Begin Date:
div.nod = Number of days:
div.bt = Begin Time:
div.et = End Time:
div.bd = Begin Date:
div.ed = End Date:
div.route = Route:
div.srf = Status Reports for
div.sr = Status Reports
div.ddsu = Database Disk Space Utilization
div.ss = Server Status
div.blocks = Blocks:
div.assigned = Assigned:
div.ddsu = Database Disk Space Utilization
div.ddsflt = Database Disk Space for Largest Tables
div.ddsbt = Database Disk Space by Table
div.ddsd = Database Disk Space Details
div.ssf = Server Status for
div.ep = Extensions Page
div.ef = Extensions for
div.htns = Holding Times Northern Stop
div.htss = Holding Times Southern Stop
div.psource = Prediction Source:
div.other = Other
div.ptype = Prediction Type:
div.pall = All
div.paff = Affected by layover
div.pnaff = Not affected by layover
div.aear = Allowable Early:
div.minutes = minutes
div.alat = Allowable Late:
div.sppaic = Select Parameters for Prediction Accuracy Intervals Chart
div.intt = Intervals Type:
div.pon = Percentage only
div.sdon = Standard Deviation only
div.ponsd = Percentage only and Standard Deviation
div.iper = Interval Percentage
div.sppas = Select Parameters for Prediction Accuracy Scatter Chart
div.csvd = Select Parameters for Prediction Accuracy CSV Download
div.spsabr = Select Parameters for Schedule Adherence by Route Chart
div.spdavld = Select Parameters for Displaying AVL Data in Map by Route
div.spdavlbv = Select Parameters for Displaying AVL Data in Map by Vehicle
div.lgpsr = Last GPS Reports for Past 24 Hours
div.lgps = Last GPS
div.spfsr = Select Parameters for Schedule Report
div.selectroute = Select Route
div.droute = Route
div.dstop = Stop
div.ddestination = Destination
div.dminutes = minutes
div.dnopredictions = No Predictions
div.dtrippattern = Trip Pattern
div.dkmhr = km/hr
div.dlayover = Layover
div.ddeparture = Departure
div.dnextstop = Next Stop
div.ddriver = Driver
div.dlat = lat
div.dlon = lon
div.dheading = Heading
div.dspeed = Speed
div.ddirection = Direction
div.dstarttime = Start Time
div.dschadh = sch adh
div.Vehicle = Vehicle
div.dgpstime = GPS Time
div.dblock = Block
div.dtrip = Trip
div.dto = To
div.drunreport = Run Report
div.drunapicall = Run Api Call
div.scfor = Schedule For
div.minearly = min early
div.minearlyto = min early to
div.minlate = min late
div.for = for
div.day = day
div.clate = Late
div.contime = On Time
div.cearly = Early
div.coutof = out of
div.cstops = stops
div.ccombined = Combined
div.hitback = Hit back button to try other parameters.
div.spfsabsc = Select Parameters for Schedule Adherence by Stop Chart
div.ctimes = times
div.ctotal = Total
div.synoptic = Synoptic
div.RoutePerformanceTable = Route Performance Table
div.AVLDataInMap = AVL Data in Map
div.AVLDataInMapParametersPage = AVL Data in Map (parameters page)
div.EventReports = Event Reports
div.EventForVehicle = Event for vehicle
div.AllRoutes = All Routes
div.ProvideTooltipInfo = Provide tooltip info
div.Export = Export
div.Submit = Submit
div.SelectParametersForDisplayingAVLDataInMap = Select Parameters for Displaying AVL Data in Map
div.LoadAllData = Load all data
div.AsOf = As of:
div.Adh = Adh:
div.Headsign = Headsign
div.Start = Start:
div.End = End:
div.Service = Service:
Loading