From 2abfff5c3681b106097bbbd05d6a35e5eb909a0a Mon Sep 17 00:00:00 2001 From: geethkokila Date: Tue, 12 May 2015 18:12:50 +0530 Subject: [PATCH] Removing policy saving after the evaluation. --- .../src/test/resources/sql/CreateH2TestDB.sql | 23 +++++++++++++++++++ .../decision/point/SimpleEvaluationImpl.java | 9 ++++---- 2 files changed, 28 insertions(+), 4 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 3005bc42bc7..a5c29692d99 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 @@ -238,5 +238,28 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( ON DELETE NO ACTION ON UPDATE NO ACTION) ; + + + CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED ( + ID INT NOT NULL AUTO_INCREMENT , + DEVICE_ID INT NOT NULL , + POLICY_ID INT NOT NULL , + POLICY_CONTENT BLOB NULL , + APPLIED TINYINT(1) NULL , + CREATED_TIME TIMESTAMP NULL , + UPDATED_TIME TIMESTAMP NULL , + APPLIED_TIME TIMESTAMP NULL , + PRIMARY KEY (ID) , + CONSTRAINT FK_DM_POLICY_DEVCIE_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) +; diff --git a/components/policy-mgt/org.wso2.carbon.simple.policy.decision.point/src/main/java/org/wso2/carbon/simple/policy/decision/point/SimpleEvaluationImpl.java b/components/policy-mgt/org.wso2.carbon.simple.policy.decision.point/src/main/java/org/wso2/carbon/simple/policy/decision/point/SimpleEvaluationImpl.java index bd15caec36a..57d8cdffece 100644 --- a/components/policy-mgt/org.wso2.carbon.simple.policy.decision.point/src/main/java/org/wso2/carbon/simple/policy/decision/point/SimpleEvaluationImpl.java +++ b/components/policy-mgt/org.wso2.carbon.simple.policy.decision.point/src/main/java/org/wso2/carbon/simple/policy/decision/point/SimpleEvaluationImpl.java @@ -57,8 +57,9 @@ public class SimpleEvaluationImpl implements SimpleEvaluation { sortPolicies(); policy = policyList.get(0); - policyAdministratorPoint = policyManagerService.getPAP(); - policyAdministratorPoint.setPolicyUsed(deviceIdentifier, policy); + //TODO : UNCOMMENT THE FOLLOWING CASE +// policyAdministratorPoint = policyManagerService.getPAP(); +// policyAdministratorPoint.setPolicyUsed(deviceIdentifier, policy); } @@ -76,7 +77,7 @@ public class SimpleEvaluationImpl implements SimpleEvaluation { Collections.sort(policyList); } - private PolicyManagerService getPolicyManagerService(){ - return PolicyDecisionPointDataHolder.getInstance().getPolicyManagerService(); + private PolicyManagerService getPolicyManagerService() { + return PolicyDecisionPointDataHolder.getInstance().getPolicyManagerService(); } }