Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Convert Google Datastore Entity into Json String. Each serialization failure results in
- * dispatch of error status and message to user.
- * @param entity The Google Datastore Entity to be serialized
- * @return String Json string representation of the entity
- */
- protected String toEntityMapString(Entity entity){
- String result = "";
- try{
- result = new ObjectMapper().writeValueAsString(entity.getProperties());
- }catch(JsonMappingException e){
- e.printStackTrace();
- databaseListener.OnQueryFinished("{\"status\":\"error\",message:\"Entity mapping failed (at com.artlogic.defaultserver.db.DBUser:toEntityMapString)\"}");
- } catch (JsonGenerationException e) {
- e.printStackTrace();
- databaseListener.OnQueryFinished("{\"status\":\"error\",message:\"Json string generation failed (at com.artlogic.defaultserver.db.DBUser:toEntityMapString)\"}");
- } catch (IOException e) {
- e.printStackTrace();
- databaseListener.OnQueryFinished("{\"status\":\"error\",message:\"IO exception raised (at com.artlogic.defaultserver.db.DBUser:toEntityMapString)\"}");
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement