Improve SQL queries in APPM

feature/appm-store/pbac
lasanthaDLPDS 5 years ago
parent 632fa88015
commit b5a1433709

@ -692,15 +692,13 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
App app = new App(); App app = new App();
MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType()); MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType());
if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) { if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) {
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
app.setType(mobileAppType); app.setType(mobileAppType);
app.setLocation(application.getApplicationReleases().get(0).getInstallerPath()); app.setLocation(application.getApplicationReleases().get(0).getInstallerPath());
app.setIdentifier(application.getPackageName()); app.setIdentifier(application.getPackageName());
app.setName(application.getName()); app.setName(application.getName());
if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) {
return MDMAndroidOperationUtil.createInstallAppOperation(app); return MDMAndroidOperationUtil.createInstallAppOperation(app);
} else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) {
app.setType(mobileAppType);
app.setAppIdentifier(application.getPackageName());
return MDMAndroidOperationUtil.createAppUninstallOperation(app); return MDMAndroidOperationUtil.createAppUninstallOperation(app);
} else { } else {
String msg = "Invalid Action is found. Action: " + action; String msg = "Invalid Action is found. Action: " + action;
@ -817,6 +815,14 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
for (DeviceSubscriptionDTO deviceIds : deviceSubscriptionDTOS) { for (DeviceSubscriptionDTO deviceIds : deviceSubscriptionDTOS) {
deviceIdList.add(deviceIds.getDeviceId()); deviceIdList.add(deviceIds.getDeviceId());
} }
if (deviceIdList.isEmpty()){
PaginationResult paginationResult = new PaginationResult();
paginationResult.setData(deviceIdList);
paginationResult.setRecordsFiltered(0);
paginationResult.setRecordsTotal(0);
return paginationResult;
}
//pass the device id list to device manager service method //pass the device id list to device manager service method
try { try {
PaginationResult deviceDetails = deviceManagementProviderService PaginationResult deviceDetails = deviceManagementProviderService

@ -59,8 +59,6 @@ public class App {
"tab and you will see the package name under the respective " + "tab and you will see the package name under the respective " +
"application..", required = true) "application..", required = true)
private String packageName; private String packageName;
@ApiModelProperty(name = "appIdentifier", value = "The package name of the application.", required = true)
private String appIdentifier;
private String location; private String location;
@ApiModelProperty(name = "properties", value = "List of meta data.", required = true) @ApiModelProperty(name = "properties", value = "List of meta data.", required = true)
private Properties properties; private Properties properties;
@ -129,14 +127,6 @@ public class App {
this.packageName = packageName; this.packageName = packageName;
} }
public String getAppIdentifier() {
return appIdentifier;
}
public void setAppIdentifier(String appIdentifier) {
this.appIdentifier = appIdentifier;
}
public String getLocation() { public String getLocation() {
return location; return location;
} }

@ -3734,12 +3734,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
PaginationResult paginationResult = new PaginationResult(); PaginationResult paginationResult = new PaginationResult();
int count; int count;
List<Device> SubscribedDeviceDetails; List<Device> subscribedDeviceDetails;
try { try {
DeviceManagementDAOFactory.openConnection(); DeviceManagementDAOFactory.openConnection();
SubscribedDeviceDetails = deviceDAO subscribedDeviceDetails = deviceDAO
.getSubscribedDevices(offsetValue, limitValue, devicesIds, tenantId, status); .getSubscribedDevices(offsetValue, limitValue, devicesIds, tenantId, status);
count = SubscribedDeviceDetails.size(); count = subscribedDeviceDetails.size();
} catch (DeviceManagementDAOException e) { } catch (DeviceManagementDAOException e) {
String msg = "Error occurred while retrieving device list for device ids " + devicesIds; String msg = "Error occurred while retrieving device list for device ids " + devicesIds;
@ -3752,7 +3752,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} finally { } finally {
DeviceManagementDAOFactory.closeConnection(); DeviceManagementDAOFactory.closeConnection();
} }
paginationResult.setData(getAllDeviceInfo(SubscribedDeviceDetails)); paginationResult.setData(getAllDeviceInfo(subscribedDeviceDetails));
paginationResult.setRecordsFiltered(count); paginationResult.setRecordsFiltered(count);
paginationResult.setRecordsTotal(count); paginationResult.setRecordsTotal(count);
return paginationResult; return paginationResult;

@ -91,14 +91,14 @@ public class MDMAndroidOperationUtil {
EnterpriseApplication enterpriseApplication = EnterpriseApplication enterpriseApplication =
new EnterpriseApplication(); new EnterpriseApplication();
enterpriseApplication.setType(application.getType().toString()); enterpriseApplication.setType(application.getType().toString());
enterpriseApplication.setAppIdentifier(application.getAppIdentifier()); enterpriseApplication.setAppIdentifier(application.getIdentifier());
operation.setPayLoad(enterpriseApplication.toJSON()); operation.setPayLoad(enterpriseApplication.toJSON());
break; break;
case PUBLIC: case PUBLIC:
AppStoreApplication appStoreApplication = AppStoreApplication appStoreApplication =
new AppStoreApplication(); new AppStoreApplication();
appStoreApplication.setType(application.getType().toString()); appStoreApplication.setType(application.getType().toString());
appStoreApplication.setAppIdentifier(application.getAppIdentifier()); appStoreApplication.setAppIdentifier(application.getIdentifier());
operation.setPayLoad(appStoreApplication.toJSON()); operation.setPayLoad(appStoreApplication.toJSON());
break; break;
case WEBAPP: case WEBAPP:

@ -25,7 +25,7 @@ CREATE TABLE IF NOT EXISTS AP_APP_RELEASE(
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
UUID VARCHAR(200) NOT NULL, UUID VARCHAR(200) NOT NULL,
RELEASE_TYPE VARCHAR(45) NOT NULL, RELEASE_TYPE VARCHAR(45) NOT NULL,
PACKAGE_NAME VARCHAR(45) NOT NULL, PACKAGE_NAME VARCHAR(150) NOT NULL,
APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL, APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL,
INSTALLER_LOCATION VARCHAR(100) NOT NULL, INSTALLER_LOCATION VARCHAR(100) NOT NULL,
ICON_LOCATION VARCHAR(100) NOT NULL, ICON_LOCATION VARCHAR(100) NOT NULL,
@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL, ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL,
@ -129,7 +129,7 @@ CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION(
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
GROUP_NAME VARCHAR(100) NOT NULL, GROUP_NAME VARCHAR(100) NOT NULL,
@ -150,7 +150,7 @@ CREATE TABLE IF NOT EXISTS AP_ROLE_SUBSCRIPTION(
ROLE_NAME VARCHAR(100) NOT NULL, ROLE_NAME VARCHAR(100) NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,
@ -185,7 +185,7 @@ CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION(
USER_NAME VARCHAR(100) NOT NULL, USER_NAME VARCHAR(100) NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,

@ -25,7 +25,7 @@ CREATE TABLE AP_APP_RELEASE(
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
UUID VARCHAR(200) NOT NULL, UUID VARCHAR(200) NOT NULL,
RELEASE_TYPE VARCHAR(45) NOT NULL, RELEASE_TYPE VARCHAR(45) NOT NULL,
PACKAGE_NAME VARCHAR(45) NOT NULL, PACKAGE_NAME VARCHAR(150) NOT NULL,
APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL, APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL,
INSTALLER_LOCATION VARCHAR(100) NOT NULL, INSTALLER_LOCATION VARCHAR(100) NOT NULL,
ICON_LOCATION VARCHAR(100) NOT NULL, ICON_LOCATION VARCHAR(100) NOT NULL,
@ -108,7 +108,7 @@ CREATE TABLE AP_DEVICE_SUBSCRIPTION(
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL, SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL,
UNSUBSCRIBED BIT NULL DEFAULT NULL, UNSUBSCRIBED BIT NOT NULL DEFAULT 'false',
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL,
ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL, ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL,
@ -130,7 +130,7 @@ CREATE TABLE AP_GROUP_SUBSCRIPTION(
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL, SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL,
UNSUBSCRIBED BIT NULL DEFAULT NULL, UNSUBSCRIBED BIT NOT NULL DEFAULT 'false',
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL,
GROUP_NAME VARCHAR(100) NOT NULL, GROUP_NAME VARCHAR(100) NOT NULL,
@ -151,7 +151,7 @@ CREATE TABLE AP_ROLE_SUBSCRIPTION(
ROLE_NAME VARCHAR(100) NOT NULL, ROLE_NAME VARCHAR(100) NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL, SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL,
UNSUBSCRIBED BIT NULL DEFAULT NULL, UNSUBSCRIBED BIT NOT NULL DEFAULT 'false',
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,
@ -186,7 +186,7 @@ CREATE TABLE AP_USER_SUBSCRIPTION(
USER_NAME VARCHAR(100) NOT NULL, USER_NAME VARCHAR(100) NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL, SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL,
UNSUBSCRIBED BIT NULL DEFAULT NULL, UNSUBSCRIBED BIT NOT NULL DEFAULT 'false',
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,

@ -25,7 +25,7 @@ CREATE TABLE IF NOT EXISTS AP_APP_RELEASE(
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
UUID VARCHAR(200) NOT NULL, UUID VARCHAR(200) NOT NULL,
RELEASE_TYPE VARCHAR(45) NOT NULL, RELEASE_TYPE VARCHAR(45) NOT NULL,
PACKAGE_NAME VARCHAR(45) NOT NULL, PACKAGE_NAME VARCHAR(150) NOT NULL,
APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL, APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL,
INSTALLER_LOCATION VARCHAR(100) NOT NULL, INSTALLER_LOCATION VARCHAR(100) NOT NULL,
ICON_LOCATION VARCHAR(100) NOT NULL, ICON_LOCATION VARCHAR(100) NOT NULL,
@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL, ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL,
@ -129,7 +129,7 @@ CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION(
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
GROUP_NAME VARCHAR(100) NOT NULL, GROUP_NAME VARCHAR(100) NOT NULL,
@ -150,7 +150,7 @@ TENANT_ID INTEGER NOT NULL,
ROLE_NAME VARCHAR(100) NOT NULL, ROLE_NAME VARCHAR(100) NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,
@ -185,7 +185,7 @@ CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION(
USER_NAME VARCHAR(100) NOT NULL, USER_NAME VARCHAR(100) NOT NULL,
SUBSCRIBED_BY VARCHAR(100) NOT NULL, SUBSCRIBED_BY VARCHAR(100) NOT NULL,
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL, SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL, UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false,
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
AP_APP_RELEASE_ID INTEGER NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL,

Loading…
Cancel
Save