Add original app icons into single device app list and application restriction policy app list #111

Merged
tcdlpds merged 22 commits from sanjana/device-mgt-core:app-icon-change into master 2 years ago
There is no content yet.
sanjana added 16 commits 2 years ago

Now the repo has been restructured. please update your PR

Now the repo has been restructured. please update your PR
sanjana added 116 commits 2 years ago
27cceecd33
Fix device enrolment using MSSQL as database (#72)
36bae5e3c1
Fix geofences not loading with MSSQL db (#75)
7324acb8d3
Add API doc while publishing APIs (#79)
47990e4a16
Add subtype-mgt feature (#74)
00b2c06ec0
Fix-invite-users-issue
d7d28b1879
Fix billing issues
bd35583737
Fix device enrolment and syncing with MSSQL db
7688aa375d
Fix operation logs not loading with mssql
7d6cfaa3b1
Add fix for serial number search
sanjana changed title from WIP: Add original app icons into single device app list and application restriction policy app list to Add original app icons into single device app list and application restriction policy app list 2 years ago
Poster
Fixes : https://roadmap.entgra.net/issues/10112
Poster
Fixes : https://roadmap.entgra.net/issues/10112
sanjana closed this pull request 2 years ago
sanjana reopened this pull request 2 years ago
tcdlpds requested changes 2 years ago
}
}
private void persistAppIconInfo(ApplicationReleaseDTO applicationReleaseDTO)
Owner

Put a Java Doc comment

Put a Java Doc comment
sanjana marked this conversation as resolved
}
}
private void deleteAppIconInfo(ApplicationDTO applicationDTO) throws ApplicationManagementException{
Owner

Put a Java Doc comment

Put a Java Doc comment
sanjana marked this conversation as resolved
+ artifactDownloadEndpoint + Constants.FORWARD_SLASH;
}
public static String createAppIconPath(ApplicationReleaseDTO applicationReleaseDTO, int tenantId) throws ApplicationManagementException {
Owner

Put a Java Doc comment

Put a Java Doc comment
sanjana marked this conversation as resolved
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.*;
Owner

Don't use wild card imports

Don't use wild card imports
sanjana marked this conversation as resolved
PreparedStatement stmt = null;
try{
conn = this.getConnection();
stmt = conn.prepareStatement("INSERT INTO DM_APP_ICONS (ICON_PATH, PACKAGE_NAME, VERSION, CREATED_TIMESTAMP, TENANT_ID) " +
Owner

Use try with resources and format the query.

Use try with resources and format the query.
sanjana marked this conversation as resolved
conn = this.getConnection();
stmt = conn.prepareStatement("SELECT COUNT(*) AS APP_PACKAGE_COUNT FROM DM_APP_ICONS WHERE PACKAGE_NAME = ?");
stmt.setString(1, packageName);
rs = stmt.executeQuery();
Owner

Use try-with-resources

Use try-with-resources
sanjana marked this conversation as resolved
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while saving application icon details");
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, null);
Owner

You can remove this finally block when you use try-with-resources

You can remove this finally block when you use try-with-resources
sanjana marked this conversation as resolved
PreparedStatement stmt = null;
try{
conn = this.getConnection();
stmt = conn.prepareStatement("UPDATE DM_APP_ICONS " +
Owner

Use try with resources

Use try with resources
sanjana marked this conversation as resolved
PreparedStatement stmt = null;
try{
conn = this.getConnection();
stmt = conn.prepareStatement("DELETE FROM DM_APP_ICONS WHERE PACKAGE_NAME = ?" );
Owner

Use try with resources and format the query

Use try with resources and format the query
sanjana marked this conversation as resolved
String iconPath = null;
try{
conn = this.getConnection();
stmt = conn.prepareStatement("SELECT ICON_PATH FROM DM_APP_ICONS" +
Owner

Use try-with-resources

Use try-with-resources
sanjana marked this conversation as resolved
ResultSet rs = null;
try {
conn = this.getConnection();
stmt = conn.prepareStatement("SELECT ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " +
Owner

Use try-with-resources and format the query

Use try-with-resources and format the query
sanjana marked this conversation as resolved
stmt.setInt(3, tenantId);
stmt.setInt(4, limit);
stmt.setInt(5, offset);
rs = stmt.executeQuery();
Owner

Use try-with-resources

Use try-with-resources
sanjana marked this conversation as resolved
applicationList.add(application);
}
} catch (SQLException e) {
throw new DeviceManagementDAOException("SQL Error occurred while retrieving the list of Applications " +
Owner

Log the message and throw it in each place.

Log the message and throw it in each place.
sanjana marked this conversation as resolved
throw new DeviceManagementException(msg, e);
} catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction();
String msg = "Error occurred while saving app icon info";
Owner

You can improve this log message.

Eg:- "Error occurred while saving app icon info. Icon Path: " + iconPath + " Package Name: " + packageName + " Version: " + version + " Tenant Id: " + tenantId;

When you put a log, try to log as much as possible, since these are service layers we can log as much as possible and it will useful when we investigate a issue (i.e wehn we analyze a log file). If it is the API layer, we must careful about response meddage, in that layer we should not put all the data there. Instead of that we should put a generic message which will be helpful for the client since API layer is the direct interact layer for the application client.

You can improve this log message. Eg:- "Error occurred while saving app icon info. Icon Path: " + iconPath + " Package Name: " + packageName + " Version: " + version + " Tenant Id: " + tenantId; When you put a log, try to log as much as possible, since these are service layers we can log as much as possible and it will useful when we investigate a issue (i.e wehn we analyze a log file). If it is the API layer, we must careful about response meddage, in that layer we should not put all the data there. Instead of that we should put a generic message which will be helpful for the client since API layer is the direct interact layer for the application client.
sanjana marked this conversation as resolved
app.setImageUrl(iconPath);
}
} catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction();
Owner

In here, you don't need to rollback since you have not started a transaction.

In here, you don't need to rollback since you have not started a transaction.
sanjana marked this conversation as resolved
log.error(msg, e);
throw new DeviceManagementException(msg, e);
} catch (SQLException e) {
DeviceManagementDAOFactory.rollbackTransaction();
Owner

In here, you don't need to rollback since you have not started a transaction.

In here, you don't need to rollback since you have not started a transaction.
sanjana marked this conversation as resolved
EMAIL_TYPE VARCHAR(20) NOT NULL,
META_INFO VARCHAR(20000) NOT NULL,
CREATED_AT TIMESTAMP(0) NOT NULL,
CREATED_AT TIMESTAMP NOT NULL,
Owner

Is this change related to this PR?

Is this change related to this PR?
sanjana marked this conversation as resolved
sanjana added 1 commit 2 years ago
tcdlpds approved these changes 2 years ago
tcdlpds merged commit c06fd22ecd into master 2 years ago

Reviewers

tcdlpds approved these changes 2 years ago
The pull request has been merged as c06fd22ecd.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: community/device-mgt-core#111
Loading…
There is no content yet.