PageRenderTime 158ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/src/traveldashboard/server/data/AllTubeRatingGetterUtils.java

https://bitbucket.org/ambientic/traveldashboard-server
Java | 31 lines | 17 code | 14 blank | 0 comment | 2 complexity | 7d90c5ab5fbb1c38aa7b2569bfbdc448 MD5 | raw file
  1. package traveldashboard.server.data;
  2. import org.ibicoop.sdp.config.NetworkMessage;
  3. import com.google.gson.Gson;
  4. public class AllTubeRatingGetterUtils extends ResponseUtils {
  5. private static final String TAG = "TubeRatingGetterUtils";
  6. public static NetworkMessage getAllTubeRatingMessage(NetworkMessage req) {
  7. String methodTag = "getAllTubeRatingMessage";
  8. if (DataConstants.DEBUG) TdServerLogger.print(TAG, methodTag, "Start getting all tube ratings");
  9. NetworkMessage resp = prepareMsgReturn(req);
  10. String city = req.getPayload(DataConstants.PARAM_KEY_CITY_TYPE);
  11. Gson gson = new Gson();
  12. String json = gson.toJson(MongoDbManager.getMetroGeneralRatingsCollection(city));
  13. resp.addPayload(DataConstants.ALL_TUBE_RATING_MESSAGE, json);
  14. if (DataConstants.DEBUG) TdServerLogger.print(TAG, methodTag, "End get all tube rating message : " + new String(resp.encode()));
  15. return resp;
  16. }
  17. }