removing Device type from AndroidDevice bean

revert-dabc3590
hasuniea 8 years ago
parent ad8bbf8863
commit 3836d393fa

@ -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<Feature> features, List<Device.Property> properties) {
public AndroidDevice(String name, String description, String deviceId, EnrolmentInfo enrolmentInfo, List<Feature> features, List<Device.Property> 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) {

@ -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());

Loading…
Cancel
Save