Fixed issues in device management APIs

revert-dabc3590
harshanL 10 years ago
parent f091ce70c6
commit e45e19c5e8

@ -17,6 +17,7 @@
package cdm.api.android;
import cdm.api.android.util.AndroidAPIUtils;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -70,7 +71,8 @@ public class Device {
}
switch (status) {
case 1:
return Response.status(200).entity(result).build();
String response = new Gson().toJson(result);
return Response.status(200).entity(response).build();
case -1:
return Response.status(500).entity(msg).build();
}
@ -83,7 +85,7 @@ public class Device {
int status = 0;
String msg = "";
DeviceManagementService dmService;
org.wso2.carbon.device.mgt.common.Device device = null;
org.wso2.carbon.device.mgt.common.Device device = new org.wso2.carbon.device.mgt.common.Device();
try {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
@ -111,7 +113,8 @@ public class Device {
}
switch (status) {
case 1:
return Response.status(200).entity(device).build();
String response = new Gson().toJson(device);
return Response.status(200).entity(response).build();
case -1:
return Response.status(500).entity(msg).build();
}

@ -31,7 +31,6 @@ public class AndroidAPIUtils {
public static Device convertToDeviceObject(String jsonString) {
JsonObject obj = new Gson().fromJson(jsonString, JsonObject.class);
Device device = new Device();
device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
if (obj.get(AndroidConstants.DeviceConstants.DEVICE_MAC_KEY) != null) {
device.setDeviceIdentifier(

Loading…
Cancel
Save