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
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'sanjana/device-mgt-core:app-icon-change'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Now the repo has been restructured. please update your PR
WIP: Add original app icons into single device app list and application restriction policy app listto Add original app icons into single device app list and application restriction policy app list 2 years agoFixes : https://roadmap.entgra.net/issues/10112
Fixes : https://roadmap.entgra.net/issues/10112
}
}
private void persistAppIconInfo(ApplicationReleaseDTO applicationReleaseDTO)
Put a Java Doc comment
}
}
private void deleteAppIconInfo(ApplicationDTO applicationDTO) throws ApplicationManagementException{
Put a Java Doc comment
+ artifactDownloadEndpoint + Constants.FORWARD_SLASH;
}
public static String createAppIconPath(ApplicationReleaseDTO applicationReleaseDTO, int tenantId) throws ApplicationManagementException {
Put a Java Doc comment
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.*;
Don't use wild card imports
PreparedStatement stmt = null;
try{
conn = this.getConnection();
stmt = conn.prepareStatement("INSERT INTO DM_APP_ICONS (ICON_PATH, PACKAGE_NAME, VERSION, CREATED_TIMESTAMP, TENANT_ID) " +
Use try with resources and format the query.
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();
Use try-with-resources
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while saving application icon details");
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, null);
You can remove this finally block when you use try-with-resources
PreparedStatement stmt = null;
try{
conn = this.getConnection();
stmt = conn.prepareStatement("UPDATE DM_APP_ICONS " +
Use try with resources
PreparedStatement stmt = null;
try{
conn = this.getConnection();
stmt = conn.prepareStatement("DELETE FROM DM_APP_ICONS WHERE PACKAGE_NAME = ?" );
Use try with resources and format the query
String iconPath = null;
try{
conn = this.getConnection();
stmt = conn.prepareStatement("SELECT ICON_PATH FROM DM_APP_ICONS" +
Use try-with-resources
ResultSet rs = null;
try {
conn = this.getConnection();
stmt = conn.prepareStatement("SELECT ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " +
Use try-with-resources and format the query
stmt.setInt(3, tenantId);
stmt.setInt(4, limit);
stmt.setInt(5, offset);
rs = stmt.executeQuery();
Use try-with-resources
applicationList.add(application);
}
} catch (SQLException e) {
throw new DeviceManagementDAOException("SQL Error occurred while retrieving the list of Applications " +
Log the message and throw it in each place.
throw new DeviceManagementException(msg, e);
} catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction();
String msg = "Error occurred while saving app icon info";
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.
app.setImageUrl(iconPath);
}
} catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction();
In here, you don't need to rollback since you have not started a transaction.
log.error(msg, e);
throw new DeviceManagementException(msg, e);
} catch (SQLException e) {
DeviceManagementDAOFactory.rollbackTransaction();
In here, you don't need to rollback since you have not started a transaction.
EMAIL_TYPE VARCHAR(20) NOT NULL,
META_INFO VARCHAR(20000) NOT NULL,
CREATED_AT TIMESTAMP(0) NOT NULL,
CREATED_AT TIMESTAMP NOT NULL,
Is this change related to this PR?
c06fd22ecd
into master 2 years agoReviewers
c06fd22ecd
.