From 2479be9f5a0b34a886c59888752da2e5804098a9 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Mon, 2 Nov 2015 19:37:21 +0530 Subject: [PATCH 1/2] Fixing the email client issue --- .../mgt/core/email/sender/EmailServiceProviderImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/email/sender/EmailServiceProviderImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/email/sender/EmailServiceProviderImpl.java index 4d450c139a..cd537f62a8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/email/sender/EmailServiceProviderImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/email/sender/EmailServiceProviderImpl.java @@ -34,7 +34,6 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.EmailMessageProperties; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; -import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig; import org.wso2.carbon.device.mgt.core.config.email.EmailConfigurations; import org.wso2.carbon.device.mgt.core.internal.EmailServiceDataHolder; import org.wso2.carbon.device.mgt.core.service.EmailService; @@ -91,8 +90,8 @@ public class EmailServiceProviderImpl implements EmailService { payload.setText(body); try { ServiceClient serviceClient; - ConfigurationContext configContext = EmailServiceDataHolder.getInstance() - .getConfigurationContextService().getClientConfigContext(); + ConfigurationContext configContext = EmailServiceDataHolder.getInstance(). + getConfigurationContextService().getServerConfigContext(); //Set configuration service client if available, else create new service client if (configContext != null) { serviceClient = new ServiceClient(configContext, null); From feab85796f9c0c7e0f4b1c4a47267f7994bcaae7 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Mon, 2 Nov 2015 19:44:52 +0530 Subject: [PATCH 2/2] Fixing the EMM-896 which restrict deleting the policy once applied due to a contraint violation --- .../src/test/resources/sql/CreateH2TestDB.sql | 5 ----- .../src/main/resources/dbscripts/cdm/h2.sql | 5 ----- .../src/main/resources/dbscripts/cdm/mssql.sql | 5 ----- .../src/main/resources/dbscripts/cdm/mysql.sql | 5 ----- .../src/main/resources/dbscripts/cdm/oracle.sql | 4 ---- .../src/main/resources/dbscripts/cdm/postgresql.sql | 5 ----- 6 files changed, 29 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql index 9f488a8694..8b101ba8c1 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql @@ -263,11 +263,6 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( FOREIGN KEY (DEVICE_ID ) REFERENCES DM_DEVICE (ID ) ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT FK_DM_POLICY_DEVICE_APPLIED_POLICY - FOREIGN KEY (POLICY_ID ) - REFERENCES DM_POLICY (ID ) - ON DELETE NO ACTION ON UPDATE NO ACTION ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql index 10e15533ed..31b46f345b 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -245,11 +245,6 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( FOREIGN KEY (DEVICE_ID ) REFERENCES DM_DEVICE (ID ) ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT FK_DM_POLICY_DEVICE_APPLIED_POLICY - FOREIGN KEY (POLICY_ID ) - REFERENCES DM_POLICY (ID ) - ON DELETE NO ACTION ON UPDATE NO ACTION ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql index c61879a5e3..e78fb33827 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -248,11 +248,6 @@ CREATE TABLE DM_USER_POLICY ( FOREIGN KEY (DEVICE_ID ) REFERENCES DM_DEVICE (ID ) ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT FK_DM_POLICY_DEVICE_APPLIED_POLICY - FOREIGN KEY (POLICY_ID ) - REFERENCES DM_POLICY (ID ) - ON DELETE NO ACTION ON UPDATE NO ACTION ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql index 00a519c65e..36a530614f 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -240,11 +240,6 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( FOREIGN KEY (DEVICE_ID ) REFERENCES DM_DEVICE (ID ) ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT FK_DM_POLICY_DEVICE_APPLIED_POLICY - FOREIGN KEY (POLICY_ID ) - REFERENCES DM_POLICY (ID ) - ON DELETE NO ACTION ON UPDATE NO ACTION )ENGINE = InnoDB; diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql index 51c6900506..cc3713817e 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -363,10 +363,6 @@ END; CONSTRAINT FK_DM_POLICY_DEVCIE_APPLIED FOREIGN KEY (DEVICE_ID ) REFERENCES DM_DEVICE (ID ) - , - CONSTRAINT FK_DM_POLICY_DEVICE_APPLIED_POLICY - FOREIGN KEY (POLICY_ID ) - REFERENCES DM_POLICY (ID ) ); -- Generate ID using sequence and trigger diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql index d874edf690..9aa7b8512a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -211,11 +211,6 @@ CREATE TABLE DM_DEVICE_POLICY_APPLIED ( FOREIGN KEY (DEVICE_ID ) REFERENCES DM_DEVICE (ID ) ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT FK_DM_POLICY_DEVICE_APPLIED_POLICY - FOREIGN KEY (POLICY_ID ) - REFERENCES DM_POLICY (ID ) - ON DELETE NO ACTION ON UPDATE NO ACTION );