|
|
|
@ -138,7 +138,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveResponseTimeToSpreadsheet(long startTime, long endTime, long responseTime) throws IOException, GeneralSecurityException {
|
|
|
|
|
private void saveResponseTimeToSpreadsheet(long startTime, long endTime, long responseTime, String message) throws IOException, GeneralSecurityException {
|
|
|
|
|
// Load credentials from JSON file
|
|
|
|
|
GoogleCredential credential = GoogleCredential.fromStream(new FileInputStream("/home/entgra/MyProject/device-mgt-core/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/resources/apicall-382608-48aa6a62800d.json"))
|
|
|
|
|
.createScoped(Collections.singleton(SheetsScopes.SPREADSHEETS));
|
|
|
|
@ -151,7 +151,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
|
|
|
|
|
|
// Define the spreadsheet ID and range
|
|
|
|
|
String spreadsheetId = "1OZCS5NRwwSum9ai3ra4lABtU0UGW-9yLYgZk-aQfxpw";
|
|
|
|
|
String range = "Sheet1!A:C";
|
|
|
|
|
String range = "Sheet1!A:D";
|
|
|
|
|
|
|
|
|
|
// Prepare the values to be written
|
|
|
|
|
List<Object> rowValues = Arrays.asList(startTime, endTime, responseTime);
|
|
|
|
@ -484,7 +484,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
|
long responseTime = endTime - startTime;
|
|
|
|
|
|
|
|
|
|
// save the start time, end time and response time to google sheet
|
|
|
|
|
saveResponseTimeToSpreadsheet(startTime, endTime, responseTime);
|
|
|
|
|
saveResponseTimeToSpreadsheet(startTime, endTime, responseTime, "Delete Device");
|
|
|
|
|
return Response.status(Response.Status.OK).entity(response).build();
|
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
|
String msg = "Error encountered while deleting requested device of type : " + deviceType;
|
|
|
|
@ -509,7 +509,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
|
Device persistedDevice = deviceManagementProviderService.getDevice(new DeviceIdentifier
|
|
|
|
|
(deviceId, deviceType), true);
|
|
|
|
|
persistedDevice.setName(device.getName());
|
|
|
|
|
System.out.println("This is renamed device");
|
|
|
|
|
System.out.println("This is rename device");
|
|
|
|
|
boolean responseOfmodifyEnrollment = deviceManagementProviderService.modifyEnrollment(persistedDevice);
|
|
|
|
|
boolean responseOfDeviceNameChanged = deviceManagementProviderService.sendDeviceNameChangedNotification(
|
|
|
|
|
persistedDevice);
|
|
|
|
@ -520,7 +520,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
|
|
|
long responseTime = endTime - startTime;
|
|
|
|
|
|
|
|
|
|
// Save the response time, start time, and end time to Google Spreadsheet
|
|
|
|
|
saveResponseTimeToSpreadsheet(startTime, endTime, responseTime);
|
|
|
|
|
saveResponseTimeToSpreadsheet(startTime, endTime, responseTime, "Rename Device");
|
|
|
|
|
|
|
|
|
|
return Response.status(Response.Status.CREATED).entity(response).build();
|
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
|