2016-09-13 11:52:27 -04:00
|
|
|
package util;
|
2016-10-04 11:54:59 -04:00
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
2016-09-13 11:52:27 -04:00
|
|
|
import play.libs.Json;
|
|
|
|
|
2016-10-04 11:54:59 -04:00
|
|
|
public class Util {
|
|
|
|
public static ObjectNode createResponse(Object response, boolean ok) {
|
|
|
|
ObjectNode result = Json.newObject();
|
|
|
|
result.put("isSuccessfull", ok);
|
|
|
|
if (response instanceof String)
|
|
|
|
result.put("body", (String) response);
|
|
|
|
else result.put("body", (JsonNode) response);
|
2016-09-13 11:52:27 -04:00
|
|
|
|
2016-10-04 11:54:59 -04:00
|
|
|
return result;
|
|
|
|
}
|
2016-09-13 11:52:27 -04:00
|
|
|
}
|