From 152a97c82087203f389bb13c44a8be611246c245 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Wed, 27 Nov 2019 20:06:30 +0530 Subject: [PATCH 1/2] Add Device type common service interface --- .../device/mgt/common/EnrolmentInfo.java | 2 +- .../common/spi/DeviceTypePluginService.java | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypePluginService.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java index 2114a2e206..11178e2204 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java @@ -34,7 +34,7 @@ public class EnrolmentInfo implements Serializable { } public enum OwnerShip { - BYOD, COPE + BYOD, COPE, WORK_PROFILE, GOOGLE_ENTERPRISE } @ApiModelProperty(name = "id", value = "ID of the device in the WSO2 EMM device information database.", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypePluginService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypePluginService.java new file mode 100644 index 0000000000..dc868431c5 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypePluginService.java @@ -0,0 +1,37 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.spi; + +import org.wso2.carbon.device.mgt.common.EnrolmentInfo; +import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; + +import java.util.Map; + +/** + * This implementation populates device type plugin management service. + */ +public interface DeviceTypePluginService { + + /** + * To get Enrollment QR code against Ownership type + * + * @return QR code Map, Key as Ownership Type and Value as QR string + * @throws DeviceManagementException if error occurred while generating the QR String for Ownership + */ + Map getEnrollmentQRCode() throws DeviceManagementException; +} From 1c24707b9f51feec401681fd7ddf26cf3ccbd9a3 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Tue, 10 Dec 2019 03:05:54 +0530 Subject: [PATCH 2/2] Add PostgreSQL support for the App Manager --- .../ApplicationManagementDAOFactory.java | 24 +- .../PostgreSQLApplicationDAOImpl.java | 29 + .../PostgreSQLApplicationReleaseDAOImpl.java | 28 + .../PostgreSQLLifecycleStateDAOImpl.java | 30 + .../impl/review/PostgreSQLReviewDAOImpl.java | 30 + .../PostgreSQLSubscriptionDAOImpl.java | 30 + .../PostgreSQLVisibilityDAOImpl.java | 30 + ...vice.java => DeviceTypeCommonService.java} | 2 +- .../cdm/application-mgt/postgresql.sql | 522 +++++++++--------- 9 files changed, 471 insertions(+), 254 deletions(-) create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/PostgreSQLApplicationDAOImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/release/PostgreSQLApplicationReleaseDAOImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/PostgreSQLLifecycleStateDAOImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/review/PostgreSQLReviewDAOImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/PostgreSQLSubscriptionDAOImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/visibility/PostgreSQLVisibilityDAOImpl.java rename components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/{DeviceTypePluginService.java => DeviceTypeCommonService.java} (96%) 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/ApplicationManagementDAOFactory.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java index 62a95b7808..36aeaf9678 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java @@ -26,10 +26,13 @@ import org.wso2.carbon.device.application.mgt.core.dao.LifecycleStateDAO; import org.wso2.carbon.device.application.mgt.core.dao.ReviewDAO; import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO; import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO; +import org.wso2.carbon.device.application.mgt.core.dao.impl.application.PostgreSQLApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.SQLServerApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.OracleApplicationReleaseDAOImpl; +import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.PostgreSQLApplicationReleaseDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release.SQLServerApplicationReleaseDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.OracleLifecycleStateDAOImpl; +import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.PostgreSQLLifecycleStateDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.SQLServerLifecycleStateDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.review.GenericReviewDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.GenericApplicationDAOImpl; @@ -37,12 +40,15 @@ import org.wso2.carbon.device.application.mgt.core.dao.impl.application.release. import org.wso2.carbon.device.application.mgt.core.dao.impl.application.OracleApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate.GenericLifecycleStateDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.review.OracleReviewDAOImpl; +import org.wso2.carbon.device.application.mgt.core.dao.impl.review.PostgreSQLReviewDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.review.SQLServerReviewDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.GenericSubscriptionDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.OracleSubscriptionDAOImpl; +import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.PostgreSQLSubscriptionDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.subscription.SQLServerSubscriptionDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.GenericVisibilityDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.OracleVisibilityDAOImpl; +import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.PostgreSQLVisibilityDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.visibility.SQLServerVisibilityDAOImpl; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import org.wso2.carbon.device.application.mgt.core.util.Constants; @@ -81,8 +87,9 @@ public class ApplicationManagementDAOFactory { switch (databaseEngine) { case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: return new GenericApplicationDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + return new PostgreSQLApplicationDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_MSSQL: return new SQLServerApplicationDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_ORACLE: @@ -99,8 +106,9 @@ public class ApplicationManagementDAOFactory { switch (databaseEngine) { case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: return new GenericLifecycleStateDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + return new PostgreSQLLifecycleStateDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_MSSQL: return new SQLServerLifecycleStateDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_ORACLE: @@ -122,8 +130,9 @@ public class ApplicationManagementDAOFactory { switch (databaseEngine) { case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: return new GenericApplicationReleaseDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + return new PostgreSQLApplicationReleaseDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_ORACLE: return new OracleApplicationReleaseDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_MSSQL: @@ -144,8 +153,9 @@ public class ApplicationManagementDAOFactory { switch (databaseEngine) { case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: return new GenericVisibilityDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + return new PostgreSQLVisibilityDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_ORACLE: return new OracleVisibilityDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_MSSQL: @@ -166,8 +176,9 @@ public class ApplicationManagementDAOFactory { switch (databaseEngine) { case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: return new GenericSubscriptionDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + return new PostgreSQLSubscriptionDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_ORACLE: return new OracleSubscriptionDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_MSSQL: @@ -184,8 +195,9 @@ public class ApplicationManagementDAOFactory { switch (databaseEngine) { case Constants.DataBaseTypes.DB_TYPE_H2: case Constants.DataBaseTypes.DB_TYPE_MYSQL: - case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: return new GenericReviewDAOImpl(); + case Constants.DataBaseTypes.DB_TYPE_POSTGRESQL: + return new PostgreSQLReviewDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_ORACLE: return new OracleReviewDAOImpl(); case Constants.DataBaseTypes.DB_TYPE_MSSQL: 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/PostgreSQLApplicationDAOImpl.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/PostgreSQLApplicationDAOImpl.java new file mode 100644 index 0000000000..54eb76b914 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/PostgreSQLApplicationDAOImpl.java @@ -0,0 +1,29 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.application.mgt.core.dao.impl.application; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This handles Application operations which are specific to MSSQL. + */ +public class PostgreSQLApplicationDAOImpl extends GenericApplicationDAOImpl { + + private static final Log log = LogFactory.getLog(PostgreSQLApplicationDAOImpl.class); +} 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/release/PostgreSQLApplicationReleaseDAOImpl.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/release/PostgreSQLApplicationReleaseDAOImpl.java new file mode 100644 index 0000000000..3ffa907fcf --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/release/PostgreSQLApplicationReleaseDAOImpl.java @@ -0,0 +1,28 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.application.mgt.core.dao.impl.application.release; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This handles Application Release operations which are specific to MSSQL. + */ +public class PostgreSQLApplicationReleaseDAOImpl extends GenericApplicationReleaseDAOImpl { + private static final Log log = LogFactory.getLog(GenericApplicationReleaseDAOImpl.class); +} 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/lifecyclestate/PostgreSQLLifecycleStateDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/PostgreSQLLifecycleStateDAOImpl.java new file mode 100644 index 0000000000..1637777285 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/lifecyclestate/PostgreSQLLifecycleStateDAOImpl.java @@ -0,0 +1,30 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.application.mgt.core.dao.impl.lifecyclestate; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This handles App Lifecycle operations which are specific to MSSQL. + */ +public class PostgreSQLLifecycleStateDAOImpl extends GenericLifecycleStateDAOImpl{ + + private static final Log log = LogFactory.getLog(PostgreSQLLifecycleStateDAOImpl.class); + +} 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/review/PostgreSQLReviewDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/review/PostgreSQLReviewDAOImpl.java new file mode 100644 index 0000000000..38bebccd12 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/review/PostgreSQLReviewDAOImpl.java @@ -0,0 +1,30 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.application.mgt.core.dao.impl.review; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This handles Application Review handling operations which are specific to MsSQL. + */ +public class PostgreSQLReviewDAOImpl extends GenericReviewDAOImpl { + + private static final Log log = LogFactory.getLog(PostgreSQLReviewDAOImpl.class); + +} 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/subscription/PostgreSQLSubscriptionDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/PostgreSQLSubscriptionDAOImpl.java new file mode 100644 index 0000000000..de13737299 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/subscription/PostgreSQLSubscriptionDAOImpl.java @@ -0,0 +1,30 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.application.mgt.core.dao.impl.subscription; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This handles Application subscribing operations which are specific to MsSQL. + */ +public class PostgreSQLSubscriptionDAOImpl extends GenericSubscriptionDAOImpl { + + private static Log log = LogFactory.getLog(PostgreSQLSubscriptionDAOImpl.class); + +} 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/visibility/PostgreSQLVisibilityDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/visibility/PostgreSQLVisibilityDAOImpl.java new file mode 100644 index 0000000000..3d9169f7b6 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/visibility/PostgreSQLVisibilityDAOImpl.java @@ -0,0 +1,30 @@ +/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.application.mgt.core.dao.impl.visibility; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * This handles Application visibility handling operations which are specific to MsSQL. + */ +public class PostgreSQLVisibilityDAOImpl extends GenericVisibilityDAOImpl { + + private static Log log = LogFactory.getLog(PostgreSQLVisibilityDAOImpl.class); + +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypePluginService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypeCommonService.java similarity index 96% rename from components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypePluginService.java rename to components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypeCommonService.java index dc868431c5..383166d05c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypePluginService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceTypeCommonService.java @@ -25,7 +25,7 @@ import java.util.Map; /** * This implementation populates device type plugin management service. */ -public interface DeviceTypePluginService { +public interface DeviceTypeCommonService { /** * To get Enrollment QR code against Ownership type diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql index 04c8dab36c..5c20aa4a75 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql @@ -1,279 +1,307 @@ -DROP TABLE IF EXISTS APPM_PLATFORM; -DROP SEQUENCE IF EXISTS APPM_PLATFORM_PK_SEQ; -CREATE SEQUENCE APPM_PLATFORM_PK_SEQ; - -CREATE TABLE APPM_PLATFORM ( -ID INT DEFAULT NEXTVAL('APPM_PLATFORM_PK_SEQ') UNIQUE, -IDENTIFIER VARCHAR (100) NOT NULL, -TENANT_ID INT NOT NULL , -NAME VARCHAR (255), -FILE_BASED BOOLEAN, -DESCRIPTION VARCHAR(2048), -IS_SHARED BOOLEAN, -IS_DEFAULT_TENANT_MAPPING BOOLEAN, -ICON_NAME VARCHAR (100), -PRIMARY KEY (ID) +-- ----------------------------------------------------- +-- Table AP_APP +-- ----------------------------------------------------- +CREATE SEQUENCE AP_APP_seq; + +CREATE TABLE IF NOT EXISTS AP_APP( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_seq'), + NAME VARCHAR(350) NOT NULL, + DESCRIPTION VARCHAR(200) NOT NULL, + TYPE VARCHAR(200) NOT NULL, + TENANT_ID INTEGER NOT NULL, + STATUS VARCHAR(45) NOT NULL DEFAULT 'ACTIVE', + SUB_TYPE VARCHAR(45) NOT NULL, + CURRENCY VARCHAR(45) NULL DEFAULT '$', + RATING DOUBLE PRECISION NULL DEFAULT NULL, + DEVICE_TYPE_ID INTEGER NOT NULL, + PRIMARY KEY (ID) ); -DROP TABLE IF EXISTS APPM_PLATFORM_PROPERTIES; -DROP SEQUENCE IF EXISTS APPM_PLATFORM_PROPERTIES_PK_SEQ; -CREATE SEQUENCE APPM_PLATFORM_PROPERTIES_PK_SEQ; - -CREATE TABLE APPM_PLATFORM_PROPERTIES ( -ID INT DEFAULT NEXTVAL('APPM_PLATFORM_PROPERTIES_PK_SEQ'), -PLATFORM_ID INT NOT NULL, -PROP_NAME VARCHAR (100) NOT NULL, -OPTIONAL BOOLEAN, -DEFAUL_VALUE VARCHAR (255), -FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE, -PRIMARY KEY (ID, PLATFORM_ID, PROP_NAME) +-- ----------------------------------------------------- +-- Table AP_APP_RELEASE +-- ----------------------------------------------------- +CREATE SEQUENCE AP_APP_RELEASE_seq; + +CREATE TABLE IF NOT EXISTS AP_APP_RELEASE( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_RELEASE_seq'), + DESCRIPTION VARCHAR(200) NOT NULL, + VERSION VARCHAR(70) NOT NULL, + TENANT_ID INTEGER NOT NULL, + UUID VARCHAR(200) NOT NULL, + RELEASE_TYPE VARCHAR(45) NOT NULL, + PACKAGE_NAME VARCHAR(150) NOT NULL, + APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL, + INSTALLER_LOCATION VARCHAR(100) NOT NULL, + ICON_LOCATION VARCHAR(100) NOT NULL, + BANNER_LOCATION VARCHAR(100) NULL DEFAULT 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(1000) NOT NULL, + SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE, + APP_META_INFO VARCHAR(150) NULL DEFAULT NULL, + SUPPORTED_OS_VERSIONS VARCHAR(45) NOT NULL, + RATING DOUBLE PRECISION NULL DEFAULT NULL, + CURRENT_STATE VARCHAR(45) NOT NULL, + RATED_USERS INTEGER NULL, + AP_APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_APP_RELEASE_AP_APP1 + FOREIGN KEY (AP_APP_ID) + REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); +CREATE INDEX fk_AP_APP_RELEASE_AP_APP1_idx ON AP_APP_RELEASE (AP_APP_ID ASC); -DROP TABLE IF EXISTS APPM_PLATFORM_TENANT_MAPPING; -DROP SEQUENCE IF EXISTS APPM_PLATFORM_TENANT_MAPPING_PK_SEQ; -CREATE SEQUENCE APPM_PLATFORM_TENANT_MAPPING_PK_SEQ; - -CREATE TABLE APPM_PLATFORM_TENANT_MAPPING ( -ID INT DEFAULT NEXTVAL('APPM_PLATFORM_TENANT_MAPPING_PK_SEQ'), -TENANT_ID INT NOT NULL , -PLATFORM_ID INT NOT NULL, -FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE, -PRIMARY KEY (ID, TENANT_ID, PLATFORM_ID) +-- ----------------------------------------------------- +-- Table AP_APP_REVIEW +-- ----------------------------------------------------- +CREATE SEQUENCE AP_APP_REVIEW_seq; + +CREATE TABLE IF NOT EXISTS AP_APP_REVIEW( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_REVIEW_seq'), + TENANT_ID INTEGER NOT NULL, + COMMENT TEXT NOT NULL, + ROOT_PARENT_ID INTEGER NOT NULL, + IMMEDIATE_PARENT_ID INTEGER NOT NULL, + CREATED_AT TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL, + MODIFIED_AT TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL, + RATING INTEGER NULL, + USERNAME VARCHAR(45) NOT NULL, + ACTIVE_REVIEW BOOLEAN NOT NULL DEFAULT TRUE, + AP_APP_RELEASE_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_APP_COMMENT_AP_APP_RELEASE1 + FOREIGN KEY (AP_APP_RELEASE_ID) + REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); - -CREATE INDEX FK_PLATFROM_TENANT_MAPPING_PLATFORM ON APPM_PLATFORM_TENANT_MAPPING(PLATFORM_ID ASC); - -DROP TABLE IF EXISTS APPM_APPLICATION_CATEGORY; -DROP SEQUENCE IF EXISTS APPM_APPLICATION_CATEGORY_PK_SEQ; -CREATE SEQUENCE APPM_APPLICATION_CATEGORY_PK_SEQ; - -CREATE TABLE IF NOT EXISTS APPM_APPLICATION_CATEGORY ( - ID INT DEFAULT NEXTVAL('APPM_APPLICATION_CATEGORY_PK_SEQ'), - NAME VARCHAR(100) NOT NULL, - DESCRIPTION TEXT NULL, - PUBLISHED BOOLEAN DEFAULT FALSE, - PRIMARY KEY (ID)); - -INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION, PUBLISHED) VALUES ('Enterprise', 'Enterprise level -applications which the artifacts need to be provided', TRUE); -INSERT INTO APPM_APPLICATION_CATEGORY (NAME, DESCRIPTION, PUBLISHED) VALUES ('Public', 'Public category in which the -application need to be downloaded from the public application store', TRUE); - -DROP TABLE IF EXISTS APPM_LIFECYCLE_STATE; -DROP SEQUENCE IF EXISTS APPM_LIFECYCLE_STATE_PK_SEQ; -CREATE SEQUENCE APPM_LIFECYCLE_STATE_PK_SEQ; +CREATE INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx ON AP_APP_REVIEW (AP_APP_RELEASE_ID ASC); -- ----------------------------------------------------- --- Table APPM_LIFECYCLE_STATE +-- Table AP_APP_LIFECYCLE_STATE -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS APPM_LIFECYCLE_STATE ( - ID INT DEFAULT NEXTVAL('APPM_LIFECYCLE_STATE_PK_SEQ'), - NAME VARCHAR(100) NOT NULL, - IDENTIFIER VARCHAR(100) NOT NULL, - DESCRIPTION TEXT NULL, - PRIMARY KEY (ID)); - -DROP INDEX IF EXISTS APPM_LIFECYCLE_STATE_IDENTIFIER_UNIQUE; -CREATE INDEX APPM_LIFECYCLE_STATE_IDENTIFIER_UNIQUE ON APPM_LIFECYCLE_STATE(IDENTIFIER ASC); - -INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) VALUES ('CREATED', 'CREATED', 'Application creation -initial state'); -INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) -VALUES ('IN REVIEW', 'IN REVIEW', 'Application is in in-review state'); -INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) -VALUES ('APPROVED', 'APPROVED', 'State in which Application is approved after reviewing.'); -INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) -VALUES ('REJECTED', 'REJECTED', 'State in which Application is rejected after reviewing.'); -INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) -VALUES ('PUBLISHED', 'PUBLISHED', 'State in which Application is in published state.'); -INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) -VALUES ('BLOCKED', 'BLOCKED', 'State in which Application is in un published state.'); -INSERT INTO APPM_LIFECYCLE_STATE (NAME, IDENTIFIER, DESCRIPTION) -VALUES ('RETIRED', 'RETIRED', 'Retiring an application to indicate end of life state,'); - -DROP TABLE IF EXISTS APPM_LC_STATE_TRANSITION; -DROP SEQUENCE IF EXISTS APPM_LC_STATE_TRANSITION_PK_SEQ; -CREATE SEQUENCE APPM_LC_STATE_TRANSITION_PK_SEQ; - -CREATE TABLE IF NOT EXISTS APPM_LC_STATE_TRANSITION -( - ID INT DEFAULT NEXTVAL('APPM_LC_STATE_TRANSITION_PK_SEQ'), - INITIAL_STATE INT, - NEXT_STATE INT, - PERMISSION VARCHAR(1024), - DESCRIPTION VARCHAR(2048), - PRIMARY KEY (INITIAL_STATE, NEXT_STATE), - FOREIGN KEY (INITIAL_STATE) REFERENCES APPM_LIFECYCLE_STATE(ID) ON DELETE CASCADE, - FOREIGN KEY (NEXT_STATE) REFERENCES APPM_LIFECYCLE_STATE(ID) ON DELETE CASCADE +CREATE SEQUENCE AP_APP_LIFECYCLE_STATE_seq; + +CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_LIFECYCLE_STATE_seq'), + CURRENT_STATE VARCHAR(45) NOT NULL, + PREVIOUS_STATE VARCHAR(45) NOT NULL, + TENANT_ID INTEGER NOT NULL, + UPDATED_BY VARCHAR(100) NOT NULL, + UPDATED_AT TIMESTAMP(0) NOT NULL, + AP_APP_RELEASE_ID INTEGER NOT NULL, + REASON TEXT DEFAULT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1 + FOREIGN KEY (AP_APP_RELEASE_ID) + REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION ); +CREATE INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx ON AP_APP_LIFECYCLE_STATE( AP_APP_RELEASE_ID ASC); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (1, 2, null, 'Submit for review'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (2, 1, null, 'Revoke from review'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (2, 3, '/permission/admin/manage/device-mgt/application/review', 'APPROVE'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (2, 4, '/permission/admin/manage/device-mgt/application/review', 'REJECT'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (3, 4, '/permission/admin/manage/device-mgt/application/review', 'REJECT'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (3, 5, null, 'PUBLISH'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (5, 6, null, 'UN PUBLISH'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (6, 5, null, 'PUBLISH'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (4, 1, null, 'Return to CREATE STATE'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (6, 1, null, 'Return to CREATE STATE'); -INSERT INTO APPM_LC_STATE_TRANSITION(INITIAL_STATE, NEXT_STATE, PERMISSION, DESCRIPTION) VALUES - (6, 7, null, 'Retire'); - - -DROP TABLE IF EXISTS APPM_APPLICATION; -DROP SEQUENCE IF EXISTS APPM_APPLICATION_PK_SEQ; -CREATE SEQUENCE APPM_APPLICATION_PK_SEQ; - -CREATE TABLE IF NOT EXISTS APPM_APPLICATION ( - ID INT DEFAULT NEXTVAL('APPM_APPLICATION_PK_SEQ') UNIQUE, - UUID VARCHAR(100) NOT NULL, - NAME VARCHAR(100) NOT NULL, - SHORT_DESCRIPTION VARCHAR(255) NULL, - DESCRIPTION TEXT NULL, - SCREEN_SHOT_COUNT INT DEFAULT 0, - VIDEO_NAME VARCHAR(100) NULL, - CREATED_BY VARCHAR(255) NULL, - CREATED_AT TIMESTAMP NOT NULL, - MODIFIED_AT TIMESTAMP NULL, - IS_FREE BOOLEAN DEFAULT TRUE, - PAYMENT_CURRENCY VARCHAR(45) NULL, - PAYMENT_PRICE DECIMAL(10,2) NULL, - APPLICATION_CATEGORY_ID INT NOT NULL, - LIFECYCLE_STATE_ID INT NOT NULL, - LIFECYCLE_STATE_MODIFIED_BY VARCHAR(255) NULL, - LIFECYCLE_STATE_MODIFIED_AT TIMESTAMP NULL, - TENANT_ID INT NOT NULL, - PLATFORM_ID INT NOT NULL, - PRIMARY KEY (ID, APPLICATION_CATEGORY_ID, LIFECYCLE_STATE_ID, PLATFORM_ID), - FOREIGN KEY (APPLICATION_CATEGORY_ID) - REFERENCES APPM_APPLICATION_CATEGORY (ID) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT fk_APPM_APPLICATION_APPM_LIFECYCLE_STATE1 - FOREIGN KEY (LIFECYCLE_STATE_ID) - REFERENCES APPM_LIFECYCLE_STATE (ID) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT fk_APPM_APPLICATION_APPM_PLATFORM1 - FOREIGN KEY (PLATFORM_ID) - REFERENCES APPM_PLATFORM (ID) - ON DELETE NO ACTION - ON UPDATE NO ACTION); - -CREATE INDEX IF NOT EXISTS FK_APPLICATION_APPLICATION_CATEGORY ON APPM_APPLICATION(APPLICATION_CATEGORY_ID ASC); -CREATE INDEX IF NOT EXISTS UK_APPLICATION_UUID ON APPM_APPLICATION(UUID ASC); - -DROP TABLE IF EXISTS APPM_APPLICATION_PROPERTY; -- ----------------------------------------------------- --- Table APPM_APPLICATION_PROPERTY +-- Table AP_APP_TAG -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS APPM_APPLICATION_PROPERTY ( - PROP_KEY VARCHAR(255) NOT NULL, - PROP_VAL TEXT NULL, - APPLICATION_ID INT NOT NULL, - PRIMARY KEY (PROP_KEY, APPLICATION_ID), - CONSTRAINT FK_APPLICATION_PROPERTY_APPLICATION - FOREIGN KEY (APPLICATION_ID) - REFERENCES APPM_APPLICATION (ID) - ON DELETE NO ACTION - ON UPDATE NO ACTION); +CREATE SEQUENCE AP_APP_TAG_seq; -CREATE INDEX FK_APPLICATION_PROPERTY_APPLICATION ON APPM_APPLICATION_PROPERTY(APPLICATION_ID ASC); +CREATE TABLE IF NOT EXISTS AP_APP_TAG( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_TAG_seq'), + TENANT_ID INTEGER NOT NULL, + TAG VARCHAR(100) NOT NULL, + PRIMARY KEY (ID) +); -CREATE TABLE IF NOT EXISTS APPM_APPLICATION_TAG ( - NAME VARCHAR(45) NOT NULL, - APPLICATION_ID INT NOT NULL, - PRIMARY KEY (APPLICATION_ID, NAME), - CONSTRAINT fk_APPM_APPLICATION_TAG_APPM_APPLICATION1 - FOREIGN KEY (APPLICATION_ID) - REFERENCES APPM_APPLICATION (ID) - ON DELETE NO ACTION - ON UPDATE NO ACTION); +-- ----------------------------------------------------- +-- Table AP_DEVICE_SUBSCRIPTION +-- ----------------------------------------------------- +CREATE SEQUENCE AP_DEVICE_SUBSCRIPTION_seq; + +CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_DEVICE_SUBSCRIPTION_seq'), + TENANT_ID INTEGER NOT NULL, + SUBSCRIBED_BY VARCHAR(100) NOT NULL, + SUBSCRIBED_TIMESTAMP TIMESTAMP(0) NOT NULL, + UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false, + UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, + UNSUBSCRIBED_TIMESTAMP TIMESTAMP(0) NULL DEFAULT NULL, + ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL, + STATUS VARCHAR(45) NOT NULL, + DM_DEVICE_ID INTEGER NOT NULL, + AP_APP_RELEASE_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1 + FOREIGN KEY (AP_APP_RELEASE_ID) + REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC); -CREATE INDEX IF NOT EXISTS FK_APPLICATION_TAG_APPLICATION ON APPM_APPLICATION_TAG(APPLICATION_ID ASC); +-- ----------------------------------------------------- +-- Table AP_GROUP_SUBSCRIPTION +-- ----------------------------------------------------- +CREATE SEQUENCE AP_GROUP_SUBSCRIPTION_seq; + +CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_GROUP_SUBSCRIPTION_seq'), + TENANT_ID INTEGER NOT NULL, + SUBSCRIBED_BY VARCHAR(100) NOT NULL, + SUBSCRIBED_TIMESTAMP TIMESTAMP(0) NOT NULL, + UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false, + UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, + UNSUBSCRIBED_TIMESTAMP TIMESTAMP(0) NULL DEFAULT NULL, + GROUP_NAME VARCHAR(100) NOT NULL, + AP_APP_RELEASE_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1 + FOREIGN KEY (AP_APP_RELEASE_ID) + REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +CREATE INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_GROUP_SUBSCRIPTION (AP_APP_RELEASE_ID ASC); -CREATE TABLE IF NOT EXISTS APPM_PLATFORM_TAG ( - NAME VARCHAR(100) NOT NULL, - PLATFORM_ID INT NOT NULL, - PRIMARY KEY (PLATFORM_ID, NAME), - CONSTRAINT fk_APPM_PLATFORM_TAG_APPM_APPLICATION1 - FOREIGN KEY (PLATFORM_ID) - REFERENCES APPM_PLATFORM (ID) - ON DELETE CASCADE - ON UPDATE CASCADE); +-- ----------------------------------------------------- +-- Table AP_ROLE_SUBSCRIPTION +-- ----------------------------------------------------- +CREATE SEQUENCE AP_ROLE_SUBSCRIPTION_seq; + +CREATE TABLE IF NOT EXISTS AP_ROLE_SUBSCRIPTION( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_ROLE_SUBSCRIPTION_seq'), + TENANT_ID INTEGER NOT NULL, + ROLE_NAME VARCHAR(100) NOT NULL, + SUBSCRIBED_BY VARCHAR(100) NOT NULL, + SUBSCRIBED_TIMESTAMP TIMESTAMP(0) NOT NULL, + UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false, + UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, + UNSUBSCRIBED_TIMESTAMP TIMESTAMP(0) NULL DEFAULT NULL, + AP_APP_RELEASE_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1 + FOREIGN KEY (AP_APP_RELEASE_ID) + REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +CREATE INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_ROLE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC); -DROP TABLE IF EXISTS APPM_APPLICATION_RELEASE; -DROP SEQUENCE IF EXISTS APPM_APPLICATION_RELEASE_PK_SEQ; -CREATE SEQUENCE APPM_APPLICATION_RELEASE_PK_SEQ; -- ----------------------------------------------------- --- Table APPM_APPLICATION_RELEASE +-- Table AP_UNRESTRICTED_ROLE -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS APPM_APPLICATION_RELEASE ( - ID INT DEFAULT NEXTVAL('APPM_APPLICATION_RELEASE_PK_SEQ') UNIQUE, - VERSION_NAME VARCHAR(70) NOT NULL, - RELEASE_RESOURCE TEXT NULL, - RELEASE_CHANNEL VARCHAR(50) DEFAULT 'ALPHA', - RELEASE_DETAILS TEXT NULL, - CREATED_AT TIMESTAMP NOT NULL, - APPM_APPLICATION_ID INT NOT NULL, - IS_DEFAULT BOOLEAN DEFAULT FALSE, - PRIMARY KEY (APPM_APPLICATION_ID, VERSION_NAME), - CONSTRAINT FK_APPLICATION_VERSION_APPLICATION - FOREIGN KEY (APPM_APPLICATION_ID) - REFERENCES APPM_APPLICATION (ID) - ON DELETE NO ACTION - ON UPDATE NO ACTION); +CREATE SEQUENCE AP_UNRESTRICTED_ROLE_seq; + +CREATE TABLE IF NOT EXISTS AP_UNRESTRICTED_ROLE( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_UNRESTRICTED_ROLE_seq'), + TENANT_ID INTEGER NOT NULL, + ROLE VARCHAR(45) NOT NULL, + AP_APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_APP_VISIBILITY_AP_APP1 + FOREIGN KEY (AP_APP_ID) + REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +CREATE INDEX fk_AP_APP_VISIBILITY_AP_APP1_idx ON AP_UNRESTRICTED_ROLE (AP_APP_ID ASC); -CREATE INDEX FK_APPLICATION_VERSION_APPLICATION ON APPM_APPLICATION_RELEASE(APPM_APPLICATION_ID ASC); +-- ----------------------------------------------------- +-- Table AP_USER_SUBSCRIPTION +-- ----------------------------------------------------- +CREATE SEQUENCE AP_USER_SUBSCRIPTION_seq; + +CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_USER_SUBSCRIPTION_seq'), + TENANT_ID INTEGER NOT NULL, + USER_NAME VARCHAR(100) NOT NULL, + SUBSCRIBED_BY VARCHAR(100) NOT NULL, + SUBSCRIBED_TIMESTAMP TIMESTAMP(0) NOT NULL, + UNSUBSCRIBED BOOLEAN NOT NULL DEFAULT false, + UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL, + UNSUBSCRIBED_TIMESTAMP TIMESTAMP(0) NULL DEFAULT NULL, + AP_APP_RELEASE_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1 + FOREIGN KEY (AP_APP_RELEASE_ID) + REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +CREATE INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_USER_SUBSCRIPTION (AP_APP_RELEASE_ID ASC); -DROP TABLE IF EXISTS APPM_RELEASE_PROPERTY; -- ----------------------------------------------------- --- Table APPM_RELEASE_PROPERTY +-- Table AP_APP_CATEGORY -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS APPM_RELEASE_PROPERTY ( - PROP_KEY VARCHAR(255) NOT NULL, - PROP_VALUE TEXT NULL, - APPLICATION_RELEASE_ID INT NOT NULL, - PRIMARY KEY (PROP_KEY, APPLICATION_RELEASE_ID), - CONSTRAINT FK_RELEASE_PROPERTY_APPLICATION_RELEASE - FOREIGN KEY (APPLICATION_RELEASE_ID) - REFERENCES APPM_APPLICATION_RELEASE (ID) - ON DELETE NO ACTION - ON UPDATE NO ACTION); +CREATE SEQUENCE AP_APP_CATEGORY_seq; + +CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_CATEGORY_seq'), + TENANT_ID INTEGER NOT NULL, + CATEGORY VARCHAR(45) NOT NULL, + CATEGORY_ICON VARCHAR(45) NULL, + PRIMARY KEY (ID) +); -CREATE INDEX FK_RELEASE_PROPERTY_APPLICATION_RELEASE ON APPM_RELEASE_PROPERTY(APPLICATION_RELEASE_ID ASC); +-- ----------------------------------------------------- +-- Table AP_APP_TAG_MAPPING +-- ----------------------------------------------------- +CREATE SEQUENCE AP_APP_TAG_MAPPING_seq; + +CREATE TABLE IF NOT EXISTS AP_APP_TAG_MAPPING( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_TAG_MAPPING_seq'), + TENANT_ID INTEGER NOT NULL, + AP_APP_TAG_ID INTEGER NOT NULL, + AP_APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP_TAG1 + FOREIGN KEY (AP_APP_TAG_ID) + REFERENCES 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 AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP_TAG1_idx ON AP_APP_TAG_MAPPING (AP_APP_TAG_ID ASC); +CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP1_idx ON AP_APP_TAG_MAPPING (AP_APP_ID ASC); +-- ----------------------------------------------------- +-- Table AP_APP_CATEGORY_MAPPING +-- ----------------------------------------------------- +CREATE SEQUENCE AP_APP_CATEGORY_MAPPING_seq; + +CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY_MAPPING( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_CATEGORY_MAPPING_seq'), + TENANT_ID INTEGER NOT NULL, + AP_APP_CATEGORY_ID INTEGER NOT NULL, + AP_APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1 + FOREIGN KEY (AP_APP_CATEGORY_ID) + REFERENCES 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 AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +CREATE INDEX fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1_idx ON AP_APP_CATEGORY_MAPPING (AP_APP_CATEGORY_ID ASC); +CREATE INDEX fk_AP_APP_CATEGORY_copy1_AP_APP1_idx ON AP_APP_CATEGORY_MAPPING (AP_APP_ID ASC); -DROP TABLE IF EXISTS AP_SCHEDULED_SUBSCRIPTION; -DROP SEQUENCE IF EXISTS APPM_SCHEDULED_SUBSCRIPTION_PK_SEQ; -CREATE SEQUENCE APPM_SCHEDULED_SUBSCRIPTION_PK_SEQ; +-- ----------------------------------------------------- +-- Table AP_APP_SUB_OP_MAPPING +-- ----------------------------------------------------- +CREATE SEQUENCE AP_APP_SUB_OP_MAPPING_seq; + +CREATE TABLE IF NOT EXISTS AP_APP_SUB_OP_MAPPING ( + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_APP_SUB_OP_MAPPING_seq'), + TENANT_ID INTEGER NOT NULL, + OPERATION_ID INTEGER NOT NULL, + AP_DEVICE_SUBSCRIPTION_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1 + FOREIGN KEY (AP_DEVICE_SUBSCRIPTION_ID) + REFERENCES AP_DEVICE_SUBSCRIPTION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION +); +CREATE INDEX fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1_idx ON AP_APP_SUB_OP_MAPPING (AP_DEVICE_SUBSCRIPTION_ID ASC); -- ----------------------------------------------------- -- Table AP_SCHEDULED_SUBSCRIPTION -- ----------------------------------------------------- +CREATE SEQUENCE AP_SCHEDULED_SUBSCRIPTION_seq; + CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION( - ID INT DEFAULT NEXTVAL('APPM_SCHEDULED_SUBSCRIPTION_PK_SEQ') UNIQUE, - TASK_NAME VARCHAR(100) NOT NULL, - APPLICATION_UUID VARCHAR(36) NOT NULL, - SUBSCRIBER_LIST VARCHAR NOT NULL, - STATUS VARCHAR(15) NOT NULL, - SCHEDULED_AT TIMESTAMP NOT NULL, - SCHEDULED_BY VARCHAR(100) NOT NULL, - SCHEDULED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - DELETED BOOLEAN NOT NULL DEFAULT FALSE - PRIMARY KEY (ID), - CONSTRAINT FK_AP_SCHEDULED_SUBSCRIPTION_AP_APP_RELEASE - FOREIGN KEY (APPLICATION_UUID) - REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION + ID INTEGER NOT NULL DEFAULT NEXTVAL ('AP_SCHEDULED_SUBSCRIPTION_seq'), + TASK_NAME VARCHAR(100) NOT NULL, + APPLICATION_UUID VARCHAR(36) NOT NULL, + SUBSCRIBER_LIST TEXT NOT NULL, + STATUS VARCHAR(15) NOT NULL, + SCHEDULED_AT TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL, + SCHEDULED_BY VARCHAR(100) NOT NULL, + SCHEDULED_TIMESTAMP TIMESTAMP(0) DEFAULT CURRENT_TIMESTAMP NOT NULL, + DELETED BOOLEAN, + PRIMARY KEY (ID) );