Add application installation monitoring feature #436
Merged
tcdlpds
merged 12 commits from prathabanKavin/device-mgt-core:appm_syncbr
into master
5 months ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'prathabanKavin/device-mgt-core:appm_syncbr'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Purpose
package io.entgra.device.mgt.core.application.mgt.common.dto;
Add license
package io.entgra.device.mgt.core.application.mgt.common.dto;
Add license
package io.entgra.device.mgt.core.device.mgt.core.dto;
Add license
/*
* Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
Revert this change
return operation;
}
public static JSONObject convertBlobToJsonObject(Blob blob) throws SQLException {
Add Java Doc comment.
IMO it is better if we throw different exception, since these exceptions are not SQL exceptions.
jsonString = new JSONObject(obj).toString();
}
} catch (ClassNotFoundException e) {
throw new SQLException("Failed to deserialize object from BLOB", e);
Log and throw the exception
jsonString = new String(blobBytes, "UTF-8");
}
} catch (IOException e) {
throw new SQLException("Failed to convert BLOB to JSON string", e);
Log and throw the exception
// Convert JSON string to JSONObject
if (jsonString == null || jsonString.isEmpty()) {
throw new SQLException("Converted JSON string is null or empty");
Log and throw the exception
}
}
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving owners and device IDs for owner: " + owner, e);
Log and throw the error
"JOIN DM_DEVICE d ON e.DEVICE_ID = d.ID " +
"WHERE e.DEVICE_ID = ? AND e.TENANT_ID = ?";
try (Connection conn = this.getConnection();
Remove 'Connection conn = this.getConnection()' from try-with-resources block.
}
}
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving owner and status for device ID: "
Log and throw the error
"FROM DM_ENROLMENT " +
"WHERE TENANT_ID = ?";
try (Connection conn = this.getConnection();
Remove 'Connection conn = this.getConnection()' from try-with-resources block.
}
}
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving devices for tenant ID: "
Log and throw the error
" AND g.TENANT_ID = ? " +
"LIMIT ? OFFSET ?";
try (Connection conn = GroupManagementDAOFactory.getConnection();
Remove 'Connection conn = GroupManagementDAOFactory.getConnection()' from try-with-resources block.
}
}
} catch (SQLException e) {
throw new GroupManagementDAOException("Error occurred while retrieving group details and device IDs for group: "
log and throw the exception
}
@Override
public OwnerWithDeviceDTO getOwnersWithDeviceIds(String owner) throws DeviceManagementDAOException {
In these methods, we have get the value from DB and return it.
If we do so, we do not need to assign those returning values into object.
IMO we can improve these methods by evaluating the return value. In that kind of case, it is fine to assign returning value to object and do kind of a validation and return.
e.g:- If DAO layer returns null, then we can throw exception if the method does not suppose to get null for the query.
Please check all the methods in this file and do the modifications according to the use case.
"JOIN DM_DEVICE d ON e.DEVICE_ID = d.ID " +
"WHERE e.DEVICE_ID = ? AND e.TENANT_ID = ?";
try (Connection conn = this.getConnection();
Remove 'Connection conn = this.getConnection();' from try-with-resources
e.g:- Correct way of doing this. Please note this is a sample
Sync application installation monitoring featureto Add application installation monitoring feature 5 months ago6099c68d88
into master 5 months agoReviewers
6099c68d88
.