Skip to content

Commit

Permalink
Issue #5: Improve the Utility of the Trip Problem Report Admin Interface
Browse files Browse the repository at this point in the history
Add a message to indicate when a trip problem report has been updated.
  • Loading branch information
bdferris committed Apr 27, 2012
1 parent de487cb commit 4878178
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"parse", "true"}),
@Result(type = "redirectAction", name = "update", params = {
"actionName", "trip-problem-report", "tripId", "${model.tripId}", "id",
"${model.id}", "parse", "true"})})
"${model.id}", "m", "1", "parse", "true"})})
public class TripProblemReportAction extends ActionSupport implements
ModelDriven<TripProblemReportBean> {

Expand All @@ -64,6 +64,8 @@ public class TripProblemReportAction extends ActionSupport implements

private List<String> _labels;

private int _m = 0;

@Autowired
public void setTransitDataService(TransitDataService transitDataService) {
_transitDataService = transitDataService;
Expand All @@ -81,6 +83,10 @@ public void setMinutesBefore(int minutesBefore) {
public void setMinutesAfter(int minutesAfter) {
_minutesAfter = minutesAfter;
}

public void setM(int m) {
_m = m;
}

public List<VehicleLocationRecordBean> getVehicleLocationRecords() {
return _vehicleLocationRecords;
Expand All @@ -89,8 +95,11 @@ public List<VehicleLocationRecordBean> getVehicleLocationRecords() {
@Validations(requiredFields = {@RequiredFieldValidator(fieldName = "model.id", message = "missing id")}, requiredStrings = {@RequiredStringValidator(fieldName = "model.tripId", message = "missing tripId")})
@Override
public String execute() {
long t1 = System.currentTimeMillis();
_model = _transitDataService.getTripProblemReportForTripIdAndId(
_model.getTripId(), _model.getId());
long t2 = System.currentTimeMillis();
System.out.println("getTripProblemReportForTripIdAndId=" + (t2-t1));
if (_model == null)
return ERROR;

Expand All @@ -109,15 +118,27 @@ public String execute() {
query.setVehicleId(_model.getVehicleId());
query.setFromTime(timeFrom);
query.setToTime(timeTo);
long t3 = System.currentTimeMillis();
ListBean<VehicleLocationRecordBean> records = _transitDataService.getVehicleLocationRecords(query);
long t4 = System.currentTimeMillis();
System.out.println("getVehicleLocationRecords=" + (t4-t3));
_vehicleLocationRecords = records.getList();
}

long t5 = System.currentTimeMillis();
_labels = _transitDataService.getAllTripProblemReportLabels();
long t6 = System.currentTimeMillis();
System.out.println("getAllTripProblemReportLabels=" + (t6-t5));

// Deduplicate labels
_labels = new ArrayList<String>(new HashSet<String>(_labels));
Collections.sort(_labels);

switch(_m) {
case 1:
addActionMessage("Report Updated!");
break;
}

return SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

<h2>Trip Problem Report</h2>

<s:actionmessage />

<div id="tripProblemReport">

<div id="mapPanel">
Expand Down

0 comments on commit 4878178

Please sign in to comment.