use of org.onebusaway.admin.bundle.model.Bundle in project onebusaway-application-modules by camsys.
the class LocalBundleStagerServiceImpl method getBundleList.
@Override
public Response getBundleList() {
_log.info("Starting getBundleList.");
List<Bundle> bundles = bundleProvider.getBundles();
Response response;
if (bundles != null) {
BundlesListMessage bundlesMessage = new BundlesListMessage();
bundlesMessage.setBundles(bundles);
bundlesMessage.setStatus("OK");
final BundlesListMessage bundlesMessageToWrite = bundlesMessage;
StreamingOutput output = new StreamingOutput() {
@Override
public void write(OutputStream out) throws IOException, WebApplicationException {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
jsonTool.writeJson(writer, bundlesMessageToWrite);
writer.close();
out.close();
}
};
response = Response.ok(output, "application/json").build();
} else {
response = Response.serverError().build();
}
_log.info("Returning Response in getBundleList.");
return response;
}
Aggregations