PageRenderTime 70ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/src/traveldashboard/server/data/AllTubeStatusGetterUtils.java

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