diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDevice.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDevice.java index 4ec09db9c9..9f5b7bd649 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDevice.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/AndroidDevice.java @@ -41,14 +41,6 @@ public class AndroidDevice implements Serializable { @Size(min = 2, max = 45) @Pattern(regexp = "^[A-Za-z0-9]*$") private String name; - @ApiModelProperty( - name = "type", - value = "The OS type of the device.", - required = true - ) - @Size(min = 2, max = 45) - @Pattern(regexp = "^[A-Za-z]*$") - private String type; @ApiModelProperty( name = "description", value = "Additional information on the device.", @@ -93,9 +85,8 @@ public class AndroidDevice implements Serializable { public AndroidDevice() { } - public AndroidDevice(String name, String type, String description, String deviceId, EnrolmentInfo enrolmentInfo, List features, List properties) { + public AndroidDevice(String name, String description, String deviceId, EnrolmentInfo enrolmentInfo, List features, List properties) { this.name = name; - this.type = type; this.description = description; this.deviceIdentifier = deviceId; this.enrolmentInfo = enrolmentInfo; @@ -111,14 +102,6 @@ public class AndroidDevice implements Serializable { this.name = name; } - public String getType() { - return this.type; - } - - public void setType(String type) { - this.type = type; - } - public String getDescription() { return this.description; } @@ -176,7 +159,7 @@ public class AndroidDevice implements Serializable { } public String toString() { - return "device [name=" + this.name + ";" + "type=" + this.type + ";" + "description=" + this.description + ";" + "identifier=" + this.deviceIdentifier + ";" + "]"; + return "device [name=" + this.name + ";" + ";" + "description=" + this.description + ";" + "identifier=" + this.deviceIdentifier + ";" + "]"; } public boolean equals(Object o) { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java index 6d5290708b..f627e5f0f7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java @@ -304,9 +304,6 @@ public interface DeviceManagementService { @ApiParam( name = "id", value = "Device Identifier") - @NotNull - @Size(min = 2 , max = 45) - @Pattern(regexp = "^[A-Za-z0-9]*$") @PathParam("id") String id, @ApiParam( name = "device", @@ -337,9 +334,6 @@ public interface DeviceManagementService { @ApiParam( name = "id", value = "Device Identifier") - @NotNull - @Size(min = 2 , max = 45) - @Pattern(regexp = "^[A-Za-z0-9]*$") @PathParam("id") String id); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java index 3ac5afa552..69c0c5def5 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java @@ -200,7 +200,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { device.setDeviceInfo(androidDevice.getDeviceInfo()); device.setDeviceIdentifier(androidDevice.getDeviceIdentifier()); device.setDescription(androidDevice.getDescription()); - device.setType(androidDevice.getType()); device.setName(androidDevice.getName()); device.setFeatures(androidDevice.getFeatures()); device.setProperties(androidDevice.getProperties()); @@ -208,23 +207,23 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { boolean status = AndroidAPIUtils.getDeviceManagementService().enrollDevice(device); PolicyManagerService policyManagerService = AndroidAPIUtils.getPolicyManagerService(); - policyManagerService.getEffectivePolicy(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), androidDevice.getType())); + policyManagerService.getEffectivePolicy(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), device.getType())); if (status) { return Response.status(Response.Status.OK).entity("Android device, which carries the id '" + androidDevice.getDeviceIdentifier() + "' has successfully been enrolled").build(); } else { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Failed to enroll '" + - androidDevice.getType() + "' device, which carries the id '" + + device.getType() + "' device, which carries the id '" + androidDevice.getDeviceIdentifier() + "'").build(); } } catch (DeviceManagementException e) { - String msg = "Error occurred while enrolling the '" + androidDevice.getType() + "', which carries the id '" + + String msg = "Error occurred while enrolling the android, which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); throw new UnexpectedServerErrorException( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); } catch (PolicyManagementException e) { - String msg = "Error occurred while enforcing default enrollment policy upon '" + androidDevice.getType() + + String msg = "Error occurred while enforcing default enrollment policy upon android " + "', which carries the id '" + androidDevice.getDeviceIdentifier() + "'"; log.error(msg, e); @@ -267,7 +266,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { device.setDeviceInfo(androidDevice.getDeviceInfo()); device.setDeviceIdentifier(androidDevice.getDeviceIdentifier()); device.setDescription(androidDevice.getDescription()); - device.setType(androidDevice.getType()); device.setName(androidDevice.getName()); device.setFeatures(androidDevice.getFeatures()); device.setProperties(androidDevice.getProperties());