diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml
index 597b97169a..43fc4fc2fe 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml
@@ -52,6 +52,7 @@
Application Management Common Bundle
org.wso2.carbon.device.mgt.common.*;version="${carbon.device.mgt.version}",
+ org.wso2.carbon.device.mgt.core.dto;version="${carbon.device.mgt.version}",
com.google.gson,
io.swagger.annotations.*;resolution:=optional,
com.fasterxml.jackson.annotation,
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java
index f336ad3807..4516f1da0f 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java
@@ -21,6 +21,7 @@ package org.wso2.carbon.device.application.mgt.common;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
+import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import java.util.List;
@@ -36,6 +37,11 @@ public class Application {
required = true)
private String name;
+ @ApiModelProperty(name = "description",
+ value = "Description of the application",
+ required = true)
+ private String description;
+
@ApiModelProperty(name = "appCategory",
value = "Category of the application",
required = true,
@@ -81,6 +87,10 @@ public class Application {
example = "1, 2, 3")
private int deviceTypeId;
+ @ApiModelProperty(name = "appRating",
+ value = "Rating of the aplication")
+ private int appRating;
+
@ApiModelProperty(name = "deviceType",
value = "Related device type of the application",
required = true,
@@ -93,6 +103,8 @@ public class Application {
example = "REMOVED, ACTIVE")
private String status;
+ private DeviceType deviceTypeObj;
+
@ApiModelProperty(name = "applicationReleases",
value = "List of application releases",
required = true)
@@ -186,9 +198,7 @@ public class Application {
return deviceType;
}
- public void setDeviceType(String deviceType) {
- this.deviceType = deviceType;
- }
+ public void setDeviceType(String deviceType) { this.deviceType = deviceType; }
public int getDeviceTypeId() {
return deviceTypeId;
@@ -201,4 +211,16 @@ public class Application {
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
+
+ public String getDescription() { return description; }
+
+ public void setDescription(String description) { this.description = description; }
+
+ public int getAppRating() { return appRating; }
+
+ public void setAppRating(int appRating) { this.appRating = appRating; }
+
+ public DeviceType getDeviceTypeObj() { return deviceTypeObj; }
+
+ public void setDeviceTypeObj(DeviceType deviceTypeObj) { this.deviceTypeObj = deviceTypeObj; }
}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java
index c3ff893463..b1b0ab8f14 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java
@@ -18,16 +18,22 @@
*/
package org.wso2.carbon.device.application.mgt.common;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "ApplicationRelease", description = "This class holds the details when releasing an Application to application store")
public class ApplicationRelease {
+ @JsonIgnore
@ApiModelProperty(name = "id",
value = "ID of the application release")
private int id;
+ @ApiModelProperty(name = "description",
+ value = "Description of the application release")
+ private String description;
+
@ApiModelProperty(name = "version",
value = "Version of the application release")
private String version;
@@ -98,14 +104,26 @@ public class ApplicationRelease {
value = "URL which is used for WEB-CLIP")
private String url;
+ //todo remove and add string called current state
@ApiModelProperty(name = "lifecycleState",
value = "Latest Lifecycle state of the application release")
private LifecycleState lifecycleState;
+ @ApiModelProperty(name = "supportedOsVersions",
+ value = "Application release supported OS versions")
+ private String supportedOsVersions;
+
+ @ApiModelProperty(name = "currentState",
+ value = "Current state of the application release")
+ private String currentState;
+
@ApiModelProperty(name = "packageName",
value = "Application bundle identifier")
private String packageName;
+ public ApplicationRelease() {
+ }
+
public int getRatedUsers() {
return ratedUsers;
}
@@ -257,4 +275,16 @@ public class ApplicationRelease {
public String getPackageName() {
return packageName;
}
+
+ public String getDescription() { return description; }
+
+ public void setDescription(String description) { this.description = description; }
+
+ public String getSupportedOsVersions() { return supportedOsVersions; }
+
+ public void setSupportedOsVersions(String supportedOsVersions) { this.supportedOsVersions = supportedOsVersions; }
+
+ public String getCurrentState() { return currentState; }
+
+ public void setCurrentState(String currentState) { this.currentState = currentState; }
}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java
index cbffbced31..0fab3d6c7c 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java
@@ -32,6 +32,7 @@ import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorage
import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager;
import org.wso2.carbon.device.application.mgt.core.config.Configuration;
import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager;
+import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import java.sql.PreparedStatement;
@@ -47,6 +48,66 @@ public class Util {
private static final Log log = LogFactory.getLog(Util.class);
+// /**
+// * To create application object from the result set retrieved from the Database.
+// *
+// * @param rs ResultSet
+// * @return List of Applications that is retrieved from the Database.
+// * @throws SQLException SQL Exception
+// * @throws JSONException JSONException.
+// */
+// public static List loadApplications(ResultSet rs) throws SQLException, JSONException {
+//
+// List applications = new ArrayList<>();
+// Application application = null;
+// int applicationId = -1;
+// boolean hasNext = rs.next();
+//
+// while (hasNext) {
+// if (applicationId != rs.getInt("APP_ID")) {
+// if (application != null) {
+// applications.add(application);
+// }
+// applicationId = rs.getInt("APP_ID");
+// application = new Application();
+// application.setTags(new ArrayList<>());
+// application.setUnrestrictedRoles(new ArrayList<>());
+// application.setId(applicationId);
+// application.setName(rs.getString("APP_NAME"));
+// application.setType(rs.getString("APP_TYPE"));
+// application.setAppCategory(rs.getString("APP_CATEGORY"));
+// application.setSubType(rs.getString("SUB_TYPE"));
+// application.setPaymentCurrency(rs.getString("CURRENCY"));
+// application.setIsRestricted(rs.getBoolean("RESTRICTED"));
+// application.setStatus(rs.getString("STATUS"));
+// String tag = rs.getString("APP_TAG");
+// String unrestrictedRole = rs.getString("ROLE");
+// if (tag != null) {
+// application.getTags().add(tag);
+// }
+// if (unrestrictedRole != null) {
+// application.getUnrestrictedRoles().add(unrestrictedRole);
+// }
+// } else {
+// String tag = rs.getString("APP_TAG");
+// String unrestrictedRole = rs.getString("ROLE");
+// if (application != null) {
+// if (tag != null && !application.getTags().contains(tag)) {
+// application.getTags().add(tag);
+// }
+// if (unrestrictedRole != null && !application.getUnrestrictedRoles().contains(unrestrictedRole)) {
+// application.getUnrestrictedRoles().add(unrestrictedRole);
+// }
+// }
+// }
+// hasNext = rs.next();
+// if (!hasNext) {
+// applications.add(application);
+// }
+// }
+// return applications;
+// }
+
/**
* To create application object from the result set retrieved from the Database.
*
@@ -67,36 +128,38 @@ public class Util {
if (application != null) {
applications.add(application);
}
- applicationId = rs.getInt("APP_ID");
application = new Application();
- application.setTags(new ArrayList<>());
- application.setUnrestrictedRoles(new ArrayList<>());
+ application.setApplicationReleases(new ArrayList<>());
+ applicationId = rs.getInt("APP_ID");
application.setId(applicationId);
application.setName(rs.getString("APP_NAME"));
+ application.setDescription(rs.getString("APP_DESCRIPTION"));
application.setType(rs.getString("APP_TYPE"));
- application.setAppCategory(rs.getString("APP_CATEGORY"));
- application.setSubType(rs.getString("SUB_TYPE"));
- application.setPaymentCurrency(rs.getString("CURRENCY"));
- application.setIsRestricted(rs.getBoolean("RESTRICTED"));
- application.setStatus(rs.getString("STATUS"));
- String tag = rs.getString("APP_TAG");
- String unrestrictedRole = rs.getString("ROLE");
- if (tag != null) {
- application.getTags().add(tag);
- }
- if (unrestrictedRole != null) {
- application.getUnrestrictedRoles().add(unrestrictedRole);
- }
+ application.setSubType(rs.getString("APP_SUB_TYPE"));
+ application.setPaymentCurrency(rs.getString("APP_CURRENCY"));
+ application.setStatus(rs.getString("APP_STATUS"));
+ application.setAppRating(rs.getInt("APP_RATING)"));
+ DeviceType deviceType = new DeviceType();
+ application.setDeviceTypeObj(deviceType);
} else {
- String tag = rs.getString("APP_TAG");
- String unrestrictedRole = rs.getString("ROLE");
- if (application != null) {
- if (tag != null && !application.getTags().contains(tag)) {
- application.getTags().add(tag);
- }
- if (unrestrictedRole != null && !application.getUnrestrictedRoles().contains(unrestrictedRole)) {
- application.getUnrestrictedRoles().add(unrestrictedRole);
- }
+ ApplicationRelease appRelease = new ApplicationRelease();
+ appRelease.setDescription(rs.getString("RELEASE_DESCRIPTION"));
+ appRelease.setUuid(rs.getString("RELEASE_UUID"));
+ appRelease.setReleaseType(rs.getString("RELEASE_TYPE"));
+ appRelease.setVersion(rs.getString("RELEASE_VERSION"));
+ appRelease.setAppStoredLoc(rs.getString("AP_RELEASE_STORED_LOC"));
+ appRelease.setBannerLoc(rs.getString("RELEASE_BANNER_LOC"));
+ appRelease.setScreenshotLoc1("RELEASE_SC1");
+ appRelease.setScreenshotLoc2("RELEASE_SC2");
+ appRelease.setScreenshotLoc3("RELEASE_SC3");
+ appRelease.setPrice(rs.getDouble(" RELEASE_PRICE"));
+ appRelease.setMetaData(rs.getString("RELEASE.META_INFO"));
+ appRelease.setSupportedOsVersions(rs.getString("RELEASE_SUP_OS_VERSIONS"));
+ appRelease.setRating(rs.getDouble("RELEASE_RATING"));
+ appRelease.setCurrentState(rs.getString("RELEASE_CURRENT_STATE"));
+ appRelease.setRatedUsers(rs.getInt("RATED_USER_COUNT"));
+ if (application != null && application.getApplicationReleases() != null) {
+ application.getApplicationReleases().add(appRelease);
}
}
hasNext = rs.next();
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java
index 8d18bf0daf..5952419572 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java
@@ -121,6 +121,117 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
}
}
+// @Override
+// public ApplicationList getApplications(Filter filter, int tenantId) throws ApplicationManagementDAOException {
+// if (log.isDebugEnabled()) {
+// log.debug("Getting application data from the database");
+// log.debug(String.format("Filter: limit=%s, offset=%s", filter.getLimit(), filter.getOffset()));
+// }
+// int paramIndex = 1;
+// Connection conn;
+// PreparedStatement stmt = null;
+// ResultSet rs = null;
+// ApplicationList applicationList = new ApplicationList();
+// Pagination pagination = new Pagination();
+// String sql = "SELECT "
+// + "AP_APP.ID AS APP_ID,"
+// + " AP_APP.NAME AS APP_NAME,"
+// + " AP_APP.TYPE AS APP_TYPE,"
+// + " AP_APP.APP_CATEGORY AS APP_CATEGORY,"
+// + " AP_APP.SUB_TYPE AS SUB_TYPE,"
+// + " AP_APP.CURRENCY AS CURRENCY, "
+// + "AP_APP.RESTRICTED AS RESTRICTED,"
+// + " AP_APP_TAG.TAG AS APP_TAG,"
+// + " AP_UNRESTRICTED_ROLE.ROLE AS ROLE "
+// + "FROM ((AP_APP LEFT JOIN AP_APP_TAG ON AP_APP.ID = AP_APP_TAG.AP_APP_ID) "
+// + "LEFT JOIN AP_UNRESTRICTED_ROLE ON AP_APP.ID = AP_UNRESTRICTED_ROLE.AP_APP_ID) "
+// + "WHERE AP_APP.TENANT_ID = ?";
+//
+//
+// if (filter == null) {
+// throw new ApplicationManagementDAOException("Filter need to be instantiated");
+// }
+// if (filter.getAppType() != null && !filter.getAppType().isEmpty()) {
+// sql += " AND AP_APP.TYPE ";
+// sql += "= ?";
+// }
+// if (filter.getAppCategory() != null && !filter.getAppCategory().isEmpty()) {
+// sql += " AND AP_APP.APP_CATEGORY ";
+// sql += "= ?";
+// }
+// if (filter.getAppName() != null && !filter.getAppName().isEmpty()) {
+// sql += " AND LOWER (AP_APP.NAME) ";
+// if (filter.isFullMatch()) {
+// sql += "= ?";
+// } else {
+// sql += "LIKE ?";
+// }
+// }
+// if (filter.getDeviceType() != null ) {
+// sql += " AND AP_APP.DEVICE_TYPE_ID ";
+// sql += "= ?";
+// }
+//
+// String defaultSortOrder = "ASC";
+// if (filter.getSortBy() != null && !filter.getSortBy().isEmpty()) {
+// defaultSortOrder = filter.getSortBy();
+// }
+// sql += " ORDER BY APP_ID " + defaultSortOrder +" LIMIT ? OFFSET ? ";
+//
+// pagination.setLimit(filter.getLimit());
+// pagination.setOffset(filter.getOffset());
+//
+// try {
+// conn = this.getDBConnection();
+// stmt = conn.prepareStatement(sql);
+// stmt.setInt(paramIndex++, tenantId);
+//
+// if (filter.getAppType() != null && !filter.getAppType().isEmpty()) {
+// stmt.setString(paramIndex++, filter.getAppType());
+// }
+// if (filter.getAppCategory() != null && !filter.getAppCategory().isEmpty()) {
+// stmt.setString(paramIndex++, filter.getAppCategory());
+// }
+// if (filter.getAppName() != null && !filter.getAppName().isEmpty()) {
+// if (filter.isFullMatch()) {
+// stmt.setString(paramIndex++, filter.getAppName().toLowerCase());
+// } else {
+// stmt.setString(paramIndex++, "%" + filter.getAppName().toLowerCase() + "%");
+// }
+// }
+// if (filter.getDeviceType() != null ) {
+// stmt.setInt(paramIndex++, filter.getDeviceType().getId());
+// }
+//
+//
+// if (filter.getLimit() == 0) {
+// stmt.setInt(paramIndex++, 100);
+// } else {
+// stmt.setInt(paramIndex++, filter.getLimit());
+// }
+// stmt.setInt(paramIndex, filter.getOffset());
+// rs = stmt.executeQuery();
+// applicationList.setApplications(Util.loadApplications(rs));
+// applicationList.setPagination(pagination);
+// applicationList.getPagination().setSize(filter.getOffset());
+// applicationList.getPagination().setCount(applicationList.getApplications().size());
+//
+// } catch (SQLException e) {
+// throw new ApplicationManagementDAOException("Error occurred while getting application list for the tenant"
+// + " " + tenantId + ". While executing " + sql, e);
+// } catch (DBConnectionException e) {
+// throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection while "
+// + "getting application list for the tenant " + tenantId,
+// e);
+// } catch (JSONException e) {
+// throw new ApplicationManagementDAOException("Error occurred while parsing JSON ", e);
+// } finally {
+// Util.cleanupResources(stmt, rs);
+// }
+// return applicationList;
+// }
+
+
@Override
public ApplicationList getApplications(Filter filter, int tenantId) throws ApplicationManagementDAOException {
if (log.isDebugEnabled()) {
@@ -134,19 +245,35 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
ApplicationList applicationList = new ApplicationList();
Pagination pagination = new Pagination();
String sql = "SELECT "
- + "AP_APP.ID AS APP_ID,"
- + " AP_APP.NAME AS APP_NAME,"
- + " AP_APP.TYPE AS APP_TYPE,"
- + " AP_APP.APP_CATEGORY AS APP_CATEGORY,"
- + " AP_APP.SUB_TYPE AS SUB_TYPE,"
- + " AP_APP.CURRENCY AS CURRENCY, "
- + "AP_APP.RESTRICTED AS RESTRICTED,"
- + " AP_APP_TAG.TAG AS APP_TAG,"
- + " AP_UNRESTRICTED_ROLE.ROLE AS ROLE "
- + "FROM ((AP_APP LEFT JOIN AP_APP_TAG ON AP_APP.ID = AP_APP_TAG.AP_APP_ID) "
- + "LEFT JOIN AP_UNRESTRICTED_ROLE ON AP_APP.ID = AP_UNRESTRICTED_ROLE.AP_APP_ID) "
- + "WHERE AP_APP.TENANT_ID = ?";
-
+ + "AP_APP.ID AS APP_ID, "
+ + "AP_APP.NAME AS APP_NAME, "
+ + "AP_APP.DESCRIPTION AS APP_DESCRIPTION, "
+ + "AP_APP.TYPE AS APP_TYPE, "
+ + "AP_APP.STATUS AS APP_STATUS, "
+ + "AP_APP.SUB_TYPE AS APP_SUB_TYPE, "
+ + "AP_APP.CURRENCY AS APP_CURRENCY, "
+ + "AP_APP.RATING AS APP_RATING, "
+ + "AP_APP.DEVICE_TYPE_ID AS APP_DEVICE_TYPE_ID, "
+ + "AP_APP_RELEASE.DESCRIPTION AS RELEASE_DESCRIPTION, "
+ + "AP_APP_RELEASE.VERSION AS RELEASE_VERSION, "
+ + "AP_APP_RELEASE.UUID AS RELEASE_UUID, "
+ + "AP_APP_RELEASE.RELEASE_TYPE AS RELEASE_TYPE, "
+ + "AP_APP_RELEASE.STORED_LOCATION AS AP_RELEASE_STORED_LOC, "
+ + "AP_APP_RELEASE.BANNER_LOCATION AS AP_RELEASE_BANNER_LOC, "
+ + "AP_APP_RELEASE.SC_1_LOCATION AS AP_RELEASE_SC1, "
+ + "AP_APP_RELEASE.SC_2_LOCATION AS AP_RELEASE_SC2, "
+ + "AP_APP_RELEASE.SC_3_LOCATION AS AP_RELEASE_SC3, "
+ + "AP_APP_RELEASE.APP_PRICE AS RELEASE_PRICE, "
+ + "AP_APP_RELEASE.APP_META_INFO AS RELEASE.META_INFO, "
+ + "AP_APP_RELEASE.SUPPORTED_OS_VERSIONS AS RELEASE_SUP_OS_VERSIONS, "
+ + "AP_APP_RELEASE.RATING AS RELEASE_RATING, "
+ + "AP_APP_RELEASE.CURRENT_STATE AS RELEASE_CURRENT_STATE, "
+ + "AP_APP_RELEASE.RATED_USERS AS RATED_USER_COUNT "
+ + "FROM AP_APP "
+ + "INNER JOIN AP_APP_RELEASE ON "
+ + "APP_APP.ID = APP_APP_RELEASE.AP_APP_ID AND "
+ + "AP_APP.TENANT_ID = ? AND "
+ + "AP_APP.TENANT_ID = APP_APP_RELEASE.TENANT_ID";
if (filter == null) {
throw new ApplicationManagementDAOException("Filter need to be instantiated");
@@ -218,11 +345,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
} catch (SQLException e) {
throw new ApplicationManagementDAOException("Error occurred while getting application list for the tenant"
- + " " + tenantId + ". While executing " + sql, e);
+ + " " + tenantId + ". While executing " + sql, e);
} catch (DBConnectionException e) {
throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection while "
- + "getting application list for the tenant " + tenantId,
- e);
+ + "getting application list for the tenant " + tenantId,
+ e);
} catch (JSONException e) {
throw new ApplicationManagementDAOException("Error occurred while parsing JSON ", e);
} finally {
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java
index 3f107267cf..134ba1d13f 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java
@@ -232,6 +232,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
}
}
ConnectionManagerUtil.openDBConnection();
+// todo modify this logic, join app n release tables
applicationList = applicationDAO.getApplications(filter, tenantId);
apps = applicationList.getApplications();
for ( Application app : apps){
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/APIUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/APIUtil.java
index 449b8b3161..31179c5e8d 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/APIUtil.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/APIUtil.java
@@ -21,8 +21,10 @@ package org.wso2.carbon.device.application.mgt.core.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext;
+import org.wso2.carbon.device.application.mgt.common.Filter;
import org.wso2.carbon.device.application.mgt.common.services.*;
import org.wso2.carbon.device.application.mgt.common.ErrorResponse;
+import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import javax.ws.rs.core.Response;
@@ -163,4 +165,31 @@ public class APIUtil {
return configManager;
}
+ public static Filter constructFilter(String deviceType, String appName, String appType, String appCategory,
+ boolean isFullMatch, String releaseState, int offset, int limit, String sortBy) {
+ Filter filter = new Filter();
+ filter.setOffset(offset);
+ filter.setLimit(limit);
+ filter.setSortBy(sortBy);
+ filter.setFullMatch(isFullMatch);
+ if (appName != null && !appName.isEmpty()) {
+ filter.setAppName(appName);
+ }
+ if (appType != null && !appType.isEmpty()) {
+ filter.setAppType(appType);
+ }
+ if (appCategory != null && !appCategory.isEmpty()) {
+ filter.setAppCategory(appCategory);
+ }
+ if (releaseState != null && !releaseState.isEmpty()) {
+ filter.setCurrentAppReleaseState(releaseState);
+ }
+ if (deviceType != null && !deviceType.isEmpty()) {
+ DeviceType dt = new DeviceType();
+ dt.setName(deviceType);
+ filter.setDeviceType(dt);
+ }
+ return filter;
+ }
+
}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementAPIImpl.java
index d40ea6ebec..8aed74ca98 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementAPIImpl.java
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementAPIImpl.java
@@ -35,7 +35,6 @@ import org.wso2.carbon.device.application.mgt.common.exception.ResourceManagemen
import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager;
import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager;
import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException;
-import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import java.io.IOException;
import java.io.InputStream;
@@ -81,32 +80,13 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
ApplicationManager applicationManager = APIUtil.getApplicationManager();
try {
- Filter filter = new Filter();
- filter.setOffset(offset);
- filter.setLimit(limit);
- filter.setSortBy(sortBy);
- filter.setFullMatch(isFullMatch);
- if (appName != null && !appName.isEmpty()) {
- filter.setAppName(appName);
- }
- if (appType != null && !appType.isEmpty()) {
- filter.setAppType(appType);
- }
- if (appCategory != null && !appCategory.isEmpty()) {
- filter.setAppCategory(appCategory);
- }
- if (releaseState != null && !releaseState.isEmpty()) {
- filter.setCurrentAppReleaseState(releaseState);
- }
- if (deviceType != null && !deviceType.isEmpty()) {
- DeviceType dt = new DeviceType();
- dt.setName(deviceType);
- filter.setDeviceType(dt);
- }
+ Filter filter = APIUtil
+ .constructFilter(deviceType, appName, appType, appCategory, isFullMatch, releaseState, offset,
+ limit, sortBy);
ApplicationList applications = applicationManager.getApplications(filter);
if (applications.getApplications().isEmpty()) {
return Response.status(Response.Status.NOT_FOUND)
- .entity("Couldn't find any application for requested query.").build();
+ .entity("Couldn't find any application for the requested query.").build();
}
return Response.status(Response.Status.OK).entity(applications).build();
} catch(BadRequestException e){
@@ -169,8 +149,8 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
try {
if (isInvalidReleaseCreatingRequest(binaryFile, iconFile, bannerFile, attachmentList, application.getType())) {
-// todo add msg
- return Response.status(Response.Status.BAD_REQUEST).build();
+ return Response.status(Response.Status.BAD_REQUEST)
+ .entity("Invalid request for creating an application.").build();
}
// The application executable artifacts such as apks are uploaded.
@@ -673,4 +653,5 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI {
}
return false;
}
+
}
diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql
index a33659ae07..4eee8b20b7 100644
--- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql
+++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql
@@ -1,208 +1,355 @@
+CREATE SCHEMA IF NOT EXISTS APP_MANAGER
+SET CATALOG APP_MANAGER
+
-- -----------------------------------------------------
-- Table AP_APP
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_APP (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- NAME VARCHAR(45) NOT NULL,
- TYPE VARCHAR(200) NOT NULL,
- TENANT_ID VARCHAR(45) NOT NULL,
- APP_CATEGORY VARCHAR(45) NULL DEFAULT NULL,
- RESTRICTED INT(11) NOT NULL,
- STATUS VARCHAR(45) NOT NULL DEFAULT 'ACTIVE',
- SUB_TYPE VARCHAR(45) NOT NULL,
- CURRENCY VARCHAR(45) NULL DEFAULT '$',
- DEVICE_TYPE_ID INT(11) NOT NULL,
- PRIMARY KEY (ID));
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP(
+ ID int NOT NULL AUTO_INCREMENT,
+ NAME varchar(45) NOT NULL,
+ DESCRIPTION clob NULL,
+ TYPE varchar(200) NOT NULL,
+ TENANT_ID varchar(45) NOT NULL,
+ STATUS varchar(45) NOT NULL DEFAULT 'ACTIVE',
+ SUB_TYPE varchar(45) NOT NULL,
+ CURRENCY varchar(45) NULL DEFAULT '$',
+ RATING int NULL,
+ DEVICE_TYPE_ID int NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_AP_APP_DM_DEVICE_TYPE1
+ FOREIGN KEY (DEVICE_TYPE_ID)
+ REFERENCES APP_MANAGER.DM_DEVICE_TYPE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AP_APP_DM_DEVICE_TYPE1_idx (DEVICE_TYPE_ID ASC)
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
-- -----------------------------------------------------
-- Table AP_APP_RELEASE
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_APP_RELEASE (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- VERSION VARCHAR(25) NOT NULL,
- TENANT_ID VARCHAR(45) NOT NULL,
- UUID VARCHAR(200) NOT NULL,
- RELEASE_TYPE VARCHAR(45) NOT NULL,
- PACKAGE_NAME VARCHAR(45) NOT NULL,
- APP_PRICE DECIMAL(6,2) NULL DEFAULT NULL,
- STORED_LOCATION VARCHAR(100) NOT NULL,
- BANNER_LOCATION VARCHAR(100) NOT NULL,
- ICON_LOCATION VARCHAR(100) NOT NULL,
- SC_1_LOCATION VARCHAR(100) NOT NULL,
- SC_2_LOCATION VARCHAR(100) NULL DEFAULT NULL,
- SC_3_LOCATION VARCHAR(100) NULL DEFAULT NULL,
- APP_HASH_VALUE VARCHAR(100) NOT NULL,
- SHARED_WITH_ALL_TENANTS INT(11) NULL DEFAULT NULL,
- APP_META_INFO VARCHAR(20000) NULL DEFAULT NULL,
- RATING DOUBLE NULL DEFAULT NULL,
- RATED_USERS INT(11) NULL,
- AP_APP_ID INT(11) NOT NULL,
- PRIMARY KEY (ID, AP_APP_ID),
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_RELEASE(
+ ID int NOT NULL AUTO_INCREMENT,
+ DESCRIPTION clob NOT NULL,
+ VERSION varchar(10) NOT NULL,
+ TENANT_ID varchar(45) NOT NULL,
+ UUID varchar(200) NOT NULL,
+ RELEASE_TYPE varchar(45) NOT NULL,
+ APP_PRICE decimal(6, 2) NULL DEFAULT NULL,
+ STORED_LOCATION varchar(45) NOT NULL,
+ BANNER_LOCATION varchar(45) NOT NULL,
+ SC_1_LOCATION varchar(45) NOT NULL,
+ SC_2_LOCATION varchar(45) NULL DEFAULT NULL,
+ SC_3_LOCATION varchar(45) NULL DEFAULT NULL,
+ APP_HASH_VALUE varchar(1000) NOT NULL,
+ SHARED_WITH_ALL_TENANTS tinyint NULL DEFAULT NULL,
+ APP_META_INFO clob NULL DEFAULT NULL,
+ PACKAGE_NAME varchar(45) NOT NULL,
+ SUPPORTED_OS_VERSIONS varchar(45) NULL,
+ RATING double NULL DEFAULT NULL,
+ CURRENT_STATE varchar(45) NULL,
+ RATED_USERS int NULL,
+ AP_APP_ID int NOT NULL,
+ PRIMARY KEY (
+ ID,
+ AP_APP_ID
+ ),
CONSTRAINT fk_AP_APP_RELEASE_AP_APP1
- FOREIGN KEY (AP_APP_ID)
- REFERENCES AP_APP (ID));
-
-CREATE INDEX fk_AP_APP_RELEASE_AP_APP1_idx ON AP_APP_RELEASE (AP_APP_ID ASC);
-
+ FOREIGN KEY (AP_APP_ID)
+ REFERENCES APP_MANAGER.AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AP_APP_RELEASE_AP_APP1_idx (AP_APP_ID ASC)
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
-- -----------------------------------------------------
-- Table AP_APP_REVIEW
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_APP_REVIEW (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- TENANT_ID VARCHAR(45) NOT NULL,
- COMMENT VARCHAR(250) NOT NULL,
- PARENT_ID INT(11) NULL,
- CREATED_AT TIMESTAMP NOT NULL,
- MODIFIED_AT TIMESTAMP NOT NULL,
- RATING INT(11) NULL,
- USERNAME VARCHAR(45) NOT NULL,
- AP_APP_RELEASE_ID INT(11) NOT NULL,
- AP_APP_ID INT(11) NOT NULL,
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_REVIEW(
+ ID int NOT NULL AUTO_INCREMENT,
+ TENANT_ID varchar(45) NOT NULL,
+ COMMENT varchar(250) NOT NULL,
+ REPLY_COMMENT varchar(250) NULL,
+ CREATED_AT timestamp NOT NULL DEFAULT current_timestamp(),
+ MODIFIED_AT timestamp NOT NULL DEFAULT current_timestamp(),
+ RATING int NULL,
+ USERNAME varchar(45) NOT NULL,
+ AP_APP_RELEASE_ID int NOT NULL,
+ AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_COMMENT_AP_APP_RELEASE1
- FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
- REFERENCES AP_APP_RELEASE (ID , AP_APP_ID));
-
-CREATE INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx ON AP_APP_REVIEW (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);
-
+ FOREIGN KEY (
+ AP_APP_RELEASE_ID,
+ AP_APP_ID
+ )
+ REFERENCES APP_MANAGER.AP_APP_RELEASE (
+ ID,
+ AP_APP_ID
+ ) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx (
+ AP_APP_RELEASE_ID ASC,
+ AP_APP_ID ASC
+ )
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
-- -----------------------------------------------------
-- Table AP_APP_LIFECYCLE_STATE
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- CURRENT_STATE VARCHAR(45) NOT NULL,
- PREVIOUS_STATE VARCHAR(45) NOT NULL,
- TENANT_ID VARCHAR(45) NOT NULL,
- UPDATED_BY VARCHAR(100) NOT NULL,
- UPDATED_AT TIMESTAMP NOT NULL,
- AP_APP_RELEASE_ID INT(11) NOT NULL,
- AP_APP_ID INT(11) NOT NULL,
- PRIMARY KEY (ID, AP_APP_RELEASE_ID, AP_APP_ID),
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_LIFECYCLE_STATE(
+ ID int NOT NULL AUTO_INCREMENT,
+ CURRENT_STATE varchar(45) NOT NULL,
+ PREVIOUSE_STATE varchar(45) NOT NULL,
+ TENANT_ID varchar(45) NOT NULL,
+ UPDATED_BY varchar(100) NOT NULL,
+ UPDATED_AT timestamp NOT NULL DEFAULT current_timestamp(),
+ AP_APP_RELEASE_ID int NOT NULL,
+ AP_APP_ID int NOT NULL,
+ PRIMARY KEY (
+ ID,
+ AP_APP_RELEASE_ID,
+ AP_APP_ID
+ ),
CONSTRAINT fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1
- FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
- REFERENCES AP_APP_RELEASE (ID , AP_APP_ID));
-
-CREATE INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx ON AP_APP_LIFECYCLE_STATE (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);
+ FOREIGN KEY (
+ AP_APP_RELEASE_ID,
+ AP_APP_ID
+ )
+ REFERENCES APP_MANAGER.AP_APP_RELEASE (
+ ID,
+ AP_APP_ID
+ ) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx (
+ AP_APP_RELEASE_ID ASC,
+ AP_APP_ID ASC
+ )
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
-- -----------------------------------------------------
-- Table AP_APP_TAG
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_APP_TAG (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- TENANT_ID VARCHAR(45) NOT NULL,
- TAG VARCHAR(45) NOT NULL,
- AP_APP_ID INT(11) NOT NULL,
- PRIMARY KEY (ID),
- CONSTRAINT fk_AP_APP_TAGS_AP_APP1
- FOREIGN KEY (AP_APP_ID)
- REFERENCES AP_APP (ID));
-
-CREATE INDEX fk_AP_APP_TAGS_AP_APP1_idx ON AP_APP_TAG (AP_APP_ID ASC);
-
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_TAG(
+ ID int NOT NULL AUTO_INCREMENT,
+ TENANT_ID varchar(45) NOT NULL,
+ TAG varchar(45) NOT NULL,
+ PRIMARY KEY (ID)
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
-- -----------------------------------------------------
-- Table AP_DEVICE_SUBSCRIPTION
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- TENANT_ID VARCHAR(45) NOT NULL,
- SUBSCRIBED_BY VARCHAR(100) NOT NULL,
- SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
- UNSUBSCRIBED INT(11) NULL DEFAULT NULL,
- UNSUBSCRIBED_BY INT(11) NULL DEFAULT NULL,
- UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
- DM_ENROLMENT_ID INT(11) NOT NULL,
- AP_APP_RELEASE_ID INT(11) NOT NULL,
- AP_APP_ID INT(11) NOT NULL,
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_DEVICE_SUBSCRIPTION(
+ ID int NOT NULL AUTO_INCREMENT,
+ TENANT_ID varchar(45) NOT NULL,
+ SUBSCRIBED_BY varchar(100) NOT NULL,
+ SUBSCRIBED_TIMESTAMP timestamp NOT NULL DEFAULT current_timestamp(),
+ UNSUBSCRIBED int NULL DEFAULT NULL,
+ UNSUBSCRIBED_BY int NULL DEFAULT NULL,
+ UNSUBSCRIBED_TIMESTAMP timestamp NULL DEFAULT NULL,
+ SUBSCRIBED_FROM varchar(45) NULL,
+ DM_DEVICE_ID int NOT NULL,
+ AP_APP_RELEASE_ID int NOT NULL,
+ AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
+ CONSTRAINT fk_AM_DEVICE_SUBSCRIPTION_DM_DEVICE1
+ FOREIGN KEY (DM_DEVICE_ID)
+ REFERENCES APP_MANAGER.DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
- FOREIGN KEY (AP_APP_ID , AP_APP_RELEASE_ID)
- REFERENCES AP_APP_RELEASE (AP_APP_ID , ID));
-
-CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_ID ASC, AP_APP_RELEASE_ID ASC);
+ FOREIGN KEY (
+ AP_APP_RELEASE_ID,
+ AP_APP_ID
+ )
+ REFERENCES APP_MANAGER.AP_APP_RELEASE (
+ ID,
+ AP_APP_ID
+ ) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AM_DEVICE_SUBSCRIPTION_DM_DEVICE1_idx (DM_DEVICE_ID ASC),
+ INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx (
+ AP_APP_RELEASE_ID ASC,
+ AP_APP_ID ASC
+ )
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
-- -----------------------------------------------------
-- Table AP_GROUP_SUBSCRIPTION
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- TENANT_ID VARCHAR(45) NOT NULL,
- SUBSCRIBED_BY VARCHAR(100) NOT NULL,
- SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
- UNSUBSCRIBED INT(11) NULL DEFAULT NULL,
- UNSUBSCRIBED_BY INT(11) NULL DEFAULT NULL,
- UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
- DM_GROUP_ID INT(11) NOT NULL,
- AP_APP_RELEASE_ID INT(11) NOT NULL,
- AP_APP_ID INT(11) NOT NULL,
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_GROUP_SUBSCRIPTION(
+ ID int NOT NULL AUTO_INCREMENT,
+ TENANT_ID varchar(45) NOT NULL,
+ SUBSCRIBED_BY varchar(100) NOT NULL,
+ SUBSCRIBED_TIMESTAMP timestamp NOT NULL DEFAULT current_timestamp(),
+ UNSUBSCRIBED int NULL DEFAULT NULL,
+ UNSUBSCRIBED_BY int NULL DEFAULT NULL,
+ UNSUBSCRIBED_TIMESTAMP timestamp NULL DEFAULT NULL,
+ DM_GROUP_ID int NOT NULL,
+ AP_APP_RELEASE_ID int NOT NULL,
+ AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
+ CONSTRAINT fk_AM_GROUP_SUBSCRIPTION_DM_GROUP1
+ FOREIGN KEY (DM_GROUP_ID)
+ REFERENCES APP_MANAGER.DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1
- FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
- REFERENCES AP_APP_RELEASE (ID , AP_APP_ID));
-
-CREATE INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_GROUP_SUBSCRIPTION (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);
+ FOREIGN KEY (
+ AP_APP_RELEASE_ID,
+ AP_APP_ID
+ )
+ REFERENCES APP_MANAGER.AP_APP_RELEASE (
+ ID,
+ AP_APP_ID
+ ) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AM_GROUP_SUBSCRIPTION_DM_GROUP1_idx (DM_GROUP_ID ASC),
+ INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx (
+ AP_APP_RELEASE_ID ASC,
+ AP_APP_ID ASC
+ )
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
-- -----------------------------------------------------
-- Table AP_ROLE_SUBSCRIPTION
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_ROLE_SUBSCRIPTION (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- TENANT_ID VARCHAR(45) NOT NULL,
- ROLE_NAME VARCHAR(100) NOT NULL,
- SUBSCRIBED_BY VARCHAR(100) NOT NULL,
- SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
- UNSUBSCRIBED INT(11) NULL DEFAULT NULL,
- UNSUBSCRIBED_BY INT(11) NULL DEFAULT NULL,
- UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
- AP_APP_RELEASE_ID INT(11) NOT NULL,
- AP_APP_ID INT(11) NOT NULL,
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_ROLE_SUBSCRIPTION(
+ ID int NOT NULL AUTO_INCREMENT,
+ TENANT_ID varchar(45) NOT NULL,
+ ROLE_NAME varchar(100) NOT NULL,
+ SUBSCRIBED_BY varchar(100) NOT NULL,
+ SUBSCRIBED_TIMESTAMP timestamp NOT NULL DEFAULT current_timestamp(),
+ UNSUBSCRIBED int NULL DEFAULT NULL,
+ UNSUBSCRIBED_BY int NULL DEFAULT NULL,
+ UNSUBSCRIBED_TIMESTAMP timestamp NULL DEFAULT NULL,
+ AP_APP_RELEASE_ID int NOT NULL,
+ AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1
- FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
- REFERENCES AP_APP_RELEASE (ID , AP_APP_ID));
-
-CREATE INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_ROLE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);
+ FOREIGN KEY (
+ AP_APP_RELEASE_ID,
+ AP_APP_ID
+ )
+ REFERENCES APP_MANAGER.AP_APP_RELEASE (
+ ID,
+ AP_APP_ID
+ ) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx (
+ AP_APP_RELEASE_ID ASC,
+ AP_APP_ID ASC
+ )
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
-- -----------------------------------------------------
-- Table AP_UNRESTRICTED_ROLE
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_UNRESTRICTED_ROLE (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- TENANT_ID VARCHAR(45) NOT NULL,
- ROLE VARCHAR(45) NOT NULL,
- AP_APP_ID INT(11) NOT NULL,
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_UNRESTRICTED_ROLE(
+ ID int NOT NULL AUTO_INCREMENT,
+ TENANT_ID varchar(45) NOT NULL,
+ ROLE varchar(45) NOT NULL,
+ AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_APP_VISIBILITY_AP_APP1
- FOREIGN KEY (AP_APP_ID)
- REFERENCES AP_APP (ID));
-
-CREATE INDEX fk_AP_APP_VISIBILITY_AP_APP1_idx ON AP_UNRESTRICTED_ROLE (AP_APP_ID ASC);
+ FOREIGN KEY (AP_APP_ID)
+ REFERENCES APP_MANAGER.AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AP_APP_VISIBILITY_AP_APP1_idx (AP_APP_ID ASC)
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
-- -----------------------------------------------------
-- Table AP_USER_SUBSCRIPTION
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION (
- ID INT(11) NOT NULL AUTO_INCREMENT,
- TENANT_ID VARCHAR(45) NOT NULL,
- USER_NAME VARCHAR(100) NOT NULL,
- SUBSCRIBED_BY VARCHAR(100) NOT NULL,
- SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
- UNSUBSCRIBED INT(11) NULL DEFAULT NULL,
- UNSUBSCRIBED_BY INT(11) NULL DEFAULT NULL,
- UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
- AP_APP_RELEASE_ID INT(11) NOT NULL,
- AP_APP_ID INT(11) NOT NULL,
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_USER_SUBSCRIPTION(
+ ID int NOT NULL AUTO_INCREMENT,
+ TENANT_ID varchar(45) NOT NULL,
+ USER_NAME varchar(100) NOT NULL,
+ SUBSCRIBED_BY varchar(100) NOT NULL,
+ SUBSCRIBED_TIMESTAMP timestamp NOT NULL DEFAULT current_timestamp(),
+ UNSUBSCRIBED int NULL DEFAULT NULL,
+ UNSUBSCRIBED_BY int NULL DEFAULT NULL,
+ UNSUBSCRIBED_TIMESTAMP timestamp NULL DEFAULT NULL,
+ AP_APP_RELEASE_ID int NOT NULL,
+ AP_APP_ID int NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1
- FOREIGN KEY (AP_APP_RELEASE_ID , AP_APP_ID)
- REFERENCES AP_APP_RELEASE (ID , AP_APP_ID));
+ FOREIGN KEY (
+ AP_APP_RELEASE_ID,
+ AP_APP_ID
+ )
+ REFERENCES APP_MANAGER.AP_APP_RELEASE (
+ ID,
+ AP_APP_ID
+ ) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx (
+ AP_APP_RELEASE_ID ASC,
+ AP_APP_ID ASC
+ )
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
+
-CREATE INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_USER_SUBSCRIPTION (AP_APP_RELEASE_ID ASC, AP_APP_ID ASC);
+-- -----------------------------------------------------
+-- Table AP_APP_CATEGORY
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_CATEGORY(
+ ID int NOT NULL AUTO_INCREMENT,
+ TENANT_ID varchar(45) NOT NULL,
+ CATEGORY varchar(45) NOT NULL,
+ CATEGORY_ICON varchar(45) NULL,
+ PRIMARY KEY (ID)
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
+
+-- -----------------------------------------------------
+-- Table AP_APP_TAG_MAPPING
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_TAG_MAPPING(
+ ID int NOT NULL AUTO_INCREMENT,
+ AP_APP_TAG_ID int NOT NULL,
+ AP_APP_ID int NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP_TAG1
+ FOREIGN KEY (AP_APP_TAG_ID)
+ REFERENCES APP_MANAGER.AP_APP_TAG (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP1
+ FOREIGN KEY (AP_APP_ID)
+ REFERENCES APP_MANAGER.AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AP_APP_TAG_copy1_AP_APP_TAG1_idx (AP_APP_TAG_ID ASC),
+ INDEX fk_AP_APP_TAG_copy1_AP_APP1_idx (AP_APP_ID ASC)
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
+
+
+-- -----------------------------------------------------
+-- Table AP_APP_CATEGORY_MAPPING
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS APP_MANAGER.AP_APP_CATEGORY_MAPPING(
+ ID int NOT NULL AUTO_INCREMENT,
+ AP_APP_CATEGORY_ID int NOT NULL,
+ AP_APP_ID int NOT NULL,
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1
+ FOREIGN KEY (AP_APP_CATEGORY_ID)
+ REFERENCES APP_MANAGER.AP_APP_CATEGORY (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP1
+ FOREIGN KEY (AP_APP_ID)
+ REFERENCES APP_MANAGER.AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ INDEX fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1_idx (AP_APP_CATEGORY_ID ASC),
+ INDEX fk_AP_APP_CATEGORY_copy1_AP_APP1_idx (AP_APP_ID ASC)
+)
+ENGINE InnoDB
+DEFAULT CHARACTER SET utf8
diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql
index e854d459e1..dc28252bb6 100644
--- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql
+++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql
@@ -1,76 +1,89 @@
--- MySQL Script generated by MySQL Workbench
--- Tue 18 Sep 2018 17:40:45 +0530
--- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
+-- -----------------------------------------------------
+-- Schema APP_MANAGER
+-- -----------------------------------------------------
-- -----------------------------------------------------
--- Table `AP_APP`
+-- Schema APP_MANAGER
+-- -----------------------------------------------------
+CREATE SCHEMA IF NOT EXISTS `APP_MANAGER` DEFAULT CHARACTER SET utf8 ;
+USE `APP_MANAGER` ;
+
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_APP` (
+-- Table `APP_MANAGER`.`AP_APP`
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`NAME` VARCHAR(45) NOT NULL,
+ `DESCRIPTION` TEXT NULL,
`TYPE` VARCHAR(200) NOT NULL,
`TENANT_ID` VARCHAR(45) NOT NULL,
- `APP_CATEGORY` VARCHAR(45) NULL DEFAULT NULL,
- `RESTRICTED` INT(11) NOT NULL,
`STATUS` VARCHAR(45) NOT NULL DEFAULT 'ACTIVE',
`SUB_TYPE` VARCHAR(45) NOT NULL,
`CURRENCY` VARCHAR(45) NULL DEFAULT '$',
+ `RATING` INT(11) NULL,
`DEVICE_TYPE_ID` INT(11) NOT NULL,
- PRIMARY KEY (`ID`))
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8;
+ PRIMARY KEY (`ID`),
+ INDEX `fk_AP_APP_DM_DEVICE_TYPE1_idx` (`DEVICE_TYPE_ID` ASC),
+ CONSTRAINT `fk_AP_APP_DM_DEVICE_TYPE1`
+ FOREIGN KEY (`DEVICE_TYPE_ID`)
+ REFERENCES `APP_MANAGER`.`DM_DEVICE_TYPE` (`ID`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
--- Table `AP_APP_RELEASE`
+-- Table `APP_MANAGER`.`AP_APP_RELEASE`
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_APP_RELEASE` (
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_RELEASE` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
- `VERSION` VARCHAR(25) NOT NULL,
+ `DESCRIPTION` TEXT NOT NULL,
+ `VERSION` VARCHAR(10) NOT NULL,
`TENANT_ID` VARCHAR(45) NOT NULL,
`UUID` VARCHAR(200) NOT NULL,
`RELEASE_TYPE` VARCHAR(45) NOT NULL,
- `PACKAGE_NAME` VARCHAR(45) NOT NULL,
`APP_PRICE` DECIMAL(6,2) NULL DEFAULT NULL,
- `STORED_LOCATION` VARCHAR(100) NOT NULL,
- `BANNER_LOCATION` VARCHAR(100) NOT NULL,
- `ICON_LOCATION` VARCHAR(100) NOT NULL,
- `SC_1_LOCATION` VARCHAR(100) NOT NULL,
- `SC_2_LOCATION` VARCHAR(100) NULL DEFAULT NULL,
- `SC_3_LOCATION` VARCHAR(100) NULL DEFAULT NULL,
- `APP_HASH_VALUE` VARCHAR(100) NOT NULL,
- `SHARED_WITH_ALL_TENANTS` INT(11) NULL DEFAULT NULL,
- `APP_META_INFO` VARCHAR(20000) NULL DEFAULT NULL,
+ `STORED_LOCATION` VARCHAR(45) NOT NULL,
+ `BANNER_LOCATION` VARCHAR(45) NOT NULL,
+ `SC_1_LOCATION` VARCHAR(45) NOT NULL,
+ `SC_2_LOCATION` VARCHAR(45) NULL DEFAULT NULL,
+ `SC_3_LOCATION` VARCHAR(45) NULL DEFAULT NULL,
+ `APP_HASH_VALUE` VARCHAR(1000) NOT NULL,
+ `SHARED_WITH_ALL_TENANTS` TINYINT(1) NULL DEFAULT NULL,
+ `APP_META_INFO` TEXT NULL DEFAULT NULL,
+ `PACKAGE_NAME` VARCHAR(45) NOT NULL,
+ `SUPPORTED_OS_VERSIONS` VARCHAR(45) NULL,
`RATING` DOUBLE NULL DEFAULT NULL,
+ `CURRENT_STATE` VARCHAR(45) NULL,
`RATED_USERS` INT(11) NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`, `AP_APP_ID`),
+ INDEX `fk_AP_APP_RELEASE_AP_APP1_idx` (`AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_RELEASE_AP_APP1`
- FOREIGN KEY (`AP_APP_ID`)
- REFERENCES `AP_APP` (`ID`)
+ FOREIGN KEY (`AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8
- COMMENT = ' ';
-
-CREATE INDEX `fk_AP_APP_RELEASE_AP_APP1_idx` ON `AP_APP_RELEASE` (`AP_APP_ID` ASC);
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8
+COMMENT = ' ';
-- -----------------------------------------------------
--- Table `AP_APP_REVIEW`
+-- Table `APP_MANAGER`.`AP_APP_REVIEW`
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_APP_REVIEW` (
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_REVIEW` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`COMMENT` VARCHAR(250) NOT NULL,
- `PARENT_ID` INT(11) NULL,
+ `REPLY_COMMENT` VARCHAR(250) NULL,
`CREATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`MODIFIED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`RATING` INT(11) NULL,
@@ -78,65 +91,55 @@ CREATE TABLE IF NOT EXISTS `AP_APP_REVIEW` (
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
+ INDEX `fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_COMMENT_AP_APP_RELEASE1`
- FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
- REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
+ FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8;
-
-CREATE INDEX `fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx` ON `AP_APP_REVIEW` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC);
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
--- Table `AP_APP_LIFECYCLE_STATE`
+-- Table `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE`
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_APP_LIFECYCLE_STATE` (
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`CURRENT_STATE` VARCHAR(45) NOT NULL,
- `PREVIOUS_STATE` VARCHAR(45) NOT NULL,
+ `PREVIOUSE_STATE` VARCHAR(45) NOT NULL,
`TENANT_ID` VARCHAR(45) NOT NULL,
`UPDATED_BY` VARCHAR(100) NOT NULL,
`UPDATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`, `AP_APP_RELEASE_ID`, `AP_APP_ID`),
+ INDEX `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1`
- FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
- REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
+ FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8;
-
-CREATE INDEX `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx` ON `AP_APP_LIFECYCLE_STATE` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC);
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
--- Table `AP_APP_TAG`
+-- Table `APP_MANAGER`.`AP_APP_TAG`
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_APP_TAG` (
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`TAG` VARCHAR(45) NOT NULL,
- `AP_APP_ID` INT(11) NOT NULL,
- PRIMARY KEY (`ID`),
- CONSTRAINT `fk_AP_APP_TAGS_AP_APP1`
- FOREIGN KEY (`AP_APP_ID`)
- REFERENCES `AP_APP` (`ID`)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION)
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8;
-
-CREATE INDEX `fk_AP_APP_TAGS_AP_APP1_idx` ON `AP_APP_TAG` (`AP_APP_ID` ASC);
+ PRIMARY KEY (`ID`))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
--- Table `AP_DEVICE_SUBSCRIPTION`
+-- Table `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION`
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_DEVICE_SUBSCRIPTION` (
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
@@ -144,25 +147,30 @@ CREATE TABLE IF NOT EXISTS `AP_DEVICE_SUBSCRIPTION` (
`UNSUBSCRIBED` INT(11) NULL DEFAULT NULL,
`UNSUBSCRIBED_BY` INT(11) NULL DEFAULT NULL,
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
- `DM_ENROLMENT_ID` INT(11) NOT NULL,
+ `SUBSCRIBED_FROM` VARCHAR(45) NULL,
+ `DM_DEVICE_ID` INT(11) NOT NULL,
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
+ INDEX `fk_AM_DEVICE_SUBSCRIPTION_DM_DEVICE1_idx` (`DM_DEVICE_ID` ASC),
+ INDEX `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
+ CONSTRAINT `fk_AM_DEVICE_SUBSCRIPTION_DM_DEVICE1`
+ FOREIGN KEY (`DM_DEVICE_ID`)
+ REFERENCES `APP_MANAGER`.`DM_DEVICE` (`ID`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION,
CONSTRAINT `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1`
- FOREIGN KEY (`AP_APP_ID` , `AP_APP_RELEASE_ID`)
- REFERENCES `AP_APP_RELEASE` (`AP_APP_ID` , `ID`)
+ FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8;
-
-CREATE INDEX `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx` ON `AP_DEVICE_SUBSCRIPTION` (`AP_APP_ID` ASC, `AP_APP_RELEASE_ID` ASC);
-
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
--- Table `AP_GROUP_SUBSCRIPTION`
+-- Table `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION`
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_GROUP_SUBSCRIPTION` (
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
@@ -174,21 +182,26 @@ CREATE TABLE IF NOT EXISTS `AP_GROUP_SUBSCRIPTION` (
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
+ INDEX `fk_AM_GROUP_SUBSCRIPTION_DM_GROUP1_idx` (`DM_GROUP_ID` ASC),
+ INDEX `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
+ CONSTRAINT `fk_AM_GROUP_SUBSCRIPTION_DM_GROUP1`
+ FOREIGN KEY (`DM_GROUP_ID`)
+ REFERENCES `APP_MANAGER`.`DM_GROUP` (`ID`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION,
CONSTRAINT `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1`
- FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
- REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
+ FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8;
-
-CREATE INDEX `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx` ON `AP_GROUP_SUBSCRIPTION` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC);
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
--- Table `AP_ROLE_SUBSCRIPTION`
+-- Table `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION`
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_ROLE_SUBSCRIPTION` (
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`ROLE_NAME` VARCHAR(100) NOT NULL,
@@ -200,41 +213,39 @@ CREATE TABLE IF NOT EXISTS `AP_ROLE_SUBSCRIPTION` (
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
+ INDEX `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1`
- FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
- REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
+ FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8;
-
-CREATE INDEX `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx` ON `AP_ROLE_SUBSCRIPTION` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC);
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
--- Table `AP_UNRESTRICTED_ROLE`
+-- Table `APP_MANAGER`.`AP_UNRESTRICTED_ROLE`
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_UNRESTRICTED_ROLE` (
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_UNRESTRICTED_ROLE` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`ROLE` VARCHAR(45) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
+ INDEX `fk_AP_APP_VISIBILITY_AP_APP1_idx` (`AP_APP_ID` ASC),
CONSTRAINT `fk_AP_APP_VISIBILITY_AP_APP1`
- FOREIGN KEY (`AP_APP_ID`)
- REFERENCES `AP_APP` (`ID`)
+ FOREIGN KEY (`AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8;
-
-CREATE INDEX `fk_AP_APP_VISIBILITY_AP_APP1_idx` ON `AP_UNRESTRICTED_ROLE` (`AP_APP_ID` ASC);
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
--- Table `AP_USER_SUBSCRIPTION`
+-- Table `APP_MANAGER`.`AP_USER_SUBSCRIPTION`
-- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS `AP_USER_SUBSCRIPTION` (
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_USER_SUBSCRIPTION` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`TENANT_ID` VARCHAR(45) NOT NULL,
`USER_NAME` VARCHAR(100) NOT NULL,
@@ -246,15 +257,76 @@ CREATE TABLE IF NOT EXISTS `AP_USER_SUBSCRIPTION` (
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
`AP_APP_ID` INT(11) NOT NULL,
PRIMARY KEY (`ID`),
+ INDEX `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC),
CONSTRAINT `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1`
- FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
- REFERENCES `AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
+ FOREIGN KEY (`AP_APP_RELEASE_ID` , `AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID` , `AP_APP_ID`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
+
+
+-- -----------------------------------------------------
+-- Table `APP_MANAGER`.`AP_APP_CATEGORY`
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `TENANT_ID` VARCHAR(45) NOT NULL,
+ `CATEGORY` VARCHAR(45) NOT NULL,
+ `CATEGORY_ICON` VARCHAR(45) NULL,
+ PRIMARY KEY (`ID`))
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
+
+
+-- -----------------------------------------------------
+-- Table `APP_MANAGER`.`AP_APP_TAG_MAPPING`
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG_MAPPING` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `AP_APP_TAG_ID` INT(11) NOT NULL,
+ `AP_APP_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_AP_APP_TAG_copy1_AP_APP_TAG1_idx` (`AP_APP_TAG_ID` ASC),
+ INDEX `fk_AP_APP_TAG_copy1_AP_APP1_idx` (`AP_APP_ID` ASC),
+ CONSTRAINT `fk_AP_APP_TAG_copy1_AP_APP_TAG1`
+ FOREIGN KEY (`AP_APP_TAG_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP_TAG` (`ID`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION,
+ CONSTRAINT `fk_AP_APP_TAG_copy1_AP_APP1`
+ FOREIGN KEY (`AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION)
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
+
+
+-- -----------------------------------------------------
+-- Table `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING`
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `AP_APP_CATEGORY_ID` INT(11) NOT NULL,
+ `AP_APP_ID` INT(11) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1_idx` (`AP_APP_CATEGORY_ID` ASC),
+ INDEX `fk_AP_APP_CATEGORY_copy1_AP_APP1_idx` (`AP_APP_ID` ASC),
+ CONSTRAINT `fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1`
+ FOREIGN KEY (`AP_APP_CATEGORY_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP_CATEGORY` (`ID`)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION,
+ CONSTRAINT `fk_AP_APP_CATEGORY_copy1_AP_APP1`
+ FOREIGN KEY (`AP_APP_ID`)
+ REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
- ENGINE = InnoDB
- DEFAULT CHARACTER SET = utf8;
+ENGINE = InnoDB
+DEFAULT CHARACTER SET = utf8;
-CREATE INDEX `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx` ON `AP_USER_SUBSCRIPTION` (`AP_APP_RELEASE_ID` ASC, `AP_APP_ID` ASC);
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;