From ac871fdbce12bc6f27f2ea59e85935b2106cf4b8 Mon Sep 17 00:00:00 2001 From: Chatura Dilan Date: Wed, 14 Jun 2017 12:40:11 +0530 Subject: [PATCH 1/3] Fixed exception class to PlatformDAOException --- .../carbon/device/application/mgt/core/dao/PlatformDAO.java | 2 +- .../mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/PlatformDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/PlatformDAO.java index 69d875c045..f5352d8361 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/PlatformDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/PlatformDAO.java @@ -26,7 +26,7 @@ import java.util.List; public interface PlatformDAO { - public Platform getPlatformByIdentifier(String identifier) throws ApplicationManagementDAOException; + public Platform getPlatformByIdentifier(String identifier) throws PlatformManagementDAOException; void register(String tenantDomain, Platform platform) throws PlatformManagementDAOException; 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/platform/GenericPlatformDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java index 32b71c35c0..8bbd416d60 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java @@ -38,7 +38,7 @@ import java.util.List; public class GenericPlatformDAOImpl extends AbstractDAOImpl implements PlatformDAO { @Override - public Platform getPlatformByIdentifier(String identifier) throws ApplicationManagementDAOException { + public Platform getPlatformByIdentifier(String identifier) throws PlatformManagementDAOException { Connection conn = null; PreparedStatement stmt = null; @@ -68,9 +68,9 @@ public class GenericPlatformDAOImpl extends AbstractDAOImpl implements PlatformD return platform; } catch (SQLException e) { - throw new ApplicationManagementDAOException("Error occurred while getting application List", e); + throw new PlatformManagementDAOException("Error occurred while getting application List", e); } catch (DBConnectionException e) { - throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e); + throw new PlatformManagementDAOException("Error occurred while obtaining the DB connection.", e); } finally { Util.cleanupResources(stmt, rs); } From d7b784b073447bd32839b9f13a7dc1839b3778ea Mon Sep 17 00:00:00 2001 From: Chatura Dilan Date: Wed, 14 Jun 2017 12:45:15 +0530 Subject: [PATCH 2/3] Removed published from platforms --- .../carbon/device/application/mgt/common/Platform.java | 10 ---------- .../core/dao/impl/platform/GenericPlatformDAOImpl.java | 1 - 2 files changed, 11 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java index 24b7aacd6e..e51a388f0a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java @@ -74,8 +74,6 @@ public class Platform implements Cloneable { } - private boolean published; - public int getId() { return id; } @@ -132,14 +130,6 @@ public class Platform implements Cloneable { this.tags = tags; } - public boolean isPublished() { - return published; - } - - public void setPublished(boolean published) { - this.published = published; - } - public boolean isFileBased() { return fileBased; } 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/platform/GenericPlatformDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java index 8bbd416d60..bd48042106 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/platform/GenericPlatformDAOImpl.java @@ -62,7 +62,6 @@ public class GenericPlatformDAOImpl extends AbstractDAOImpl implements PlatformD platform.setId(rs.getInt("ID")); platform.setName(rs.getString("NAME")); platform.setIdentifier(rs.getString("IDENTIFIER")); - platform.setPublished(rs.getBoolean("PUBLISHED")); } return platform; From 9bc23a927d092e0fffbb8d6f53c6d971c3413a2b Mon Sep 17 00:00:00 2001 From: Chatura Dilan Date: Wed, 14 Jun 2017 12:47:52 +0530 Subject: [PATCH 3/3] Fixed the mysql script for app management --- .../dbscripts/cdm/application-mgt/mysql.sql | 83 +++++++++++-------- 1 file changed, 48 insertions(+), 35 deletions(-) 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 6799cc928b..485fb3b2bf 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,3 +1,12 @@ +-- MySQL Script generated by MySQL Workbench +-- 2017-06-14 12:46:43 +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 WSO2DM_APPM_DB -- ----------------------------------------------------- @@ -10,9 +19,7 @@ CREATE TABLE IF NOT EXISTS `APPM_PLATFORM` ( `NAME` VARCHAR(100) NOT NULL, `DESCRIPTION` TEXT NULL, `IDENTIFIER` VARCHAR(100) NOT NULL, - `ICON_NAME` VARCHAR(100) NULL, `DESCRIPTOR` LONGTEXT NOT NULL, - `PUBLISHED` TINYINT(1) NULL, PRIMARY KEY (`ID`), UNIQUE INDEX `IDENTIFIER_UNIQUE` (`IDENTIFIER` ASC)) ENGINE = InnoDB @@ -32,24 +39,6 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_CATEGORY` ( COMMENT = 'This table contains the data related to the application category'; --- ----------------------------------------------------- --- Table `APPM_PLATFORM_APPLICATION_MAPPING` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_APPLICATION_MAPPING` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `PLATFORM_ID` INT NOT NULL, - `TENANT_ID` INT NOT NULL, - PRIMARY KEY (`ID`, `PLATFORM_ID`), - INDEX `FK_PLATFROM_APPLICATION_MAPPING_PLATFORM` (`PLATFORM_ID` ASC), - CONSTRAINT `fk_APPM_PLATFORM_TENANT_MAPPING_APPM_SUPPORTED_PLATFORM1` - FOREIGN KEY (`PLATFORM_ID`) - REFERENCES `APPM_PLATFORM` (`ID`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) - ENGINE = InnoDB - COMMENT = 'This table contains the data related relationship between application platofrm and appication mappings'; - - -- ----------------------------------------------------- -- Table `APPM_LIFECYCLE_STATE` -- ----------------------------------------------------- @@ -84,28 +73,29 @@ CREATE TABLE IF NOT EXISTS `APPM_APPLICATION` ( `PAYMENT_CURRENCY` VARCHAR(45) NULL, `PAYMENT_PRICE` DECIMAL(10,2) NULL, `APPLICATION_CATEGORY_ID` INT NOT NULL, - `PLATFORM_APPLICATION_MAPPING_ID` INT NOT NULL, - `APPM_LIFECYCLE_STATE_ID` INT NOT NULL, - `LIECYCLE_STATE_MODIFIED_BY` VARCHAR(255) NULL, + `LIFECYCLE_STATE_ID` INT NOT NULL, + `LIFECYCLE_STATE_MODIFIED_BY` VARCHAR(255) NULL, `LIFECYCLE_STATE_MODIFIED_AT` DATETIME NULL, - PRIMARY KEY (`ID`, `APPLICATION_CATEGORY_ID`, `PLATFORM_APPLICATION_MAPPING_ID`, `APPM_LIFECYCLE_STATE_ID`), + `TENANT_ID` INT NULL, + `PLATFORM_ID` INT NOT NULL, + PRIMARY KEY (`ID`, `APPLICATION_CATEGORY_ID`, `LIFECYCLE_STATE_ID`, `PLATFORM_ID`), UNIQUE INDEX `UUID_UNIQUE` (`UUID` ASC), INDEX `FK_APPLICATION_APPLICATION_CATEGORY` (`APPLICATION_CATEGORY_ID` ASC), - INDEX `FK_APPLICATION_PLATFORM_APPLICATION_MAPPING` (`PLATFORM_APPLICATION_MAPPING_ID` ASC), - INDEX `FK_APPLICATION_LIFECYCLE_STATE` (`APPM_LIFECYCLE_STATE_ID` ASC), + INDEX `FK_APPLICATION_LIFECYCLE_STATE` (`LIFECYCLE_STATE_ID` ASC), + INDEX `FK_APPM_APPLICATION_APPM_PLATFORM` (`PLATFORM_ID` ASC), CONSTRAINT `FK_APPLICATION_APPLICATION_CATEGORY` FOREIGN KEY (`APPLICATION_CATEGORY_ID`) REFERENCES `APPM_APPLICATION_CATEGORY` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_APPM_APPLICATION_APPM_PLATFORM_APPLICATION_MAPPING1` - FOREIGN KEY (`PLATFORM_APPLICATION_MAPPING_ID`) - REFERENCES `APPM_PLATFORM_APPLICATION_MAPPING` (`ID`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, CONSTRAINT `fk_APPM_APPLICATION_APPM_LIFECYCLE_STATE1` - FOREIGN KEY (`APPM_LIFECYCLE_STATE_ID`) + 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) ENGINE = InnoDB @@ -242,6 +232,24 @@ CREATE TABLE IF NOT EXISTS `APPM_COMMENT` ( COMMENT = 'This table contains the data related to the application comments'; +-- ----------------------------------------------------- +-- Table `APPM_PLATFORM_TENENT_MAPPING` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_TENENT_MAPPING` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `PLATFORM_ID` INT NOT NULL, + `TENANT_ID` INT NOT NULL, + PRIMARY KEY (`ID`, `PLATFORM_ID`), + INDEX `FK_PLATFROM_TENANT_MAPPING_PLATFORM` (`PLATFORM_ID` ASC), + CONSTRAINT `fk_APPM_PLATFORM_TENANT_MAPPING_APPM_SUPPORTED_PLATFORM1` + FOREIGN KEY (`PLATFORM_ID`) + REFERENCES `APPM_PLATFORM` (`ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) + ENGINE = InnoDB + COMMENT = 'This table contains the data related relationship between application platofrm and appication mappings'; + + -- ----------------------------------------------------- -- Table `APPM_PLATFORM_TAG` -- ----------------------------------------------------- @@ -263,9 +271,9 @@ CREATE TABLE IF NOT EXISTS `APPM_PLATFORM_TAG` ( -- Table `APPM_APPLICATION_TAG` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `APPM_APPLICATION_TAG` ( - `name` VARCHAR(45) NOT NULL, + `NAME` VARCHAR(45) NOT NULL, `APPLICATION_ID` INT NOT NULL, - PRIMARY KEY (`APPLICATION_ID`, `name`), + PRIMARY KEY (`APPLICATION_ID`, `NAME`), INDEX `FK_APPLICATION_TAG_APPLICATION` (`APPLICATION_ID` ASC), CONSTRAINT `fk_APPM_APPLICATION_TAG_APPM_APPLICATION1` FOREIGN KEY (`APPLICATION_ID`) @@ -321,4 +329,9 @@ CREATE TABLE IF NOT EXISTS `APPM_SUBSCRIPTION_PROPERTIES` ( REFERENCES `APPM_SUBSCRIPTION` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION) - ENGINE = InnoDB; \ No newline at end of file + ENGINE = InnoDB; + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;