mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt-plugins into scope-impl
This commit is contained in:
commit
1b006bc155
@ -41,14 +41,6 @@ public class AndroidDevice implements Serializable {
|
|||||||
@Size(min = 2, max = 45)
|
@Size(min = 2, max = 45)
|
||||||
@Pattern(regexp = "^[A-Za-z0-9]*$")
|
@Pattern(regexp = "^[A-Za-z0-9]*$")
|
||||||
private String name;
|
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(
|
@ApiModelProperty(
|
||||||
name = "description",
|
name = "description",
|
||||||
value = "Additional information on the device.",
|
value = "Additional information on the device.",
|
||||||
@ -93,9 +85,8 @@ public class AndroidDevice implements Serializable {
|
|||||||
public AndroidDevice() {
|
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.name = name;
|
||||||
this.type = type;
|
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.deviceIdentifier = deviceId;
|
this.deviceIdentifier = deviceId;
|
||||||
this.enrolmentInfo = enrolmentInfo;
|
this.enrolmentInfo = enrolmentInfo;
|
||||||
@ -111,14 +102,6 @@ public class AndroidDevice implements Serializable {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return this.description;
|
return this.description;
|
||||||
}
|
}
|
||||||
@ -176,7 +159,7 @@ public class AndroidDevice implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
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) {
|
public boolean equals(Object o) {
|
||||||
|
|||||||
@ -304,9 +304,6 @@ public interface DeviceManagementService {
|
|||||||
@ApiParam(
|
@ApiParam(
|
||||||
name = "id",
|
name = "id",
|
||||||
value = "Device Identifier")
|
value = "Device Identifier")
|
||||||
@NotNull
|
|
||||||
@Size(min = 2 , max = 45)
|
|
||||||
@Pattern(regexp = "^[A-Za-z0-9]*$")
|
|
||||||
@PathParam("id") String id,
|
@PathParam("id") String id,
|
||||||
@ApiParam(
|
@ApiParam(
|
||||||
name = "device",
|
name = "device",
|
||||||
@ -337,9 +334,6 @@ public interface DeviceManagementService {
|
|||||||
@ApiParam(
|
@ApiParam(
|
||||||
name = "id",
|
name = "id",
|
||||||
value = "Device Identifier")
|
value = "Device Identifier")
|
||||||
@NotNull
|
|
||||||
@Size(min = 2 , max = 45)
|
|
||||||
@Pattern(regexp = "^[A-Za-z0-9]*$")
|
|
||||||
@PathParam("id") String id);
|
@PathParam("id") String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -200,7 +200,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
device.setDeviceInfo(androidDevice.getDeviceInfo());
|
device.setDeviceInfo(androidDevice.getDeviceInfo());
|
||||||
device.setDeviceIdentifier(androidDevice.getDeviceIdentifier());
|
device.setDeviceIdentifier(androidDevice.getDeviceIdentifier());
|
||||||
device.setDescription(androidDevice.getDescription());
|
device.setDescription(androidDevice.getDescription());
|
||||||
device.setType(androidDevice.getType());
|
|
||||||
device.setName(androidDevice.getName());
|
device.setName(androidDevice.getName());
|
||||||
device.setFeatures(androidDevice.getFeatures());
|
device.setFeatures(androidDevice.getFeatures());
|
||||||
device.setProperties(androidDevice.getProperties());
|
device.setProperties(androidDevice.getProperties());
|
||||||
@ -208,23 +207,23 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
boolean status = AndroidAPIUtils.getDeviceManagementService().enrollDevice(device);
|
boolean status = AndroidAPIUtils.getDeviceManagementService().enrollDevice(device);
|
||||||
|
|
||||||
PolicyManagerService policyManagerService = AndroidAPIUtils.getPolicyManagerService();
|
PolicyManagerService policyManagerService = AndroidAPIUtils.getPolicyManagerService();
|
||||||
policyManagerService.getEffectivePolicy(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), androidDevice.getType()));
|
policyManagerService.getEffectivePolicy(new DeviceIdentifier(androidDevice.getDeviceIdentifier(), device.getType()));
|
||||||
if (status) {
|
if (status) {
|
||||||
return Response.status(Response.Status.OK).entity("Android device, which carries the id '" +
|
return Response.status(Response.Status.OK).entity("Android device, which carries the id '" +
|
||||||
androidDevice.getDeviceIdentifier() + "' has successfully been enrolled").build();
|
androidDevice.getDeviceIdentifier() + "' has successfully been enrolled").build();
|
||||||
} else {
|
} else {
|
||||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Failed to enroll '" +
|
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();
|
androidDevice.getDeviceIdentifier() + "'").build();
|
||||||
}
|
}
|
||||||
} catch (DeviceManagementException e) {
|
} 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() + "'";
|
androidDevice.getDeviceIdentifier() + "'";
|
||||||
log.error(msg, e);
|
log.error(msg, e);
|
||||||
throw new UnexpectedServerErrorException(
|
throw new UnexpectedServerErrorException(
|
||||||
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
|
||||||
} catch (PolicyManagementException e) {
|
} 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 '" +
|
"', which carries the id '" +
|
||||||
androidDevice.getDeviceIdentifier() + "'";
|
androidDevice.getDeviceIdentifier() + "'";
|
||||||
log.error(msg, e);
|
log.error(msg, e);
|
||||||
@ -267,7 +266,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|||||||
device.setDeviceInfo(androidDevice.getDeviceInfo());
|
device.setDeviceInfo(androidDevice.getDeviceInfo());
|
||||||
device.setDeviceIdentifier(androidDevice.getDeviceIdentifier());
|
device.setDeviceIdentifier(androidDevice.getDeviceIdentifier());
|
||||||
device.setDescription(androidDevice.getDescription());
|
device.setDescription(androidDevice.getDescription());
|
||||||
device.setType(androidDevice.getType());
|
|
||||||
device.setName(androidDevice.getName());
|
device.setName(androidDevice.getName());
|
||||||
device.setFeatures(androidDevice.getFeatures());
|
device.setFeatures(androidDevice.getFeatures());
|
||||||
device.setProperties(androidDevice.getProperties());
|
device.setProperties(androidDevice.getProperties());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user