diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/pom.xml b/components/action-mgt/org.wso2.carbon.identity.action.execution/pom.xml
index 4173b2637d37..ba62777f4345 100644
--- a/components/action-mgt/org.wso2.carbon.identity.action.execution/pom.xml
+++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.identity.framework
action-mgt
- 7.6.20-SNAPSHOT
+ 7.7.16-SNAPSHOT
../pom.xml
diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/impl/ActionExecutorServiceImpl.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/impl/ActionExecutorServiceImpl.java
index 94e054d0fecf..d4c1ffc4eee8 100644
--- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/impl/ActionExecutorServiceImpl.java
+++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/impl/ActionExecutorServiceImpl.java
@@ -114,13 +114,10 @@ public ActionExecutionStatus> execute(ActionType actionType, Map execute(ActionType actionType, String[] actionId
validateActionIdList(actionType, actionIdList);
Action action = getActionByActionId(actionType, actionIdList[0], tenantDomain);
- DIAGNOSTIC_LOGGER.logActionInitiation(action);
try {
return execute(action, eventContext);
} catch (ActionExecutionRuntimeException e) {
- DIAGNOSTIC_LOGGER.logSkippedActionExecution(actionType);
LOG.debug("Skip executing actions for action type: " + actionType.name(), e);
- // Skip executing actions when no action available or due to a failure in retrieving actions,
- // is considered as action execution being successful.
+ // Skip executing actions when no action available is considered as action execution being successful.
return new SuccessStatus.Builder().setResponseContext(eventContext).build();
}
}
@@ -172,6 +166,7 @@ private ActionExecutionStatus> execute(Action action, Map even
ActionExecutionResponseProcessor actionExecutionResponseProcessor = getResponseProcessor(actionType);
if (action.getStatus() == Action.Status.ACTIVE) {
+ DIAGNOSTIC_LOGGER.logActionInitiation(action);
return executeAction(action, actionRequest, eventContext, actionExecutionResponseProcessor);
} else {
// If no active actions are detected, it is regarded as the action execution being successful.
@@ -191,13 +186,13 @@ private Action getActionByActionId(ActionType actionType, String actionId, Strin
}
private List getActionsByActionType(ActionType actionType, String tenantDomain) throws
- ActionExecutionRuntimeException {
+ ActionExecutionException {
try {
return ActionExecutionServiceComponentHolder.getInstance().getActionManagementService()
.getActionsByActionType(Action.ActionTypes.valueOf(actionType.name()).getPathParam(), tenantDomain);
} catch (ActionMgtException e) {
- throw new ActionExecutionRuntimeException("Error occurred while retrieving actions.", e);
+ throw new ActionExecutionException("Error occurred while retrieving actions.", e);
}
}
diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/ActionExecutionDiagnosticLogger.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/ActionExecutionDiagnosticLogger.java
index 31a2f9c45cfd..4b3f750de2d7 100644
--- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/ActionExecutionDiagnosticLogger.java
+++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/ActionExecutionDiagnosticLogger.java
@@ -21,7 +21,6 @@
import org.apache.http.client.methods.HttpPost;
import org.wso2.carbon.identity.action.execution.ActionExecutionLogConstants;
import org.wso2.carbon.identity.action.execution.model.ActionInvocationResponse;
-import org.wso2.carbon.identity.action.execution.model.ActionType;
import org.wso2.carbon.identity.action.management.model.Action;
import org.wso2.carbon.identity.central.log.mgt.utils.LoggerUtils;
import org.wso2.carbon.utils.DiagnosticLog;
@@ -47,19 +46,6 @@ public void logActionInitiation(Action action) {
DiagnosticLog.ResultStatus.SUCCESS));
}
- public void logSkippedActionExecution(ActionType actionType) {
-
- if (!LoggerUtils.isDiagnosticLogsEnabled()) {
- return;
- }
-
- triggerLogEvent(
- initializeDiagnosticLogBuilder(
- ActionExecutionLogConstants.ActionIDs.EXECUTE_ACTION,
- "Skip executing action for " + actionType + " type.",
- DiagnosticLog.ResultStatus.FAILED));
- }
-
public void logActionRequest(Action action) {
if (!LoggerUtils.isDiagnosticLogsEnabled()) {
diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/impl/ActionExecutorServiceImplTest.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/impl/ActionExecutorServiceImplTest.java
index 5f1ece8a0c9e..96ac65dacdd3 100644
--- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/impl/ActionExecutorServiceImplTest.java
+++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/impl/ActionExecutorServiceImplTest.java
@@ -230,6 +230,16 @@ public void testActionExecuteWithActionIdFailureWhenInvalidActionIdGiven() throw
actionExecutorService.execute(ActionType.PRE_ISSUE_ACCESS_TOKEN, new String[]{any()}, any(), any());
}
+ @Test(expectedExceptions = ActionExecutionException.class,
+ expectedExceptionsMessageRegExp = "Error occurred while retrieving actions.")
+ public void testActionExecuteWithActionFailureWhenInvalidActionGiven() throws Exception {
+
+ when(actionManagementService.getActionsByActionType(any(), any())).thenThrow(
+ new ActionMgtException("Error occurred while retrieving actions."));
+
+ actionExecutorService.execute(ActionType.PRE_ISSUE_ACCESS_TOKEN, any(), any());
+ }
+
@Test(expectedExceptions = ActionExecutionException.class,
expectedExceptionsMessageRegExp = "Failed to build the request payload for action type: " +
"PRE_ISSUE_ACCESS_TOKEN")
diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/pom.xml b/components/action-mgt/org.wso2.carbon.identity.action.management/pom.xml
index 4b4be8e287d9..3f9169cfbbb4 100644
--- a/components/action-mgt/org.wso2.carbon.identity.action.management/pom.xml
+++ b/components/action-mgt/org.wso2.carbon.identity.action.management/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.identity.framework
action-mgt
- 7.6.20-SNAPSHOT
+ 7.7.16-SNAPSHOT
../pom.xml
diff --git a/components/action-mgt/pom.xml b/components/action-mgt/pom.xml
index 086df4b98999..064962145d1b 100644
--- a/components/action-mgt/pom.xml
+++ b/components/action-mgt/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.identity.framework
identity-framework
- 7.6.20-SNAPSHOT
+ 7.7.16-SNAPSHOT
../../pom.xml
diff --git a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.collection.mgt/pom.xml b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.collection.mgt/pom.xml
index 7e15e252ad8d..2fafe440f411 100644
--- a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.collection.mgt/pom.xml
+++ b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.collection.mgt/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.identity.framework
api-resource-mgt
- 7.6.20-SNAPSHOT
+ 7.7.16-SNAPSHOT
../pom.xml
diff --git a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/pom.xml b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/pom.xml
index 5c8e2851fed6..562f53a5c63a 100644
--- a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/pom.xml
+++ b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.identity.framework
api-resource-mgt
- 7.6.20-SNAPSHOT
+ 7.7.16-SNAPSHOT
../pom.xml
org.wso2.carbon.identity.api.resource.mgt
diff --git a/components/api-resource-mgt/pom.xml b/components/api-resource-mgt/pom.xml
index d5ec1fba483c..860d34576a87 100644
--- a/components/api-resource-mgt/pom.xml
+++ b/components/api-resource-mgt/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.identity.framework
identity-framework
- 7.6.20-SNAPSHOT
+ 7.7.16-SNAPSHOT
../../pom.xml
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.common/pom.xml b/components/application-mgt/org.wso2.carbon.identity.application.common/pom.xml
index 64c0eb0bb01e..19d6925b5cdc 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.common/pom.xml
+++ b/components/application-mgt/org.wso2.carbon.identity.application.common/pom.xml
@@ -18,7 +18,7 @@
org.wso2.carbon.identity.framework
application-mgt
- 7.6.20-SNAPSHOT
+ 7.7.16-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/pom.xml b/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/pom.xml
index c9f7619c45db..2ec12e157a22 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/pom.xml
+++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/pom.xml
@@ -19,7 +19,7 @@
org.wso2.carbon.identity.framework
application-mgt
- 7.6.20-SNAPSHOT
+ 7.7.16-SNAPSHOT
../pom.xml
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/pom.xml b/components/application-mgt/org.wso2.carbon.identity.application.mgt/pom.xml
index b44bde459e8f..9e031c9f1947 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/pom.xml
+++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.identity.framework
application-mgt
- 7.6.20-SNAPSHOT
+ 7.7.16-SNAPSHOT
../pom.xml
org.wso2.carbon.identity.application.mgt
diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/test/resources/repository/conf/identity/identity.xml b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/test/resources/repository/conf/identity/identity.xml
index fdf6f07a9355..b6626035b87e 100644
--- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/test/resources/repository/conf/identity/identity.xml
+++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/test/resources/repository/conf/identity/identity.xml
@@ -294,7 +294,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/README.md b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/README.md
deleted file mode 100644
index f3ec4a2ff85b..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-REST API implementation for WSO2 IS
-===================================
-
-This is a REST implementation of the WSO2 IS Entitlement Service, done as a part of GSoC 2016
-
-The code is still in early stages, and I would highly appreciate if you could carry out tests and provide feedback / issues / comments on it.
-
-Design and implementation
--------------------------
-
-Design and implementation details of the endpoint is available at [http://manzzup.blogspot.com/2016/08/gsoc-2016-rest-implementation-for-wso2.html](http://manzzup.blogspot.com/2016/08/gsoc-2016-rest-implementation-for-wso2.html)
-
-
-Procedure
---------
-
-1. Download the target/entitlement.war file
-2. Place it in your **{IS ROOT}/repository/deployement/server/webapps** (Tested for IS 5.2.0)
-3. You can hot deploy the war file as well
-4. Once deployed the WADL definitions for the service can be seen at, **https://localhost:9443/entitlement/entitlement/Decision?_wadl**
-5. The service curently support both JSON and XML
-6. TO test various service methods, use the curl requests and json/xml request definitions available under resources/curlTests
-
-Thank you!!
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/REQUIRED_CHANGES.md b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/REQUIRED_CHANGES.md
deleted file mode 100644
index 81640581ce27..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/REQUIRED_CHANGES.md
+++ /dev/null
@@ -1,26 +0,0 @@
-Changes need to be done for different wso2 components for completion of the endpoint
-====================================================================================
-
-Balana
-------
-
-1) Public constructor for [MultiRequests](https://github.com/wso2/balana/blob/master/modules/balana-core/src/main/java/org/wso2/balana/xacml3/MultiRequests.java)
-
-Needs the public constructor for manual creation of `RequestCtx` object in JSONParser
-
-2) Public getter for obligationId in [Obligation](https://github.com/wso2/balana/blob/master/modules/balana-core/src/main/java/org/wso2/balana/xacml3/Obligation.java)
-
-Refer the following [PR](https://github.com/wso2/balana/pull/41)
-
-3) Public method in [PDP](https://github.com/wso2/balana/blob/master/modules/balana-core/src/main/java/org/wso2/balana/PDP.java) that
-can convert a given XACML String to `ResponseCtx` object.
-
-This process only done internally in `evaluate` method bodies. But in the REST endpoint, someone can send the request in XACML
-but needs the response in JSON, for which the `evaluate` method should either return a ResponseCtx object or a JSON String. Since
-JSON is not already supported in Balana, if there's a converter method to produce `RequestCtx` from XACML String, the exsting
-evaluate method can be used.
-
-4) Integrating the JSON support
-
-JSON support is give using 2 supporter classes in the REST source code. But since the functionality of the code is better related
-to balana, it's better to implement them inside Balana.
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml
index 2a683f22138d..631d34da6f96 100644
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml
+++ b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml
@@ -22,7 +22,7 @@
org.wso2.carbon.identity.framework
entitlement
../pom.xml
- 7.6.20-SNAPSHOT
+ 7.7.0-SNAPSHOT
org.wso2.carbon.identity.entitlement.endpoint
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/src/main/webapp/META-INF/webapp-classloading.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/src/main/webapp/META-INF/webapp-classloading.xml
deleted file mode 100644
index aa3a4c279762..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/src/main/webapp/META-INF/webapp-classloading.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
- false
-
-
- CXF3,Carbon
-
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/src/main/webapp/WEB-INF/cxf-servlet.xml
deleted file mode 100644
index a9cac8d44233..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/src/main/webapp/WEB-INF/cxf-servlet.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/src/main/webapp/WEB-INF/web.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 7b1c2f3bbd89..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
- Entitlement-Service-Provider
-
-
- HttpHeaderSecurityFilter
- org.apache.catalina.filters.HttpHeaderSecurityFilter
-
- hstsEnabled
- false
-
-
-
-
- HttpHeaderSecurityFilter
- *
-
-
-
- ContentTypeBasedCachePreventionFilter
-
- org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter
-
-
- patterns
- "text/html" ,"application/json" ,"plain/text"
-
-
- filterAction
- enforce
-
-
- httpHeaders
-
- Cache-Control: no-store, no-cache, must-revalidate, private
-
-
-
-
-
- ContentTypeBasedCachePreventionFilter
- *
-
-
-
-
- ApiOriginFilter
- org.wso2.carbon.identity.entitlement.endpoint.filter.ApiOriginFilter
-
-
- ApiOriginFilter
- /*
-
-
-
- EntitlementServlet
- EntitlementServlet
- Entitlement Endpoints
- org.apache.cxf.transport.servlet.CXFServlet
- 1
-
-
-
- swagger.api.basepath
- https://localhost:9443/entitlement
-
-
-
-
- EntitlementServlet
- /*
-
-
-
- 60
-
- true
-
-
-
-
-
- secured services
- /decision/*
-
-
-
-
-
- CONFIDENTIAL
-
-
-
-
- org.wso2.carbon.identity.entitlement.endpoint.impl.ApplicationInitializer
-
-
-
-
-
-
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/pom.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/pom.xml
index d93944923a25..f987d471181e 100644
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/pom.xml
+++ b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/pom.xml
@@ -21,7 +21,7 @@
org.wso2.carbon.identity.framework
entitlement
- 7.6.20-SNAPSHOT
+ 7.7.0-SNAPSHOT
../pom.xml
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyBean.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyBean.java
deleted file mode 100644
index b6e97e01b7f8..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyBean.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.identity.entitlement.ui;
-
-import org.wso2.balana.utils.policy.dto.BasicRuleDTO;
-import org.wso2.balana.utils.policy.dto.BasicTargetDTO;
-import org.wso2.carbon.identity.entitlement.stub.dto.EntitlementFinderDataHolder;
-import org.wso2.carbon.identity.entitlement.stub.dto.EntitlementTreeNodeDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.ExtendAttributeDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.ObligationDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.PolicyRefIdDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.PolicySetDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.RuleDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.SimplePolicyEditorDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.TargetDTO;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * This Bean is used to keep the user data temporary while travelling through
- * the UI wizard
- */
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class EntitlementPolicyBean {
-
- public Map functionIdMap = new HashMap();
- public Map functionIdElementValueMap = new HashMap();
- private String policyName;
- private String algorithmName;
- private String policyDescription;
- private String userInputData;
- private List subscribersList = new ArrayList();
- private SimplePolicyEditorDTO SimplePolicyEditorDTO;
- private Map categoryMap = new HashMap();
- private Map targetFunctionMap = new HashMap();
- private Map attributeIdMap = new HashMap();
- private Map ruleFunctionMap = new HashMap();
- private boolean editPolicy;
- private String[] policyCombiningAlgorithms = new String[0];
- private Map entitlementFinders =
- new HashMap();
- private Map selectedEntitlementData = new HashMap();
- private Map entitlementLevelData =
- new HashMap();
- private BasicTargetDTO basicTargetDTO = null;
- private TargetDTO targetDTO = null;
- private PolicySetDTO policySetDTO = null;
- private List basicRuleDTOs = new ArrayList();
-
- private List ruleDTOs = new ArrayList();
-
- private List extendAttributeDTOs = new ArrayList();
-
- private List obligationDTOs = new ArrayList();
-
- private String ruleElementOrder;
-
- private String policyReferenceOrder;
-
- private Set preFunctions = new HashSet();
-
- private List policyRefIds = new ArrayList();
-
- /**
- * This method is temporally used to clear the entitlement bean. Need to
- * update with a method proper implementation TODO
- */
- public void cleanEntitlementPolicyBean() {
-
- policyName = null;
-
- algorithmName = null;
-
- policyDescription = null;
-
- userInputData = null;
-
- editPolicy = false;
-
- policySetDTO = null;
-
- functionIdMap.clear();
-
- functionIdElementValueMap.clear();
-
- basicRuleDTOs.clear();
-
- removeBasicTargetElementDTO();
-
- targetDTO = null;
-
- ruleDTOs.clear();
-
- extendAttributeDTOs.clear();
-
- obligationDTOs.clear();
-
- SimplePolicyEditorDTO = null;
-
- basicTargetDTO = null;
-
- policyReferenceOrder = null;
-
- policyRefIds.clear();
-
- }
-
- public String getPolicyName() {
- return policyName;
- }
-
- public void setPolicyName(String policyName) {
- this.policyName = policyName;
- }
-
- public String getAlgorithmName() {
- return algorithmName;
- }
-
- public void setAlgorithmName(String algorithmName) {
- this.algorithmName = algorithmName;
- }
-
- public String getPolicyDescription() {
- return policyDescription;
- }
-
- public void setPolicyDescription(String policyDescription) {
- this.policyDescription = policyDescription;
- }
-
- public String getUserInputData() {
- return userInputData;
- }
-
- public void setUserInputData(String userInputData) {
- this.userInputData = userInputData;
- }
-
- public List getBasicRuleDTOs() {
- return basicRuleDTOs;
- }
-
- public void setBasicRuleDTOs(List basicRuleDTOs) {
- this.basicRuleDTOs = basicRuleDTOs;
- }
-
- public void setBasicRuleElementDTOs(BasicRuleDTO basicRuleDTO) {
- if (basicRuleDTOs.size() > 0) {
- Iterator iterator = basicRuleDTOs.listIterator();
- while (iterator.hasNext()) {
- BasicRuleDTO elementDTO = (BasicRuleDTO) iterator
- .next();
- if (elementDTO.getRuleId().equals(
- basicRuleDTO.getRuleId())) {
- if (elementDTO.isCompletedRule()) {
- basicRuleDTO.setCompletedRule(true);
- }
- iterator.remove();
- }
- }
- }
- this.basicRuleDTOs.add(basicRuleDTO);
- }
-
- public BasicRuleDTO getBasicRuleElement(String ruleId) {
- if (basicRuleDTOs.size() > 0) {
- for (BasicRuleDTO basicRuleDTO : basicRuleDTOs) {
- if (basicRuleDTO.getRuleId().equals(ruleId)) {
- return basicRuleDTO;
- }
- }
- }
- return null;
- }
-
- public boolean removeBasicRuleElement(String ruleId) {
- if (basicRuleDTOs.size() > 0 && ruleId != null) {
- for (BasicRuleDTO basicRuleDTO : basicRuleDTOs) {
- if (ruleId.equals(basicRuleDTO.getRuleId())) {
- return basicRuleDTOs.remove(basicRuleDTO);
- }
- }
- }
- return false;
- }
-
- public void removeBasicRuleElements() {
- if (basicRuleDTOs.size() > 0) {
- Iterator iterator = basicRuleDTOs.listIterator();
- while (iterator.hasNext()) {
- iterator.next();
- iterator.remove();
- }
- }
- }
-
-
-/////////////////////////////////////// new
-
- public List getRuleDTOs() {
- return ruleDTOs;
- }
-
- public void setRuleDTOs(List ruleDTOs) {
- this.ruleDTOs = ruleDTOs;
- }
-
- public void setRuleDTO(RuleDTO ruleDTO) {
- if (ruleDTOs.size() > 0) {
- Iterator iterator = ruleDTOs.listIterator();
- while (iterator.hasNext()) {
- RuleDTO elementDTO = (RuleDTO) iterator.next();
- if (elementDTO.getRuleId().equals(
- ruleDTO.getRuleId())) {
- if (elementDTO.isCompletedRule()) {
- ruleDTO.setCompletedRule(true);
- }
- iterator.remove();
- }
- }
- }
- this.ruleDTOs.add(ruleDTO);
- }
-
- public RuleDTO getRuleDTO(String ruleId) {
- if (ruleDTOs.size() > 0) {
- for (RuleDTO ruleDTO : ruleDTOs) {
- if (ruleDTO.getRuleId().equals(ruleId)) {
- return ruleDTO;
- }
- }
- }
- return null;
- }
-
- public boolean removeRuleDTO(String ruleId) {
- if (ruleDTOs.size() > 0) {
- for (RuleDTO ruleDTO : ruleDTOs) {
- if (ruleDTO.getRuleId().equals(ruleId)) {
- return ruleDTOs.remove(ruleDTO);
- }
- }
- }
- return false;
- }
-
- public void removeRuleDTOs() {
- if (ruleDTOs.size() > 0) {
- Iterator iterator = ruleDTOs.listIterator();
- while (iterator.hasNext()) {
- iterator.next();
- iterator.remove();
- }
- }
- }
-
- public List getExtendAttributeDTOs() {
- return extendAttributeDTOs;
- }
-
- public void setExtendAttributeDTOs(List extendAttributeDTOs) {
- this.extendAttributeDTOs = extendAttributeDTOs;
- }
-
- public List getObligationDTOs() {
- return obligationDTOs;
- }
-
- public void setObligationDTOs(List obligationDTOs) {
- this.obligationDTOs = obligationDTOs;
- }
-
- public void addExtendAttributeDTO(ExtendAttributeDTO extendAttributeDTO) {
- this.extendAttributeDTOs.add(extendAttributeDTO);
- }
-
- /////////////////////////// ////////
- public BasicTargetDTO getBasicTargetDTO() {
- return basicTargetDTO;
- }
-
- public void setBasicTargetDTO(
- BasicTargetDTO basicTargetDTO) {
- this.basicTargetDTO = basicTargetDTO;
- }
-
- public void removeBasicTargetElementDTO() {
- this.basicTargetDTO = null;
- }
-
- public boolean isEditPolicy() {
- return editPolicy;
- }
-
- public void setEditPolicy(boolean editPolicy) {
- this.editPolicy = editPolicy;
- }
-
- public String[] getPolicyCombiningAlgorithms() {
- return Arrays.copyOf(policyCombiningAlgorithms, policyCombiningAlgorithms.length);
- }
-
- public void setPolicyCombiningAlgorithms(String[] policyCombiningAlgorithms) {
- this.policyCombiningAlgorithms = Arrays.copyOf(policyCombiningAlgorithms, policyCombiningAlgorithms.length);
- }
-
- public PolicySetDTO getPolicySetDTO() {
- return policySetDTO;
- }
-
- public void setPolicySetDTO(PolicySetDTO policySetDTO) {
- this.policySetDTO = policySetDTO;
- }
-
- public String getRuleElementOrder() {
- return ruleElementOrder;
- }
-
- public void setRuleElementOrder(String ruleElementOrder) {
- this.ruleElementOrder = ruleElementOrder;
- }
-
-
- public TargetDTO getTargetDTO() {
- return targetDTO;
- }
-
- public void setTargetDTO(TargetDTO targetDTO) {
- this.targetDTO = targetDTO;
- }
-
- public Map getCategoryMap() {
- return categoryMap;
- }
-
- public void setCategoryMap(Map categoryMap) {
- this.categoryMap = categoryMap;
- }
-
- public Set getCategorySet() {
- return categoryMap.keySet();
- }
-
- public Map getRuleFunctionMap() {
- return ruleFunctionMap;
- }
-
- public void setRuleFunctionMap(Map ruleFunctionMap) {
- this.ruleFunctionMap = ruleFunctionMap;
- }
-
- public Map getTargetFunctionMap() {
- return targetFunctionMap;
- }
-
- public void setTargetFunctionMap(Map targetFunctionMap) {
- this.targetFunctionMap = targetFunctionMap;
- }
-
- public Map getAttributeIdMap() {
- return attributeIdMap;
- }
-
- public void setAttributeIdMap(Map attributeIdMap) {
- this.attributeIdMap = attributeIdMap;
- }
-
- public Set getPreFunctions() {
- return preFunctions;
- }
-
- public void addPreFunction(String preFunction) {
- this.preFunctions.add(preFunction);
- }
-
-
- public SimplePolicyEditorDTO getSimplePolicyEditorDTO() {
- return SimplePolicyEditorDTO;
- }
-
- public void setSimplePolicyEditorDTO(SimplePolicyEditorDTO simplePolicyEditorDTO) {
- this.SimplePolicyEditorDTO = simplePolicyEditorDTO;
- }
-
- public Map getEntitlementFinders() {
- return entitlementFinders;
- }
-
- public Set getEntitlementFinders(String category) {
- Set holders = new HashSet();
- for (Map.Entry entry : entitlementFinders.entrySet()) {
- EntitlementFinderDataHolder holder = entry.getValue();
- if (Arrays.asList(holder.getSupportedCategory()).contains(category)) {
- holders.add(holder);
- }
- }
- return holders;
- }
-
- public void setEntitlementFinders(String name, EntitlementFinderDataHolder entitlementFinders) {
- this.entitlementFinders.put(name, entitlementFinders);
- }
-
- public Map getSelectedEntitlementData() {
- return selectedEntitlementData;
- }
-
- public Map getEntitlementLevelData() {
- return entitlementLevelData;
- }
-
- public List getPolicyRefIds() {
- return policyRefIds;
- }
-
- public void setPolicyRefIds(List policyRefIds) {
- this.policyRefIds = policyRefIds;
- }
-
- public void addPolicyRefId(PolicyRefIdDTO policyRefId) {
- Iterator iterator = policyRefIds.listIterator();
- while (iterator.hasNext()) {
- PolicyRefIdDTO dto = (PolicyRefIdDTO) iterator.next();
- if (policyRefId != null && dto.getId().equalsIgnoreCase(policyRefId.getId())) {
- iterator.remove();
- }
- }
- this.policyRefIds.add(policyRefId);
- }
-
- public void removePolicyRefId(String policyRefId) {
- Iterator iterator = policyRefIds.listIterator();
- while (iterator.hasNext()) {
- PolicyRefIdDTO dto = (PolicyRefIdDTO) iterator.next();
- if (policyRefId != null && dto.getId().equalsIgnoreCase(policyRefId)) {
- iterator.remove();
- }
- }
- }
-
- public String getPolicyReferenceOrder() {
- return policyReferenceOrder;
- }
-
- public void setPolicyReferenceOrder(String policyReferenceOrder) {
- this.policyReferenceOrder = policyReferenceOrder;
- }
-
- public List getSubscribersList() {
- return subscribersList;
- }
-
- public void setSubscribersList(String[] subscribersList) {
- List list = new ArrayList(Arrays.asList(subscribersList));
- this.subscribersList.addAll(list);
- }
-}
\ No newline at end of file
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyConstants.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyConstants.java
deleted file mode 100644
index 78a48fb4f0db..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyConstants.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
-* Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui;
-
-/**
- * Constants related with XACML policy such as per-defined Element Names and NameSpaces
- */
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class EntitlementPolicyConstants {
-
- public static final int DEFAULT_ITEMS_PER_PAGE = 10;
- public static final String ENTITLEMENT_ADMIN_CLIENT = "EntitlementAdminClient";
- public static final String ENTITLEMENT_SUBSCRIBER_CLIENT = "EntitlementSubscriberClient";
-
- public static final String ENTITLEMENT_CURRENT_VERSION = "currentVersion";
-
- public static final String XACML3_POLICY_NAMESPACE = "urn:oasis:names:tc:xacml:3.0:core:schema:wd-17";
-
- public static final String ATTRIBUTE_NAMESPACE = "urn:oasis:names:tc:xacml:2.0:example:attribute:";
-
- public static final String POLICY_ELEMENT = "Policy";
-
- public static final String APPLY_ELEMENT = "Apply";
-
- public static final String MATCH_ELEMENT = "Match";
-
- public static final String SUBJECT_ELEMENT = "Subject";
-
- public static final String ACTION_ELEMENT = "Action";
-
- public static final String RESOURCE_ELEMENT = "Resource";
-
- public static final String ENVIRONMENT_ELEMENT = "Environment";
-
- public static final String POLICY_ID = "PolicyId";
-
- public static final String RULE_ALGORITHM = "RuleCombiningAlgId";
-
- public static final String POLICY_VERSION = "Version";
-
- public static final String DESCRIPTION_ELEMENT = "Description";
-
- public static final String TARGET_ELEMENT = "Target";
-
- public static final String RULE_ELEMENT = "Rule";
-
- public static final String CONDITION_ELEMENT = "Condition";
-
- public static final String FUNCTION_ELEMENT = "Function";
-
- public static final String ATTRIBUTE_SELECTOR = "AttributeSelector";
-
- public static final String ATTRIBUTE_VALUE = "AttributeValue";
-
- public static final String FUNCTION = "Function";
-
- public static final String VARIABLE_REFERENCE = "VariableReference";
-
- public static final String ATTRIBUTE_DESIGNATOR = "AttributeDesignator";
-
- public static final String ATTRIBUTE_ID = "AttributeId";
-
- public static final String CATEGORY = "Category";
-
- public static final String ATTRIBUTE = "Attribute";
-
- public static final String ATTRIBUTES = "Attributes";
-
- public static final String INCLUDE_RESULT = "IncludeInResult";
-
- public static final String DATA_TYPE = "DataType";
-
- public static final String ISSUER = "Issuer";
-
- public static final String MUST_BE_PRESENT = "MustBePresent";
-
- public static final String REQUEST_CONTEXT_PATH = "RequestContextPath";
-
- public static final String MATCH_ID = "MatchId";
-
- public static final String RULE_ID = "RuleId";
-
- public static final String RULE_EFFECT = "Effect";
-
- public static final String RULE_DESCRIPTION = "Description";
-
- public static final String FUNCTION_ID = "FunctionId";
-
- public static final String VARIABLE_ID = "VariableId";
-
- public static final String OBLIGATION_EXPRESSIONS = "ObligationExpressions";
-
- public static final String OBLIGATION_EXPRESSION = "ObligationExpression";
-
- public static final String OBLIGATION_ID = "ObligationId";
-
- public static final String OBLIGATION_EFFECT = "FulfillOn";
-
- public static final String ADVICE_EXPRESSIONS = "AdviceExpressions";
-
- public static final String ADVICE_EXPRESSION = "AdviceExpression";
-
- public static final String ADVICE_ID = "AdviceId";
-
- public static final String ADVICE_EFFECT = "AppliesTo";
-
- public static final String ATTRIBUTE_ASSIGNMENT = "AttributeAssignmentExpression";
-
- public static final String STRING_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#string";
-
- public static final String INT_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#integer";
-
- public static final String BOOLEAN_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#boolean";
-
- public static final String DATE_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#date";
-
- public static final String TIME_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#time";
-
- public static final String DATE_TIME_DATA_TYPE = "http://www.w3.org/2001/XMLSchema#dateTime";
-
- public static final String FUNCTION_BAG = "urn:oasis:names:tc:xacml:1.0:function:string-bag";
-
- public static final String SUBJECT_ID_DEFAULT = "urn:oasis:names:tc:xacml:1.0:subject:subject-id";
-
- public static final String SUBJECT_ID_ROLE = "http://wso2.org/claims/roles";
-
- public static final String RESOURCE_ID = "urn:oasis:names:tc:xacml:1.0:resource:resource-id";
-
- public static final String RESOURCE_ID_DEFAULT = "urn:oasis:names:tc:xacml:1.0:resource:resource";
-
-// public static final String FUNCTION_EQUAL = "urn:oasis:names:tc:xacml:1.0:function:string-equal";
-//
-// public static final String FUNCTION_ONE_AND_ONLY = "urn:oasis:names:tc:xacml:1.0:function:string-one-and-only";
-//
-// public static final String FUNCTION_IS_IN = "urn:oasis:names:tc:xacml:1.0:function:string-is-in";
-//
-// public static final String FUNCTION_REGEXP = "urn:oasis:names:tc:xacml:1.0:function:string-regexp-match";
-//
-// public static final String FUNCTION_AT_LEAST = "urn:oasis:names:tc:xacml:1.0:function:string-at-least-one-member-of";
-//
-// public static final String FUNCTION_UNION = "urn:oasis:names:tc:xacml:1.0:function:string-union";
-//
-// public static final String FUNCTION_SUBSET = "urn:oasis:names:tc:xacml:1.0:function:string-subset";
-//
-// public static final String FUNCTION_SET_EQUAL = "urn:oasis:names:tc:xacml:1.0:function:string-set-equals";
-//
-// public static final String FUNCTION_ANY_OF = "urn:oasis:names:tc:xacml:1.0:function:any-of";
-//
-// public static final String FUNCTION_AND = "urn:oasis:names:tc:xacml:1.0:function:and";
-//
-// public static final String EQUAL_TO = "equals to";
-//
-// public static final String MATCH_TO = "matching-with";
-//
-// public static final String IS_IN = "in";
-//
-// public static final String REGEXP_MATCH = "matching reg-ex to";
-//
-// public static final String AT_LEAST = "at-least-one-member-of";
-//
-// public static final String AT_LEAST_ONE_MATCH = "at-least-one-matching-member-of";
-//
-// public static final String AT_LEAST_ONE_MATCH_REGEXP = "at-least-one-matching-reg-ex-member-of";
-//
-// public static final String SUBSET_OF = "a-sub-set-of";
-//
-// public static final String SET_OF = "a-matching-set-of";
-//
-// public static final String MATCH_REGEXP_SET_OF = "a matching reg-ex set of";
-
- public static final String RULE_EFFECT_PERMIT = "Permit";
-
- public static final String RULE_EFFECT_NOT_APPLICABLE = "Not Applicable";
-
- public static final String RULE_EFFECT_DENY = "Deny";
-
- public static final String ACTION_ID = "urn:oasis:names:tc:xacml:1.0:action:action-id";
-
- public static final String ENVIRONMENT_ID = "urn:oasis:names:tc:xacml:1.0:environment:environment-id";
-
- public static final String SUBJECT_TYPE_ROLES = "Roles";
-
- public static final String SUBJECT_TYPE_USERS = "Users";
-
- public static final String DEFAULT_CARBON_DIALECT = "http://wso2.org/claims";
-
- public static final String IMPORT_POLICY_REGISTRY = "Registry";
-
- public static final String IMPORT_POLICY_FILE_SYSTEM = "FileSystem";
-
- public static final String REQ_RES_CONTEXT_XACML2 = "urn:oasis:names:tc:xacml:2.0:context:schema:os";
-
- public static final String REQ_RES_CONTEXT_XACML3 = "urn:oasis:names:tc:xacml:3.0:core:schema:wd-17";
-
- public static final String REQ_SCHEME = "http://www.w3.org/2001/XMLSchema-instance";
-
- public static final String RETURN_POLICY_LIST = "ReturnPolicyIdList";
-
- public static final String COMBINED_DECISION = "CombinedDecision";
-
- public static final String REQUEST_ELEMENT = "Request";
-
- public static final String POLICY_SET_ID = "PolicySetId";
-
- public static final String POLICY_ALGORITHM = "PolicyCombiningAlgId";
-
- public static final String POLICY_SET_ELEMENT = "PolicySet";
-
- public static final String POLICY_REFERENCE = "PolicyIdReference";
-
- public static final String POLICY_SET_REFERENCE = "PolicySetIdReference";
-
- public static final String ATTRIBUTE_SEPARATOR = ",";
-
- public static final String COMBO_BOX_DEFAULT_VALUE = "---Select---";
-
- public static final String COMBO_BOX_ANY_VALUE = "Any";
-
- public static final String SEARCH_ERROR = "Search_Error";
-
- public static final String DEFAULT_META_DATA_MODULE_NAME = "Carbon Attribute Finder Module";
-
- public static final int BASIC_POLICY_EDITOR_RULE_DATA_AMOUNT = 23;
-
- public static final int BASIC_POLICY_EDITOR_TARGET_DATA_AMOUNT = 20;
-
- public static final String ENTITLEMENT_PUBLISHER_PROPERTY = "entitlementPublisherPropertyDTO";
-
- public static final String ENTITLEMENT_PUBLISHER_MODULE = "entitlementPublisherModuleHolders";
-
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyCreationException.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyCreationException.java
deleted file mode 100644
index a37955b9bda6..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyCreationException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * WSO2 Inc. 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.identity.entitlement.ui;
-
-import org.wso2.carbon.identity.base.IdentityException;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class EntitlementPolicyCreationException extends IdentityException {
-
- private static final long serialVersionUID = -574465923080421499L;
-
- public EntitlementPolicyCreationException(String message) {
- super(message);
- }
-
- public EntitlementPolicyCreationException(String message, Throwable e) {
- super(message, e);
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyCreator.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyCreator.java
deleted file mode 100644
index d1b3a5723b2b..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/EntitlementPolicyCreator.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.balana.utils.exception.PolicyBuilderException;
-import org.wso2.balana.utils.policy.PolicyBuilder;
-import org.wso2.balana.utils.policy.dto.BasicPolicyDTO;
-import org.wso2.balana.utils.policy.dto.ObligationElementDTO;
-import org.wso2.balana.utils.policy.dto.PolicyElementDTO;
-import org.wso2.balana.utils.policy.dto.PolicySetElementDTO;
-import org.wso2.balana.utils.policy.dto.RequestElementDTO;
-import org.wso2.balana.utils.policy.dto.RuleElementDTO;
-import org.wso2.balana.utils.policy.dto.TargetElementDTO;
-import org.wso2.carbon.identity.entitlement.common.PolicyEditorException;
-import org.wso2.carbon.identity.entitlement.ui.client.EntitlementPolicyAdminServiceClient;
-import org.wso2.carbon.identity.entitlement.ui.dto.PolicyDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.PolicyRefIdDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.PolicySetDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.RequestDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.RuleDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.SimplePolicyEditorDTO;
-import org.wso2.carbon.identity.entitlement.ui.util.PolicyCreatorUtil;
-import org.wso2.carbon.identity.entitlement.ui.util.PolicyEditorUtil;
-
-import java.util.List;
-
-/**
- * create XACML policy and convert it to a String Object
- */
-public class EntitlementPolicyCreator {
-
- private static Log log = LogFactory.getLog(EntitlementPolicyCreator.class);
-
- /**
- * Create XACML policy using the data received from basic policy wizard
- *
- * @param basicPolicyDTO BasicPolicyDTO
- * @return String object of the XACML policy
- * @throws PolicyEditorException throws
- */
- public String createBasicPolicy(BasicPolicyDTO basicPolicyDTO) throws PolicyEditorException {
-
- if (basicPolicyDTO == null) {
- throw new PolicyEditorException("Policy object can not be null");
- }
-
- try {
- return PolicyBuilder.getInstance().build(basicPolicyDTO);
- } catch (PolicyBuilderException e) {
- log.error(e);
- throw new PolicyEditorException("Error while building policy");
- }
- }
-
-
- /**
- * Create XACML policy using the data received from basic policy wizard
- *
- * @param policyDTO PolicyDTO
- * @return String object of the XACML policy
- * @throws PolicyEditorException throws
- */
- public String createPolicy(PolicyDTO policyDTO) throws PolicyEditorException {
-
- if (policyDTO == null) {
- throw new PolicyEditorException("Policy object can not be null");
- }
-
- PolicyElementDTO policyElementDTO = new PolicyElementDTO();
- policyElementDTO.setPolicyName(policyDTO.getPolicyId());
- policyElementDTO.setRuleCombiningAlgorithms(policyDTO.getRuleAlgorithm());
- policyElementDTO.setPolicyDescription(policyDTO.getDescription());
- policyElementDTO.setVersion(policyDTO.getVersion());
-
- if (policyDTO.getTargetDTO() != null) {
- TargetElementDTO targetElementDTO = PolicyEditorUtil.
- createTargetElementDTO(policyDTO.getTargetDTO());
- policyElementDTO.setTargetElementDTO(targetElementDTO);
- }
-
- if (policyDTO.getRuleDTOs() != null) {
- for (RuleDTO ruleDTO : policyDTO.getRuleDTOs()) {
- RuleElementDTO ruleElementDTO = PolicyEditorUtil.createRuleElementDTO(ruleDTO);
- policyElementDTO.addRuleElementDTO(ruleElementDTO);
- }
- }
-
- if (policyDTO.getObligationDTOs() != null) {
- List obligationElementDTOs = PolicyEditorUtil.
- createObligation(policyDTO.getObligationDTOs());
- policyElementDTO.setObligationElementDTOs(obligationElementDTOs);
- }
-
- try {
- return PolicyBuilder.getInstance().build(policyElementDTO);
- } catch (PolicyBuilderException e) {
- throw new PolicyEditorException("Error while building XACML Policy");
- }
- }
-
-
- /**
- * Create XACML policy using the data received from basic policy wizard
- *
- * @param policyEditorDTO complete policy editor object
- * @return String object of the XACML policy
- * @throws PolicyEditorException throws
- */
- public String createSOAPolicy(SimplePolicyEditorDTO policyEditorDTO) throws PolicyEditorException {
-
- return PolicyEditorUtil.createSOAPolicy(policyEditorDTO);
- }
-
-
- /**
- * Create policy set using the added policy ot policy sets
- *
- * @param policySetDTO policy set element
- * @param client
- * @return String object of the XACML policy Set
- * @throws PolicyEditorException throws
- */
- public String createPolicySet(PolicySetDTO policySetDTO,
- EntitlementPolicyAdminServiceClient client) throws PolicyEditorException {
-
- if (policySetDTO == null) {
- throw new PolicyEditorException("Policy Set object can not be null");
- }
-
- PolicySetElementDTO policyElementDTO = new PolicySetElementDTO();
- policyElementDTO.setPolicySetId(policySetDTO.getPolicySetId());
- policyElementDTO.setPolicyCombiningAlgId(policySetDTO.getPolicyCombiningAlgId());
- policyElementDTO.setDescription(policySetDTO.getDescription());
- policyElementDTO.setVersion(policySetDTO.getVersion());
-
- if (policySetDTO.getTargetDTO() != null) {
- TargetElementDTO targetElementDTO = PolicyEditorUtil.
- createTargetElementDTO(policySetDTO.getTargetDTO());
- policyElementDTO.setTargetElementDTO(targetElementDTO);
- }
-
- if (policySetDTO.getPolicyIdReferences() != null) {
-
- for (PolicyRefIdDTO dto : policySetDTO.getPolicyRefIdDTOs()) {
- if (dto.isReferenceOnly()) {
- if (dto.isPolicySet()) {
- policyElementDTO.getPolicySetIdReferences().add(dto.getId());
- } else {
- policyElementDTO.getPolicyIdReferences().add(dto.getId());
- }
- } else {
- org.wso2.carbon.identity.entitlement.stub.dto.PolicyDTO policyDTO = null;
- try {
- policyDTO = client.getPolicy(dto.getId(), false);
- } catch (Exception e) {
- //ignore
- }
- if (policyDTO != null && policyDTO.getPolicy() != null) {
- if (dto.isPolicySet()) {
- policyElementDTO.getPolicySets().add(policyDTO.getPolicy());
- } else {
- policyElementDTO.getPolicies().add(policyDTO.getPolicy());
- }
- }
- }
- }
- }
-
- if (policySetDTO.getObligations() != null) {
- List obligationElementDTOs = PolicyEditorUtil.
- createObligation(policySetDTO.getObligations());
- policyElementDTO.setObligationElementDTOs(obligationElementDTOs);
- }
-
- try {
- return PolicyBuilder.getInstance().build(policyElementDTO);
- } catch (PolicyBuilderException e) {
- throw new PolicyEditorException("Error while building XACML Policy");
- }
- }
-
-
- /**
- * Create basic XACML request
- *
- * @param requestDTO request element
- * @return String object of the XACML request
- * @throws EntitlementPolicyCreationException throws
- */
- public String createBasicRequest(RequestDTO requestDTO)
- throws EntitlementPolicyCreationException, PolicyEditorException {
- try {
-
- RequestElementDTO requestElementDTO = PolicyCreatorUtil.createRequestElementDTO(requestDTO);
- return PolicyBuilder.getInstance().buildRequest(requestElementDTO);
- } catch (PolicyBuilderException e) {
- throw new PolicyEditorException("Error while building XACML Request");
- }
-
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/PolicyEditorConstants.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/PolicyEditorConstants.java
deleted file mode 100644
index c3426693ee35..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/PolicyEditorConstants.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui;
-
-/**
- * Policy editor related constants
- */
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class PolicyEditorConstants {
-
-
- public static final String ATTRIBUTE_SEPARATOR = ",";
-
- public static final String TARGET_ELEMENT = "Target";
-
- public static final String ANY_OF_ELEMENT = "AnyOf";
-
- public static final String ALL_OF_ELEMENT = "AllOf";
-
- public static final String COMBINE_FUNCTION_AND = "AND";
-
- public static final String COMBINE_FUNCTION_OR = "OR";
-
- public static final String COMBINE_FUNCTION_END = "END";
-
- public static final String MATCH_ELEMENT = "Match";
-
- public static final String MATCH_ID = "MatchId";
-
- public static final String ATTRIBUTE_ID = "AttributeId";
-
- public static final String CATEGORY = "Category";
-
- public static final String DATA_TYPE = "DataType";
-
- public static final String ISSUER = "Issuer";
-
- public static final String SOA_CATEGORY_USER = "Subject";
-
- public static final String SOA_CATEGORY_SUBJECT = "Subject";
-
- public static final String SOA_CATEGORY_RESOURCE = "Resource";
-
- public static final String SOA_CATEGORY_ACTION = "Action";
-
- public static final String SOA_CATEGORY_ENVIRONMENT = "Environment";
-
- public static final String MUST_BE_PRESENT = "MustBePresent";
-
- public static final String ATTRIBUTE_DESIGNATOR = "AttributeDesignator";
- public static final String RULE_EFFECT_PERMIT = "Permit";
- public static final String RULE_EFFECT_DENY = "Deny";
- public static final String RULE_ALGORITHM_IDENTIFIER_1 = "urn:oasis:names:tc:xacml:1.0:" +
- "rule-combining-algorithm:";
- public static final String RULE_ALGORITHM_IDENTIFIER_3 = "urn:oasis:names:tc:xacml:3.0:" +
- "rule-combining-algorithm:";
- public static final String POLICY_ALGORITHM_IDENTIFIER_1 = "urn:oasis:names:tc:xacml:1.0:" +
- "policy-combining-algorithm:";
- public static final String POLICY_ALGORITHM_IDENTIFIER_3 = "urn:oasis:names:tc:xacml:3.0:" +
- "policy-combining-algorithm:";
- public static final String POLICY_EDITOR_SEPARATOR = "|";
- public static final int POLICY_EDITOR_ROW_DATA = 7;
- public static final String DYNAMIC_SELECTOR_CATEGORY = "Category";
- public static final String DYNAMIC_SELECTOR_FUNCTION = "Function";
- public static final String SUBJECT_ID_DEFAULT = "urn:oasis:names:tc:xacml:1.0:subject:subject-id";
- public static final String SUBJECT_ID_ROLE = "http://wso2.org/claims/roles";
- public static final String RESOURCE_ID_DEFAULT = "urn:oasis:names:tc:xacml:1.0:resource:resource-id";
- public static final String ACTION_ID_DEFAULT = "urn:oasis:names:tc:xacml:1.0:action:action-id";
- public static final String ENVIRONMENT_ID_DEFAULT = "urn:oasis:names:tc:xacml:1.0:environment:environment-id";
- public static final String RESOURCE_CATEGORY_URI = "urn:oasis:names:tc:xacml:3.0:" +
- "attribute-category:resource";
- public static final String SUBJECT_CATEGORY_URI = "urn:oasis:names:tc:xacml:1.0:" +
- "subject-category:access-subject";
- public static final String ACTION_CATEGORY_URI = "urn:oasis:names:tc:xacml:3.0:" +
- "attribute-category:action";
- public static final String ENVIRONMENT_CATEGORY_URI = "urn:oasis:names:tc:xacml:3.0:" +
- "attribute-category:environment";
- public static final String ENVIRONMENT_CURRENT_DATE = "urn:oasis:names:tc:xacml:1.0:environment:current-date";
- public static final String ENVIRONMENT_CURRENT_TIME = "urn:oasis:names:tc:xacml:1.0:environment:current-time";
- public static final String ENVIRONMENT_CURRENT_DATETIME = "urn:oasis:names:tc:xacml:1.0:environment:current-dateTime";
- public static final String SOA_POLICY_EDITOR = "SOA";
-
- public static final class PreFunctions {
-
- public static final String PRE_FUNCTION_IS = "is";
-
- public static final String PRE_FUNCTION_IS_NOT = "is-not";
-
- public static final String PRE_FUNCTION_ARE = "are";
-
- public static final String PRE_FUNCTION_ARE_NOT = "are-not";
-
- public static final String CAN_DO = "can";
-
- public static final String CAN_NOT_DO = "can not";
- }
-
- public static final class TargetPreFunctions {
-
- public static final String PRE_FUNCTION_IS = "is";
-
- }
-
- public static final class TargetFunctions {
-
- public static final String FUNCTION_EQUAL = "equal";
-
- }
-
- public static final class DataType {
-
- public static final String DAY_TIME_DURATION = "http://www.w3.org/2001/XMLSchema#dayTimeDuration";
-
- public static final String YEAR_MONTH_DURATION = "http://www.w3.org/2001/XMLSchema#yearMonthDuration";
-
- public static final String STRING = "http://www.w3.org/2001/XMLSchema#string";
-
- public static final String TIME = "http://www.w3.org/2001/XMLSchema#time";
-
- public static final String IP_ADDRESS = "urn:oasis:names:tc:xacml:2.0:data-type:ipAddress";
-
- public static final String DATE_TIME = "http://www.w3.org/2001/XMLSchema#dateTime";
-
- public static final String DATE = "http://www.w3.org/2001/XMLSchema#date";
-
- public static final String DOUBLE = "http://www.w3.org/2001/XMLSchema#double";
-
- public static final String INT = "http://www.w3.org/2001/XMLSchema#integer";
-
- }
-
- public static final class CombiningAlog {
-
- public static final String DENY_OVERRIDE_ID = "deny-overrides";
-
- public static final String PERMIT_OVERRIDE_ID = "permit-overrides";
-
- public static final String FIRST_APPLICABLE_ID = "first-applicable";
-
- public static final String ORDER_PERMIT_OVERRIDE_ID = "ordered-permit-overrides";
-
- public static final String ORDER_DENY_OVERRIDE_ID = "ordered-deny-overrides";
-
- public static final String DENY_UNLESS_PERMIT_ID = "deny-unless-permit";
-
- public static final String PERMIT_UNLESS_DENY_ID = "permit-unless-deny";
-
- public static final String ONLY_ONE_APPLICABLE_ID = "only-one-applicable";
-
- }
-
- public static class FunctionIdentifier {
-
- public static final String ANY = "*";
-
- public static final String EQUAL_RANGE = "[";
-
- public static final String EQUAL_RANGE_CLOSE = "]";
-
- public static final String RANGE = "(";
-
- public static final String RANGE_CLOSE = ")";
-
- public static final String GREATER = ">";
-
- public static final String GREATER_EQUAL = ">=";
-
- public static final String LESS = "<";
-
- public static final String LESS_EQUAL = "<=";
-
- public static final String REGEX = "{";
-
- public static final String AND = "&";
-
- public static final String OR = "|";
-
- }
-
- public static final class AttributeId {
-
- public static final String ENV_DOMAIN = "Domain";
-
- public static final String ENV_DATE = "Date";
-
- public static final String ENV_DATE_TIME = "DateTime";
-
- public static final String ENV_IP = "IP";
-
- public static final String ENV_TIME = "Time";
-
- public static final String USER_AGE = "Age";
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/PropertyDTOComparator.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/PropertyDTOComparator.java
deleted file mode 100644
index 943654eecde7..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/PropertyDTOComparator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui;
-
-import org.wso2.carbon.identity.entitlement.stub.dto.PublisherPropertyDTO;
-
-import java.util.Comparator;
-
-/**
- * Comparator implementation to sort the ModulePropertyDTO
object array
- */
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class PropertyDTOComparator implements Comparator {
-
- @Override
- public int compare(Object o1, Object o2) {
-
- PublisherPropertyDTO dto1 = (PublisherPropertyDTO) o1;
- PublisherPropertyDTO dto2 = (PublisherPropertyDTO) o2;
- if (dto1.getDisplayOrder() < dto2.getDisplayOrder()) {
- return -1;
- } else if (dto1.getDisplayOrder() == dto2.getDisplayOrder()) {
- return 0;
- } else {
- return 1;
- }
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementAdminServiceClient.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementAdminServiceClient.java
deleted file mode 100644
index ebc9ea6a5830..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementAdminServiceClient.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.client;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.identity.entitlement.stub.EntitlementAdminServiceStub;
-import org.wso2.carbon.identity.entitlement.stub.dto.PDPDataHolder;
-import org.wso2.carbon.identity.entitlement.stub.dto.PIPFinderDataHolder;
-import org.wso2.carbon.identity.entitlement.stub.dto.PolicyFinderDataHolder;
-
-/**
- *
- */
-public class EntitlementAdminServiceClient {
-
- private static final Log log = LogFactory.getLog(EntitlementAdminServiceClient.class);
- private EntitlementAdminServiceStub stub;
-
- /**
- * Instantiates EntitlementServiceClient
- *
- * @param cookie For session management
- * @param backendServerURL URL of the back end server where EntitlementPolicyAdminService is
- * running.
- * @param configCtx ConfigurationContext
- * @throws org.apache.axis2.AxisFault
- */
- public EntitlementAdminServiceClient(String cookie, String backendServerURL,
- ConfigurationContext configCtx) throws AxisFault {
- String serviceURL = backendServerURL + "EntitlementAdminService";
- stub = new EntitlementAdminServiceStub(configCtx, serviceURL);
- ServiceClient client = stub._getServiceClient();
- Options option = client.getOptions();
- option.setManageSession(true);
- option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
- }
-
- /**
- * Clears the decision cache maintained by the PDP.
- *
- * @throws AxisFault
- */
- public void clearDecisionCache() throws AxisFault {
-
- try {
- stub.clearDecisionCache();
- } catch (Exception e) {
- String message = e.getMessage();
- handleException(message, e);
- }
- }
-
- /**
- * Clears the attribute cache maintained by the PDP.
- *
- * @throws AxisFault
- */
- public void clearAttributeCache() throws AxisFault {
-
- try {
- stub.clearAllAttributeCaches();
- } catch (Exception e) {
- String message = e.getMessage();
- handleException(message, e);
- }
- }
-
-
- /**
- * Evaluate XACML request with PDP
- *
- * @param request XACML request as String
- * @return XACML response as String
- * @throws AxisFault if fails
- */
- public String getDecision(String request) throws AxisFault {
- try {
- return stub.doTestRequest(request);
- } catch (Exception e) {
- handleException("Error occurred while test policy evaluation", e);
- }
- return null;
- }
-
- /**
- * Evaluate XACML request with PDP
- *
- * @param policies
- * @param request XACML request as String
- * @return XACML response as String
- * @throws AxisFault if fails
- */
- public String getDecision(String request, String[] policies) throws AxisFault {
- try {
- return stub.doTestRequestForGivenPolicies(request, policies);
- } catch (Exception e) {
- handleException("Error occurred while test policy evaluation", e);
- }
- return null;
- }
-
- public PDPDataHolder getPDPData() throws AxisFault {
-
- try {
- return stub.getPDPData();
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
-
- return null;
- }
-
-
- public PolicyFinderDataHolder getPolicyFinderData(String finderName) throws AxisFault {
-
- try {
- return stub.getPolicyFinderData(finderName);
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
-
- return null;
- }
-
- public PIPFinderDataHolder getPIPAttributeFinderData(String finderName) throws AxisFault {
-
- try {
- return stub.getPIPAttributeFinderData(finderName);
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
-
- return null;
- }
-
- public PIPFinderDataHolder getPIPResourceFinderData(String finderName) throws AxisFault {
-
- try {
- return stub.getPIPResourceFinderData(finderName);
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
-
- return null;
- }
-
- public void refreshAttributeFinder(String finderName) throws AxisFault {
-
- try {
- stub.refreshAttributeFinder(finderName);
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
- }
-
- public void refreshResourceFinder(String finderName) throws AxisFault {
-
- try {
- stub.refreshResourceFinder(finderName);
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
- }
-
- public void refreshPolicyFinder(String finderName) throws AxisFault {
-
- try {
- stub.refreshPolicyFinders(finderName);
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
- }
-
- /**
- * Get globally defined policy combining algorithm
- *
- * @return policy combining algorithm as a String
- * @throws AxisFault
- */
- public String getGlobalPolicyAlgorithm() throws AxisFault {
- try {
- return stub.getGlobalPolicyAlgorithm();
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
-
- return null;
- }
-
- /**
- * Set policy combining algorithm globally
- *
- * @param policyAlgorithm policy combining algorithm as a String
- * @throws AxisFault
- */
- public void setGlobalPolicyAlgorithm(String policyAlgorithm) throws AxisFault {
- try {
- stub.setGlobalPolicyAlgorithm(policyAlgorithm);
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
- }
-
- /**
- * Logs and wraps the given exception.
- *
- * @param msg Error message
- * @param e Exception
- * @throws AxisFault
- */
- private void handleException(String msg, Exception e) throws AxisFault {
- log.error(msg, e);
- throw new AxisFault(msg, e);
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementPolicyAdminServiceClient.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementPolicyAdminServiceClient.java
deleted file mode 100644
index 6d18ce3c2dcf..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementPolicyAdminServiceClient.java
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
-* Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.client;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.fileupload.FileItemFactory;
-import org.apache.commons.fileupload.FileUploadException;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.apache.commons.fileupload.servlet.ServletRequestContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.identity.entitlement.stub.EntitlementPolicyAdminServiceEntitlementException;
-import org.wso2.carbon.identity.entitlement.stub.EntitlementPolicyAdminServiceStub;
-import org.wso2.carbon.identity.entitlement.stub.dto.EntitlementFinderDataHolder;
-import org.wso2.carbon.identity.entitlement.stub.dto.EntitlementTreeNodeDTO;
-import org.wso2.carbon.identity.entitlement.stub.dto.PaginatedPolicySetDTO;
-import org.wso2.carbon.identity.entitlement.stub.dto.PaginatedStatusHolder;
-import org.wso2.carbon.identity.entitlement.stub.dto.PolicyDTO;
-import org.wso2.carbon.identity.entitlement.stub.dto.PublisherDataHolder;
-
-import java.util.List;
-
-
-public class EntitlementPolicyAdminServiceClient {
-
- private static final Log log = LogFactory.getLog(EntitlementPolicyAdminServiceClient.class);
- private EntitlementPolicyAdminServiceStub stub;
-
- /**
- * Instantiates EntitlementServiceClient
- *
- * @param cookie For session management
- * @param backendServerURL URL of the back end server where EntitlementPolicyAdminService is
- * running.
- * @param configCtx ConfigurationContext
- * @throws org.apache.axis2.AxisFault
- */
- public EntitlementPolicyAdminServiceClient(String cookie, String backendServerURL,
- ConfigurationContext configCtx) throws AxisFault {
- String serviceURL = backendServerURL + "EntitlementPolicyAdminService";
- stub = new EntitlementPolicyAdminServiceStub(configCtx, serviceURL);
- ServiceClient client = stub._getServiceClient();
- Options option = client.getOptions();
- option.setManageSession(true);
- option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
- }
-
- /**
- * @param policyTypeFilter
- * @param policySearchString
- * @param pageNumber
- * @param isPDPPolicy
- * @return PaginatedPolicySetDTO object containing the number of pages and the set of policies that reside in the
- * given page.
- * @throws AxisFault
- */
- public PaginatedPolicySetDTO getAllPolicies(String policyTypeFilter, String policySearchString,
- int pageNumber, boolean isPDPPolicy) throws AxisFault {
- try {
- return stub.getAllPolicies(policyTypeFilter, policySearchString, pageNumber, isPDPPolicy);
- } catch (Exception e) {
- String message = "Error while loading all policies from backend service";
- handleException(e);
- }
- PaginatedPolicySetDTO paginatedPolicySetDTO = new PaginatedPolicySetDTO();
- paginatedPolicySetDTO.setPolicySet(new PolicyDTO[0]);
- return paginatedPolicySetDTO;
- }
-
- /**
- * Gets policy DTO for given policy id
- *
- * @param policyId policy id
- * @param isPDPPolicy
- * @return returns policy DTO
- * @throws AxisFault throws
- */
- public PolicyDTO getPolicy(String policyId, boolean isPDPPolicy) throws AxisFault {
- PolicyDTO dto = null;
- try {
- dto = stub.getPolicy(policyId, isPDPPolicy);
- if (dto != null && dto.getPolicy() != null) {
- dto.setPolicy(dto.getPolicy().trim().replaceAll("><", ">\n<"));
- }
- } catch (Exception e) {
- handleException(e);
- }
- return dto;
- }
-
- /**
- * Gets policy DTO for given policy id with given version
- *
- * @param policyId policy id
- * @param version
- * @return returns policy DTO
- * @throws AxisFault throws
- */
- public PolicyDTO getPolicyByVersion(String policyId, String version) throws AxisFault {
- PolicyDTO dto = null;
- try {
- dto = stub.getPolicyByVersion(policyId, version);
- if (dto != null && dto.getPolicy() != null) {
- dto.setPolicy(dto.getPolicy().trim().replaceAll("><", ">\n<"));
- }
- } catch (Exception e) {
- handleException(e);
- }
- return dto;
- }
-
- /**
- * Gets light weight policy DTO for given policy id
- *
- * @param policyId policy id
- * @return returns policy DTO
- * @throws AxisFault throws
- */
- public PolicyDTO getLightPolicy(String policyId) throws AxisFault {
- PolicyDTO dto = null;
- try {
- dto = stub.getLightPolicy(policyId);
- } catch (Exception e) {
- handleException(e);
- }
- return dto;
- }
-
- /**
- * Rollbacks policy DTO for given policy version
- *
- * @param policyId policy id
- * @param version policy version
- * @throws AxisFault throws
- */
- public void rollBackPolicy(String policyId, String version) throws AxisFault {
-
- try {
- stub.rollBackPolicy(policyId, version);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
-
- /**
- * @param policyIds
- * @throws AxisFault
- */
- public void removePolicies(String[] policyIds, boolean dePromote) throws AxisFault {
- try {
- stub.removePolicies(policyIds, dePromote);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public void dePromotePolicy(String policyId) throws AxisFault {
- try {
- stub.dePromotePolicy(policyId);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public void enableDisablePolicy(String policyId, boolean enable) throws AxisFault {
- try {
- stub.enableDisablePolicy(policyId, enable);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public void orderPolicy(String policyId, int order) throws AxisFault {
- try {
- stub.orderPolicy(policyId, order);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- /**
- * @param policy
- * @throws AxisFault
- */
- public void updatePolicy(PolicyDTO policy) throws AxisFault {
- try {
- if (policy.getPolicy() != null && policy.getPolicy().trim().length() > 0) {
- policy.setPolicy(policy.getPolicy().trim().replaceAll(">\\s+<", "><"));
- }
- stub.updatePolicy(policy);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- /**
- * @param policy
- * @throws AxisFault
- */
- public void addPolicy(PolicyDTO policy) throws AxisFault {
- try {
- policy.setPolicy(policy.getPolicy().trim().replaceAll(">\\s+<", "><"));
- stub.addPolicy(policy);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- /**
- * adding an entitlement policy which is extracted using file upload executor
- *
- * @param content content of the policy as a String
Object
- * @throws AxisFault, throws if fails
- */
- public void uploadPolicy(String content) throws AxisFault {
-
- PolicyDTO dto = new PolicyDTO();
- dto.setPolicy(content);
- dto.setPolicy(dto.getPolicy().trim().replaceAll(">\\s+<", "><"));
- try {
- stub.addPolicy(dto);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- /**
- * Import XACML policy from registry
- *
- * @deprecated since the functionality cannot be support by the rdbms based implementation
- * @param policyRegistryPath registry path
- * @throws AxisFault
- */
- @Deprecated
- public void importPolicyFromRegistry(String policyRegistryPath) throws AxisFault {
-
- try {
- stub.importPolicyFromRegistry(policyRegistryPath);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- /**
- * Returns the list of policy set ids available in PDP
- *
- * @return list of policy set ids
- * @throws AxisFault
- */
- public String[] getAllPolicyIds() throws AxisFault {
-
- try {
- return stub.getAllPolicyIds("*");
- } catch (Exception e) {
- handleException(e);
- }
- return null;
- }
-
-
- /**
- * @param requestContext
- * @return
- * @throws FileUploadException
- */
- private List parseRequest(ServletRequestContext requestContext) throws FileUploadException {
- FileItemFactory factory = new DiskFileItemFactory();
- ServletFileUpload upload = new ServletFileUpload(factory);
- return upload.parseRequest(requestContext);
- }
-
- /**
- * Gets attribute value tree for given attribute type
- *
- * @param dataModule
- * @param category
- * @param regexp
- * @param dataLevel
- * @param limit
- * @return attribute value tree
- * @throws AxisFault throws
- */
- public EntitlementTreeNodeDTO getEntitlementData(String dataModule, String category,
- String regexp, int dataLevel, int limit) throws AxisFault {
- try {
- return stub.getEntitlementData(dataModule, category, regexp, dataLevel, limit);
- } catch (Exception e) {
- handleException(e);
- }
-
- return null;
- }
-
- /**
- * @return
- * @throws AxisFault
- */
- public EntitlementFinderDataHolder[] getEntitlementDataModules() throws AxisFault {
-
- try {
- return stub.getEntitlementDataModules();
- } catch (Exception e) {
- handleException(e);
- }
-
- return null;
- }
-
- /**
- * Gets all subscriber ids
- *
- * @param subscriberSearchString subscriberSearchString
- * @return subscriber ids as String array
- * @throws AxisFault throws
- */
- public String[] getSubscriberIds(String subscriberSearchString) throws AxisFault {
-
- try {
- return stub.getSubscriberIds(subscriberSearchString);
- } catch (Exception e) {
- handleException(e);
- }
-
- return null;
- }
-
- /**
- * Gets subscriber data
- *
- * @param id subscriber id
- * @return subscriber data as SubscriberDTO object
- * @throws AxisFault throws
- */
- public PublisherDataHolder getSubscriber(String id) throws AxisFault {
-
- try {
- return stub.getSubscriber(id);
- } catch (Exception e) {
- handleException(e);
- }
-
- return null;
- }
-
- /**
- * Updates or creates subscriber data
- *
- * @param holder subscriber data as ModuleDataHolder object
- * @param update
- * @throws AxisFault throws
- */
- public void updateSubscriber(PublisherDataHolder holder, boolean update) throws AxisFault {
-
- try {
- if (update) {
- stub.updateSubscriber(holder);
- } else {
- stub.addSubscriber(holder);
- }
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- /**
- * Removes publisher data
- *
- * @param id subscriber id
- * @throws AxisFault throws
- */
- public void deleteSubscriber(String id) throws AxisFault {
-
- try {
- stub.deleteSubscriber(id);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- /**
- * Publishes given set of policies to given set of subscribers
- *
- * @param policies policy ids as String array, if null or empty, all policies are published
- * @param subscriberId subscriber ids as String array, if null or empty, publish to all subscribers
- * @param version
- * @param action
- * @param enabled
- * @param order
- * @throws AxisFault throws
- */
- public void publish(String[] policies, String[] subscriberId, String action, String version,
- boolean enabled, int order) throws AxisFault {
- try {
- stub.publishPolicies(policies, subscriberId, action, version, enabled, order);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
-
- /**
- * Get all publisher modules properties that is needed to configure
- *
- * @return publisher modules properties as ModuleDataHolder
- * @throws AxisFault throws
- */
- public PublisherDataHolder[] getPublisherModuleData() throws AxisFault {
-
- try {
- return stub.getPublisherModuleData();
- } catch (Exception e) {
- handleException(e);
- }
-
- return new PublisherDataHolder[0];
- }
-
- public String[] getPolicyVersions(String policyId) throws AxisFault {
- try {
- return stub.getPolicyVersions(policyId);
- } catch (Exception e) {
- handleException(e);
- }
-
- return new String[0];
- }
-
- public PaginatedStatusHolder getStatusData(String about, String key, String type,
- String searchString, int pageNumber) throws AxisFault {
- try {
- return stub.getStatusData(about, key, type, searchString, pageNumber);
- } catch (Exception e) {
- handleException(e);
- }
- return null;
- }
-
- /**
- * Logs and wraps the given exception.
- *
- * @param e Exception
- * @throws AxisFault
- */
- private void handleException(Exception e) throws AxisFault {
-
- String errorMessage = "Unknown";
-
- if (e instanceof EntitlementPolicyAdminServiceEntitlementException) {
- EntitlementPolicyAdminServiceEntitlementException entitlementException =
- (EntitlementPolicyAdminServiceEntitlementException) e;
- if (entitlementException.getFaultMessage().getEntitlementException() != null) {
- errorMessage = entitlementException.getFaultMessage().getEntitlementException().getMessage();
- }
- } else {
- errorMessage = e.getMessage();
- }
-
- throw new AxisFault(errorMessage, e);
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementPolicyUploadExecutor.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementPolicyUploadExecutor.java
deleted file mode 100644
index 3885571a45eb..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementPolicyUploadExecutor.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-* Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.client;
-
-import org.apache.commons.lang.StringUtils;
-import org.wso2.carbon.CarbonConstants;
-import org.wso2.carbon.CarbonException;
-import org.wso2.carbon.ui.CarbonUIMessage;
-import org.wso2.carbon.ui.transports.fileupload.AbstractFileUploadExecutor;
-import org.wso2.carbon.utils.FileItemData;
-import org.wso2.carbon.utils.ServerConstants;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This class is responsible for uploading entitlement policy files.
- * And this uses the AbstractFileUploadExecutor
- * which has written to handle the carbon specific file uploading
- */
-public class EntitlementPolicyUploadExecutor extends AbstractFileUploadExecutor {
-
- private static final String[] ALLOWED_FILE_EXTENSIONS = new String[]{".xml"};
-
- private String errorRedirectionPage;
-
- @Override
- public boolean execute(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
- throws CarbonException, IOException {
-
- String webContext = (String) httpServletRequest.getAttribute(CarbonConstants.WEB_CONTEXT);
- String serverURL = (String) httpServletRequest.getAttribute(CarbonConstants.SERVER_URL);
- String cookie = (String) httpServletRequest.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
- errorRedirectionPage = getContextRoot(httpServletRequest) + "/" + webContext
- + "/entitlement/index.jsp";
-
- Map> fileItemsMap = getFileItemsMap();
- if (fileItemsMap == null || fileItemsMap.isEmpty()) {
- String msg = "File uploading failed. No files are specified";
- log.error(msg);
- CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, httpServletRequest,
- httpServletResponse, errorRedirectionPage);
- return false;
- }
-
- EntitlementPolicyAdminServiceClient client =
- new EntitlementPolicyAdminServiceClient(cookie, serverURL, configurationContext);
- List fileItems = fileItemsMap.get("policyFromFileSystem");
- String msg;
- try {
- for (FileItemData fileItem : fileItems) {
- String filename = getFileName(fileItem.getFileItem().getName());
- checkServiceFileExtensionValidity(filename, ALLOWED_FILE_EXTENSIONS);
-
- if (!filename.endsWith(".xml")) {
- throw new CarbonException("File with extension " +
- getFileName(fileItem.getFileItem().getName()) + " is not supported!");
- } else {
- try (BufferedReader br = new BufferedReader(new InputStreamReader(
- fileItem.getDataHandler().getInputStream()))) {
-
- String temp;
- String policyContent = "";
- while ((temp = br.readLine()) != null) {
- policyContent += temp;
- }
- if (StringUtils.isNotEmpty(policyContent)) {
- client.uploadPolicy(policyContent);
- }
- } catch (IOException ex) {
- throw new CarbonException("Policy file " + filename + "cannot be read");
- }
- }
- }
- httpServletResponse.setContentType("text/html; charset=utf-8");
- msg = "Policy have been uploaded successfully.";
- CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.INFO, httpServletRequest,
- httpServletResponse, getContextRoot(httpServletRequest)
- + "/" + webContext + "/entitlement/index.jsp");
- return true;
- } catch (Exception e) {
- msg = "Policy uploading failed. " + e.getMessage();
- log.error(msg);
- CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, httpServletRequest,
- httpServletResponse, errorRedirectionPage);
- }
- return false;
- }
-
- @Override
- protected String getErrorRedirectionPage() {
- return errorRedirectionPage;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementServiceClient.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementServiceClient.java
deleted file mode 100644
index d3569795a632..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/client/EntitlementServiceClient.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-* Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.client;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.identity.entitlement.stub.EntitlementServiceStub;
-import org.wso2.carbon.identity.entitlement.stub.dto.EntitledResultSetDTO;
-
-public class EntitlementServiceClient {
-
- private static final Log log = LogFactory.getLog(EntitlementServiceClient.class);
- private EntitlementServiceStub stub;
-
- /**
- * Instantiates EntitlementServiceClient
- *
- * @param cookie For session management
- * @param backendServerURL URL of the back end server where EntitlementService is running.
- * @param configCtx ConfigurationContext
- * @throws org.apache.axis2.AxisFault
- */
- public EntitlementServiceClient(String cookie, String backendServerURL,
- ConfigurationContext configCtx) throws AxisFault {
- String serviceURL = backendServerURL + "EntitlementService";
- stub = new EntitlementServiceStub(configCtx, serviceURL);
- ServiceClient client = stub._getServiceClient();
- Options option = client.getOptions();
- option.setManageSession(true);
- option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
- }
-
- /**
- * Evaluate XACML request with PDP
- *
- * @param request XACML request as String
- * @return XACML response as String
- * @throws AxisFault if fails
- */
- public String getDecision(String request) throws AxisFault {
- try {
- return stub.getDecision(request);
- } catch (Exception e) {
- handleException("Error occurred while policy evaluation", e);
- }
- return null;
- }
-
- /**
- * Gets user or role entitled resources
- *
- * @param subjectName user or role name
- * @param resourceName resource name
- * @param subjectId attribute id of the subject, user or role
- * @param action action name
- * @param enableChildSearch whether search is done for the child resources under the given resource name
- * @return entitled resources as String array
- * @throws org.apache.axis2.AxisFault throws
- */
- public EntitledResultSetDTO getEntitledAttributes(String subjectName, String resourceName,
- String subjectId, String action, boolean enableChildSearch)
- throws AxisFault {
- try {
- return stub.getEntitledAttributes(subjectName, resourceName, subjectId, action,
- enableChildSearch);
- } catch (Exception e) {
- handleException(e.getMessage(), e);
- }
-
- return null;
- }
-
- /**
- * Logs and wraps the given exception.
- *
- * @param msg Error message
- * @param e Exception
- * @throws AxisFault
- */
- private void handleException(String msg, Exception e) throws AxisFault {
- log.error(msg, e);
- throw new AxisFault(msg, e);
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/BasicRequestDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/BasicRequestDTO.java
deleted file mode 100644
index dd5e585e3ab0..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/BasicRequestDTO.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-import java.util.List;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class BasicRequestDTO {
-
-
- private List rowDTOs;
-
- private String resources;
-
- private String subjects;
-
- private String actions;
-
- private String enviornement;
-
- private String userAttributeValue;
-
- private String userAttributeId;
-
- public String getResources() {
- return resources;
- }
-
- public void setResources(String resources) {
- this.resources = resources;
- }
-
- public String getSubjects() {
- return subjects;
- }
-
- public void setSubjects(String subjects) {
- this.subjects = subjects;
- }
-
- public String getActions() {
- return actions;
- }
-
- public void setActions(String actions) {
- this.actions = actions;
- }
-
- public String getUserAttributeValue() {
- return userAttributeValue;
- }
-
- public void setUserAttributeValue(String userAttributeValue) {
- this.userAttributeValue = userAttributeValue;
- }
-
- public String getUserAttributeId() {
- return userAttributeId;
- }
-
- public void setUserAttributeId(String userAttributeId) {
- this.userAttributeId = userAttributeId;
- }
-
- public String getEnviornement() {
- return enviornement;
- }
-
- public void setEnviornement(String enviornement) {
- this.enviornement = enviornement;
- }
-
- public List getRowDTOs() {
- return rowDTOs;
- }
-
- public void setRowDTOs(List rowDTOs) {
- this.rowDTOs = rowDTOs;
- }
-
- public void addRowDTOs(RowDTO rowDTO) {
- this.rowDTOs.add(rowDTO);
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/ElementCountDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/ElementCountDTO.java
deleted file mode 100644
index 6de1eea4cb84..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/ElementCountDTO.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class ElementCountDTO {
-
- private int subElementCount;
-
- private int attributeDesignatorsElementCount;
-
- private int attributeValueElementCount;
-
- private int attributeSelectorElementCount;
-
- public int getSubElementCount() {
- return subElementCount;
- }
-
- public void setSubElementCount(int subElementCount) {
- this.subElementCount = subElementCount;
- }
-
- public int getAttributeSelectorElementCount() {
- return attributeSelectorElementCount;
- }
-
- public void setAttributeSelectorElementCount(int attributeSelectorElementCount) {
- this.attributeSelectorElementCount = attributeSelectorElementCount;
- }
-
- public int getAttributeValueElementCount() {
- return attributeValueElementCount;
- }
-
- public void setAttributeValueElementCount(int attributeValueElementCount) {
- this.attributeValueElementCount = attributeValueElementCount;
- }
-
- public int getAttributeDesignatorsElementCount() {
- return attributeDesignatorsElementCount;
- }
-
- public void setAttributeDesignatorsElementCount(int attributeDesignatorsElementCount) {
- this.attributeDesignatorsElementCount = attributeDesignatorsElementCount;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/ExtendAttributeDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/ExtendAttributeDTO.java
deleted file mode 100644
index a584f39e9944..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/ExtendAttributeDTO.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-/**
- * extended attribute value element
- */
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class ExtendAttributeDTO {
-
- private String id;
-
- private String selector;
-
- private String function;
-
- private String category;
-
- private String attributeValue;
-
- private String attributeId;
-
- private String dataType;
-
- private String issuer;
-
- private boolean notCompleted;
-
- public ExtendAttributeDTO() {
- }
-
- public ExtendAttributeDTO(ExtendAttributeDTO dto) {
- this.id = dto.getId();
- this.selector = dto.getSelector();
- this.function = dto.getFunction();
- this.category = dto.getCategory();
- this.attributeValue = dto.getAttributeValue();
- this.attributeId = dto.getAttributeId();
- this.dataType = dto.getDataType();
- this.issuer = dto.getIssuer();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getSelector() {
- return selector;
- }
-
- public void setSelector(String selector) {
- this.selector = selector;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getAttributeValue() {
- return attributeValue;
- }
-
- public void setAttributeValue(String attributeValue) {
- this.attributeValue = attributeValue;
- }
-
- public String getAttributeId() {
- return attributeId;
- }
-
- public void setAttributeId(String attributeId) {
- this.attributeId = attributeId;
- }
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public String getFunction() {
- return function;
- }
-
- public void setFunction(String function) {
- this.function = function;
- }
-
- public String getIssuer() {
- return issuer;
- }
-
- public void setIssuer(String issuer) {
- this.issuer = issuer;
- }
-
- public boolean isNotCompleted() {
- return notCompleted;
- }
-
- public void setNotCompleted(boolean notCompleted) {
- this.notCompleted = notCompleted;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/ObligationDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/ObligationDTO.java
deleted file mode 100644
index fe7eabbf251b..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/ObligationDTO.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-/**
- * encapsulates obligation and advice expression data that requires for policy editor
- */
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class ObligationDTO {
-
- private String type;
-
- private String obligationId;
-
- private String effect;
-
- private String attributeValue;
-
- private String attributeValueDataType;
-
- private String resultAttributeId;
-
- private boolean notCompleted;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getResultAttributeId() {
- return resultAttributeId;
- }
-
- public void setResultAttributeId(String resultAttributeId) {
- this.resultAttributeId = resultAttributeId;
- }
-
- public String getAttributeValue() {
- return attributeValue;
- }
-
- public void setAttributeValue(String attributeValue) {
- this.attributeValue = attributeValue;
- }
-
- public String getAttributeValueDataType() {
- return attributeValueDataType;
- }
-
- public void setAttributeValueDataType(String attributeValueDataType) {
- this.attributeValueDataType = attributeValueDataType;
- }
-
- public String getEffect() {
- return effect;
- }
-
- public void setEffect(String effect) {
- this.effect = effect;
- }
-
- public String getObligationId() {
- return obligationId;
- }
-
- public void setObligationId(String obligationId) {
- this.obligationId = obligationId;
- }
-
- public boolean isNotCompleted() {
- return notCompleted;
- }
-
- public void setNotCompleted(boolean notCompleted) {
- this.notCompleted = notCompleted;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/PolicyDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/PolicyDTO.java
deleted file mode 100644
index 7ab54877cd74..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/PolicyDTO.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class PolicyDTO {
-
- private String policyId;
-
- private String ruleAlgorithm;
-
- private String description;
-
- private String ruleOrder;
-
- private String version;
-
- private TargetDTO targetDTO;
-
- private List ruleDTOs = new ArrayList();
-
- private List obligationDTOs = new ArrayList();
-
- public String getRuleAlgorithm() {
- return ruleAlgorithm;
- }
-
- public void setRuleAlgorithm(String ruleAlgorithm) {
- this.ruleAlgorithm = ruleAlgorithm;
- }
-
- public String getPolicyId() {
- return policyId;
- }
-
- public void setPolicyId(String policyId) {
- this.policyId = policyId;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getRuleOrder() {
- return ruleOrder;
- }
-
- public void setRuleOrder(String ruleOrder) {
- this.ruleOrder = ruleOrder;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public TargetDTO getTargetDTO() {
- return targetDTO;
- }
-
- public void setTargetDTO(TargetDTO targetDTO) {
- this.targetDTO = targetDTO;
- }
-
- public List getRuleDTOs() {
- return ruleDTOs;
- }
-
- public void setRuleDTOs(List ruleDTOs) {
- this.ruleDTOs = ruleDTOs;
- }
-
- public List getObligationDTOs() {
- return obligationDTOs;
- }
-
- public void setObligationDTOs(List obligationDTOs) {
- this.obligationDTOs = obligationDTOs;
- }
-}
\ No newline at end of file
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/PolicyRefIdDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/PolicyRefIdDTO.java
deleted file mode 100644
index 4b835399e18a..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/PolicyRefIdDTO.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class PolicyRefIdDTO {
-
- private String id;
-
- private boolean referenceOnly;
-
- private boolean policySet;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public boolean isPolicySet() {
- return policySet;
- }
-
- public void setPolicySet(boolean policySet) {
- this.policySet = policySet;
- }
-
- public boolean isReferenceOnly() {
- return referenceOnly;
- }
-
- public void setReferenceOnly(boolean referenceOnly) {
- this.referenceOnly = referenceOnly;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/PolicySetDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/PolicySetDTO.java
deleted file mode 100644
index cfa9cdb11957..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/PolicySetDTO.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-* Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class PolicySetDTO {
-
- private String policySetId;
-
- private String policyCombiningAlgId;
-
- private String version;
-
- private TargetDTO targetDTO;
-
- private String description;
-
- private List policySets = new ArrayList();
-
- private List policies = new ArrayList();
-
- private List policySetIdReferences = new ArrayList();
-
- private List PolicyIdReferences = new ArrayList();
-
- private List obligations = new ArrayList();
-
- private List policyRefIdDTOs = new ArrayList();
-
- private String policyOrder;
-
- public String getPolicySetId() {
- return policySetId;
- }
-
- public void setPolicySetId(String policySetId) {
- this.policySetId = policySetId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getPolicyCombiningAlgId() {
- return policyCombiningAlgId;
- }
-
- public void setPolicyCombiningAlgId(String policyCombiningAlgId) {
- this.policyCombiningAlgId = policyCombiningAlgId;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public List getPolicySets() {
- return policySets;
- }
-
- public void setPolicySets(List policySets) {
- this.policySets = policySets;
- }
-
- public List getPolicies() {
- return policies;
- }
-
- public void setPolicy(String policy) {
- this.policies.add(policy);
- }
-
- public List getPolicySetIdReferences() {
- return policySetIdReferences;
- }
-
- public void setPolicySetIdReferences(List policySetIdReferences) {
- this.policySetIdReferences = policySetIdReferences;
- }
-
- public List getPolicyIdReferences() {
- return PolicyIdReferences;
- }
-
- public void setPolicyIdReferences(List policyIdReferences) {
- PolicyIdReferences = policyIdReferences;
- }
-
- public List getObligations() {
- return obligations;
- }
-
- public void setObligations(List obligations) {
- this.obligations = obligations;
- }
-
- public TargetDTO getTargetDTO() {
- return targetDTO;
- }
-
- public void setTargetDTO(TargetDTO targetDTO) {
- this.targetDTO = targetDTO;
- }
-
- public String getPolicyOrder() {
- return policyOrder;
- }
-
- public void setPolicyOrder(String policyOrder) {
- this.policyOrder = policyOrder;
- }
-
- public List getPolicyRefIdDTOs() {
- return policyRefIdDTOs;
- }
-
- public void setPolicyRefIdDTOs(List policyRefIdDTOs) {
- this.policyRefIdDTOs = policyRefIdDTOs;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/RequestDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/RequestDTO.java
deleted file mode 100644
index dc6753f1b4dc..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/RequestDTO.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-import java.util.List;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class RequestDTO {
-
- private boolean multipleRequest;
-
- private boolean returnPolicyIdList;
-
- private boolean combinedDecision;
-
- private List rowDTOs;
-
- public boolean isCombinedDecision() {
- return combinedDecision;
- }
-
- public void setCombinedDecision(boolean combinedDecision) {
- this.combinedDecision = combinedDecision;
- }
-
- public List getRowDTOs() {
- return rowDTOs;
- }
-
- public void setRowDTOs(List rowDTOs) {
- this.rowDTOs = rowDTOs;
- }
-
- public boolean isReturnPolicyIdList() {
- return returnPolicyIdList;
- }
-
- public void setReturnPolicyIdList(boolean returnPolicyIdList) {
- this.returnPolicyIdList = returnPolicyIdList;
- }
-
- public boolean isMultipleRequest() {
- return multipleRequest;
- }
-
- public void setMultipleRequest(boolean multipleRequest) {
- this.multipleRequest = multipleRequest;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/RowDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/RowDTO.java
deleted file mode 100644
index ccf5bb3770b9..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/RowDTO.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class RowDTO {
-
- private String category;
-
- private String preFunction;
-
- private String function;
-
- private String attributeValue;
-
- private String attributeId;
-
- private String attributeDataType;
-
- private String combineFunction;
-
- private boolean notCompleted;
-
- public RowDTO() {
- }
-
- public RowDTO(RowDTO rowDTO) {
- this.category = rowDTO.getCategory();
- this.preFunction = rowDTO.getPreFunction();
- this.function = rowDTO.getFunction();
- this.attributeValue = rowDTO.getAttributeValue();
- this.attributeId = rowDTO.getAttributeId();
- this.combineFunction = rowDTO.getCombineFunction();
- this.attributeDataType = rowDTO.getAttributeDataType();
- }
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public String getCombineFunction() {
- return combineFunction;
- }
-
- public void setCombineFunction(String combineFunction) {
- this.combineFunction = combineFunction;
- }
-
- public String getAttributeDataType() {
- return attributeDataType;
- }
-
- public void setAttributeDataType(String attributeDataType) {
- this.attributeDataType = attributeDataType;
- }
-
- public String getAttributeId() {
- return attributeId;
- }
-
- public void setAttributeId(String attributeId) {
- this.attributeId = attributeId;
- }
-
- public String getAttributeValue() {
- return attributeValue;
- }
-
- public void setAttributeValue(String attributeValue) {
- this.attributeValue = attributeValue;
- }
-
- public String getFunction() {
- return function;
- }
-
- public void setFunction(String function) {
- this.function = function;
- }
-
- public String getPreFunction() {
- return preFunction;
- }
-
- public void setPreFunction(String preFunction) {
- this.preFunction = preFunction;
- }
-
- public boolean isNotCompleted() {
- return notCompleted;
- }
-
- public void setNotCompleted(boolean notCompleted) {
- this.notCompleted = notCompleted;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/RuleDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/RuleDTO.java
deleted file mode 100644
index ad6e15f3d379..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/RuleDTO.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class RuleDTO {
-
- private String ruleId;
-
- private String ruleEffect;
-
- private String ruleDescription;
-
- private TargetDTO targetDTO = new TargetDTO();
-
- private List rowDTOList = new ArrayList();
-
- private List attributeDTOs = new ArrayList();
-
- private List obligationDTOs = new ArrayList();
-
- private boolean completedRule;
-
- public String getRuleId() {
- return ruleId;
- }
-
- public void setRuleId(String ruleId) {
- this.ruleId = ruleId;
- }
-
- public String getRuleEffect() {
- return ruleEffect;
- }
-
- public void setRuleEffect(String ruleEffect) {
- this.ruleEffect = ruleEffect;
- }
-
- public String getRuleDescription() {
- return ruleDescription;
- }
-
- public void setRuleDescription(String ruleDescription) {
- this.ruleDescription = ruleDescription;
- }
-
- public List getRowDTOList() {
- return rowDTOList;
- }
-
- public void setRowDTOList(List rowDTOList) {
- this.rowDTOList = rowDTOList;
- }
-
- public void addRowDTO(RowDTO rowDTO) {
- this.rowDTOList.add(rowDTO);
- }
-
- public TargetDTO getTargetDTO() {
- return targetDTO;
- }
-
- public void setTargetDTO(TargetDTO targetDTO) {
- this.targetDTO = targetDTO;
- }
-
- public boolean isCompletedRule() {
- return completedRule;
- }
-
- public void setCompletedRule(boolean completedRule) {
- this.completedRule = completedRule;
- }
-
- public List getAttributeDTOs() {
- return attributeDTOs;
- }
-
- public void setAttributeDTOs(List attributeDTOs) {
- this.attributeDTOs = attributeDTOs;
- }
-
- public void addAttributeDTO(ExtendAttributeDTO attributeDTO) {
- this.attributeDTOs.add(attributeDTO);
- }
-
- public List getObligationDTOs() {
- return obligationDTOs;
- }
-
- public void setObligationDTOs(List obligationDTOs) {
- this.obligationDTOs = obligationDTOs;
- }
-
- public void addObligationDTO(ObligationDTO obligationDTO) {
- this.obligationDTOs.add(obligationDTO);
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/SimplePolicyEditorDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/SimplePolicyEditorDTO.java
deleted file mode 100644
index 9cb122bdf501..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/SimplePolicyEditorDTO.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class SimplePolicyEditorDTO {
-
- private String policyId;
-
- private String appliedCategory;
-
- private String description;
-
- private String userAttributeValue;
-
- private String userAttributeId;
-
- private String resourceValue;
-
- private String actionValue;
-
- private String environmentValue;
-
- private String function;
-
- private String environmentId;
-
- private List SimplePolicyEditorElementDTOs =
- new ArrayList();
-
- public String getPolicyId() {
- return policyId;
- }
-
- public void setPolicyId(String policyId) {
- this.policyId = policyId;
- }
-
- public String getAppliedCategory() {
- return appliedCategory;
- }
-
- public void setAppliedCategory(String appliedCategory) {
- this.appliedCategory = appliedCategory;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public List getSimplePolicyEditorElementDTOs() {
- return SimplePolicyEditorElementDTOs;
- }
-
- public void setSimplePolicyEditorElementDTOs(List
- simplePolicyEditorElementDTOs) {
- this.SimplePolicyEditorElementDTOs = simplePolicyEditorElementDTOs;
- }
-
- public void setBasicPolicyEditorElementDTO(SimplePolicyEditorElementDTO
- SimplePolicyEditorElementDTO) {
- this.SimplePolicyEditorElementDTOs.add(SimplePolicyEditorElementDTO);
- }
-
- public String getUserAttributeValue() {
- return userAttributeValue;
- }
-
- public void setUserAttributeValue(String userAttributeValue) {
- this.userAttributeValue = userAttributeValue;
- }
-
- public String getEnvironmentValue() {
- return environmentValue;
- }
-
- public void setEnvironmentValue(String environmentValue) {
- this.environmentValue = environmentValue;
- }
-
- public String getFunction() {
- return function;
- }
-
- public void setFunction(String function) {
- this.function = function;
- }
-
- public String getActionValue() {
- return actionValue;
- }
-
- public void setActionValue(String actionValue) {
- this.actionValue = actionValue;
- }
-
- public String getResourceValue() {
- return resourceValue;
- }
-
- public void setResourceValue(String resourceValue) {
- this.resourceValue = resourceValue;
- }
-
- public String getUserAttributeId() {
- return userAttributeId;
- }
-
- public void setUserAttributeId(String userAttributeId) {
- this.userAttributeId = userAttributeId;
- }
-
- public String getEnvironmentId() {
- return environmentId;
- }
-
- public void setEnvironmentId(String environmentId) {
- this.environmentId = environmentId;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/SimplePolicyEditorElementDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/SimplePolicyEditorElementDTO.java
deleted file mode 100644
index 43d8d6ad4c49..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/SimplePolicyEditorElementDTO.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class SimplePolicyEditorElementDTO {
-
- private String userAttributeId;
-
- private String userAttributeValue;
-
- private String actionValue;
-
- private String resourceValue;
-
- private String environmentId;
-
- private String environmentValue;
-
- private String operationType;
-
- private String functionOnResources;
-
- private String functionOnActions;
-
- private String functionOnUsers;
-
- private String functionOnEnvironments;
-
- public String getUserAttributeId() {
- return userAttributeId;
- }
-
- public void setUserAttributeId(String userAttributeId) {
- this.userAttributeId = userAttributeId;
- }
-
- public String getOperationType() {
- return operationType;
- }
-
- public void setOperationType(String operationType) {
- this.operationType = operationType;
- }
-
- public String getEnvironmentValue() {
- return environmentValue;
- }
-
- public void setEnvironmentValue(String environmentValue) {
- this.environmentValue = environmentValue;
- }
-
- public String getEnvironmentId() {
- return environmentId;
- }
-
- public void setEnvironmentId(String environmentId) {
- this.environmentId = environmentId;
- }
-
- public String getResourceValue() {
- return resourceValue;
- }
-
- public void setResourceValue(String resourceValue) {
- this.resourceValue = resourceValue;
- }
-
- public String getUserAttributeValue() {
- return userAttributeValue;
- }
-
- public void setUserAttributeValue(String userAttributeValue) {
- this.userAttributeValue = userAttributeValue;
- }
-
- public String getActionValue() {
- return actionValue;
- }
-
- public void setActionValue(String actionValue) {
- this.actionValue = actionValue;
- }
-
- public String getFunctionOnUsers() {
- return functionOnUsers;
- }
-
- public void setFunctionOnUsers(String functionOnUsers) {
- this.functionOnUsers = functionOnUsers;
- }
-
- public String getFunctionOnActions() {
- return functionOnActions;
- }
-
- public void setFunctionOnActions(String functionOnActions) {
- this.functionOnActions = functionOnActions;
- }
-
- public String getFunctionOnResources() {
- return functionOnResources;
- }
-
- public void setFunctionOnResources(String functionOnResources) {
- this.functionOnResources = functionOnResources;
- }
-
- public String getFunctionOnEnvironments() {
- return functionOnEnvironments;
- }
-
- public void setFunctionOnEnvironments(String functionOnEnvironments) {
- this.functionOnEnvironments = functionOnEnvironments;
- }
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/TargetDTO.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/TargetDTO.java
deleted file mode 100644
index 5b073fa9c6ef..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/dto/TargetDTO.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class TargetDTO {
-
- private List rowDTOList = new ArrayList();
-
- public List getRowDTOList() {
- return rowDTOList;
- }
-
- public void setRowDTOList(List rowDTOList) {
- this.rowDTOList = rowDTOList;
- }
-
- public void addRowDTO(RowDTO rowDTO) {
- this.rowDTOList.add(rowDTO);
- }
-
-
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/util/ClientUtil.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/util/ClientUtil.java
deleted file mode 100644
index d8eef8a6830f..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/util/ClientUtil.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.util;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.wso2.carbon.identity.entitlement.stub.dto.StatusHolder;
-import org.wso2.carbon.identity.entitlement.ui.EntitlementPolicyConstants;
-
-import javax.xml.namespace.QName;
-
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class ClientUtil {
-
- /**
- * Helper method to extract the boolean response
- *
- * @param xmlstring XACML resource as String
- * @return Decision
- * @throws Exception if fails
- */
- public static String getStatus(String xmlstring) throws Exception {
-
- OMElement response = null;
- OMElement result = null;
- OMElement decision = null;
- response = AXIOMUtil.stringToOM(xmlstring);
-
- OMNamespace nameSpace = response.getNamespace();
-
- if (nameSpace != null) {
- result = response.getFirstChildWithName(new QName(nameSpace.getNamespaceURI(), "Result"));
- } else {
- result = response.getFirstElement();
- }
- if (result != null) {
- if (nameSpace != null) {
- decision = result.getFirstChildWithName(new QName(nameSpace.getNamespaceURI(), "Decision"));
- } else {
- decision = result.getFirstChildWithName(new QName("Decision"));
- }
- if (decision != null) {
- return decision.getText();
- }
- }
-
- return "Invalid Status";
- }
-
- public static String[] doPagingForStrings(int pageNumber, int itemsPerPageInt, String[] names) {
-
- String[] returnedSubscriberNameSet;
-
- int startIndex = pageNumber * itemsPerPageInt;
- int endIndex = (pageNumber + 1) * itemsPerPageInt;
- if (itemsPerPageInt < names.length) {
- returnedSubscriberNameSet = new String[itemsPerPageInt];
- } else {
- returnedSubscriberNameSet = new String[names.length];
- }
- for (int i = startIndex, j = 0; i < endIndex && i < names.length; i++, j++) {
- returnedSubscriberNameSet[j] = names[i];
- }
-
- return returnedSubscriberNameSet;
- }
-
- public static StatusHolder[] doModuleStatusHoldersPaging(int pageNumber,
- StatusHolder[] moduleStatusHolderSet) {
-
- int itemsPerPageInt = EntitlementPolicyConstants.DEFAULT_ITEMS_PER_PAGE;
- StatusHolder[] returnedModuleStatusHolderSet;
-
- int startIndex = pageNumber * itemsPerPageInt;
- int endIndex = (pageNumber + 1) * itemsPerPageInt;
- if (itemsPerPageInt < moduleStatusHolderSet.length) {
- returnedModuleStatusHolderSet = new StatusHolder[itemsPerPageInt];
- } else {
- returnedModuleStatusHolderSet = new StatusHolder[moduleStatusHolderSet.length];
- }
- for (int i = startIndex, j = 0; i < endIndex && i < moduleStatusHolderSet.length; i++, j++) {
- returnedModuleStatusHolderSet[j] = moduleStatusHolderSet[i];
- }
-
- return returnedModuleStatusHolderSet;
- }
-
-}
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/util/PolicyCreatorUtil.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/util/PolicyCreatorUtil.java
deleted file mode 100644
index 95801574cacd..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/util/PolicyCreatorUtil.java
+++ /dev/null
@@ -1,2199 +0,0 @@
-/*
-* Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.util;
-
-import org.wso2.balana.utils.policy.dto.AttributeElementDTO;
-import org.wso2.balana.utils.policy.dto.AttributesElementDTO;
-import org.wso2.balana.utils.policy.dto.RequestElementDTO;
-import org.wso2.carbon.identity.entitlement.ui.EntitlementPolicyConstants;
-import org.wso2.carbon.identity.entitlement.ui.dto.RequestDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.RowDTO;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class PolicyCreatorUtil {
-//
-// /**
-// * This method creates a policy element of the XACML policy
-// * @param policyElementDTO policy element data object
-// * @param doc XML document
-// * @return policyElement
-// */
-//
-// public static Element createPolicyElement(PolicyElementDTO policyElementDTO, Document doc) {
-//
-// Element policyElement = doc.createElement(EntitlementPolicyConstants.POLICY_ELEMENT);
-//
-// policyElement.setAttribute("xmlns", EntitlementPolicyConstants.XACML3_POLICY_NAMESPACE);
-//
-// if(policyElementDTO.getPolicyName() != null && policyElementDTO.getPolicyName().trim().length() > 0) {
-// policyElement.setAttribute(EntitlementPolicyConstants.POLICY_ID, policyElementDTO.
-// getPolicyName());
-// } else {
-// return null;
-// }
-//
-// if(policyElementDTO.getRuleCombiningAlgorithms() != null && policyElementDTO.
-// getRuleCombiningAlgorithms().trim().length() > 0) {
-// if(PolicyEditorConstants.CombiningAlog.FIRST_APPLICABLE_ID.equals(policyElementDTO.
-// getRuleCombiningAlgorithms().trim())){
-// policyElement.setAttribute(EntitlementPolicyConstants.RULE_ALGORITHM,
-// PolicyEditorConstants.RULE_ALGORITHM_IDENTIFIER_1 + policyElementDTO.
-// getRuleCombiningAlgorithms());
-// } else {
-// policyElement.setAttribute(EntitlementPolicyConstants.RULE_ALGORITHM,
-// PolicyEditorConstants.RULE_ALGORITHM_IDENTIFIER_3 + policyElementDTO.
-// getRuleCombiningAlgorithms());
-// }
-// } else {
-// return null;
-// }
-//
-// if(policyElementDTO.getVersion() != null && policyElementDTO.getVersion().trim().length() > 0){
-// policyElement.setAttribute(EntitlementPolicyConstants.POLICY_VERSION,
-// policyElementDTO.getVersion());
-// } else {
-// // policy version is handled by wso2 registry. therefore we can ignore it, although it
-// // is a required attribute
-// policyElement.setAttribute(EntitlementPolicyConstants.POLICY_VERSION, "1.0");
-// }
-//
-// if(policyElementDTO.getPolicyDescription() != null && policyElementDTO.
-// getPolicyDescription().trim().length() > 0) {
-//
-// Element descriptionElement = doc.createElement(EntitlementPolicyConstants.
-// DESCRIPTION_ELEMENT);
-// descriptionElement.setTextContent(policyElementDTO.getPolicyDescription());
-// policyElement.appendChild(descriptionElement);
-// }
-//
-// return policyElement;
-// }
-//
-// ////XACML3
-//
-// /**
-// * This method creates a match element (subject,action,resource or environment) of the XACML policy
-// * @param matchElementDTO match element data object
-// * @param doc XML document
-// * @return match Element
-// */
-// public static Element createMatchElement(MatchElementDTO matchElementDTO, Document doc) {
-//
-// Element matchElement = null;
-// if(matchElementDTO.getMatchId() != null && matchElementDTO.getMatchId().trim().length() > 0) {
-//
-// matchElement = doc.createElement(EntitlementPolicyConstants.MATCH_ELEMENT);
-//
-// matchElement.setAttribute(EntitlementPolicyConstants.MATCH_ID,
-// matchElementDTO.getMatchId());
-//
-// if(matchElementDTO.getAttributeValueElementDTO() != null) {
-// Element attributeValueElement = createAttributeValueElement(matchElementDTO.
-// getAttributeValueElementDTO(), doc);
-// matchElement.appendChild(attributeValueElement);
-// }
-//
-// if(matchElementDTO.getAttributeDesignatorDTO() != null ) {
-// Element attributeDesignatorElement = createAttributeDesignatorElement(matchElementDTO.
-// getAttributeDesignatorDTO(), doc);
-// matchElement.appendChild(attributeDesignatorElement);
-// }
-//
-// if(matchElementDTO.getAttributeSelectorDTO() != null ) {
-// Element attributeSelectorElement = createAttributeSelectorElement(matchElementDTO.
-// getAttributeSelectorDTO(), doc);
-// matchElement.appendChild(attributeSelectorElement);
-// }
-// }
-// return matchElement;
-// }
-//
-// /**
-// * This method creates the attribute value element
-// * @param attributeValueElementDTO attribute value element data object
-// * @param doc XML document
-// * @return attribute value element
-// */
-// public static Element createAttributeValueElement(AttributeValueElementDTO
-// attributeValueElementDTO, Document doc) {
-//
-// Element attributeValueElement = doc.createElement(EntitlementPolicyConstants.ATTRIBUTE_VALUE);
-//
-// if(attributeValueElementDTO.getAttributeValue() != null && attributeValueElementDTO.
-// getAttributeValue().trim().length() > 0) {
-//
-// attributeValueElement.setTextContent(attributeValueElementDTO.getAttributeValue().trim());
-//
-// if(attributeValueElementDTO.getAttributeDataType()!= null && attributeValueElementDTO.
-// getAttributeDataType().trim().length() > 0){
-// attributeValueElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
-// attributeValueElementDTO.getAttributeDataType());
-// } else {
-// attributeValueElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
-// EntitlementPolicyConstants.STRING_DATA_TYPE);
-// }
-//
-// }
-//
-// return attributeValueElement;
-//
-// }
-//
-// /**
-// * This creates XML representation of Attributes Element using AttributesElementDTO object
-// *
-// * @param elementDTO AttributesElementDTO
-// * @param doc Document
-// * @return DOM element
-// */
-// public static Element createAttributesElement(AttributesElementDTO elementDTO, Document doc){
-//
-// Element attributesElement = doc.createElement(EntitlementPolicyConstants.ATTRIBUTES);
-//
-// attributesElement.setAttribute(EntitlementPolicyConstants.CATEGORY, elementDTO.getCategory());
-//
-// List attributeElementDTOs = elementDTO.getAttributeElementDTOs();
-// if(attributeElementDTOs != null && attributeElementDTOs.size() > 0){
-// for(AttributeElementDTO attributeElementDTO : attributeElementDTOs){
-// Element attributeElement = doc.createElement(EntitlementPolicyConstants.ATTRIBUTE);
-// attributeElement.setAttribute(EntitlementPolicyConstants.ATTRIBUTE_ID,
-// attributeElementDTO.getAttributeId());
-// attributeElement.setAttribute(EntitlementPolicyConstants.INCLUDE_RESULT,
-// Boolean.toString(attributeElementDTO.isIncludeInResult()));
-//
-// if(attributeElementDTO.getIssuer() != null &&
-// attributeElementDTO.getIssuer().trim().length() > 0){
-// attributeElement.setAttribute(EntitlementPolicyConstants.ISSUER,
-// attributeElementDTO.getIssuer());
-// }
-//
-// List values = attributeElementDTO.getAttributeValues();
-// for(String value : values){
-// Element attributeValueElement = doc.createElement(EntitlementPolicyConstants.
-// ATTRIBUTE_VALUE);
-// attributeValueElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
-// attributeElementDTO.getDataType());
-// attributeValueElement.setTextContent(value.trim());
-// attributeElement.appendChild(attributeValueElement);
-// }
-// attributesElement.appendChild(attributeElement);
-// }
-// }
-// return attributesElement;
-// }
-//
-//
-// public static Element createFunctionElement(FunctionDTO functionDTO, Document doc) {
-//
-// Element functionElement = doc.createElement(EntitlementPolicyConstants.FUNCTION);
-//
-// if(functionDTO.getFunctionId() != null && functionDTO.getFunctionId().trim().length() > 0) {
-// functionElement.setAttribute(EntitlementPolicyConstants.FUNCTION_ID,
-// functionDTO.getFunctionId());
-// }
-//
-// return functionElement;
-// }
-//
-//// public static Element createAttributeDesignatorElement(AttributeDesignatorDTO
-//// attributeDesignatorDTO, Document doc) {
-////
-//// String attributeDesignatorElementName = attributeDesignatorDTO.getElementName() +
-//// EntitlementPolicyConstants.ATTRIBUTE_DESIGNATOR;
-////
-//// Element attributeDesignatorElement = doc.createElement(attributeDesignatorElementName);
-////
-//// if(attributeDesignatorDTO.getAttributeId() != null && attributeDesignatorDTO.
-//// getAttributeId().trim().length() > 0 ){
-////
-//// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.ATTRIBUTE_ID,
-//// attributeDesignatorDTO.getAttributeId());
-////
-//// if(attributeDesignatorDTO.getDataType() != null && attributeDesignatorDTO.
-//// getDataType().trim().length() > 0) {
-//// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
-//// attributeDesignatorDTO.getDataType());
-//// } else {
-//// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
-//// EntitlementPolicyConstants.STRING_DATA_TYPE);
-//// }
-////
-//// if(attributeDesignatorDTO.getIssuer() != null && attributeDesignatorDTO.getIssuer().
-//// trim().length() > 0) {
-//// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.ISSUER,
-//// attributeDesignatorDTO.getIssuer());
-//// }
-////
-//// if(attributeDesignatorDTO.getMustBePresent() != null && attributeDesignatorDTO.
-//// getMustBePresent().trim().length() > 0){
-//// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.MUST_BE_PRESENT,
-//// attributeDesignatorDTO.getMustBePresent());
-//// }
-////
-//// if(attributeDesignatorDTO.getSubjectCategory() != null){
-//// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.MUST_BE_PRESENT,
-//// attributeDesignatorDTO.getSubjectCategory());
-//// }
-////
-//// }
-////
-//// return attributeDesignatorElement;
-//// }
-//
-//
-// public static Element createAttributeDesignatorElement(AttributeDesignatorDTO
-// attributeDesignatorDTO, Document doc) {
-//
-// String attributeDesignatorElementName =
-// EntitlementPolicyConstants.ATTRIBUTE_DESIGNATOR;
-//
-// Element attributeDesignatorElement = doc.createElement(attributeDesignatorElementName);
-//
-// String attributeId = attributeDesignatorDTO.getAttributeId();
-// String category = attributeDesignatorDTO.getCategory();
-//
-// if(attributeId != null && attributeId.trim().length() > 0 && category != null &&
-// category.trim().length() > 0){
-//
-// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.ATTRIBUTE_ID,
-// attributeDesignatorDTO.getAttributeId());
-//
-// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.CATEGORY,
-// attributeDesignatorDTO.getCategory());
-//
-// if(attributeDesignatorDTO.getDataType() != null && attributeDesignatorDTO.
-// getDataType().trim().length() > 0) {
-// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
-// attributeDesignatorDTO.getDataType());
-// } else {
-// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
-// EntitlementPolicyConstants.STRING_DATA_TYPE);
-// }
-//
-// if(attributeDesignatorDTO.getIssuer() != null && attributeDesignatorDTO.getIssuer().
-// trim().length() > 0) {
-// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.ISSUER,
-// attributeDesignatorDTO.getIssuer());
-// }
-//
-// if(attributeDesignatorDTO.getMustBePresent() != null && attributeDesignatorDTO.
-// getMustBePresent().trim().length() > 0){
-// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.MUST_BE_PRESENT,
-// attributeDesignatorDTO.getMustBePresent());
-// } else {
-// attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.MUST_BE_PRESENT,
-// "true");
-// }
-//
-// }
-//
-// return attributeDesignatorElement;
-// }
-//
-//
-// public static Element createAttributeSelectorElement(AttributeSelectorDTO attributeSelectorDTO,
-// Document doc) {
-//
-// Element attributeSelectorElement = doc.createElement(EntitlementPolicyConstants.
-// ATTRIBUTE_SELECTOR);
-//
-// if(attributeSelectorDTO.getAttributeSelectorRequestContextPath() != null &&
-// attributeSelectorDTO.getAttributeSelectorRequestContextPath().trim().length() > 0) {
-//
-// attributeSelectorElement.setAttribute(EntitlementPolicyConstants.REQUEST_CONTEXT_PATH,
-// EntitlementPolicyConstants.ATTRIBUTE_NAMESPACE + attributeSelectorDTO.
-// getAttributeSelectorRequestContextPath());
-//
-// if(attributeSelectorDTO.getAttributeSelectorDataType() != null &&
-// attributeSelectorDTO.getAttributeSelectorDataType().trim().length() > 0) {
-// attributeSelectorElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
-// attributeSelectorDTO.getAttributeSelectorDataType());
-// } else {
-// attributeSelectorElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
-// EntitlementPolicyConstants.STRING_DATA_TYPE);
-// }
-//
-// if(attributeSelectorDTO.getAttributeSelectorMustBePresent() != null &&
-// attributeSelectorDTO.getAttributeSelectorMustBePresent().trim().length() > 0) {
-// attributeSelectorElement.setAttribute(EntitlementPolicyConstants.MUST_BE_PRESENT,
-// attributeSelectorDTO.getAttributeSelectorMustBePresent());
-// }
-//
-// }
-//
-// return attributeSelectorElement;
-// }
-//
-// public static Element createObligationsElement(List obligationElementDTOs,
-// Document doc){
-//
-//
-// Element obligationExpressions = null;
-// Element adviceExpressions = null;
-//
-// if(obligationElementDTOs != null && obligationElementDTOs.size() > 0){
-//
-// for(ObligationElementDTO dto : obligationElementDTOs){
-// String id = dto.getId();
-// String effect = dto.getEffect();
-//
-// if(id != null && id.trim().length() > 0 && effect != null){
-// if(dto.getType() == ObligationElementDTO.ADVICE){
-// if(adviceExpressions == null){
-// adviceExpressions = doc.
-// createElement(EntitlementPolicyConstants.ADVICE_EXPRESSIONS);
-// }
-//
-// Element adviceExpression = doc.
-// createElement(EntitlementPolicyConstants.ADVICE_EXPRESSION);
-// adviceExpression.setAttribute(EntitlementPolicyConstants.ADVICE_ID, id);
-// adviceExpression.setAttribute(EntitlementPolicyConstants.ADVICE_EFFECT, effect);
-// List elementDTOs = dto.getAssignmentElementDTOs();
-// if(elementDTOs != null){
-// for(AttributeAssignmentElementDTO elementDTO : elementDTOs){
-// Element element = createAttributeAssignmentElement(elementDTO, doc);
-// if(element != null){
-// adviceExpression.appendChild(element);
-// }
-// }
-// }
-// adviceExpressions.appendChild(adviceExpression);
-// } else {
-//
-// if(obligationExpressions == null){
-// obligationExpressions = doc.
-// createElement(EntitlementPolicyConstants.OBLIGATION_EXPRESSIONS);
-// }
-//
-// Element obligationExpression = doc.
-// createElement(EntitlementPolicyConstants.OBLIGATION_EXPRESSION);
-// obligationExpression.setAttribute(EntitlementPolicyConstants.OBLIGATION_ID, id);
-// obligationExpression.setAttribute(EntitlementPolicyConstants.OBLIGATION_EFFECT,
-// effect);
-// List elementDTOs = dto.getAssignmentElementDTOs();
-// if(elementDTOs != null){
-// for(AttributeAssignmentElementDTO elementDTO : elementDTOs){
-// Element element = createAttributeAssignmentElement(elementDTO, doc);
-// if(element != null){
-// obligationExpression.appendChild(element);
-// }
-// }
-// }
-// obligationExpressions.appendChild(obligationExpression);
-// }
-// }
-// }
-// }
-//
-// if(adviceExpressions != null){
-// return adviceExpressions;
-// }
-//
-// return obligationExpressions;
-// }
-//
-// public static Element createAttributeAssignmentElement(AttributeAssignmentElementDTO assignmentElementDTO,
-// Document doc){
-//
-// String attributeId = assignmentElementDTO.getAttributeId();
-//
-// if(attributeId != null && attributeId.trim().length() > 0){
-//
-// String category = assignmentElementDTO.getCategory();
-// String issuer = assignmentElementDTO.getIssuer();
-// ApplyElementDTO applyElementDTO = assignmentElementDTO.getApplyElementDTO();
-// AttributeDesignatorDTO designatorDTO = assignmentElementDTO.getDesignatorDTO();
-// AttributeValueElementDTO valueElementDTO = assignmentElementDTO.getValueElementDTO();
-//
-// Element attributeAssignment = doc.
-// createElement(EntitlementPolicyConstants.ATTRIBUTE_ASSIGNMENT);
-// attributeAssignment.setAttribute(EntitlementPolicyConstants.ATTRIBUTE_ID,
-// attributeId);
-// if(category != null && category.trim().length() > 0){
-// attributeAssignment.setAttribute(EntitlementPolicyConstants.CATEGORY, category);
-// }
-//
-// if(issuer != null && issuer.trim().length() > 0){
-// attributeAssignment.setAttribute(EntitlementPolicyConstants.ISSUER, issuer);
-// }
-//
-// if(applyElementDTO != null){
-// attributeAssignment.appendChild(createApplyElement(applyElementDTO, doc));
-// }
-//
-// if(designatorDTO != null){
-// attributeAssignment.appendChild(createAttributeDesignatorElement(designatorDTO, doc));
-// }
-//
-// if(valueElementDTO != null){
-// attributeAssignment.appendChild(createAttributeValueElement(valueElementDTO, doc));
-// }
-//
-// return attributeAssignment;
-// }
-//
-// return null;
-// }
-//
-// public static Element createSubElement(SubElementDTO subElementDTO, Document doc) {
-//
-// String subElementName = subElementDTO.getElementName();
-//
-// Element subElement = doc.createElement(subElementName);
-//
-// for( MatchElementDTO matchElementDTO : subElementDTO.getMatchElementDTOs()) {
-// Element matchElement = createMatchElement(matchElementDTO, doc);
-// if(matchElement != null) {
-// subElement.appendChild(matchElement);
-// }
-// }
-//
-// return subElement;
-// }
-//
-// public static Element createTargetElement(List subElementDTOs, Document doc) {
-//
-// Element targetElement = doc.createElement(EntitlementPolicyConstants.TARGET_ELEMENT);
-// String subjectElementName = EntitlementPolicyConstants.SUBJECT_ELEMENT + "s";
-// String actionElementName = EntitlementPolicyConstants.ACTION_ELEMENT + "s";
-// String resourceElementName = EntitlementPolicyConstants.RESOURCE_ELEMENT + "s";
-// String enviornementElementName = EntitlementPolicyConstants.ENVIRONMENT_ELEMENT + "s";
-//
-// Element subjectElement = doc.createElement(subjectElementName);
-// Element actionElement = doc.createElement(actionElementName);
-// Element resourceElement = doc.createElement(resourceElementName);
-// Element enviornementElement = doc.createElement(enviornementElementName);
-//
-//
-// for(SubElementDTO subElementDTO : subElementDTOs) {
-//
-// if(subElementDTO.getElementName().equals(EntitlementPolicyConstants.SUBJECT_ELEMENT)) {
-// Element subParentElement = createSubElement(subElementDTO, doc);
-// subjectElement.appendChild(subParentElement);
-// }
-//
-// if(subElementDTO.getElementName().equals(EntitlementPolicyConstants.ACTION_ELEMENT)) {
-// Element subParentElement = createSubElement(subElementDTO, doc);
-// actionElement.appendChild(subParentElement);
-// }
-//
-// if(subElementDTO.getElementName().equals(EntitlementPolicyConstants.RESOURCE_ELEMENT)) {
-// Element subParentElement = createSubElement(subElementDTO, doc);
-// resourceElement.appendChild(subParentElement);
-// }
-//
-// if(subElementDTO.getElementName().equals(EntitlementPolicyConstants.ENVIRONMENT_ELEMENT)) {
-// Element subParentElement = createSubElement(subElementDTO, doc);
-// enviornementElement.appendChild(subParentElement);
-// }
-// }
-//
-// targetElement.appendChild(subjectElement);
-// targetElement.appendChild(actionElement);
-// targetElement.appendChild(resourceElement);
-// targetElement.appendChild(enviornementElement);
-//
-// return targetElement;
-// }
-//
-//
-// public static Element createRuleElement(RuleElementDTO ruleElementDTO, Document doc) {
-//
-// TargetElementDTO targetElementDTO = ruleElementDTO.getTargetElementDTO();
-// ConditionElementDT0 conditionElementDT0 = ruleElementDTO.getConditionElementDT0();
-// List obligationElementDTOs = ruleElementDTO.getObligationElementDTOs();
-//
-// Element ruleElement = doc.createElement(EntitlementPolicyConstants.RULE_ELEMENT);
-//
-// if(ruleElementDTO.getRuleId() != null && ruleElementDTO.getRuleId().trim().length() > 0){
-// ruleElement.setAttribute(EntitlementPolicyConstants.RULE_ID, ruleElementDTO.getRuleId());
-// }
-//
-// if(ruleElementDTO.getRuleEffect() != null && ruleElementDTO.getRuleEffect().trim().length() > 0){
-// ruleElement.setAttribute(EntitlementPolicyConstants.RULE_EFFECT,
-// ruleElementDTO.getRuleEffect());
-// }
-//
-// if(ruleElementDTO.getRuleDescription() != null && ruleElementDTO.getRuleDescription().
-// trim().length() > 0){
-// Element descriptionElement = doc.createElement(EntitlementPolicyConstants.
-// DESCRIPTION_ELEMENT);
-// descriptionElement.setTextContent(ruleElementDTO.getRuleDescription());
-// ruleElement.appendChild(descriptionElement);
-// }
-//
-// if(targetElementDTO != null ){
-// Element targetElement = PolicyEditorUtil.createTargetElement(targetElementDTO, doc);
-// ruleElement.appendChild(targetElement);
-// }
-//
-// if(conditionElementDT0 != null){
-// ruleElement.appendChild(createConditionElement(conditionElementDT0, doc));
-// }
-//
-//
-// if(obligationElementDTOs != null && obligationElementDTOs.size() > 0){
-// List obligations = new ArrayList();
-// List advices = new ArrayList();
-// for(ObligationElementDTO obligationElementDTO : obligationElementDTOs){
-// if(obligationElementDTO.getType() == ObligationElementDTO.ADVICE){
-// advices.add(obligationElementDTO);
-// } else {
-// obligations.add(obligationElementDTO);
-// }
-// }
-// Element obligation = createObligationsElement(obligations, doc);
-// Element advice = createObligationsElement(advices, doc);
-// if(obligation != null){
-// ruleElement.appendChild(obligation);
-// }
-// if(advice != null){
-// ruleElement.appendChild(advice);
-// }
-// }
-//
-// return ruleElement;
-// }
-//
-//
-// public static Element createConditionElement(ConditionElementDT0 conditionElementDT0, Document doc) {
-//
-// Element conditionElement = doc.createElement(EntitlementPolicyConstants.CONDITION_ELEMENT);
-//
-// if(conditionElementDT0.getApplyElement() != null){
-// conditionElement.appendChild(createApplyElement(conditionElementDT0.getApplyElement(), doc));
-//
-// } else if(conditionElementDT0.getAttributeValueElementDTO() != null) {
-// Element attributeValueElement = createAttributeValueElement(conditionElementDT0.
-// getAttributeValueElementDTO(), doc);
-// conditionElement.appendChild(attributeValueElement);
-//
-// } else if(conditionElementDT0.getAttributeDesignator() != null) {
-// AttributeDesignatorDTO attributeDesignatorDTO = conditionElementDT0.getAttributeDesignator();
-// conditionElement.appendChild(createAttributeDesignatorElement(attributeDesignatorDTO, doc));
-//
-// } else if(conditionElementDT0.getFunctionFunctionId() != null) {
-// Element functionElement = doc.createElement(EntitlementPolicyConstants.FUNCTION_ELEMENT);
-// functionElement.setAttribute(EntitlementPolicyConstants.FUNCTION_ID,
-// conditionElementDT0.getFunctionFunctionId());
-// conditionElement.appendChild(functionElement);
-// } else if(conditionElementDT0.getVariableId() != null){
-// Element variableReferenceElement = doc.createElement(EntitlementPolicyConstants.
-// VARIABLE_REFERENCE);
-// variableReferenceElement.setAttribute(EntitlementPolicyConstants.VARIABLE_ID,
-// conditionElementDT0.getVariableId());
-// conditionElement.appendChild(variableReferenceElement);
-// }
-//
-// return conditionElement;
-//
-// }
-//
-// public static Element createApplyElement(ApplyElementDTO applyElementDTO, Document doc) {
-//
-// Element applyElement = doc.createElement(EntitlementPolicyConstants.APPLY_ELEMENT);
-//
-// if(applyElementDTO.getFunctionId() != null && applyElementDTO.getFunctionId().trim().length() > 0){
-// applyElement.setAttribute(EntitlementPolicyConstants.FUNCTION_ID,
-// applyElementDTO.getFunctionId());
-// }
-//
-// if(applyElementDTO.getFunctionFunctionId() != null && applyElementDTO.
-// getFunctionFunctionId().trim().length() > 0){
-// FunctionDTO functionDTO = new FunctionDTO();
-// functionDTO.setFunctionId(applyElementDTO.getFunctionFunctionId());
-// Element functionElement = createFunctionElement(functionDTO, doc);
-// applyElement.appendChild(functionElement);
-// }
-//
-// List applyElementDTOs = applyElementDTO.getApplyElements();
-//
-// if(applyElementDTOs != null && applyElementDTOs.size() > 0) {
-//
-// for(ApplyElementDTO elementDTO : applyElementDTOs) {
-// Element subApplyElement = createApplyElement(elementDTO, doc);
-// applyElement.appendChild(subApplyElement);
-// }
-// }
-//
-// List attributeValueElementDTOs = applyElementDTO.
-// getAttributeValueElementDTOs();
-// if(attributeValueElementDTOs != null && attributeValueElementDTOs.size() > 0) {
-//
-// for(AttributeValueElementDTO attributeValueElementDTO : attributeValueElementDTOs) {
-// Element attributeValueElement = createAttributeValueElement(attributeValueElementDTO,
-// doc);
-//
-// applyElement.appendChild(attributeValueElement);
-// }
-// }
-//
-// List attributeDesignatorDTOs = applyElementDTO.getAttributeDesignators();
-// if(attributeDesignatorDTOs != null && attributeDesignatorDTOs.size() > 0) {
-//
-// for(AttributeDesignatorDTO attributeDesignatorDTO : attributeDesignatorDTOs) {
-// Element attributeDesignatorElement =
-// createAttributeDesignatorElement(attributeDesignatorDTO, doc);
-// applyElement.appendChild(attributeDesignatorElement);
-// }
-// }
-//
-// List attributeSelectorDTOs = applyElementDTO.getAttributeSelectors();
-// if(attributeSelectorDTOs != null && attributeSelectorDTOs.size() > 0) {
-//
-// for(AttributeSelectorDTO attributeSelectorDTO : attributeSelectorDTOs) {
-// Element attributeSelectorElement = createAttributeSelectorElement(attributeSelectorDTO,
-// doc);
-// applyElement.appendChild(attributeSelectorElement);
-// }
-// }
-// return applyElement;
-// }
-//
-// ///////
-// public static ApplyElementDTO createApplyElementForBagFunctions(String functionId,
-// String category,
-// String attributeId,
-// String[] attributeValues,
-// String dataType){
-//
-// ApplyElementDTO applyElementDTO = new ApplyElementDTO();
-//
-// if(attributeValues != null && functionId != null && functionId.trim().length() > 0 &&
-// category != null && category.trim().length() > 0 &&
-// attributeId != null && attributeId.trim().length() > 0){
-//
-// ApplyElementDTO applyElementDTOBag = new ApplyElementDTO();
-// for(String attributeValue :attributeValues){
-// attributeValue = attributeValue.trim();
-// AttributeValueElementDTO attributeValueElementDTO = new AttributeValueElementDTO();
-// if(dataType != null && dataType.trim().length() > 0){
-// attributeValueElementDTO.setAttributeDataType(dataType);
-// } else {
-// attributeValueElementDTO.setAttributeDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
-// }
-// attributeValueElementDTO.setAttributeValue(attributeValue.trim());
-// applyElementDTOBag.setAttributeValueElementDTO(attributeValueElementDTO);
-// }
-//
-// applyElementDTOBag.setFunctionId(EntitlementPolicyConstants.FUNCTION_BAG);
-//
-// AttributeDesignatorDTO attributeDesignatorDTO = new AttributeDesignatorDTO();
-// if(dataType != null && dataType.trim().length() > 0){
-// attributeDesignatorDTO.setDataType(dataType);
-// } else {
-// attributeDesignatorDTO.setDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
-// }
-// attributeDesignatorDTO.setAttributeId(attributeId);
-// attributeDesignatorDTO.setCategory(category);
-//
-// applyElementDTO.setApplyElement(applyElementDTOBag);
-// applyElementDTO.setAttributeDesignators(attributeDesignatorDTO);
-// applyElementDTO.setFunctionId(functionId);
-//
-// }
-//
-// return applyElementDTO;
-// }
-//
-// public static ApplyElementDTO createApplyElementForNonBagFunctions(String functionId,
-// String category,
-// String attributeId,
-// String attributeValue,
-// String dataType){
-//
-// ApplyElementDTO applyElementDTO = new ApplyElementDTO();
-//
-// if(attributeValue != null && attributeValue.trim().length() > 0 && functionId != null &&
-// functionId.trim().length() > 0 && category != null &&
-// category.trim().length() > 0 && attributeId != null &&
-// attributeId.trim().length() > 0) {
-//
-// AttributeValueElementDTO attributeValueElementDTO = new AttributeValueElementDTO();
-// if(dataType != null && dataType.trim().length() > 0){
-// attributeValueElementDTO.setAttributeDataType(dataType);
-// } else {
-// attributeValueElementDTO.setAttributeDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
-// }
-// attributeValueElementDTO.setAttributeValue(attributeValue.trim());
-//
-// AttributeDesignatorDTO attributeDesignatorDTO = new AttributeDesignatorDTO();
-// if(dataType != null && dataType.trim().length() > 0){
-// attributeDesignatorDTO.setDataType(dataType);
-// } else {
-// attributeDesignatorDTO.setDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
-// }
-// attributeDesignatorDTO.setAttributeId(attributeId);
-// attributeDesignatorDTO.setCategory(category);
-//
-// applyElementDTO.setAttributeValueElementDTO(attributeValueElementDTO);
-// applyElementDTO.setAttributeDesignators(attributeDesignatorDTO);
-// applyElementDTO.setFunctionId(functionId);
-//
-// }
-//
-// return applyElementDTO;
-// }
-//
-// public static ApplyElementDTO createApplyElementForNonBagFunctionsWithAnyOf(String functionId,
-// String attributeDesignatorType,
-// String attributeDesignatorId,
-// String attributeValue){
-//
-// ApplyElementDTO applyElementDTO = new ApplyElementDTO();
-//
-// if(attributeValue != null && attributeValue.trim().length() > 0 && functionId != null &&
-// functionId.trim().length() > 0 && attributeDesignatorType != null &&
-// attributeDesignatorType.trim().length() > 0 && attributeDesignatorId != null &&
-// attributeDesignatorId.trim().length() > 0) {
-//
-// AttributeValueElementDTO attributeValueElementDTO = new AttributeValueElementDTO();
-// attributeValueElementDTO.setAttributeDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
-// attributeValueElementDTO.setAttributeValue(attributeValue.trim());
-//
-// AttributeDesignatorDTO attributeDesignatorDTO = new AttributeDesignatorDTO();
-// attributeDesignatorDTO.setDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
-// attributeDesignatorDTO.setAttributeId(attributeDesignatorId);
-// attributeDesignatorDTO.setCategory(attributeDesignatorType);
-//
-// applyElementDTO.setFunctionFunctionId(functionId);
-// applyElementDTO.setAttributeValueElementDTO(attributeValueElementDTO);
-// applyElementDTO.setAttributeDesignators(attributeDesignatorDTO);
-// applyElementDTO.setFunctionId(EntitlementPolicyConstants.FUNCTION_ANY_OF);
-//
-// }
-//
-// return applyElementDTO;
-// }
-//
-//
-// public static MatchElementDTO createMatchElementForNonBagFunctions(String functionId,
-// String attributeValue,
-// String category,
-// String attributeId,
-// String dataType) {
-// MatchElementDTO matchElementDTO = new MatchElementDTO();
-//
-// if(functionId != null && functionId.trim().length() > 0 && attributeValue != null &&
-// attributeValue.trim().length() > 0&& category != null &&
-// category.trim().length() > 0 && attributeId != null &&
-// attributeId.trim().length() > 0) {
-// AttributeValueElementDTO attributeValueElementDTO = new AttributeValueElementDTO();
-// if(dataType != null && dataType.trim().length() > 0){
-// attributeValueElementDTO.setAttributeDataType(dataType);
-// } else {
-// attributeValueElementDTO.setAttributeDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
-// }
-// attributeValueElementDTO.setAttributeValue(attributeValue.trim());
-//
-// AttributeDesignatorDTO attributeDesignatorDTO = new AttributeDesignatorDTO();
-// if(dataType != null && dataType.trim().length() > 0){
-// attributeValueElementDTO.setAttributeDataType(dataType);
-// } else {
-// attributeValueElementDTO.setAttributeDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
-// }
-// attributeDesignatorDTO.setAttributeId(attributeId);
-// attributeDesignatorDTO.setCategory(category);
-//
-// matchElementDTO.setMatchId(functionId);
-// matchElementDTO.setAttributeValueElementDTO(attributeValueElementDTO);
-// matchElementDTO.setAttributeDesignatorDTO(attributeDesignatorDTO);
-// }
-//
-// return matchElementDTO;
-// }
-//
-// public static Element createBasicRuleElementDTO(BasicRuleDTO basicRuleDTO,
-// Document doc) {
-//
-// String functionOnResources = basicRuleDTO.getFunctionOnResources();
-// String functionOnSubjects = basicRuleDTO.getFunctionOnSubjects();
-// String functionOnActions = basicRuleDTO.getFunctionOnActions();
-// String functionOnEnvironment = basicRuleDTO.getFunctionOnEnvironment();
-// String resourceNames = basicRuleDTO.getResourceList();
-// String actionNames = basicRuleDTO.getActionList();
-// String subjectNames = basicRuleDTO.getSubjectList();
-// String environmentNames = basicRuleDTO.getEnvironmentList();
-// String resourceId = basicRuleDTO.getResourceId();
-// String subjectId = basicRuleDTO.getSubjectId();
-// String actionId = basicRuleDTO.getActionId();
-// String environmentId = basicRuleDTO.getEnvironmentId();
-// String resourceDataType = basicRuleDTO.getResourceDataType();
-// String subjectDataType = basicRuleDTO.getSubjectDataType();
-// String actionDataType = basicRuleDTO.getActionDataType();
-// String environmentDataType = basicRuleDTO.getEnvironmentDataType();
-//
-//
-// Element resourcesElement = null;
-// Element actionsElement = null;
-// Element subjectsElement = null;
-// Element environmentsElement = null;
-// Element targetElement = null;
-// Element applyElement = null;
-// Element conditionElement = null;
-// Element ruleElement = null ;
-//
-// ApplyElementDTO applyElementDTO = new ApplyElementDTO();
-//
-// if(resourceNames != null && resourceNames.trim().length() > 0) {
-// String[] resources = resourceNames.split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
-// if(resourceId == null || resourceId.trim().length() < 1){
-// resourceId = EntitlementPolicyConstants.RESOURCE_ID;
-// }
-// if(functionOnResources.equals(EntitlementPolicyConstants.EQUAL_TO) ||
-// functionOnResources.equals(EntitlementPolicyConstants.REGEXP_MATCH) ) {
-// resourcesElement = doc.createElement(PolicyEditorConstants.ANY_OF_ELEMENT);
-// Element resourceElement = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(functionOnResources),
-// resources[0].trim(), PolicyEditorConstants.RESOURCE_CATEGORY_URI, resourceId, resourceDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// resourceElement.appendChild(matchElement);
-// }
-// resourcesElement.appendChild(resourceElement);
-//
-// } else if(functionOnResources.contains("less") || functionOnResources.contains("greater")){
-//
-// AttributeDesignatorDTO designatorDTO = new AttributeDesignatorDTO();
-// designatorDTO.setCategory(PolicyEditorConstants.RESOURCE_CATEGORY_URI);
-// designatorDTO.setAttributeId(resourceId);
-// designatorDTO.setDataType(resourceDataType);
-// designatorDTO.setMustBePresent("true");
-// try {
-// ApplyElementDTO elementDTO = PolicyEditorUtil.
-// processGreaterLessThanFunctions(functionOnResources, resourceDataType,
-// resourceNames, designatorDTO);
-// applyElementDTO.setApplyElement(elementDTO);
-// } catch (PolicyEditorException e) {
-// //ignore TODO
-// }
-// } else if(functionOnResources.equals(EntitlementPolicyConstants.IS_IN)) {
-// ApplyElementDTO elementDTO = createApplyElementForNonBagFunctions(
-// getFunctionId(functionOnResources),
-// PolicyEditorConstants.RESOURCE_CATEGORY_URI, resourceId, resources[0].trim(), resourceDataType);
-// applyElementDTO.setApplyElement(elementDTO);
-// } else {
-// ApplyElementDTO elementDTO = createApplyElementForBagFunctions(
-// getFunctionId(functionOnResources),
-// PolicyEditorConstants.RESOURCE_CATEGORY_URI, resourceId, resources, resourceDataType);
-// applyElementDTO.setApplyElement(elementDTO);
-// }
-// }
-//
-// if(actionNames != null && actionNames.trim().length() > 0) {
-// String[] actions = actionNames.split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
-// if(actionId == null || actionId.trim().length() < 1){
-// actionId = EntitlementPolicyConstants.ACTION_ID;
-// }
-// if(functionOnActions.equals(EntitlementPolicyConstants.EQUAL_TO) ||
-// functionOnActions.equals(EntitlementPolicyConstants.REGEXP_MATCH)) {
-// actionsElement = doc.createElement(PolicyEditorConstants.ANY_OF_ELEMENT);
-// Element actionElement = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(functionOnActions),
-// actions[0].trim(), PolicyEditorConstants.ACTION_CATEGORY_URI, actionId, actionDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// actionElement.appendChild(matchElement);
-// }
-// actionsElement.appendChild(actionElement);
-// } else if(functionOnActions.contains("less") || functionOnActions.contains("greater")){
-//
-// AttributeDesignatorDTO designatorDTO = new AttributeDesignatorDTO();
-// designatorDTO.setCategory(PolicyEditorConstants.ACTION_CATEGORY_URI);
-// designatorDTO.setAttributeId(actionId);
-// designatorDTO.setDataType(actionDataType);
-// designatorDTO.setMustBePresent("true");
-// try {
-// ApplyElementDTO elementDTO = PolicyEditorUtil.
-// processGreaterLessThanFunctions(functionOnActions, actionDataType,
-// actionNames, designatorDTO);
-// applyElementDTO.setApplyElement(elementDTO);
-// } catch (PolicyEditorException e) {
-// //ignore TODO
-// }
-// } else if(functionOnActions.equals(EntitlementPolicyConstants.IS_IN)) {
-// ApplyElementDTO elementDTO = createApplyElementForNonBagFunctions(
-// getFunctionId(functionOnActions),
-// PolicyEditorConstants.ACTION_CATEGORY_URI, actionId, actions[0].trim(), actionDataType);
-// applyElementDTO.setApplyElement(elementDTO);
-// } else {
-// ApplyElementDTO elementDTO = createApplyElementForBagFunctions(
-// getFunctionId(functionOnActions),
-// EntitlementPolicyConstants.ACTION_ELEMENT, actionId, actions, actionDataType);
-// applyElementDTO.setApplyElement(elementDTO);
-// }
-// }
-//
-// if(environmentNames != null && environmentNames.trim().length() > 0) {
-// String[] environments = environmentNames.split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
-// if(environmentId == null || environmentId.trim().length() < 1){
-// environmentId = EntitlementPolicyConstants.ENVIRONMENT_ID;
-// }
-// if(functionOnEnvironment.equals(EntitlementPolicyConstants.EQUAL_TO) ||
-// functionOnEnvironment.equals(EntitlementPolicyConstants.REGEXP_MATCH)) {
-// environmentsElement = doc.createElement(PolicyEditorConstants.ANY_OF_ELEMENT);
-// Element environmentElement = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(functionOnEnvironment),
-// environments[0].trim(), PolicyEditorConstants.ENVIRONMENT_CATEGORY_URI, environmentId, environmentDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// environmentElement.appendChild(matchElement);
-// }
-// environmentsElement.appendChild(environmentElement);
-// } else if(functionOnEnvironment.contains("less") || functionOnEnvironment.contains("greater")){
-//
-// AttributeDesignatorDTO designatorDTO = new AttributeDesignatorDTO();
-// designatorDTO.setCategory(PolicyEditorConstants.ENVIRONMENT_CATEGORY_URI);
-// designatorDTO.setAttributeId(environmentId);
-// designatorDTO.setDataType(environmentDataType);
-// designatorDTO.setMustBePresent("true");
-// try {
-// ApplyElementDTO elementDTO = PolicyEditorUtil.
-// processGreaterLessThanFunctions(functionOnEnvironment, environmentDataType,
-// environmentNames, designatorDTO);
-// applyElementDTO.setApplyElement(elementDTO);
-// } catch (PolicyEditorException e) {
-// //ignore TODO
-// }
-// } else if(functionOnEnvironment.equals(EntitlementPolicyConstants.IS_IN)) {
-// ApplyElementDTO elementDTO = createApplyElementForNonBagFunctions(
-// getFunctionId(functionOnEnvironment),
-// PolicyEditorConstants.ENVIRONMENT_CATEGORY_URI, environmentId, environments[0].trim(), environmentDataType);
-// applyElementDTO.setApplyElement(elementDTO);
-// } else {
-// ApplyElementDTO elementDTO = createApplyElementForBagFunctions(
-// getFunctionId(functionOnEnvironment),
-// PolicyEditorConstants.ENVIRONMENT_CATEGORY_URI, environmentId, environments, environmentDataType);
-// applyElementDTO.setApplyElement(elementDTO);
-// }
-// }
-//
-// if(subjectNames != null && subjectNames.trim().length() > 0) {
-// String[] subjects = subjectNames.split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
-// if(subjectId == null || subjectId.trim().length() < 1){
-// subjectId = EntitlementPolicyConstants.SUBJECT_ID_DEFAULT;
-// }
-//
-// ApplyElementDTO elementDTO = null;
-// if(functionOnSubjects.equals(EntitlementPolicyConstants.EQUAL_TO) ||
-// functionOnSubjects.equals(EntitlementPolicyConstants.REGEXP_MATCH)) {
-// elementDTO = createApplyElementForNonBagFunctionsWithAnyOf(
-// getFunctionId(functionOnSubjects),
-// PolicyEditorConstants.SUBJECT_CATEGORY_URI,subjectId, subjects[0].trim());
-//
-// } else if(functionOnSubjects.contains("less") || functionOnSubjects.contains("greater")){
-//
-// AttributeDesignatorDTO designatorDTO = new AttributeDesignatorDTO();
-// designatorDTO.setCategory(PolicyEditorConstants.ACTION_CATEGORY_URI);
-// designatorDTO.setAttributeId(subjectId);
-// designatorDTO.setDataType(subjectDataType);
-// designatorDTO.setMustBePresent("true");
-// try {
-// elementDTO = PolicyEditorUtil.
-// processGreaterLessThanFunctions(functionOnSubjects, subjectDataType,
-// subjectNames, designatorDTO);
-// applyElementDTO.setApplyElement(elementDTO);
-// } catch (PolicyEditorException e) {
-// //ignore TODO
-// }
-// } else if(functionOnSubjects.equals(EntitlementPolicyConstants.IS_IN)) {
-// elementDTO = createApplyElementForNonBagFunctions(
-// getFunctionId(functionOnSubjects),
-// PolicyEditorConstants.SUBJECT_CATEGORY_URI, subjectId, subjects[0].trim(), subjectDataType);
-// } else {
-// elementDTO = createApplyElementForBagFunctions(
-// getFunctionId(functionOnSubjects),
-// PolicyEditorConstants.SUBJECT_CATEGORY_URI, subjectId, subjects, subjectDataType);
-// }
-//
-// if(elementDTO != null){
-// applyElementDTO.setApplyElement(elementDTO);
-// }
-// }
-//
-// List applyElementDTOs = applyElementDTO.getApplyElements();
-//
-// if(applyElementDTOs.size() > 1) {
-// applyElementDTO.setFunctionId(EntitlementPolicyConstants.FUNCTION_AND);
-// applyElement = createApplyElement(applyElementDTO, doc);
-// } else if(applyElementDTOs.size() == 1){
-// applyElement = createApplyElement(applyElementDTOs.get(0), doc);
-// }
-//
-// if(resourcesElement != null || actionsElement != null || subjectsElement != null ||
-// environmentsElement != null) {
-// targetElement = doc.createElement(EntitlementPolicyConstants.TARGET_ELEMENT);
-// if(resourcesElement != null) {
-// targetElement.appendChild(resourcesElement);
-// }
-// if(actionsElement != null) {
-// targetElement.appendChild(actionsElement);
-// }
-// if(subjectsElement != null) {
-// targetElement.appendChild(subjectsElement);
-// }
-//
-// if(environmentsElement != null){
-// targetElement.appendChild(environmentsElement);
-// }
-// }
-//
-// if(applyElement != null) {
-// conditionElement = doc.createElement(EntitlementPolicyConstants.CONDITION_ELEMENT);
-// conditionElement.appendChild(applyElement);
-// }
-//
-// if(basicRuleDTO.getRuleId() != null && basicRuleDTO.getRuleId().trim().length() > 0 &&
-// basicRuleDTO.getRuleEffect() != null && basicRuleDTO.getRuleEffect().
-// trim().length() > 0){
-//
-// ruleElement = doc.createElement(EntitlementPolicyConstants.RULE_ELEMENT);
-// ruleElement.setAttribute(EntitlementPolicyConstants.RULE_ID, basicRuleDTO.
-// getRuleId());
-// ruleElement.setAttribute(EntitlementPolicyConstants.RULE_EFFECT,
-// basicRuleDTO.getRuleEffect());
-//
-// if(basicRuleDTO.getRuleDescription() != null && basicRuleDTO.
-// getRuleDescription().trim().length() > 0){
-// ruleElement.setAttribute(EntitlementPolicyConstants.RULE_DESCRIPTION,
-// basicRuleDTO.getRuleDescription());
-// }
-//
-// if(targetElement != null) {
-// ruleElement.appendChild(targetElement);
-// }
-// if(conditionElement != null) {
-// ruleElement.appendChild(conditionElement);
-// }
-// }
-//
-// return ruleElement;
-//
-// }
-//
-//
-//
-// public static Element createBasicTargetElementDTO(BasicTargetDTO basicTargetDTO,
-// Document doc) {
-//
-// //TODO
-// String functionOnResources = basicTargetDTO.getFunctionOnResources();
-// String functionOnSubjects = basicTargetDTO.getFunctionOnSubjects();
-// String functionOnActions = basicTargetDTO.getFunctionOnActions();
-// String functionOnEnvironment = basicTargetDTO.getFunctionOnEnvironment();
-// String resourceNames = basicTargetDTO.getResourceList();
-// String actionNames = basicTargetDTO.getActionList();
-// String subjectNames = basicTargetDTO.getSubjectList();
-// String environmentNames = basicTargetDTO.getEnvironmentList();
-// String resourceId = basicTargetDTO.getResourceId();
-// String subjectId = basicTargetDTO.getSubjectId();
-// String actionId = basicTargetDTO.getActionId();
-// String environmentId = basicTargetDTO.getEnvironmentId();
-// String resourceDataType = basicTargetDTO.getResourceDataType();
-// String subjectDataType = basicTargetDTO.getSubjectDataType();
-// String actionDataType = basicTargetDTO.getActionDataType();
-// String environmentDataType = basicTargetDTO.getResourceDataType();
-//
-// Element resourcesElement = null;
-// Element actionsElement = null;
-// Element subjectsElement = null;
-// Element environmentsElement = null;
-// Element targetElement = doc.createElement(EntitlementPolicyConstants.TARGET_ELEMENT);
-//
-// if(resourceNames != null && resourceNames.trim().length() > 0) {
-// resourcesElement = doc.createElement(PolicyEditorConstants.ANY_OF_ELEMENT);
-// Element resourceElement = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// String[] resources = resourceNames.split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
-// if(resourceId == null || resourceId.trim().length() < 1) {
-// resourceId = EntitlementPolicyConstants.RESOURCE_ID;
-// }
-// if(functionOnResources.equals(EntitlementPolicyConstants.EQUAL_TO) ||
-// functionOnResources.equals(EntitlementPolicyConstants.REGEXP_MATCH) ) {
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(functionOnResources),
-// resources[0].trim(), PolicyEditorConstants.RESOURCE_CATEGORY_URI, resourceId, resourceDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// resourceElement.appendChild(matchElement);
-// }
-// resourcesElement.appendChild(resourceElement);
-// } else if(functionOnResources.equals(EntitlementPolicyConstants.AT_LEAST_ONE_MATCH)) {
-// for(String resource : resources){
-// resource = resource.trim();
-// Element resourceEle = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.EQUAL_TO),
-// resource, PolicyEditorConstants.RESOURCE_CATEGORY_URI, resourceId, resourceDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// resourceEle.appendChild(matchElement);
-// }
-// resourcesElement.appendChild(resourceEle);
-// }
-// } else if(functionOnResources.equals(EntitlementPolicyConstants.AT_LEAST_ONE_MATCH_REGEXP)) {
-// for(String resource : resources){
-// resource = resource.trim();
-// Element resourceEle = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.REGEXP_MATCH),
-// resource, PolicyEditorConstants.RESOURCE_CATEGORY_URI, resourceId, resourceDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// resourceEle.appendChild(matchElement);
-// }
-// resourcesElement.appendChild(resourceEle);
-// }
-// } else if(functionOnResources.equals(EntitlementPolicyConstants.MATCH_REGEXP_SET_OF)) {
-// for(String resource : resources){
-// resource = resource.trim();
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.REGEXP_MATCH),
-// resource, PolicyEditorConstants.RESOURCE_CATEGORY_URI, resourceId, resourceDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// resourceElement.appendChild(matchElement);
-// }
-// }
-// resourcesElement.appendChild(resourceElement);
-// }else if(functionOnResources.equals(EntitlementPolicyConstants.SET_OF)) {
-// for(String resource : resources){
-// resource = resource.trim();
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.EQUAL_TO),
-// resource, PolicyEditorConstants.RESOURCE_CATEGORY_URI, resourceId, resourceDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// resourceElement.appendChild(matchElement);
-// }
-// }
-// resourcesElement.appendChild(resourceElement);
-// }
-// }
-//
-// if(actionNames != null && actionNames.trim().length() > 0) {
-// actionsElement = doc.createElement(PolicyEditorConstants.ANY_OF_ELEMENT);
-// Element actionElement = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// String[] actions = actionNames.split(",");
-// if(actionId == null || actionId.trim().length() < 1) {
-// actionId = EntitlementPolicyConstants.ACTION_ID;
-// }
-// if(functionOnActions.equals(EntitlementPolicyConstants.EQUAL_TO) ||
-// functionOnActions.equals(EntitlementPolicyConstants. REGEXP_MATCH)) {
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(functionOnActions),
-// actions[0].trim(), PolicyEditorConstants.ACTION_CATEGORY_URI, actionId, actionDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// actionElement.appendChild(matchElement);
-// }
-// actionsElement.appendChild(actionElement);
-// } else if(functionOnActions.equals(EntitlementPolicyConstants.AT_LEAST_ONE_MATCH)) {
-// for(String action : actions){
-// action = action.trim();
-// Element actionEle = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.EQUAL_TO),
-// action, PolicyEditorConstants.ACTION_CATEGORY_URI, actionId, actionDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// actionEle.appendChild(matchElement);
-// }
-// actionsElement.appendChild(actionEle);
-// }
-// } else if(functionOnActions.equals(EntitlementPolicyConstants.AT_LEAST_ONE_MATCH_REGEXP)) {
-// for(String action : actions){
-// action = action.trim();
-// Element actionEle = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.REGEXP_MATCH),
-// action, PolicyEditorConstants.ACTION_CATEGORY_URI, actionId, actionDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// actionEle.appendChild(matchElement);
-// }
-// actionsElement.appendChild(actionEle);
-// }
-// } else if(functionOnActions.equals(EntitlementPolicyConstants.MATCH_REGEXP_SET_OF)) {
-// for(String action : actions){
-// action = action.trim();
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.REGEXP_MATCH),
-// action, PolicyEditorConstants.ACTION_CATEGORY_URI, actionId, actionDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// actionElement.appendChild(matchElement);
-// }
-// }
-// actionsElement.appendChild(actionElement);
-// } else if(functionOnActions.equals(EntitlementPolicyConstants.SET_OF)) {
-// for(String action : actions){
-// action = action.trim();
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.EQUAL_TO),
-// action, PolicyEditorConstants.ACTION_CATEGORY_URI, actionId, actionDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// actionElement.appendChild(matchElement);
-// }
-// }
-// actionsElement.appendChild(actionElement);
-// }
-//
-// }
-//
-// if(environmentNames != null && environmentNames.trim().length() > 0) {
-// environmentsElement = doc.createElement(PolicyEditorConstants.ANY_OF_ELEMENT);
-// Element environmentElement = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// String[] environments = environmentNames.split(",");
-// if(environmentId == null || environmentId.trim().length() < 1) {
-// environmentId = EntitlementPolicyConstants.ENVIRONMENT_ID;
-// }
-// if(functionOnEnvironment.equals(EntitlementPolicyConstants.EQUAL_TO) ||
-// functionOnEnvironment.equals(EntitlementPolicyConstants.REGEXP_MATCH)) {
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(functionOnEnvironment),
-// environments[0].trim(), PolicyEditorConstants.ENVIRONMENT_CATEGORY_URI, environmentId, environmentDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// environmentElement.appendChild(matchElement);
-// }
-// environmentsElement.appendChild(environmentElement);
-// } else if(functionOnEnvironment.equals(EntitlementPolicyConstants.AT_LEAST_ONE_MATCH)) {
-// for(String environment : environments){
-// environment = environment.trim();
-// Element environmentEle = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.EQUAL_TO),
-// environment, PolicyEditorConstants.ENVIRONMENT_CATEGORY_URI, environmentId, environmentDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// environmentEle.appendChild(matchElement);
-// }
-// environmentsElement.appendChild(environmentEle);
-// }
-// } else if(functionOnEnvironment.equals(EntitlementPolicyConstants.AT_LEAST_ONE_MATCH_REGEXP)) {
-// for(String environment : environments){
-// environment = environment.trim();
-// Element environmentEle = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.REGEXP_MATCH),
-// environment, PolicyEditorConstants.ENVIRONMENT_CATEGORY_URI, environmentId, environmentDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// environmentEle.appendChild(matchElement);
-// }
-// environmentsElement.appendChild(environmentEle);
-// }
-// }else if(functionOnEnvironment.equals(EntitlementPolicyConstants.MATCH_REGEXP_SET_OF)) {
-// for(String environment : environments){
-// environment = environment.trim();
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.REGEXP_MATCH),
-// environment, PolicyEditorConstants.ENVIRONMENT_CATEGORY_URI, environmentId, environmentDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// environmentElement.appendChild(matchElement);
-// }
-// }
-// environmentsElement.appendChild(environmentElement);
-// }else if(functionOnEnvironment.equals(EntitlementPolicyConstants.SET_OF)) {
-// for(String environment : environments){
-// environment = environment.trim();
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.EQUAL_TO),
-// environment, PolicyEditorConstants.ENVIRONMENT_CATEGORY_URI, environmentId, environmentDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// environmentElement.appendChild(matchElement);
-// }
-// }
-// environmentsElement.appendChild(environmentElement);
-// }
-// }
-//
-// if(subjectNames != null && subjectNames.trim().length() > 0) {
-// subjectsElement = doc.createElement(PolicyEditorConstants.ANY_OF_ELEMENT);
-// Element subjectElement = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// String[] subjects = subjectNames.split(",");
-// if(subjectId == null || subjectId.trim().length() < 1){
-// subjectId = EntitlementPolicyConstants.SUBJECT_ID_DEFAULT;
-// }
-//
-// if(EntitlementPolicyConstants.EQUAL_TO.equals(functionOnSubjects) ||
-// EntitlementPolicyConstants.REGEXP_MATCH.equals(functionOnSubjects)) {
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(functionOnSubjects),
-// subjects[0].trim(), PolicyEditorConstants.SUBJECT_CATEGORY_URI, subjectId, subjectDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// subjectElement.appendChild(matchElement);
-// }
-// subjectsElement.appendChild(subjectElement);
-// } else if(EntitlementPolicyConstants.AT_LEAST_ONE_MATCH.equals(functionOnSubjects)){
-// for(String subject : subjects){
-// subject = subject.trim();
-// Element subjectEle = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.EQUAL_TO),
-// subject, PolicyEditorConstants.SUBJECT_CATEGORY_URI, subjectId, subjectDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// subjectEle.appendChild(matchElement);
-// }
-// subjectsElement.appendChild(subjectEle);
-// }
-// } else if(EntitlementPolicyConstants.AT_LEAST_ONE_MATCH_REGEXP.equals(functionOnSubjects)){
-// for(String subject : subjects){
-// subject = subject.trim();
-// Element subjectEle = doc.createElement(PolicyEditorConstants.ALL_OF_ELEMENT);
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.REGEXP_MATCH),
-// subject, PolicyEditorConstants.SUBJECT_CATEGORY_URI, subjectId, subjectDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// subjectEle.appendChild(matchElement);
-// }
-// subjectsElement.appendChild(subjectEle);
-// }
-// } else if(EntitlementPolicyConstants.SET_OF.equals(functionOnSubjects)){
-// for(String subject : subjects){
-// subject = subject.trim();
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.EQUAL_TO),
-// subject, PolicyEditorConstants.SUBJECT_CATEGORY_URI, subjectId, subjectDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// subjectElement.appendChild(matchElement);
-// }
-// }
-// subjectsElement.appendChild(subjectElement);
-// } else if(EntitlementPolicyConstants.MATCH_REGEXP_SET_OF.equals(functionOnSubjects)){
-// for(String subject : subjects){
-// subject = subject.trim();
-// MatchElementDTO matchElementDTO = createMatchElementForNonBagFunctions(
-// getFunctionId(EntitlementPolicyConstants.REGEXP_MATCH),
-// subject, PolicyEditorConstants.SUBJECT_CATEGORY_URI, subjectId, subjectDataType);
-// Element matchElement= createMatchElement(matchElementDTO, doc);
-// if(matchElement != null){
-// subjectElement.appendChild(matchElement);
-// }
-// }
-// subjectsElement.appendChild(subjectElement);
-// }
-// }
-//
-// if(resourcesElement != null) {
-// targetElement.appendChild(resourcesElement);
-// }
-// if(actionsElement != null) {
-// targetElement.appendChild(actionsElement);
-// }
-// if(subjectsElement != null) {
-// targetElement.appendChild(subjectsElement);
-// }
-//
-// if(environmentsElement != null){
-// targetElement.appendChild(environmentsElement);
-// }
-//
-// return targetElement;
-// }
-//
-
- /**
- * Creates XML request from RequestDTO object
- *
- * @param requestDTO
- * @return
- */
- public static RequestElementDTO createRequestElementDTO(RequestDTO requestDTO) {
-
- RequestElementDTO requestElement = new RequestElementDTO();
-
- List rowDTOs = requestDTO.getRowDTOs();
- if (rowDTOs == null || rowDTOs.size() < 1) {
- return requestElement;
- }
-
- Map dtoMap = new HashMap();
- List dtoList = new ArrayList();
-
- for (RowDTO rowDTO : rowDTOs) {
- String category = rowDTO.getCategory();
- String value = rowDTO.getAttributeValue();
- String attributeId = rowDTO.getAttributeId();
- if (category != null && category.trim().length() > 0 && value != null &&
- value.trim().length() > 0 && attributeId != null && attributeId.trim().length() > 0) {
-
- if (requestDTO.isMultipleRequest()) {
- String[] values = value.split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
- for (String attributeValue : values) {
- AttributesElementDTO attributesElementDTO = new AttributesElementDTO();
- attributesElementDTO.setCategory(category);
-
- AttributeElementDTO attributeElementDTO = new AttributeElementDTO();
- attributeElementDTO.addAttributeValue(attributeValue);
- attributeElementDTO.setAttributeId(attributeId);
- attributeElementDTO.setIncludeInResult(rowDTO.isNotCompleted());
- attributesElementDTO.addAttributeElementDTO(attributeElementDTO);
- if (rowDTO.getAttributeDataType() != null && rowDTO.
- getAttributeDataType().trim().length() > 0) {
- attributeElementDTO.setDataType(rowDTO.getAttributeDataType());
- } else {
- attributeElementDTO.setDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
- }
- dtoList.add(attributesElementDTO);
- }
-
- } else {
- AttributesElementDTO attributesElementDTO = dtoMap.get(category);
- if (attributesElementDTO == null) {
- attributesElementDTO = new AttributesElementDTO();
- attributesElementDTO.setCategory(category);
- }
-
- String[] values = value.split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
- AttributeElementDTO attributeElementDTO = new AttributeElementDTO();
- attributeElementDTO.setAttributeValues(Arrays.asList(values));
- attributeElementDTO.setAttributeId(attributeId);
- attributeElementDTO.setIncludeInResult(rowDTO.isNotCompleted());
- attributesElementDTO.addAttributeElementDTO(attributeElementDTO);
- if (rowDTO.getAttributeDataType() != null && rowDTO.
- getAttributeDataType().trim().length() > 0) {
- attributeElementDTO.setDataType(rowDTO.getAttributeDataType());
- } else {
- attributeElementDTO.setDataType(EntitlementPolicyConstants.STRING_DATA_TYPE);
- }
- dtoMap.put(category, attributesElementDTO);
- }
- }
- }
-
- requestElement.setMultipleRequest(requestDTO.isMultipleRequest());
- requestElement.setCombinedDecision(requestDTO.isCombinedDecision());
- requestElement.setReturnPolicyIdList(requestDTO.isReturnPolicyIdList());
- if (!requestDTO.isMultipleRequest()) {
- dtoList = new ArrayList();
- for (Map.Entry entry : dtoMap.entrySet()) {
- dtoList.add(entry.getValue());
- }
- }
- requestElement.setAttributesElementDTOs(dtoList);
- return requestElement;
- }
-
-
-// public static TargetElementDTO createTargetElementDTOs(String policy)
-// throws EntitlementPolicyCreationException {
-//
-// TargetElementDTO targetElementDTO = null;
-// OMElement omElement;
-// try {
-// omElement = AXIOMUtil.stringToOM(policy);
-// } catch (XMLStreamException e) {
-// throw new EntitlementPolicyCreationException("Policy can not be converted to OMElement");
-// }
-//
-// if (omElement != null) {
-// Iterator iterator = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// TARGET_ELEMENT);
-// while(iterator.hasNext()){
-// OMElement targetElement = (OMElement)iterator.next();
-// targetElementDTO = createTargetElementDTO(targetElement, null);
-// }
-// }
-// return targetElementDTO;
-// }
-
-
-//
-//
-//
-// public static PolicySetDTO createPolicySetDTO(String policySet)
-// throws EntitlementPolicyCreationException {
-// PolicySetDTO policySetDTO = new PolicySetDTO();
-// OMElement omElement;
-// try {
-// omElement = AXIOMUtil.stringToOM(policySet);
-// } catch (XMLStreamException e) {
-// throw new EntitlementPolicyCreationException("Policy can not be converted to OMElement");
-// }
-//
-// if(omElement != null){
-// policySetDTO.setPolicySetId(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.POLICY_SET_ID)));
-//
-// String policyCombiningAlgorithm = omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.POLICY_ALGORITHM));
-// //TODO
-//
-// if(policyCombiningAlgorithm.contains(PolicyEditorConstants.POLICY_ALGORITHM_IDENTIFIER_1)){
-// policySetDTO.setPolicyCombiningAlgId(policyCombiningAlgorithm.
-// split(PolicyEditorConstants.POLICY_ALGORITHM_IDENTIFIER_1)[1]);
-// } else {
-// policySetDTO.setPolicyCombiningAlgId(policyCombiningAlgorithm.
-// split(PolicyEditorConstants.POLICY_ALGORITHM_IDENTIFIER_3)[1]);
-// }
-//
-// Iterator iterator1 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// DESCRIPTION_ELEMENT);
-//
-// if(iterator1.hasNext()){
-// OMElement descriptionElement = (OMElement) iterator1.next();
-// if(descriptionElement != null && descriptionElement.getText() != null){
-// policySetDTO.setDescription(descriptionElement.getText().trim());
-// }
-// }
-//
-//
-// Iterator iterator2 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// POLICY_ELEMENT);
-// while(iterator2.hasNext()){
-// OMElement policyElement = (OMElement)iterator2.next();
-// if(policyElement != null){
-// policySetDTO.setPolicyIds(policyElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.POLICY_ID)));
-// }
-// }
-//
-// Iterator iterator3 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// POLICY_SET_ELEMENT);
-// while(iterator3.hasNext()){
-// OMElement policySetElement = (OMElement)iterator3.next();
-// if(policySetElement != null){
-// policySetDTO.setPolicyIds(policySetElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.POLICY_SET_ID)));
-// }
-// }
-//
-// Iterator iterator4 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// POLICY_SET_REFERENCE);
-// while(iterator4.hasNext()){
-// OMElement policySetReferenceElement = (OMElement)iterator4.next();
-// if(policySetReferenceElement != null){
-// policySetDTO.setPolicyIds(policySetReferenceElement.getText().trim());
-// }
-// }
-//
-// Iterator iterator5 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// POLICY_REFERENCE);
-// while(iterator5.hasNext()){
-// OMElement policyReferenceElement = (OMElement)iterator5.next();
-// if(policyReferenceElement != null){
-// policySetDTO.setPolicyIds(policyReferenceElement.getText().trim());
-// }
-// }
-//
-// }
-//
-// return policySetDTO;
-// }
-//
-
-//
-// public static ConditionElementDT0 createConditionElementDT0(OMElement omElement){
-// ConditionElementDT0 conditionElementDT0 = new ConditionElementDT0();
-// if(omElement != null){
-// Iterator iterator = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// APPLY_ELEMENT);
-// while(iterator.hasNext()){
-// OMElement applyElement = (OMElement)iterator.next();
-// ApplyElementDTO applyElementDTO = new ApplyElementDTO();
-// conditionElementDT0.setApplyElement(createApplyElementDTO(applyElementDTO,
-// applyElement, 0, 0, ""));
-// }
-// }
-// return conditionElementDT0;
-// }
-//
-// public static ApplyElementDTO createApplyElementDTO(ApplyElementDTO applyElementDTO,
-// OMElement omElement , int applyElementNo,
-// int addApplyElementNo, String applyElementId){
-// if(applyElementDTO == null){
-// applyElementDTO = new ApplyElementDTO();
-// }
-// if(omElement != null){
-// applyElementNo ++;
-//
-// applyElementId = applyElementId + "/" + applyElementNo;
-// applyElementDTO.setApplyElementNumber(applyElementNo);
-//// applyElementDTO.setAddApplyElementPageNumber(addApplyElementNo);
-// applyElementDTO.setApplyElementId(applyElementId);
-// applyElementDTO.setFunctionId(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.FUNCTION_ID)));
-// Iterator iterator1 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// APPLY_ELEMENT);
-// while(iterator1.hasNext()){
-// OMElement applyElement = (OMElement)iterator1.next();
-// ApplyElementDTO elementDTO = createApplyElementDTO(null, applyElement,applyElementNo,
-// addApplyElementNo, applyElementId);
-// applyElementNo = elementDTO.getApplyElementNumber() + 1;
-// applyElementDTO.setApplyElement(elementDTO);
-// }
-//
-// Iterator iterator2 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// SUBJECT_ELEMENT + EntitlementPolicyConstants.ATTRIBUTE_DESIGNATOR);
-// int attributeDesignatorElementNo = 0;
-// while(iterator2.hasNext()){
-// OMElement attributeDesignatorElement = (OMElement)iterator2.next();
-// applyElementDTO.setAttributeDesignators(createAttributeDesignatorDTO(
-// attributeDesignatorElement, addApplyElementNo,
-// EntitlementPolicyConstants.SUBJECT_ELEMENT, attributeDesignatorElementNo, applyElementId));
-// attributeDesignatorElementNo ++;
-// }
-//
-// Iterator iterator3 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// RESOURCE_ELEMENT + EntitlementPolicyConstants.ATTRIBUTE_DESIGNATOR);
-//
-// while(iterator3.hasNext()){
-// OMElement attributeDesignatorElement = (OMElement)iterator3.next();
-// applyElementDTO.setAttributeDesignators(createAttributeDesignatorDTO(
-// attributeDesignatorElement, addApplyElementNo,
-// EntitlementPolicyConstants.RESOURCE_ELEMENT, 0, applyElementId));
-// attributeDesignatorElementNo ++;
-// }
-//
-// Iterator iterator4 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// ACTION_ELEMENT + EntitlementPolicyConstants.ATTRIBUTE_DESIGNATOR);
-//
-// while(iterator4.hasNext()){
-// OMElement attributeDesignatorElement = (OMElement)iterator4.next();
-// applyElementDTO.setAttributeDesignators(createAttributeDesignatorDTO(
-// attributeDesignatorElement, addApplyElementNo,
-// EntitlementPolicyConstants.ACTION_ELEMENT, 0, applyElementId));
-// attributeDesignatorElementNo ++;
-// }
-//
-// Iterator iterator5 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// ENVIRONMENT_ELEMENT + EntitlementPolicyConstants.ATTRIBUTE_DESIGNATOR);
-//
-// while(iterator5.hasNext()){
-// OMElement attributeDesignatorElement = (OMElement)iterator5.next();
-// applyElementDTO.setAttributeDesignators(createAttributeDesignatorDTO(
-// attributeDesignatorElement, addApplyElementNo,
-// EntitlementPolicyConstants.ENVIRONMENT_ELEMENT, 0, applyElementId));
-// attributeDesignatorElementNo ++;
-// }
-//
-// Iterator iterator6 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// ATTRIBUTE_VALUE);
-// int attributeValueElementNo = 0;
-// while(iterator6.hasNext()){
-// AttributeValueElementDTO attributeValueElementDTO = new AttributeValueElementDTO();
-// OMElement attributeValueElement = (OMElement)iterator6.next();
-// attributeValueElementDTO.setAttributeDataType(attributeValueElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.DATA_TYPE)));
-// attributeValueElementDTO.setAttributeValue(attributeValueElement.getText());
-// attributeValueElementDTO.setApplyElementNumber(addApplyElementNo);
-// attributeValueElementDTO.setApplyElementId(applyElementId);
-// attributeValueElementDTO.setElementId(attributeValueElementNo);
-// applyElementDTO.setAttributeValueElementDTO(attributeValueElementDTO);
-// attributeValueElementNo ++;
-// }
-//
-// Iterator iterator7 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// FUNCTION);
-//
-// while(iterator7.hasNext()){
-// OMElement functionElement = (OMElement)iterator7.next();
-// applyElementDTO.setFunctionFunctionId(functionElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.FUNCTION_ID)));
-// }
-//
-// Iterator iterator8 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// ENVIRONMENT_ELEMENT + EntitlementPolicyConstants.ATTRIBUTE_SELECTOR);
-// int attributeSelectorElementNo = 0;
-// while(iterator8.hasNext()){
-// OMElement attributeSelectorElement = (OMElement)iterator8.next();
-// applyElementDTO.setAttributeSelectors(createAttributeSelectorDTO(
-// attributeSelectorElement, addApplyElementNo, attributeSelectorElementNo, applyElementId));
-// attributeSelectorElementNo ++;
-// }
-//
-// applyElementDTO.setAttributeValueElementCount(attributeValueElementNo);
-// applyElementDTO.setAttributeDesignatorsElementCount(attributeDesignatorElementNo);
-// applyElementDTO.setAttributeSelectorElementCount(attributeSelectorElementNo);
-// }
-// return applyElementDTO;
-// }
-//
-// public static TargetElementDTO createTargetElementDTO(OMElement omElement, String ruleId){
-//
-// TargetElementDTO targetElementDTO = new TargetElementDTO();
-// List subElementDTOs = new ArrayList();
-// int subElementId = 0;
-//
-// if(omElement != null){
-// if(omElement.getChildrenWithLocalName(EntitlementPolicyConstants.RESOURCE_ELEMENT + "s").
-// hasNext()){
-// OMElement element = (OMElement) omElement.getChildrenWithLocalName(
-// EntitlementPolicyConstants.RESOURCE_ELEMENT + "s").next();
-// Iterator iterator1 = element.getChildrenWithLocalName(EntitlementPolicyConstants.
-// RESOURCE_ELEMENT);
-// while(iterator1.hasNext()){
-// OMElement resourceElement = (OMElement)iterator1.next();
-// subElementDTOs.add(createSubElementDTO(resourceElement, ruleId,
-// EntitlementPolicyConstants.RESOURCE_ELEMENT, subElementId));
-// subElementId ++;
-// }
-// }
-//
-// if(omElement.getChildrenWithLocalName(EntitlementPolicyConstants.SUBJECT_ELEMENT + "s").
-// hasNext()){
-// OMElement element = (OMElement) omElement.getChildrenWithLocalName(
-// EntitlementPolicyConstants.SUBJECT_ELEMENT + "s").next();
-// Iterator iterator2 = element.getChildrenWithLocalName(EntitlementPolicyConstants.
-// SUBJECT_ELEMENT);
-// while(iterator2.hasNext()){
-// OMElement resourceElement = (OMElement)iterator2.next();
-// subElementDTOs.add(createSubElementDTO(resourceElement,ruleId,
-// EntitlementPolicyConstants.SUBJECT_ELEMENT, subElementId));
-// subElementId ++;
-// }
-// }
-//
-// if(omElement.getChildrenWithLocalName(EntitlementPolicyConstants.ACTION_ELEMENT + "s").
-// hasNext()){
-// OMElement element = (OMElement) omElement.getChildrenWithLocalName(
-// EntitlementPolicyConstants.ACTION_ELEMENT + "s").next();
-// Iterator iterator3 = element.getChildrenWithLocalName(EntitlementPolicyConstants.
-// ACTION_ELEMENT);
-// while(iterator3.hasNext()){
-// OMElement resourceElement = (OMElement)iterator3.next();
-// subElementDTOs.add(createSubElementDTO(resourceElement,ruleId,
-// EntitlementPolicyConstants.ACTION_ELEMENT, subElementId));
-// subElementId ++;
-// }
-// }
-//
-// if(omElement.getChildrenWithLocalName(EntitlementPolicyConstants.SUBJECT_ELEMENT + "s").
-// hasNext()){
-// OMElement element = (OMElement) omElement.getChildrenWithLocalName(
-// EntitlementPolicyConstants.SUBJECT_ELEMENT + "s").next();
-// Iterator iterator4 = element.getChildrenWithLocalName(EntitlementPolicyConstants.
-// ENVIRONMENT_ELEMENT);
-// while(iterator4.hasNext()){
-// OMElement resourceElement = (OMElement)iterator4.next();
-// subElementDTOs.add(createSubElementDTO(resourceElement,ruleId,
-// EntitlementPolicyConstants.ENVIRONMENT_ELEMENT, subElementId));
-// subElementId ++;
-// }
-// }
-// }
-//
-// targetElementDTO.setSubElementDTOs(subElementDTOs);
-// targetElementDTO.setSubElementCount(subElementId);
-//
-// return targetElementDTO;
-// }
-//
-// public static SubElementDTO createSubElementDTO(OMElement omElement, String ruleId,
-// String subElementName, int subElementId){
-//
-// SubElementDTO subElementDTO = new SubElementDTO();
-// subElementDTO.setElementName(subElementName);
-// subElementDTO.setElementId(subElementId);
-// subElementDTO.setRuleId(ruleId);
-// int matchElementId = 0;
-// if(omElement != null){
-// Iterator iterator1 = omElement.getChildrenWithLocalName(subElementName +
-// EntitlementPolicyConstants.MATCH_ELEMENT);
-//
-// while(iterator1.hasNext()){
-// MatchElementDTO matchElementDTO = new MatchElementDTO();
-// OMElement matchElement = (OMElement)iterator1.next();
-// matchElementDTO.setMatchElementName(subElementName);
-// matchElementDTO.setElementId(matchElementId);
-// matchElementDTO.setRuleElementName(ruleId);
-// matchElementDTO.setMatchId(matchElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.MATCH_ID)));
-//
-// Iterator iterator2 = matchElement.getChildrenWithLocalName(subElementName +
-// EntitlementPolicyConstants.ATTRIBUTE_DESIGNATOR);
-//
-// while(iterator2.hasNext()){
-// OMElement attributeDesignatorElement = (OMElement)iterator2.next();
-// matchElementDTO.setAttributeDesignatorDTO(createAttributeDesignatorDTO(
-// attributeDesignatorElement, 0, subElementName, 0, ""));
-// }
-//
-// Iterator iterator3 = matchElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// ATTRIBUTE_VALUE);
-//
-// while(iterator3.hasNext()){
-// AttributeValueElementDTO attributeValueElementDTO = new AttributeValueElementDTO();
-// OMElement attributeValueElement = (OMElement)iterator3.next();
-// attributeValueElementDTO.setAttributeDataType(attributeValueElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.DATA_TYPE)));
-// attributeValueElementDTO.setAttributeValue(attributeValueElement.getText());
-// matchElementDTO.setAttributeValueElementDTO(attributeValueElementDTO);
-// }
-//
-// Iterator iterator4 = matchElement.getChildrenWithLocalName(subElementName +
-// EntitlementPolicyConstants.ATTRIBUTE_SELECTOR);
-// while(iterator4.hasNext()){
-// OMElement attributeSelectorElement = (OMElement)iterator4.next();
-// matchElementDTO.setAttributeSelectorDTO(createAttributeSelectorDTO(
-// attributeSelectorElement, 0, 0, ""));
-// }
-// matchElementId ++;
-// subElementDTO.setMatchElementDTOs(matchElementDTO);
-// }
-// }
-// subElementDTO.setMatchElementCount(matchElementId);
-//
-// return subElementDTO;
-// }
-//
-// /**
-// * This method creates the AttributeDesignatorDTO object using matchElement
-// * @param omElement attributeDesignator OMElement
-// * @param applyElementNo if attributeDesignator element is embed in a apply element, its number
-// * @param elementName attributeSelectorElement number to uniquely identification
-// * @param matchElementId match element id to identity the element
-// * @param applyElementId apply element id to identity the element
-// * @return AttributeDesignatorDTO object
-// */
-// public static AttributeDesignatorDTO createAttributeDesignatorDTO(OMElement omElement,
-// int applyElementNo,
-// String elementName,
-// int matchElementId,
-// String applyElementId){
-// AttributeDesignatorDTO attributeDesignatorDTO = new AttributeDesignatorDTO();
-//
-// if(omElement != null){
-// attributeDesignatorDTO.setAttributeId(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.ATTRIBUTE_ID)));
-// attributeDesignatorDTO.setDataType(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.DATA_TYPE)));
-// attributeDesignatorDTO.setIssuer(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.ISSUER)));
-// attributeDesignatorDTO.setMustBePresent(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.MUST_BE_PRESENT)));
-// attributeDesignatorDTO.setApplyElementNumber(applyElementNo);
-// attributeDesignatorDTO.setElementName(elementName);
-// attributeDesignatorDTO.setElementId(matchElementId);
-// attributeDesignatorDTO.setApplyElementId(applyElementId);
-// }
-// return attributeDesignatorDTO;
-// }
-//
-// /**
-// * This method creates the AttributeSelectorDTO object using matchElement
-// * @param omElement attributeSelector OMElement
-// * @param applyElementNo if attributeSelector element is embed in a apply element, its number
-// * @param attributeSelectorElementNo attributeSelectorElement number to uniquely identification
-// * @param applyElementId apply element id to identity the element
-// * @return AttributeSelectorDTO object
-// */
-// public static AttributeSelectorDTO createAttributeSelectorDTO(OMElement omElement,
-// int applyElementNo,
-// int attributeSelectorElementNo,
-// String applyElementId){
-// AttributeSelectorDTO attributeSelectorDTO = new AttributeSelectorDTO();
-//
-// if(omElement != null){
-// attributeSelectorDTO.setAttributeSelectorDataType(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.DATA_TYPE)));
-// attributeSelectorDTO.setAttributeSelectorRequestContextPath(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.REQUEST_CONTEXT_PATH)));
-// attributeSelectorDTO.setAttributeSelectorMustBePresent(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.MUST_BE_PRESENT)));
-// attributeSelectorDTO.setApplyElementNumber(applyElementNo);
-// attributeSelectorDTO.setElementNumber(attributeSelectorElementNo);
-// attributeSelectorDTO.setApplyElementId(applyElementId);
-// }
-// return attributeSelectorDTO;
-// }
-//
-// /**
-// *
-// * @param applyElementDTO
-// * @param attributeValueElementNumber
-// * @return
-// */
-// public static int getAttributeValueElementCount(ApplyElementDTO applyElementDTO,
-// int attributeValueElementNumber){
-// attributeValueElementNumber = applyElementDTO.getAttributeValueElementCount();
-// List applyElementDTOs = applyElementDTO.getApplyElements();
-// for(ApplyElementDTO elementDTO : applyElementDTOs){
-// attributeValueElementNumber = attributeValueElementNumber +
-// getAttributeValueElementCount(elementDTO, attributeValueElementNumber);
-// }
-// return attributeValueElementNumber;
-// }
-//
-// public static int getAttributeDesignatorElementCount(ApplyElementDTO applyElementDTO,
-// int attributeDesignatorElementNumber){
-// attributeDesignatorElementNumber = attributeDesignatorElementNumber + applyElementDTO.
-// getAttributeDesignatorsElementCount();
-// List applyElementDTOs = applyElementDTO.getApplyElements();
-// for(ApplyElementDTO elementDTO : applyElementDTOs){
-// attributeDesignatorElementNumber = attributeDesignatorElementNumber +
-// getAttributeDesignatorElementCount(elementDTO, attributeDesignatorElementNumber);
-// }
-// return attributeDesignatorElementNumber;
-// }
-//
-// public static int getAttributeSelectorElementCount(ApplyElementDTO applyElementDTO,
-// int attributeSelectorElementNumber){
-// attributeSelectorElementNumber = attributeSelectorElementNumber + applyElementDTO.
-// getAttributeSelectorElementCount();
-// List applyElementDTOs = applyElementDTO.getApplyElements();
-// for(ApplyElementDTO elementDTO : applyElementDTOs){
-// attributeSelectorElementNumber = attributeSelectorElementNumber +
-// getAttributeSelectorElementCount(elementDTO, attributeSelectorElementNumber);
-// }
-// return attributeSelectorElementNumber;
-// }
-//
-// /**
-// * This method creates policy set element
-// * @param policySetDTO PolicySetDTO
-// * @param doc Document
-// * @return DOM Element of Policy Set
-// * @throws EntitlementPolicyCreationException throw exception
-// */
-// public static Element createPolicySetElement(PolicySetDTO policySetDTO, Document doc)
-// throws EntitlementPolicyCreationException {
-//
-// Element policySetElement = doc.createElement(EntitlementPolicyConstants.POLICY_SET_ELEMENT);
-// Element targetElement = null;
-// policySetElement.setAttribute("xmlns", EntitlementPolicyConstants.XACML3_POLICY_NAMESPACE);
-//
-// if(policySetDTO.getPolicySetId() != null && policySetDTO.getPolicySetId().trim().length() > 0) {
-// policySetElement.setAttribute(EntitlementPolicyConstants.POLICY_SET_ID, policySetDTO.
-// getPolicySetId());
-// }
-//
-// String combiningAlgId = policySetDTO.getPolicyCombiningAlgId();
-// if(combiningAlgId != null && combiningAlgId.trim().length() > 0) {
-//
-// if(PolicyEditorConstants.CombiningAlog.ONLY_ONE_APPLICABLE_ID.equals(combiningAlgId) ||
-// PolicyEditorConstants.CombiningAlog.FIRST_APPLICABLE_ID.equals(combiningAlgId)){
-// policySetElement.setAttribute(EntitlementPolicyConstants.POLICY_ALGORITHM,
-// PolicyEditorConstants.POLICY_ALGORITHM_IDENTIFIER_1 + combiningAlgId);
-// } else {
-// policySetElement.setAttribute(EntitlementPolicyConstants.POLICY_ALGORITHM,
-// PolicyEditorConstants.POLICY_ALGORITHM_IDENTIFIER_3 + combiningAlgId);
-// }
-// }
-//
-// if(policySetDTO.getVersion() != null && policySetDTO.getVersion().trim().length() > 0){
-// policySetElement.setAttribute(EntitlementPolicyConstants.POLICY_VERSION,
-// policySetDTO.getVersion());
-// } else {
-// // policy version is handled by wso2 registry. therefore we can ignore it, although it
-// // is a required attribute
-// policySetElement.setAttribute(EntitlementPolicyConstants.POLICY_VERSION, "1.0");
-// }
-//
-//
-// Element descriptionElement = doc.createElement(EntitlementPolicyConstants.
-// DESCRIPTION_ELEMENT);
-// if(policySetDTO.getDescription() != null && policySetDTO.
-// getDescription().trim().length() > 0) {
-// descriptionElement.setTextContent(policySetDTO.getDescription());
-// policySetElement.appendChild(descriptionElement);
-// } else {
-// String description = "This is " + policySetDTO.getPolicySetId() + " policy set";
-// descriptionElement.setTextContent(description);
-// policySetElement.appendChild(descriptionElement);
-// }
-//
-//// if(policySetDTO.getTargetElementDTO() != null && // TODO
-//// policySetDTO.getTargetElementDTO().getSubElementDTOs() != null){
-//// if(policySetDTO.getTargetElementDTO().getSubElementDTOs().size() > 0){
-//// targetElement = PolicyEditorUtil.createTargetElement(policySetDTO.getTargetElementDTO().
-//// getSubElementDTOs(), doc);
-//// }
-//// } else if(policySetDTO.getBasicTargetDTO() != null){
-//// targetElement = createBasicTargetElementDTO(policySetDTO.getBasicTargetDTO(), doc);
-//// }
-//
-// if(targetElement != null){
-// policySetElement.appendChild(targetElement);
-// } else {
-// targetElement = doc.createElement(EntitlementPolicyConstants.TARGET_ELEMENT);
-// policySetElement.appendChild(targetElement);
-// }
-//
-// if(policySetDTO.getPolicyIdReferences() != null && policySetDTO.getPolicyIdReferences().size() > 0){
-// for(String policeReferences : policySetDTO.getPolicyIdReferences()){
-// Element policeReferencesElement = doc.
-// createElement(EntitlementPolicyConstants.POLICY_REFERENCE);
-// policeReferencesElement.setTextContent(policeReferences);
-// policySetElement.appendChild(policeReferencesElement);
-// }
-// }
-//
-// if(policySetDTO.getPolicySetIdReferences() != null && policySetDTO.getPolicySetIdReferences().size() > 0){
-// for(String policeSetReferences : policySetDTO.getPolicySetIdReferences()){
-// Element policeSetReferencesElement = doc.
-// createElement(EntitlementPolicyConstants.POLICY_SET_REFERENCE);
-// policeSetReferencesElement.setTextContent(policeSetReferences);
-// policySetElement.appendChild(policeSetReferencesElement);
-// }
-// }
-// return policySetElement;
-// }
-//
-// /**
-// * Convert XACML policy Document element to a String object
-// * @param doc Document element
-// * @return String XACML policy
-// * @throws EntitlementPolicyCreationException throws when transform fails
-// */
-// public static String getStringFromDocument(Document doc) throws EntitlementPolicyCreationException {
-// try {
-//
-// DOMSource domSource = new DOMSource(doc);
-// StringWriter writer = new StringWriter();
-// StreamResult result = new StreamResult(writer);
-// TransformerFactory transformerFactory = TransformerFactory.newInstance();
-// Transformer transformer = transformerFactory.newTransformer();
-// transformer.transform(domSource, result);
-// return writer.toString().substring(writer.toString().indexOf('>') + 1);
-//
-// } catch(TransformerException e){
-// throw new EntitlementPolicyCreationException("While transforming policy element to String", e);
-// }
-// }
-//
-// /**
-// * Select relavent function ID for given function name
-// * @param functionName function name as String argument
-// * @return returns function ID
-// */
-// private static String getFunctionId(String functionName){
-//
-// String functionId;
-//
-// if(functionName.equals(EntitlementPolicyConstants.REGEXP_MATCH)){
-// functionId = EntitlementPolicyConstants.FUNCTION_REGEXP;
-// } else if(functionName.equals(EntitlementPolicyConstants.IS_IN)){
-// functionId = EntitlementPolicyConstants.FUNCTION_IS_IN;
-// } else if(functionName.equals(EntitlementPolicyConstants.SET_OF)){
-// functionId = EntitlementPolicyConstants.FUNCTION_SET_EQUAL;
-// } else if(functionName.equals(EntitlementPolicyConstants.SUBSET_OF)){
-// functionId = EntitlementPolicyConstants.FUNCTION_SUBSET;
-// } else if(functionName.equals(EntitlementPolicyConstants.AT_LEAST)){
-// functionId = EntitlementPolicyConstants.FUNCTION_AT_LEAST;
-// } else {
-// functionId = EntitlementPolicyConstants.FUNCTION_EQUAL;
-// }
-//
-// return functionId;
-// }
-//
-//
-//// /**
-//// * create policy meta data that helps to edit the policy using basic editor
-//// * @param order of the rule element are decided by this
-//// * @return String Array to dent to back end
-//// */
-//// public static String[] generateBasicPolicyEditorData(TargetDTO basicTargetDTO,
-//// List ruleDTOs,
-//// String ruleElementOrder){
-////
-//// List policyMetaDataList = new ArrayList();
-////
-//// if(basicTargetDTO != null){
-//// List rowDTOs = basicTargetDTO.getRowDTOList();
-//// for(RowDTO rowDTO : rowDTOs){
-//// createMetaDataFromRowDTO("target", rowDTO, policyMetaDataList);
-//// }
-//// }
-////
-//// if(ruleDTOs != null && ruleDTOs.size() > 0){
-//// if(ruleElementOrder != null && ruleElementOrder.trim().length() > 0){
-//// String[] ruleIds = ruleElementOrder.
-//// split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
-//// for(String ruleId : ruleIds){
-//// for(RuleDTO ruleDTO : ruleDTOs) {
-//// if(ruleId.trim().equals(ruleDTO.getRuleId())){
-//// List rowDTOs = ruleDTO.getRowDTOList();
-//// if(rowDTOs != null && rowDTOs.size() > 0){
-//// for(RowDTO rowDTO : rowDTOs){
-//// createMetaDataFromRowDTO("rule" + ruleId, rowDTO,
-//// policyMetaDataList);
-//// }
-//// }
-////
-//// if(ruleDTO.getTargetDTO() != null &&
-//// ruleDTO.getTargetDTO().getRowDTOList() != null){
-//// for(RowDTO rowDTO : ruleDTO.getTargetDTO().getRowDTOList()){
-//// createMetaDataFromRowDTO("ruleTarget" + ruleId, rowDTO,
-//// policyMetaDataList);
-//// }
-//// }
-//// }
-//// }
-//// }
-//// } else {
-//// for(RuleDTO ruleDTO : ruleDTOs) {
-//// List rowDTOs = ruleDTO.getRowDTOList();
-//// if(rowDTOs != null && rowDTOs.size() > 0){
-//// for(RowDTO rowDTO : rowDTOs){
-//// createMetaDataFromRowDTO("rule" + ruleDTO.getRuleId(), rowDTO,
-//// policyMetaDataList);
-//// }
-//// }
-////
-//// if(ruleDTO.getTargetDTO() != null &&
-//// ruleDTO.getTargetDTO().getRowDTOList() != null){
-//// for(RowDTO rowDTO : ruleDTO.getTargetDTO().getRowDTOList()){
-//// createMetaDataFromRowDTO("ruleTarget" + ruleDTO.getRuleId(), rowDTO,
-//// policyMetaDataList);
-//// }
-//// }
-//// }
-//// }
-//// }
-////
-//// return policyMetaDataList.toArray(new String[policyMetaDataList.size()]);
-//// }
-//
-//
-// private static void createMetaDataFromRowDTO(String prefix, RowDTO rowDTO, List metaDataList){
-//
-// if(metaDataList != null){
-// metaDataList.add(prefix + "|" + rowDTO.getCategory());
-// metaDataList.add(prefix + "|" + rowDTO.getPreFunction());
-// metaDataList.add(prefix + "|" + rowDTO.getFunction());
-// metaDataList.add(prefix + "|" + rowDTO.getAttributeValue());
-// metaDataList.add(prefix + "|" + rowDTO.getAttributeId());
-// metaDataList.add(prefix + "|" + rowDTO.getAttributeDataType());
-// metaDataList.add(prefix + "|" + rowDTO.getCombineFunction());
-// }
-// }
-
-}
\ No newline at end of file
diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/util/PolicyEditorUtil.java b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/util/PolicyEditorUtil.java
deleted file mode 100644
index 5234a1cb0fb7..000000000000
--- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/src/main/java/org/wso2/carbon/identity/entitlement/ui/util/PolicyEditorUtil.java
+++ /dev/null
@@ -1,3025 +0,0 @@
-/*
-* Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-* WSO2 Inc. 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.identity.entitlement.ui.util;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.util.AXIOMUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.wso2.balana.utils.Constants.PolicyConstants;
-import org.wso2.balana.utils.exception.PolicyBuilderException;
-import org.wso2.balana.utils.policy.PolicyBuilder;
-import org.wso2.balana.utils.policy.dto.AllOfElementDTO;
-import org.wso2.balana.utils.policy.dto.AnyOfElementDTO;
-import org.wso2.balana.utils.policy.dto.ApplyElementDTO;
-import org.wso2.balana.utils.policy.dto.AttributeAssignmentElementDTO;
-import org.wso2.balana.utils.policy.dto.AttributeDesignatorDTO;
-import org.wso2.balana.utils.policy.dto.AttributeSelectorDTO;
-import org.wso2.balana.utils.policy.dto.AttributeValueElementDTO;
-import org.wso2.balana.utils.policy.dto.BasicPolicyDTO;
-import org.wso2.balana.utils.policy.dto.BasicRuleDTO;
-import org.wso2.balana.utils.policy.dto.BasicTargetDTO;
-import org.wso2.balana.utils.policy.dto.ConditionElementDT0;
-import org.wso2.balana.utils.policy.dto.MatchElementDTO;
-import org.wso2.balana.utils.policy.dto.ObligationElementDTO;
-import org.wso2.balana.utils.policy.dto.PolicyElementDTO;
-import org.wso2.balana.utils.policy.dto.RuleElementDTO;
-import org.wso2.balana.utils.policy.dto.TargetElementDTO;
-import org.wso2.carbon.identity.entitlement.common.EntitlementConstants;
-import org.wso2.carbon.identity.entitlement.common.PolicyEditorEngine;
-import org.wso2.carbon.identity.entitlement.common.PolicyEditorException;
-import org.wso2.carbon.identity.entitlement.common.dto.PolicyEditorDataHolder;
-import org.wso2.carbon.identity.entitlement.ui.EntitlementPolicyConstants;
-import org.wso2.carbon.identity.entitlement.ui.EntitlementPolicyCreationException;
-import org.wso2.carbon.identity.entitlement.ui.PolicyEditorConstants;
-import org.wso2.carbon.identity.entitlement.ui.dto.ExtendAttributeDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.ObligationDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.PolicyDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.PolicyRefIdDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.PolicySetDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.RowDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.RuleDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.SimplePolicyEditorDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.SimplePolicyEditorElementDTO;
-import org.wso2.carbon.identity.entitlement.ui.dto.TargetDTO;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-/**
- * Util class that helps to create the XACML policy which is defined by the XACML basic policy editor
- */
-
-/**
- * @deprecated As this moved to org.wso2.carbon.identity.entitlement.common
- */
-@Deprecated
-public class PolicyEditorUtil {
-
- private static Log log = LogFactory.getLog(PolicyEditorUtil.class);
-
- /**
- * map of apply element w.r.t identifier
- */
- private static Map applyElementMap = new HashMap();
-
- /**
- * Create XACML policy with the simplest input attributes
- *
- * @param policyEditorDTO
- * @return
- * @throws PolicyEditorException
- */
- public static String createSOAPolicy(SimplePolicyEditorDTO policyEditorDTO) throws PolicyEditorException {
-
- BasicPolicyDTO basicPolicyDTO = new BasicPolicyDTO();
- BasicTargetDTO basicTargetDTO = null;
- List ruleElementDTOs = new ArrayList();
-
- PolicyEditorDataHolder holder = PolicyEditorEngine.getInstance().
- getPolicyEditorData(EntitlementConstants.PolicyEditor.RBAC);
-
- //create policy element
- basicPolicyDTO.setPolicyId(policyEditorDTO.getPolicyId());
- // setting rule combining algorithm
- basicPolicyDTO.setRuleAlgorithm(PolicyConstants.RuleCombiningAlog.FIRST_APPLICABLE_ID);
- basicPolicyDTO.setDescription(policyEditorDTO.getDescription());
-
- if (PolicyEditorConstants.SOA_CATEGORY_USER.equals(policyEditorDTO.getAppliedCategory())) {
-
- if (policyEditorDTO.getUserAttributeValue() != null &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.
- equals(policyEditorDTO.getUserAttributeValue().trim())) {
-
- basicTargetDTO = new BasicTargetDTO();
- String selectedDataType = null;
-
- if (policyEditorDTO.getUserAttributeId() == null) {
- basicTargetDTO.setSubjectId(PolicyEditorConstants.SUBJECT_ID_DEFAULT);
- } else {
- basicTargetDTO.setSubjectId(holder.getAttributeIdUri(policyEditorDTO.getUserAttributeId()));
- if ((selectedDataType = holder.getDataTypeUriForAttribute(policyEditorDTO.getUserAttributeId())) != null) {
- basicTargetDTO.setSubjectDataType(selectedDataType);
- }
- }
-
- if (basicTargetDTO.getSubjectDataType() == null) {
- basicTargetDTO.setSubjectDataType(PolicyConstants.DataType.STRING);
- }
-
- String function = findFunction(policyEditorDTO.getUserAttributeValue(),
- basicTargetDTO.getSubjectDataType());
- String value = findAttributeValue(policyEditorDTO.getUserAttributeValue());
- basicTargetDTO.setSubjectList(value);
- basicTargetDTO.setFunctionOnSubjects(function);
- }
-
- List elementDTOs = policyEditorDTO.getSimplePolicyEditorElementDTOs();
-
- if (elementDTOs != null) {
- int ruleNo = 1;
- for (SimplePolicyEditorElementDTO dto : elementDTOs) {
- BasicRuleDTO ruleElementDTO = new BasicRuleDTO();
-
- if (dto.getResourceValue() != null && dto.getResourceValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getResourceValue().trim())) {
- addResourceElement(ruleElementDTO, dto);
- }
-
- if (dto.getActionValue() != null && dto.getActionValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getActionValue().trim())) {
- addActionElement(ruleElementDTO, dto);
- }
-
- if (dto.getEnvironmentValue() != null && dto.getEnvironmentValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getEnvironmentValue().trim())) {
- addEnvironmentElement(ruleElementDTO, dto);
- }
-
- ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_PERMIT);
- ruleElementDTO.setRuleId("Rule-" + ruleNo);
- ruleElementDTOs.add(ruleElementDTO);
- ruleNo++;
- }
-
- BasicRuleDTO ruleElementDTO = new BasicRuleDTO();
- ruleElementDTO.setRuleId("Deny-Rule");
- ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_DENY);
- ruleElementDTOs.add(ruleElementDTO);
- }
- } else if (PolicyEditorConstants.SOA_CATEGORY_RESOURCE.equals(policyEditorDTO.getAppliedCategory())) {
-
- if (policyEditorDTO.getResourceValue() != null &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(policyEditorDTO.getResourceValue().trim())) {
- basicTargetDTO = new BasicTargetDTO();
-
- basicTargetDTO.setResourceId(PolicyEditorConstants.RESOURCE_ID_DEFAULT);
- basicTargetDTO.setResourceDataType(PolicyConstants.DataType.STRING);
-
- String function = findFunction(policyEditorDTO.getResourceValue(),
- basicTargetDTO.getResourceDataType());
- String value = findAttributeValue(policyEditorDTO.getResourceValue());
- basicTargetDTO.setResourceList(value);
- basicTargetDTO.setFunctionOnResources(function);
- }
-
- List elementDTOs = policyEditorDTO.getSimplePolicyEditorElementDTOs();
-
- if (elementDTOs != null) {
- int ruleNo = 1;
- for (SimplePolicyEditorElementDTO dto : elementDTOs) {
- BasicRuleDTO ruleElementDTO = new BasicRuleDTO();
-
- if (dto.getResourceValue() != null && dto.getResourceValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getResourceValue().trim())) {
-
- addResourceElement(ruleElementDTO, dto);
- }
-
- if (dto.getUserAttributeValue() != null && dto.getUserAttributeValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getUserAttributeValue().trim())) {
-
- addSubjectElement(ruleElementDTO, dto);
- }
-
- if (dto.getActionValue() != null && dto.getActionValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getActionValue().trim())) {
-
- addActionElement(ruleElementDTO, dto);
- }
-
- if (dto.getEnvironmentValue() != null && dto.getEnvironmentValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getEnvironmentValue().trim())) {
-
- addEnvironmentElement(ruleElementDTO, dto);
- }
-
- ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_PERMIT);
- ruleElementDTO.setRuleId("Rule-" + ruleNo);
- ruleElementDTOs.add(ruleElementDTO);
- ruleNo++;
- }
-
- BasicRuleDTO ruleElementDTO = new BasicRuleDTO();
- ruleElementDTO.setRuleId("Deny-Rule");
- ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_DENY);
- ruleElementDTOs.add(ruleElementDTO);
- }
- } else if (PolicyEditorConstants.SOA_CATEGORY_ACTION.equals(policyEditorDTO.getAppliedCategory())) {
-
- if (policyEditorDTO.getActionValue() != null &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(policyEditorDTO.getActionValue().trim())) {
-
- basicTargetDTO = new BasicTargetDTO();
-
- basicTargetDTO.setActionId(PolicyEditorConstants.ACTION_ID_DEFAULT);
- basicTargetDTO.setActionDataType(PolicyConstants.DataType.STRING);
-
- String function = findFunction(policyEditorDTO.getActionValue(),
- basicTargetDTO.getActionDataType());
- String value = findAttributeValue(policyEditorDTO.getActionValue());
- basicTargetDTO.setActionList(value);
- basicTargetDTO.setFunctionOnActions(function);
-
- }
- List elementDTOs = policyEditorDTO.getSimplePolicyEditorElementDTOs();
-
- if (elementDTOs != null) {
- int ruleNo = 1;
- for (SimplePolicyEditorElementDTO dto : elementDTOs) {
- BasicRuleDTO ruleElementDTO = new BasicRuleDTO();
-
- if (dto.getResourceValue() != null && dto.getResourceValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getResourceValue().trim())) {
- addResourceElement(ruleElementDTO, dto);
- }
-
- if (dto.getUserAttributeValue() != null && dto.getUserAttributeValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getUserAttributeValue().trim())) {
- addSubjectElement(ruleElementDTO, dto);
- }
-
- if (dto.getEnvironmentValue() != null && dto.getEnvironmentValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getEnvironmentValue().trim())) {
- addEnvironmentElement(ruleElementDTO, dto);
- }
-
- ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_PERMIT);
- ruleElementDTO.setRuleId("Rule-" + ruleNo);
- ruleElementDTOs.add(ruleElementDTO);
- ruleNo++;
- }
-
- BasicRuleDTO ruleElementDTO = new BasicRuleDTO();
- ruleElementDTO.setRuleId("Deny-Rule");
- ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_DENY);
- ruleElementDTOs.add(ruleElementDTO);
- }
- } else if (PolicyEditorConstants.SOA_CATEGORY_ENVIRONMENT.equals(policyEditorDTO.getAppliedCategory())) {
-
- if (policyEditorDTO.getEnvironmentValue() != null &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(policyEditorDTO.getEnvironmentValue().trim())) {
-
- basicTargetDTO = new BasicTargetDTO();
-
- String selectedDataType = null;
-
- if (policyEditorDTO.getEnvironmentId() == null) {
- basicTargetDTO.setEnvironmentId(PolicyEditorConstants.ENVIRONMENT_ID_DEFAULT);
- } else {
- basicTargetDTO.setEnvironmentId(holder.getAttributeIdUri(policyEditorDTO.getEnvironmentId()));
- if ((selectedDataType = holder.getDataTypeUriForAttribute(policyEditorDTO.getEnvironmentId())) != null) {
- basicTargetDTO.setEnvironmentDataType(selectedDataType);
- }
- }
-
- if (basicTargetDTO.getEnvironmentDataType() == null) {
- basicTargetDTO.setEnvironmentDataType(PolicyConstants.DataType.STRING);
- }
-
-
- String function = findFunction(policyEditorDTO.getEnvironmentValue(),
- basicTargetDTO.getEnvironmentDataType());
- String value = findAttributeValue(policyEditorDTO.getEnvironmentValue());
- basicTargetDTO.setEnvironmentList(value);
- basicTargetDTO.setFunctionOnEnvironment(function);
-
- }
- List elementDTOs = policyEditorDTO.getSimplePolicyEditorElementDTOs();
-
- if (elementDTOs != null) {
- int ruleNo = 1;
- for (SimplePolicyEditorElementDTO dto : elementDTOs) {
- BasicRuleDTO ruleElementDTO = new BasicRuleDTO();
-
- if (dto.getResourceValue() != null && dto.getResourceValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getResourceValue().trim())) {
- addResourceElement(ruleElementDTO, dto);
- }
-
- if (dto.getUserAttributeValue() != null && dto.getUserAttributeValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getUserAttributeValue().trim())) {
- addSubjectElement(ruleElementDTO, dto);
- }
-
- if (dto.getActionValue() != null && dto.getActionValue().trim().length() > 0 &&
- !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getActionValue().trim())) {
- addActionElement(ruleElementDTO, dto);
- }
-
- ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_PERMIT);
- ruleElementDTO.setRuleId("Rule-" + ruleNo);
- ruleElementDTOs.add(ruleElementDTO);
- ruleNo++;
- }
-
- BasicRuleDTO ruleElementDTO = new BasicRuleDTO();
- ruleElementDTO.setRuleId("Deny-Rule");
- ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_DENY);
- ruleElementDTOs.add(ruleElementDTO);
- }
- }
-
- if (basicTargetDTO != null) {
- basicPolicyDTO.setTargetDTO(basicTargetDTO);
- }
-
- if (ruleElementDTOs.size() > 0) {
- basicPolicyDTO.setBasicRuleDTOs(ruleElementDTOs);
- }
-
- try {
- return PolicyBuilder.getInstance().build(basicPolicyDTO);
- } catch (PolicyBuilderException e) {
- log.error(e);
- throw new PolicyEditorException("Error while building policy");
- }
- }
-
- /**
- * Helper method to create SOA policy
- *
- * @param ruleElementDTO
- * @param editorElementDTO
- */
- private static void addResourceElement(BasicRuleDTO ruleElementDTO,
- SimplePolicyEditorElementDTO editorElementDTO) {
-
-
- ruleElementDTO.setResourceId(PolicyEditorConstants.RESOURCE_ID_DEFAULT);
- ruleElementDTO.setResourceDataType(PolicyConstants.DataType.STRING);
- String function = findFunction(editorElementDTO.getResourceValue(),
- ruleElementDTO.getResourceDataType());
- String value = findAttributeValue(editorElementDTO.getResourceValue());
- ruleElementDTO.setResourceList(value);
- ruleElementDTO.setFunctionOnResources(function);
- }
-
- /**
- * Helper method to create SOA policy
- *
- * @param ruleElementDTO
- * @param editorElementDTO
- */
- private static void addSubjectElement(BasicRuleDTO ruleElementDTO,
- SimplePolicyEditorElementDTO editorElementDTO) {
-
- String selectedDataType = null;
- PolicyEditorDataHolder holder = PolicyEditorEngine.getInstance().
- getPolicyEditorData(EntitlementConstants.PolicyEditor.RBAC);
-
- if (editorElementDTO.getUserAttributeId() == null) {
- ruleElementDTO.setSubjectId(PolicyEditorConstants.SUBJECT_ID_DEFAULT);
- } else {
- ruleElementDTO.setSubjectId(holder.getAttributeIdUri(editorElementDTO.getUserAttributeId()));
- if ((selectedDataType = holder.getDataTypeUriForAttribute(editorElementDTO.getUserAttributeId())) != null) {
- ruleElementDTO.setSubjectDataType(selectedDataType);
- }
- }
-
- if (ruleElementDTO.getSubjectDataType() == null) {
- ruleElementDTO.setSubjectDataType(PolicyConstants.DataType.STRING);
- }
- String function = findFunction(editorElementDTO.getUserAttributeValue(),
- ruleElementDTO.getSubjectDataType());
- String value = findAttributeValue(editorElementDTO.getUserAttributeValue());
- ruleElementDTO.setSubjectList(value);
- ruleElementDTO.setFunctionOnSubjects(function);
- }
-
- /**
- * Helper method to create SOA policy
- *
- * @param ruleElementDTO
- * @param editorElementDTO
- */
- private static void addActionElement(BasicRuleDTO ruleElementDTO,
- SimplePolicyEditorElementDTO editorElementDTO) {
-
- ruleElementDTO.setActionId(PolicyEditorConstants.ACTION_ID_DEFAULT);
- ruleElementDTO.setActionDataType(PolicyConstants.DataType.STRING);
-
- String function = findFunction(editorElementDTO.getActionValue(),
- ruleElementDTO.getActionDataType());
- String value = findAttributeValue(editorElementDTO.getActionValue());
- ruleElementDTO.setActionList(value);
- ruleElementDTO.setFunctionOnActions(function);
- }
-
- /**
- * Helper method to create SOA policy
- *
- * @param ruleElementDTO
- * @param editorElementDTO
- */
- private static void addEnvironmentElement(BasicRuleDTO ruleElementDTO,
- SimplePolicyEditorElementDTO editorElementDTO) {
-
- String selectedDataType = null;
- PolicyEditorDataHolder holder = PolicyEditorEngine.getInstance().
- getPolicyEditorData(EntitlementConstants.PolicyEditor.RBAC);
- if (editorElementDTO.getEnvironmentId() == null) {
- ruleElementDTO.setEnvironmentId(PolicyEditorConstants.ENVIRONMENT_ID_DEFAULT);
- } else {
- ruleElementDTO.setEnvironmentId(holder.getAttributeIdUri(editorElementDTO.getEnvironmentId()));
- if ((selectedDataType = holder.getDataTypeUriForAttribute(editorElementDTO.getEnvironmentId())) != null) {
- ruleElementDTO.setEnvironmentDataType(selectedDataType);
- }
- }
-
- if (ruleElementDTO.getEnvironmentDataType() == null) {
- ruleElementDTO.setEnvironmentDataType(PolicyConstants.DataType.STRING);
- }
-
- String function = findFunction(editorElementDTO.getEnvironmentValue(),
- ruleElementDTO.getEnvironmentDataType());
- String value = findAttributeValue(editorElementDTO.getEnvironmentValue());
- ruleElementDTO.setEnvironmentDataType(ruleElementDTO.getEnvironmentDataType());
- ruleElementDTO.setEnvironmentList(value);
- ruleElementDTO.setFunctionOnEnvironment(function);
-
- }
-
- /**
- * Helper method to create SOA policy
- *
- * @param value
- * @param dataType
- * @return
- */
- private static String findFunction(String value, String dataType) {
-
- if (value == null) {
- return PolicyConstants.Functions.FUNCTION_EQUAL;
- }
-
- value = value.replace(">", ">");
- value = value.replace("<", "<");
-
- // only time range finction are valid for following data types
- if (PolicyConstants.DataType.DATE.equals(dataType) ||
- PolicyConstants.DataType.INT.equals(dataType) ||
- PolicyConstants.DataType.TIME.equals(dataType) ||
- PolicyConstants.DataType.DATE_TIME.equals(dataType) ||
- PolicyConstants.DataType.DOUBLE.equals(dataType) ||
- PolicyConstants.DataType.STRING.equals(dataType)) {
-
- if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.EQUAL_RANGE)) {
- if (value.contains(PolicyEditorConstants.FunctionIdentifier.RANGE_CLOSE)) {
- return PolicyConstants.Functions.FUNCTION_GREATER_EQUAL_AND_LESS;
- } else {
- return PolicyConstants.Functions.FUNCTION_GREATER_EQUAL_AND_LESS_EQUAL;
- }
- }
-
- if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.RANGE)) {
- if (value.contains(PolicyEditorConstants.FunctionIdentifier.EQUAL_RANGE_CLOSE)) {
- return PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS_EQUAL;
- } else {
- return PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS;
- }
- }
-
- if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.GREATER)) {
- return PolicyConstants.Functions.FUNCTION_GREATER;
- } else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.GREATER_EQUAL)) {
- return PolicyConstants.Functions.FUNCTION_GREATER_EQUAL;
- } else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.LESS)) {
- return PolicyConstants.Functions.FUNCTION_LESS;
- } else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.LESS_EQUAL)) {
- return PolicyConstants.Functions.FUNCTION_LESS_EQUAL;
- }
- }
-
- if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.REGEX)) {
- return PolicyConstants.Functions.FUNCTION_EQUAL_MATCH_REGEXP;
- }
-
- if (value.contains(PolicyEditorConstants.FunctionIdentifier.OR)) {
- return PolicyConstants.Functions.FUNCTION_AT_LEAST_ONE;
- }
-
- if (value.contains(PolicyEditorConstants.FunctionIdentifier.AND)) {
- return PolicyConstants.Functions.FUNCTION_SET_EQUALS;
- }
-
- return PolicyConstants.Functions.FUNCTION_EQUAL;
- }
-
- /**
- * Helper method to create SOA policy
- *
- * @param value
- * @return
- */
- private static String findAttributeValue(String value) {
-
- if (value == null) {
- return null;
- }
-
- value = value.replace(">", ">");
- value = value.replace("<", "<");
-
- if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.EQUAL_RANGE) ||
- value.startsWith(PolicyEditorConstants.FunctionIdentifier.RANGE) ||
- value.startsWith(PolicyEditorConstants.FunctionIdentifier.REGEX)) {
-
- return value.substring(1, value.length() - 1).trim();
-
- } else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.GREATER) ||
- value.startsWith(PolicyEditorConstants.FunctionIdentifier.LESS)) {
- return value.substring(1).trim();
- } else if (value.startsWith(PolicyEditorConstants.FunctionIdentifier.GREATER_EQUAL) ||
- value.startsWith(PolicyEditorConstants.FunctionIdentifier.LESS_EQUAL)) {
- return value.substring(2).trim();
- }
-
- if (value.contains(PolicyEditorConstants.FunctionIdentifier.AND)) {
- value = value.replace(PolicyEditorConstants.FunctionIdentifier.AND,
- PolicyEditorConstants.ATTRIBUTE_SEPARATOR);
- }
-
- if (value.contains(PolicyEditorConstants.FunctionIdentifier.OR)) {
- value = value.replace(PolicyEditorConstants.FunctionIdentifier.OR,
- PolicyEditorConstants.ATTRIBUTE_SEPARATOR);
- }
-
- return value.trim();
- }
-
-
-// TODO for what?
-// public static String createRules(List elementDTOs, Document doc)
-// throws PolicyEditorException {
-//
-// List ruleElementDTOs = new ArrayList();
-// if(elementDTOs != null){
-// int ruleNo = 1;
-// for(SimplePolicyEditorElementDTO dto : elementDTOs){
-// BasicRuleDTO ruleElementDTO = new BasicRuleDTO();
-//
-// if(dto.getResourceValue() != null && dto.getResourceValue().trim().length() > 0 &&
-// !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getResourceValue().trim())){
-// ruleElementDTO.setResourceDataType(PolicyEditorConstants.DataType.STRING);
-// ruleElementDTO.setResourceId(PolicyEditorConstants.RESOURCE_ID_DEFAULT);
-// ruleElementDTO.setResourceList(dto.getResourceValue());
-// ruleElementDTO.setFunctionOnResources(getBasicPolicyEditorFunction(dto.
-// getFunctionOnResources()));
-// }
-//
-// if(dto.getUserAttributeValue() != null && dto.getUserAttributeValue().trim().length() > 0 &&
-// !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getUserAttributeValue().trim())){
-// ruleElementDTO.setSubjectDataType(PolicyEditorConstants.DataType.STRING);
-// ruleElementDTO.setSubjectId(dto.getUserAttributeId());
-// ruleElementDTO.setSubjectList(dto.getUserAttributeValue());
-// ruleElementDTO.setFunctionOnSubjects(getBasicPolicyEditorFunction(dto.
-// getFunctionOnUsers()));
-// }
-//
-// if(dto.getActionValue() != null && dto.getActionValue().trim().length() > 0 &&
-// !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getActionValue().trim())){
-// ruleElementDTO.setActionDataType(PolicyEditorConstants.DataType.STRING);
-// ruleElementDTO.setActionList(dto.getActionValue());
-// ruleElementDTO.setActionId(PolicyEditorConstants.ACTION_ID_DEFAULT);
-// ruleElementDTO.setFunctionOnActions(getBasicPolicyEditorFunction(dto.
-// getFunctionOnActions()));
-// }
-//
-// if(dto.getEnvironmentValue() != null && dto.getEnvironmentValue().trim().length() > 0 &&
-// !PolicyEditorConstants.FunctionIdentifier.ANY.equals(dto.getEnvironmentValue().trim())){
-// ruleElementDTO.setEnvironmentId(dto.getEnvironmentId());
-// ruleElementDTO.setEnvironmentList(dto.getEnvironmentValue());
-// ruleElementDTO.setEnvironmentDataType(PolicyEditorConstants.DataType.STRING);
-// ruleElementDTO.setFunctionOnEnvironment(getBasicPolicyEditorFunction(dto.
-// getFunctionOnEnvironments()));
-// }
-//
-// if(dto.getOperationType() != null && PolicyEditorConstants.PreFunctions.CAN_DO.
-// equals(dto.getOperationType().trim())){
-// ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_PERMIT);
-// } else {
-// ruleElementDTO.setRuleEffect(PolicyEditorConstants.RULE_EFFECT_DENY);
-// }
-// ruleElementDTO.setRuleId("Rule-" + System.currentTimeMillis() + "-" + ruleNo);
-// ruleElementDTOs.add(ruleElementDTO);
-// ruleNo ++;
-// }
-// }
-//
-// if(ruleElementDTOs.size() > 0){
-// for(BasicRuleDTO dto : ruleElementDTOs){
-// Element rule = null;
-// try {
-// rule = BasicPolicyHelper.createRuleElement(dto, doc);
-// } catch (PolicyBuilderException e) {
-// throw new PolicyEditorException("Error while creating rule element");
-// }
-// doc.appendChild(rule);
-// }
-// }
-//
-// return PolicyCreatorUtil.getStringFromDocument(doc);
-// }
-
-
- /**
- * Creates DOM representation of the XACML rule element.
- *
- * @param ruleDTO RuleDTO
- * @return
- * @throws PolicyEditorException throws
- */
- public static RuleElementDTO createRuleElementDTO(RuleDTO ruleDTO) throws PolicyEditorException {
-
- RuleElementDTO ruleElementDTO = new RuleElementDTO();
-
- ruleElementDTO.setRuleId(ruleDTO.getRuleId());
- ruleElementDTO.setRuleEffect(ruleDTO.getRuleEffect());
- TargetDTO targetDTO = ruleDTO.getTargetDTO();
- List dynamicAttributeDTOs = ruleDTO.getAttributeDTOs();
- List obligationDTOs = ruleDTO.getObligationDTOs();
-
- if (dynamicAttributeDTOs != null && dynamicAttributeDTOs.size() > 0) {
- Map dtoMap = new HashMap();
- //1st creating map of dynamic attribute elements
- for (ExtendAttributeDTO dto : dynamicAttributeDTOs) {
- dtoMap.put("${" + dto.getId().trim() + "}", dto);
- }
- //creating map of apply element with identifier
- for (ExtendAttributeDTO dto : dynamicAttributeDTOs) {
- ApplyElementDTO applyElementDTO = createApplyElement(dto, dtoMap);
- if (applyElementDTO == null) {
- continue;
- }
- applyElementMap.put("${" + dto.getId().trim() + "}", applyElementDTO);
- }
- }
-
- if (targetDTO != null && targetDTO.getRowDTOList() != null && targetDTO.getRowDTOList().size() > 0) {
- TargetElementDTO targetElementDTO = createTargetElementDTO(ruleDTO.getTargetDTO());
- if (targetElementDTO != null) {
- ruleElementDTO.setTargetElementDTO(targetElementDTO);
- }
- }
-
- if (ruleDTO.getRowDTOList() != null && ruleDTO.getRowDTOList().size() > 0) {
- ConditionElementDT0 conditionElementDT0 = createConditionDTO(ruleDTO.getRowDTOList());
- if (conditionElementDT0 != null) {
- ruleElementDTO.setConditionElementDT0(conditionElementDT0);
- }
- }
-
- if (obligationDTOs != null && obligationDTOs.size() > 0) {
- for (ObligationDTO obligationDTO : obligationDTOs) {
- ObligationElementDTO elementDTO = createObligationElement(obligationDTO);
- if (elementDTO != null) {
- ruleElementDTO.addObligationElementDTO(elementDTO);
- }
- }
- }
-
- return ruleElementDTO;
- }
-
- /**
- * creates DOM representation of the XACML obligation/advice element.
- *
- * @param obligationDTOs List of ObligationDTO
- * @return
- * @throws PolicyEditorException throws
- */
- public static List createObligation(List obligationDTOs)
- throws PolicyEditorException {
-
- List obligationElementDTOs = new ArrayList();
- if (obligationDTOs != null) {
- for (ObligationDTO obligationDTO : obligationDTOs) {
- ObligationElementDTO elementDTO = createObligationElement(obligationDTO);
- if (elementDTO != null) {
- obligationElementDTOs.add(elementDTO);
- }
- }
- }
-
- return obligationElementDTOs;
- }
-
-
- /**
- * @param dynamicAttributeDTO
- * @param map
- * @return
- */
- private static ApplyElementDTO createApplyElement(ExtendAttributeDTO dynamicAttributeDTO,
- Map map) {
-
- if (PolicyEditorConstants.DYNAMIC_SELECTOR_CATEGORY.equals(dynamicAttributeDTO.getSelector())) {
-
- String category = dynamicAttributeDTO.getCategory();
- String attributeId = dynamicAttributeDTO.getAttributeId();
- String attributeDataType = dynamicAttributeDTO.getDataType();
-
- if (category != null && category.trim().length() > 0 && attributeDataType != null &&
- attributeDataType.trim().length() > 0) {
- AttributeDesignatorDTO designatorDTO = new AttributeDesignatorDTO();
- designatorDTO.setCategory(category);
- designatorDTO.setAttributeId(attributeId);
- designatorDTO.setDataType(attributeDataType);
- designatorDTO.setMustBePresent("true");
-
- ApplyElementDTO applyElementDTO = new ApplyElementDTO();
- applyElementDTO.setAttributeDesignators(designatorDTO);
- applyElementDTO.setFunctionId(processFunction("bag", attributeDataType));
- return applyElementDTO;
- }
-
- } else {
-
- String function = dynamicAttributeDTO.getFunction();
- String attributeValue = dynamicAttributeDTO.getAttributeValue();
- String attributeDataType = dynamicAttributeDTO.getDataType();
-
- if (attributeValue != null && function != null) {
- String[] values = attributeValue.split(",");
-
- if (values != null && values.length > 0) {
-
- if (function.contains("concatenate")) {
- ApplyElementDTO applyElementDTO = new ApplyElementDTO();
- applyElementDTO.setFunctionId(processFunction(function, attributeDataType, "2.0"));
- // there can be any number of inputs
- for (String value : values) {
- if (map.containsKey(value)) {
- applyElementDTO.setApplyElement(createApplyElement(map.get(value), map));
- } else {
- AttributeValueElementDTO valueElementDTO = new AttributeValueElementDTO();
- valueElementDTO.setAttributeDataType(attributeDataType);
- valueElementDTO.setAttributeValue(value);
- applyElementDTO.setAttributeValueElementDTO(valueElementDTO);
- }
- }
-
- return applyElementDTO;
- }
- }
- }
- }
-
- return null;
- }
-
-
- private static ObligationElementDTO createObligationElement(ObligationDTO obligationDTO) {
-
- String id = obligationDTO.getObligationId();
- String effect = obligationDTO.getEffect();
- String type = obligationDTO.getType();
-
- if (id != null && id.trim().length() > 0 && effect != null) {
-
- ObligationElementDTO elementDTO = new ObligationElementDTO();
- elementDTO.setId(id);
- elementDTO.setEffect(effect);
- if ("Advice".equals(type)) {
- elementDTO.setType(ObligationElementDTO.ADVICE);
- } else {
- elementDTO.setType(ObligationElementDTO.OBLIGATION);
- }
-
- String attributeValue = obligationDTO.getAttributeValue();
- String attributeDataType = obligationDTO.getAttributeValueDataType();
- String resultingAttributeId = obligationDTO.getResultAttributeId();
-
- if (attributeValue != null && attributeValue.trim().length() > 0 &&
- resultingAttributeId != null && resultingAttributeId.trim().length() > 0) {
-
- AttributeAssignmentElementDTO assignmentElementDTO = new
- AttributeAssignmentElementDTO();
- assignmentElementDTO.setAttributeId(resultingAttributeId);
- if (attributeValue.contains(",")) {
- String[] values = attributeValue.split(",");
- ApplyElementDTO applyElementDTO = new ApplyElementDTO();
- applyElementDTO.setFunctionId(processFunction("bag", attributeDataType));
- for (String value : values) {
- if (applyElementMap.containsKey(value)) {
- applyElementDTO.setApplyElement(applyElementMap.get(value));
- } else {
- AttributeValueElementDTO valueElementDTO = new AttributeValueElementDTO();
- valueElementDTO.setAttributeDataType(attributeDataType);
- valueElementDTO.setAttributeValue(value);
- applyElementDTO.setAttributeValueElementDTO(valueElementDTO);
- }
- }
- assignmentElementDTO.setApplyElementDTO(applyElementDTO);
- } else {
- if (applyElementMap.containsKey(attributeValue)) {
- assignmentElementDTO.setApplyElementDTO(applyElementMap.get(attributeValue));
- } else {
- AttributeValueElementDTO valueElementDTO = new AttributeValueElementDTO();
- valueElementDTO.setAttributeDataType(attributeDataType);
- valueElementDTO.setAttributeValue(attributeValue);
- assignmentElementDTO.setValueElementDTO(valueElementDTO);
- }
- }
-
- elementDTO.addAssignmentElementDTO(assignmentElementDTO);
- }
-
- return elementDTO;
- }
-
- return null;
- }
-
- /**
- * Creates ConditionElementDT0
Object that represents the XACML Condition element
- *
- * @param rowDTOs
- * @return
- * @throws PolicyEditorException
- */
- public static ConditionElementDT0 createConditionDTO(List rowDTOs) throws PolicyEditorException {
-
- ConditionElementDT0 rootApplyDTO = new ConditionElementDT0();
-
- ArrayList temp = new ArrayList();
- Set> listSet = new HashSet>();
-
- for (int i = 0; i < rowDTOs.size(); i++) {
-
- if (i == 0) {
- temp.add(rowDTOs.get(0));
- continue;
- }
-
- String combineFunction = rowDTOs.get(i - 1).getCombineFunction();
-
- if (PolicyEditorConstants.COMBINE_FUNCTION_AND.equals(combineFunction)) {
- temp.add(rowDTOs.get(i));
- }
-
- if (PolicyEditorConstants.COMBINE_FUNCTION_OR.equals(combineFunction)) {
- listSet.add(temp);
- temp = new ArrayList();
- temp.add(rowDTOs.get(i));
- }
- }
-
- listSet.add(temp);
-
- if (listSet.size() > 1) {
- ApplyElementDTO orApplyDTO = new ApplyElementDTO();
- orApplyDTO.setFunctionId(processFunction("or"));
- for (ArrayList rowDTOArrayList : listSet) {
- if (rowDTOArrayList.size() > 1) {
- ApplyElementDTO andApplyDTO = new ApplyElementDTO();
- andApplyDTO.setFunctionId(processFunction("and"));
- for (RowDTO rowDTO : rowDTOArrayList) {
- ApplyElementDTO applyElementDTO = createApplyElement(rowDTO);
- andApplyDTO.setApplyElement(applyElementDTO);
- }
- orApplyDTO.setApplyElement(andApplyDTO);
-
- } else if (rowDTOArrayList.size() == 1) {
- RowDTO rowDTO = rowDTOArrayList.get(0);
- ApplyElementDTO andApplyDTO = createApplyElement(rowDTO);
- orApplyDTO.setApplyElement(andApplyDTO);
- }
- }
- rootApplyDTO.setApplyElement(orApplyDTO);
- } else if (listSet.size() == 1) {
- ArrayList rowDTOArrayList = listSet.iterator().next();
- if (rowDTOArrayList.size() > 1) {
- ApplyElementDTO andApplyDTO = new ApplyElementDTO();
- andApplyDTO.setFunctionId(processFunction("and"));
- for (RowDTO rowDTO : rowDTOArrayList) {
- ApplyElementDTO applyElementDTO = createApplyElement(rowDTO);
- andApplyDTO.setApplyElement(applyElementDTO);
- }
- rootApplyDTO.setApplyElement(andApplyDTO);
- } else if (rowDTOArrayList.size() == 1) {
- RowDTO rowDTO = rowDTOArrayList.get(0);
- ApplyElementDTO andApplyDTO = createApplyElement(rowDTO);
- rootApplyDTO.setApplyElement(andApplyDTO);
- }
- }
-
- return rootApplyDTO;
- }
-
- /**
- * Creates ApplyElementDTO
Object that represents the XACML Apply element
- *
- * @param rowDTO
- * @return
- * @throws PolicyEditorException
- */
- public static ApplyElementDTO createApplyElement(RowDTO rowDTO) throws PolicyEditorException {
-
- String preFunction = rowDTO.getPreFunction();
- String function = rowDTO.getFunction();
- String dataType = rowDTO.getAttributeDataType();
- String attributeValue = rowDTO.getAttributeValue();
-
- if (function == null || function.trim().length() < 1) {
- throw new PolicyEditorException("Can not create Apply element:" +
- "Missing required function Id");
- }
-
- if (attributeValue == null || attributeValue.trim().length() < 1) {
- throw new PolicyEditorException("Can not create Apply element:" +
- "Missing required attribute value");
- }
-
- ApplyElementDTO applyElementDTO = null;
-
- AttributeDesignatorDTO designatorDTO = new AttributeDesignatorDTO();
- designatorDTO.setCategory(rowDTO.getCategory());
- designatorDTO.setAttributeId(rowDTO.getAttributeId());
- designatorDTO.setDataType(dataType);
- designatorDTO.setMustBePresent("true");
-
-
- if (rowDTO.getFunction().contains("less") || rowDTO.getFunction().contains("greater")) {
- applyElementDTO = processGreaterLessThanFunctions(function, dataType, attributeValue,
- designatorDTO);
- } else if (PolicyConstants.Functions.FUNCTION_EQUAL.equals(rowDTO.getFunction())) {
- applyElementDTO = processEqualFunctions(function, dataType, attributeValue, designatorDTO);
- } else if (PolicyConstants.Functions.FUNCTION_EQUAL_MATCH_REGEXP.equals(rowDTO.getFunction())) {
- applyElementDTO = processRegexpFunctions(function, dataType, attributeValue, designatorDTO);
- } else {
- applyElementDTO = processBagFunction(function, dataType, attributeValue, designatorDTO);
- }
-
-
- if (PolicyConstants.PreFunctions.PRE_FUNCTION_NOT.equals(preFunction)) {
- ApplyElementDTO notApplyElementDTO = new ApplyElementDTO();
- notApplyElementDTO.setFunctionId(processFunction("not"));
- notApplyElementDTO.setApplyElement(applyElementDTO);
- applyElementDTO = notApplyElementDTO;
- }
-
- return applyElementDTO;
- }
-
- /**
- * Creates TargetElementDTO
Object that represents the XACML Target element
- *
- * @param targetDTO
- * @return
- */
- public static TargetElementDTO createTargetElementDTO(TargetDTO targetDTO) {
-
- AllOfElementDTO allOfElementDTO = new AllOfElementDTO();
- AnyOfElementDTO anyOfElementDTO = new AnyOfElementDTO();
- TargetElementDTO targetElementDTO = new TargetElementDTO();
-
- List rowDTOs = targetDTO.getRowDTOList();
- ArrayList tempRowDTOs = new ArrayList();
-
- // pre function processing
- for (RowDTO rowDTO : rowDTOs) {
- if (PolicyEditorConstants.PreFunctions.PRE_FUNCTION_ARE.equals(rowDTO.getPreFunction())) {
- String[] attributeValues = rowDTO.getAttributeValue().split(PolicyEditorConstants.ATTRIBUTE_SEPARATOR);
- allOfElementDTO = new AllOfElementDTO();
- for (int j = 0; j < attributeValues.length; j++) {
- RowDTO newDto = new RowDTO(rowDTO);
- newDto.setAttributeValue(attributeValues[j]);
- if (j != attributeValues.length - 1) {
- newDto.setCombineFunction(PolicyEditorConstants.COMBINE_FUNCTION_AND);
- }
- tempRowDTOs.add(newDto);
- }
- } else {
- tempRowDTOs.add(rowDTO);
- }
- }
-
- if (tempRowDTOs.size() > 0) {
- for (int i = 0; i < tempRowDTOs.size(); i++) {
- if (i == 0) {
- MatchElementDTO matchElementDTO = createTargetMatch(tempRowDTOs.get(0));
- if (matchElementDTO != null) {
- allOfElementDTO.addMatchElementDTO(matchElementDTO);
- }
- continue;
- }
-
- String combineFunction = tempRowDTOs.get(i - 1).getCombineFunction();
-
- if (PolicyEditorConstants.COMBINE_FUNCTION_AND.equals(combineFunction)) {
- MatchElementDTO matchElementDTO = createTargetMatch(tempRowDTOs.get(i));
- if (matchElementDTO != null) {
- allOfElementDTO.addMatchElementDTO(matchElementDTO);
- }
-
- }
-
- if (PolicyEditorConstants.COMBINE_FUNCTION_OR.equals(combineFunction)) {
- anyOfElementDTO.addAllOfElementDTO(allOfElementDTO);
- allOfElementDTO = new AllOfElementDTO();
- MatchElementDTO matchElementDTO = createTargetMatch(tempRowDTOs.get(i));
- if (matchElementDTO != null) {
- allOfElementDTO.addMatchElementDTO(matchElementDTO);
- }
- }
- }
- anyOfElementDTO.addAllOfElementDTO(allOfElementDTO);
- targetElementDTO.addAnyOfElementDTO(anyOfElementDTO);
- }
- return targetElementDTO;
- }
-
-
- /**
- * process Bag functions
- *
- * @param function
- * @param dataType
- * @param attributeValue
- * @param designatorDTO
- * @return
- */
- public static ApplyElementDTO processBagFunction(String function, String dataType,
- String attributeValue, AttributeDesignatorDTO designatorDTO) {
-
- if (PolicyConstants.Functions.FUNCTION_IS_IN.equals(function)) {
- ApplyElementDTO applyElementDTO = new ApplyElementDTO();
- applyElementDTO.setFunctionId(processFunction("is-in", dataType));
- if (applyElementMap.containsKey(attributeValue)) {
- applyElementDTO.setApplyElement(applyElementMap.get(attributeValue));
- } else {
- AttributeValueElementDTO valueElementDTO = new AttributeValueElementDTO();
- valueElementDTO.setAttributeDataType(dataType);
- valueElementDTO.setAttributeValue(attributeValue);
- applyElementDTO.setAttributeValueElementDTO(valueElementDTO);
- }
-
- applyElementDTO.setAttributeDesignators(designatorDTO);
- return applyElementDTO;
-
- } else if (PolicyConstants.Functions.FUNCTION_AT_LEAST_ONE.equals(function) ||
- PolicyConstants.Functions.FUNCTION_SET_EQUALS.equals(function)) {
-
- ApplyElementDTO applyElementDTO = new ApplyElementDTO();
- if (PolicyConstants.Functions.FUNCTION_AT_LEAST_ONE.equals(function)) {
- applyElementDTO.setFunctionId(processFunction("at-least-one-member-of", dataType));
- } else {
- applyElementDTO.setFunctionId(processFunction("set-equals", dataType));
- }
-
- String[] values = attributeValue.split(PolicyEditorConstants.ATTRIBUTE_SEPARATOR);
-
- ApplyElementDTO applyBagElementDTO = new ApplyElementDTO();
- applyBagElementDTO.setFunctionId(processFunction("bag", dataType));
- for (String value : values) {
- if (applyElementMap.containsKey(value)) {
- applyBagElementDTO.setApplyElement(applyElementMap.get(value));
- } else {
- AttributeValueElementDTO valueElementDTO = new AttributeValueElementDTO();
- valueElementDTO.setAttributeDataType(dataType);
- valueElementDTO.setAttributeValue(value);
- applyBagElementDTO.setAttributeValueElementDTO(valueElementDTO);
- }
- }
-
- applyElementDTO.setAttributeDesignators(designatorDTO);
- applyElementDTO.setApplyElement(applyBagElementDTO);
-
- return applyElementDTO;
- }
-
- return null;
- }
-
- /**
- * Process equal function
- *
- * @param function
- * @param dataType
- * @param attributeValue
- * @param designatorDTO
- * @return
- */
- public static ApplyElementDTO processEqualFunctions(String function, String dataType,
- String attributeValue, AttributeDesignatorDTO designatorDTO) {
-
- if (PolicyConstants.Functions.FUNCTION_EQUAL.equals(function)) {
-
- ApplyElementDTO applyElementDTO = new ApplyElementDTO();
- if (PolicyEditorConstants.DataType.DAY_TIME_DURATION.equals(dataType) ||
- PolicyEditorConstants.DataType.YEAR_MONTH_DURATION.equals(dataType)) {
- applyElementDTO.setFunctionId(processFunction("equal", dataType, "3.0"));
- } else {
- applyElementDTO.setFunctionId(processFunction("equal", dataType));
- }
-
- ApplyElementDTO oneAndOnlyApplyElement = new ApplyElementDTO();
- oneAndOnlyApplyElement.setFunctionId(processFunction("one-and-only", dataType));
- oneAndOnlyApplyElement.setAttributeDesignators(designatorDTO);
-
- if (applyElementMap.containsKey(attributeValue)) {
- applyElementDTO.setApplyElement(applyElementMap.get(attributeValue));
- } else {
- AttributeValueElementDTO valueElementDTO = new AttributeValueElementDTO();
- valueElementDTO.setAttributeDataType(dataType);
- valueElementDTO.setAttributeValue(attributeValue);
- applyElementDTO.setAttributeValueElementDTO(valueElementDTO);
- }
-
- applyElementDTO.setApplyElement(oneAndOnlyApplyElement);
-
- return applyElementDTO;
- }
-
- return null;
- }
-
- /**
- * Process less than and greater than functions
- *
- * @param function
- * @param dataType
- * @param attributeValue
- * @param designatorDTO
- * @return
- * @throws PolicyEditorException
- */
- public static ApplyElementDTO processGreaterLessThanFunctions(String function, String dataType,
- String attributeValue, AttributeDesignatorDTO designatorDTO)
- throws PolicyEditorException {
-
- String[] values = attributeValue.split(PolicyEditorConstants.ATTRIBUTE_SEPARATOR);
-
-
- if (PolicyConstants.Functions.FUNCTION_GREATER_EQUAL_AND_LESS_EQUAL.equals(function) ||
- PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS_EQUAL.equals(function) ||
- PolicyConstants.Functions.FUNCTION_GREATER_EQUAL_AND_LESS.equals(function) ||
- PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS.equals(function)) {
-
- String leftValue;
- String rightValue;
-
- if (values.length == 2) {
- leftValue = values[0].trim();
- rightValue = values[1].trim();
- } else {
- throw new PolicyEditorException("Can not create Apply element:" +
- "Missing required attribute values for function : " + function);
- }
-
- ApplyElementDTO andApplyElement = new ApplyElementDTO();
-
- andApplyElement.setFunctionId(processFunction("and"));
-
- ApplyElementDTO greaterThanApplyElement = new ApplyElementDTO();
- if (PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS.equals(function) ||
- PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS_EQUAL.equals(function)) {
- greaterThanApplyElement.setFunctionId(processFunction("greater-than", dataType));
- } else {
- greaterThanApplyElement.setFunctionId(processFunction("greater-than-or-equal", dataType));
- }
-
-
- ApplyElementDTO lessThanApplyElement = new ApplyElementDTO();
- if (PolicyConstants.Functions.FUNCTION_GREATER_AND_LESS.equals(function) ||
- PolicyConstants.Functions.FUNCTION_GREATER_EQUAL_AND_LESS.equals(function)) {
- lessThanApplyElement.setFunctionId(processFunction("less-than", dataType));
- } else {
- lessThanApplyElement.setFunctionId(processFunction("less-than-or-equal", dataType));
- }
-
- ApplyElementDTO oneAndOnlyApplyElement = new ApplyElementDTO();
- oneAndOnlyApplyElement.setFunctionId(processFunction("one-and-only", dataType));
- oneAndOnlyApplyElement.setAttributeDesignators(designatorDTO);
-
- AttributeValueElementDTO leftValueElementDTO = new AttributeValueElementDTO();
- leftValueElementDTO.setAttributeDataType(dataType);
- leftValueElementDTO.setAttributeValue(leftValue);
-
- AttributeValueElementDTO rightValueElementDTO = new AttributeValueElementDTO();
- rightValueElementDTO.setAttributeDataType(dataType);
- rightValueElementDTO.setAttributeValue(rightValue);
-
- greaterThanApplyElement.setApplyElement(oneAndOnlyApplyElement);
- greaterThanApplyElement.setAttributeValueElementDTO(leftValueElementDTO);
-
- lessThanApplyElement.setApplyElement(oneAndOnlyApplyElement);
- lessThanApplyElement.setAttributeValueElementDTO(rightValueElementDTO);
-
- andApplyElement.setApplyElement(greaterThanApplyElement);
- andApplyElement.setApplyElement(lessThanApplyElement);
-
- return andApplyElement;
-
- } else {
-
- ApplyElementDTO applyElementDTO = new ApplyElementDTO();
-
- if (PolicyConstants.Functions.FUNCTION_GREATER.equals(function)) {
- applyElementDTO.setFunctionId(processFunction("greater-than", dataType));
- } else if (PolicyConstants.Functions.FUNCTION_GREATER_EQUAL.equals(function)) {
- applyElementDTO.setFunctionId(processFunction("greater-than-or-equal", dataType));
- } else if (PolicyConstants.Functions.FUNCTION_LESS.equals(function)) {
- applyElementDTO.setFunctionId(processFunction("less-than", dataType));
- } else if (PolicyConstants.Functions.FUNCTION_LESS_EQUAL.equals(function)) {
- applyElementDTO.setFunctionId(processFunction("less-than-or-equal", dataType));
- } else {
- throw new PolicyEditorException("Can not create Apply element:" +
- "Invalid function : " + function);
- }
-
- ApplyElementDTO oneAndOnlyApplyElement = new ApplyElementDTO();
- oneAndOnlyApplyElement.setFunctionId(processFunction("one-and-only", dataType));
- oneAndOnlyApplyElement.setAttributeDesignators(designatorDTO);
-
- AttributeValueElementDTO valueElementDTO = new AttributeValueElementDTO();
- valueElementDTO.setAttributeDataType(dataType);
- valueElementDTO.setAttributeValue(values[0]);
-
- applyElementDTO.setApplyElement(oneAndOnlyApplyElement);
- applyElementDTO.setAttributeValueElementDTO(valueElementDTO);
-
- return applyElementDTO;
-
- }
- }
-
- /**
- * Process regexp-match functions.
- *
- * @param function Function name.
- * @param dataType Data type.
- * @param attributeValue Attribute Value.
- * @param designatorDTO AttributeDesignator information.
- * @return ApplyElementDTO.
- */
- public static ApplyElementDTO processRegexpFunctions(String function, String dataType, String attributeValue,
- AttributeDesignatorDTO designatorDTO) {
-
- if (PolicyConstants.Functions.FUNCTION_EQUAL_MATCH_REGEXP.equals(function)) {
- ApplyElementDTO applyElementDTO = new ApplyElementDTO();
- applyElementDTO.setFunctionId(PolicyConstants.XACMLData.FUNCTION_ANY_OF);
- if (applyElementMap.containsKey(attributeValue)) {
- applyElementDTO.setApplyElement(applyElementMap.get(attributeValue));
- } else {
- AttributeValueElementDTO valueElementDTO = new AttributeValueElementDTO();
- valueElementDTO.setAttributeDataType(dataType);
- valueElementDTO.setAttributeValue(attributeValue);
- applyElementDTO.setAttributeValueElementDTO(valueElementDTO);
- }
- applyElementDTO.setFunctionFunctionId(
- processFunction(PolicyConstants.Functions.FUNCTION_EQUAL_MATCH_REGEXP, dataType));
- applyElementDTO.setAttributeDesignators(designatorDTO);
- return applyElementDTO;
- }
- return null;
- }
-
- /**
- * Helper method to create full XACML function URI
- *
- * @param function
- * @param type
- * @param version
- * @return
- */
- private static String processFunction(String function, String type, String version) {
- return "urn:oasis:names:tc:xacml:" + version + ":function:" + getDataTypePrefix(type) +
- "-" + function;
- }
-
- /**
- * Helper method to create full XACML function URI
- *
- * @param function
- * @return
- */
- private static String processFunction(String function) {
- return "urn:oasis:names:tc:xacml:1.0:function:" + function;
- }
-
- /**
- * Helper method to create full XACML function URI
- *
- * @param function
- * @param type
- * @return
- */
- private static String processFunction(String function, String type) {
- return "urn:oasis:names:tc:xacml:1.0:function:" + getDataTypePrefix(type) + "-" + function;
- }
-//
-// /**
-// * Helper method to check whether attribute value is pre-defined one
-// *
-// * @param value
-// * @return
-// */
-// private static boolean isPreDefinedValue(String value){
-//
-// if(value != null && applyElementMap != null && applyElementMap.size() > 0){
-// value = value.trim();
-// if(value.startsWith("${") && value.endsWith("}")){
-// value = value.substring(value.indexOf("{") + 1, value.indexOf("}"));
-// return applyElementMap.containsKey(value);
-// }
-// }
-//
-// return false;
-// }
-//
-// /**
-// * Helper method to check whether attribute value is pre-defined one
-// *
-// * @param value
-// * @param map
-// * @return
-// */
-// private static boolean isPreDefinedValue(String value, Map map){
-//
-// if(value != null && map != null && map.size() > 0){
-// value = value.trim();
-// if(value.startsWith("${") && value.endsWith("}")){
-// value = value.substring(value.indexOf("{") + 1, value.indexOf("}"));
-// return map.containsKey(value);
-// }
-// }
-//
-// return false;
-// }
-
- /**
- * Helper method to create full XACML function URI
- *
- * @param dataTypeUri
- * @return
- */
- private static String getDataTypePrefix(String dataTypeUri) {
-
- if (dataTypeUri != null) {
- if (dataTypeUri.contains("#")) {
- return dataTypeUri.substring(dataTypeUri.indexOf("#") + 1);
- } else if (dataTypeUri.contains(":")) {
- String[] stringArray = dataTypeUri.split(":");
- if (stringArray != null && stringArray.length > 0) {
- return stringArray[stringArray.length - 1];
- }
- }
- }
- return dataTypeUri;
- }
-
- /**
- * Creates match element
- *
- * @param rowDTO
- * @return
- */
- public static MatchElementDTO createTargetMatch(RowDTO rowDTO) {
-
-
- String category = rowDTO.getCategory();
- String functionId = rowDTO.getFunction();
- String attributeValue = rowDTO.getAttributeValue();
- String attributeId = rowDTO.getAttributeId();
- String dataType = rowDTO.getAttributeDataType();
- MatchElementDTO matchElementDTO;
-
- if (functionId != null && functionId.trim().length() > 0 && attributeValue != null &&
- attributeValue.trim().length() > 0 && category != null &&
- category.trim().length() > 0 && attributeId != null &&
- attributeId.trim().length() > 0 && dataType != null &&
- dataType.trim().length() > 0) {
-
- functionId = processFunction(functionId, dataType);
-
- matchElementDTO = new MatchElementDTO();
-
- AttributeValueElementDTO attributeValueElementDTO = new AttributeValueElementDTO();
- attributeValueElementDTO.setAttributeDataType(dataType);
- attributeValueElementDTO.setAttributeValue(attributeValue.trim());
-
- AttributeDesignatorDTO attributeDesignatorDTO = new AttributeDesignatorDTO();
- attributeDesignatorDTO.setDataType(dataType);
- attributeDesignatorDTO.setAttributeId(attributeId);
- attributeDesignatorDTO.setCategory(category);
-
- matchElementDTO.setMatchId(functionId);
- matchElementDTO.setAttributeValueElementDTO(attributeValueElementDTO);
- matchElementDTO.setAttributeDesignatorDTO(attributeDesignatorDTO);
- } else {
- return null; // TODO
- }
-
- return matchElementDTO;
- }
-
-
- /**
- * This method creates a match element (such as subject,action,resource or environment) of the XACML policy
- *
- * @param matchElementDTO match element data object
- * @param doc XML document
- * @return match Element
- * @throws PolicyEditorException if any error occurs
- */
- public static Element createMatchElement(MatchElementDTO matchElementDTO, Document doc)
- throws PolicyEditorException {
-
- Element matchElement;
-
- if (matchElementDTO.getMatchId() != null && matchElementDTO.getMatchId().trim().length() > 0) {
-
- matchElement = doc.createElement(PolicyEditorConstants.MATCH_ELEMENT);
-
- matchElement.setAttribute(PolicyEditorConstants.MATCH_ID,
- matchElementDTO.getMatchId());
-
- if (matchElementDTO.getAttributeValueElementDTO() != null) {
- Element attributeValueElement = createAttributeValueElement(matchElementDTO.
- getAttributeValueElementDTO(), doc);
- matchElement.appendChild(attributeValueElement);
- }
-
- if (matchElementDTO.getAttributeDesignatorDTO() != null) {
- Element attributeDesignatorElement = createAttributeDesignatorElement(matchElementDTO.
- getAttributeDesignatorDTO(), doc);
- matchElement.appendChild(attributeDesignatorElement);
- } else if (matchElementDTO.getAttributeSelectorDTO() != null) {
- Element attributeSelectorElement = createAttributeSelectorElement(matchElementDTO.
- getAttributeSelectorDTO(), doc);
- matchElement.appendChild(attributeSelectorElement);
- }
- } else {
- throw new PolicyEditorException("Can not create Match element:" +
- " Required Attributes are missing");
- }
- return matchElement;
- }
-
- /**
- * This method creates attribute value DOM element
- *
- * @param attributeValueElementDTO attribute value element data object
- * @param doc XML document
- * @return attribute value element as DOM
- */
- public static Element createAttributeValueElement(AttributeValueElementDTO
- attributeValueElementDTO, Document doc) {
-
- Element attributeValueElement = doc.createElement(EntitlementPolicyConstants.ATTRIBUTE_VALUE);
-
- if (attributeValueElementDTO.getAttributeValue() != null && attributeValueElementDTO.
- getAttributeValue().trim().length() > 0) {
-
- attributeValueElement.setTextContent(attributeValueElementDTO.getAttributeValue().trim());
-
- if (attributeValueElementDTO.getAttributeDataType() != null && attributeValueElementDTO.
- getAttributeDataType().trim().length() > 0) {
- attributeValueElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
- attributeValueElementDTO.getAttributeDataType());
- } else {
- attributeValueElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
- EntitlementPolicyConstants.STRING_DATA_TYPE);
- }
-
- }
-
- return attributeValueElement;
- }
-
- /**
- * This method creates attribute designator DOM element
- *
- * @param attributeDesignatorDTO attribute designator data object
- * @param doc XML document
- * @return attribute designator element as DOM
- * @throws PolicyEditorException throws if missing required data
- */
- public static Element createAttributeDesignatorElement(AttributeDesignatorDTO
- attributeDesignatorDTO, Document doc) throws PolicyEditorException {
-
- Element attributeDesignatorElement;
-
- if (attributeDesignatorDTO != null && doc != null) {
-
- String category = attributeDesignatorDTO.getCategory();
- String attributeId = attributeDesignatorDTO.getAttributeId();
- String dataType = attributeDesignatorDTO.getDataType();
- String mustBe = attributeDesignatorDTO.getMustBePresent();
-
- if (category != null && category.trim().length() > 0 && attributeId != null &&
- attributeId.trim().length() > 0 && dataType != null && dataType.trim().length() > 0 &&
- mustBe != null && mustBe.trim().length() > 0) {
-
- attributeDesignatorElement = doc.
- createElement(PolicyEditorConstants.ATTRIBUTE_DESIGNATOR);
-
- attributeDesignatorElement.setAttribute(PolicyEditorConstants.ATTRIBUTE_ID,
- attributeId);
-
- attributeDesignatorElement.setAttribute(PolicyEditorConstants.CATEGORY, category);
-
- attributeDesignatorElement.setAttribute(PolicyEditorConstants.DATA_TYPE, dataType);
-
- attributeDesignatorElement.setAttribute(PolicyEditorConstants.MUST_BE_PRESENT, mustBe);
-
- if (attributeDesignatorDTO.getIssuer() != null && attributeDesignatorDTO.getIssuer().
- trim().length() > 0) {
- attributeDesignatorElement.setAttribute(EntitlementPolicyConstants.ISSUER,
- attributeDesignatorDTO.getIssuer());
- }
- } else {
- throw new PolicyEditorException("Can not create AttributeDesignator element:" +
- " Required Attributes are missing");
- }
- } else {
- throw new PolicyEditorException("Can not create AttributeDesignator element:" +
- " A Null object is received");
- }
- return attributeDesignatorElement;
- }
-
- /**
- * This method creates attribute selector DOM element
- *
- * @param attributeSelectorDTO attribute selector data object
- * @param doc xML document
- * @return attribute selector element as DOM
- */
- public static Element createAttributeSelectorElement(AttributeSelectorDTO attributeSelectorDTO,
- Document doc) {
-
- Element attributeSelectorElement = doc.createElement(EntitlementPolicyConstants.
- ATTRIBUTE_SELECTOR);
-
- if (attributeSelectorDTO.getAttributeSelectorRequestContextPath() != null &&
- attributeSelectorDTO.getAttributeSelectorRequestContextPath().trim().length() > 0) {
-
- attributeSelectorElement.setAttribute(EntitlementPolicyConstants.REQUEST_CONTEXT_PATH,
- EntitlementPolicyConstants.ATTRIBUTE_NAMESPACE + attributeSelectorDTO.
- getAttributeSelectorRequestContextPath());
-
- if (attributeSelectorDTO.getAttributeSelectorDataType() != null &&
- attributeSelectorDTO.getAttributeSelectorDataType().trim().length() > 0) {
- attributeSelectorElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
- attributeSelectorDTO.getAttributeSelectorDataType());
- } else {
- attributeSelectorElement.setAttribute(EntitlementPolicyConstants.DATA_TYPE,
- EntitlementPolicyConstants.STRING_DATA_TYPE);
- }
-
- if (attributeSelectorDTO.getAttributeSelectorMustBePresent() != null &&
- attributeSelectorDTO.getAttributeSelectorMustBePresent().trim().length() > 0) {
- attributeSelectorElement.setAttribute(EntitlementPolicyConstants.MUST_BE_PRESENT,
- attributeSelectorDTO.getAttributeSelectorMustBePresent());
- }
-
- }
-
- return attributeSelectorElement;
- }
-
- /**
- * Modifies the user data that are got from policy editor. If there are null values for required
- * things, replace them with default values
- */
- public static String[] processPolicySetData(PolicySetDTO policyDTO) {
-
- TargetDTO targetDTO = policyDTO.getTargetDTO();
- List obligationDTOs = policyDTO.getObligations();
- List policyRefIdDTOs = policyDTO.getPolicyRefIdDTOs();
- String policyOrder = policyDTO.getPolicyOrder();
-
-
- PolicyEditorDataHolder holder = PolicyEditorEngine.getInstance().
- getPolicyEditorData(EntitlementConstants.PolicyEditor.SET);
-
- List policyMetaDataList = new ArrayList();
-
- List arrangedRefIdDTOs = new ArrayList();
-
- if (policyOrder != null && policyOrder.trim().length() > 0) {
- String[] ruleIds = policyOrder.
- split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
- for (String ruleId : ruleIds) {
- for (PolicyRefIdDTO dto : policyRefIdDTOs) {
- if (ruleId.equals(dto.getId())) {
- arrangedRefIdDTOs.add(dto);
- }
- }
- }
- policyRefIdDTOs = arrangedRefIdDTOs;
- }
- createMetaDataFromPolicySet("policy", policyDTO, policyMetaDataList);
- String algorithm = policyDTO.getPolicyCombiningAlgId();
- if (algorithm != null && algorithm.trim().length() > 0) {
- policyDTO.setPolicyCombiningAlgId(holder.getPolicyAlgorithmUri(algorithm));
- } else {
- policyDTO.setPolicyCombiningAlgId(holder.getDefaultPolicyAlgorithm());
- }
-
- if (targetDTO != null && targetDTO.getRowDTOList() != null) {
- List newRowDTOs = new ArrayList();
- for (RowDTO rowDTO : targetDTO.getRowDTOList()) {
- createMetaDataFromRowDTO("target", rowDTO, policyMetaDataList);
- String category = rowDTO.getCategory();
-
- if (category == null) {
- continue;
- }
-
- String attributeValue = rowDTO.getAttributeValue();
- if (attributeValue == null || attributeValue.trim().length() < 1) {
- continue;
- }
- rowDTO.setCategory(holder.getCategoryUri(category));
-
- if (rowDTO.getAttributeDataType() == null ||
- rowDTO.getAttributeDataType().trim().length() < 1 ||
- rowDTO.getAttributeDataType().trim().equals("null")) {
-
- if (holder.getDefaultDataType() != null) {
- rowDTO.setAttributeDataType(holder.getDefaultDataType());
- } else {
- rowDTO.setAttributeDataType(PolicyEditorConstants.DataType.STRING);
- }
- } else {
- if (holder.getDataTypeUri(rowDTO.getAttributeDataType()) != null) {
- rowDTO.setAttributeDataType(holder.getDataTypeUri(rowDTO.getAttributeDataType()));
- }
- }
-
- String attributeId = rowDTO.getAttributeId();
- if (attributeId == null || attributeId.trim().length() < 1 ||
- attributeId.trim().equals("null")) {
- attributeId = holder.getCategoryDefaultAttributeId(category);
- }
- rowDTO.setAttributeId(holder.getAttributeIdUri(attributeId));
- rowDTO.setFunction(holder.getFunctionUri(rowDTO.getFunction()));
- rowDTO.setPreFunction(holder.getPreFunctionUri(rowDTO.getPreFunction()));
- newRowDTOs.add(rowDTO);
- }
- targetDTO.setRowDTOList(newRowDTOs);
- policyDTO.setTargetDTO(targetDTO);
- }
-
- if (policyRefIdDTOs != null) {
- policyDTO.setPolicyRefIdDTOs(policyRefIdDTOs);
- for (PolicyRefIdDTO dto : policyRefIdDTOs) {
- createMetaDataFromReference("reference", dto, policyMetaDataList);
- }
- }
-
- if (obligationDTOs != null) {
- for (ObligationDTO dto : obligationDTOs) {
- createMetaDataFromObligation("obligation", dto, policyMetaDataList);
- if (dto.getAttributeValueDataType() == null ||
- dto.getAttributeValueDataType().trim().length() == 0 ||
- dto.getAttributeValueDataType().trim().equals("null")) {
- dto.setAttributeValueDataType(PolicyEditorConstants.DataType.STRING);
- }
- if (dto.getResultAttributeId() == null ||
- dto.getResultAttributeId().trim().length() == 0 ||
- dto.getResultAttributeId().trim().equals("null")) {
- // setting obligation id
- dto.setResultAttributeId(dto.getObligationId());
- }
- }
- policyDTO.setObligations(obligationDTOs);
- }
-
- return policyMetaDataList.toArray(new String[policyMetaDataList.size()]);
- }
-
-
- /**
- * Modifies the user data that are got from policy editor. If there are null values for required
- * things, replace them with default values
- */
- public static String[] processPolicyData(PolicyDTO policyDTO) {
-
- TargetDTO targetDTO = policyDTO.getTargetDTO();
- List ruleDTOs = policyDTO.getRuleDTOs();
- List obligationDTOs = policyDTO.getObligationDTOs();
- String ruleElementOrder = policyDTO.getRuleOrder();
-
-
- PolicyEditorDataHolder holder = PolicyEditorEngine.getInstance().
- getPolicyEditorData(EntitlementConstants.PolicyEditor.STANDARD);
-
- List policyMetaDataList = new ArrayList();
-
- List arrangedRules = new ArrayList();
-
- if (ruleElementOrder != null && ruleElementOrder.trim().length() > 0) {
- String[] ruleIds = ruleElementOrder.
- split(EntitlementPolicyConstants.ATTRIBUTE_SEPARATOR);
- for (String ruleId : ruleIds) {
- for (RuleDTO ruleDTO : ruleDTOs) {
- if (ruleId.equals(ruleDTO.getRuleId())) {
- arrangedRules.add(ruleDTO);
- }
- }
- }
- ruleDTOs = arrangedRules;
- }
- createMetaDataFromPolicy("policy", policyDTO, policyMetaDataList);
- String algorithm = policyDTO.getRuleAlgorithm();
- if (algorithm != null && algorithm.trim().length() > 0) {
- policyDTO.setRuleAlgorithm(holder.getRuleAlgorithmUri(algorithm));
- } else {
- policyDTO.setRuleAlgorithm(holder.getDefaultRuleAlgorithm());
- }
-
- if (targetDTO != null && targetDTO.getRowDTOList() != null) {
- List newRowDTOs = new ArrayList();
- for (RowDTO rowDTO : targetDTO.getRowDTOList()) {
- createMetaDataFromRowDTO("target", rowDTO, policyMetaDataList);
- String category = rowDTO.getCategory();
-
- if (category == null) {
- continue;
- }
-
- String attributeValue = rowDTO.getAttributeValue();
- if (attributeValue == null || attributeValue.trim().length() < 1) {
- continue;
- }
- rowDTO.setCategory(holder.getCategoryUri(category));
-
- if (rowDTO.getAttributeDataType() == null ||
- rowDTO.getAttributeDataType().trim().length() < 1 ||
- rowDTO.getAttributeDataType().trim().equals("null")) {
-
- if (holder.getDefaultDataType() != null) {
- rowDTO.setAttributeDataType(holder.getDefaultDataType());
- } else {
- rowDTO.setAttributeDataType(PolicyEditorConstants.DataType.STRING);
- }
- } else {
- if (holder.getDataTypeUri(rowDTO.getAttributeDataType()) != null) {
- rowDTO.setAttributeDataType(holder.getDataTypeUri(rowDTO.getAttributeDataType()));
- }
- }
-
- String attributeId = rowDTO.getAttributeId();
- if (attributeId == null || attributeId.trim().length() < 1 ||
- attributeId.trim().equals("null")) {
- attributeId = holder.getCategoryDefaultAttributeId(category);
- }
- rowDTO.setAttributeId(holder.getAttributeIdUri(attributeId));
- rowDTO.setFunction(holder.getFunctionUri(rowDTO.getFunction()));
- rowDTO.setPreFunction(holder.getPreFunctionUri(rowDTO.getPreFunction()));
- newRowDTOs.add(rowDTO);
- }
- targetDTO.setRowDTOList(newRowDTOs);
- policyDTO.setTargetDTO(targetDTO);
- }
-
- if (ruleDTOs != null) {
- for (RuleDTO ruleDTO : ruleDTOs) {
- createMetaDataFromRule("rule", ruleDTO, policyMetaDataList);
- List newRowDTOs = new ArrayList();
- for (RowDTO rowDTO : ruleDTO.getRowDTOList()) {
- createMetaDataFromRowDTO("ruleRow" + ruleDTO.getRuleId(), rowDTO, policyMetaDataList);
- String category = rowDTO.getCategory();
-
- if (category == null) {
- continue;
- }
-
- String attributeValue = rowDTO.getAttributeValue();
- if (attributeValue == null || attributeValue.trim().length() < 1) {
- continue;
- }
- rowDTO.setCategory(holder.getCategoryUri(category));
-
- if (rowDTO.getAttributeDataType() == null ||
- rowDTO.getAttributeDataType().trim().length() < 1 ||
- rowDTO.getAttributeDataType().trim().equals("null")) {
-
- if (holder.getDefaultDataType() != null) {
- rowDTO.setAttributeDataType(holder.getDefaultDataType());
- } else {
- rowDTO.setAttributeDataType(PolicyEditorConstants.DataType.STRING);
- }
- } else {
- if (holder.getDataTypeUri(rowDTO.getAttributeDataType()) != null) {
- rowDTO.setAttributeDataType(holder.getDataTypeUri(rowDTO.getAttributeDataType()));
- }
- }
-
- String attributeId = rowDTO.getAttributeId();
- if (attributeId == null || attributeId.trim().length() < 1 ||
- attributeId.trim().equals("null")) {
- attributeId = holder.getCategoryDefaultAttributeId(category);
- }
- rowDTO.setAttributeId(holder.getAttributeIdUri(attributeId));
- rowDTO.setFunction(holder.getFunctionUri(rowDTO.getFunction()));
- rowDTO.setPreFunction(holder.getPreFunctionUri(rowDTO.getPreFunction()));
- newRowDTOs.add(rowDTO);
- }
-
- ruleDTO.setRowDTOList(newRowDTOs);
-
- TargetDTO ruleTargetDTO = ruleDTO.getTargetDTO();
-
- if (ruleTargetDTO == null) {
- continue;
- }
-
- List newTargetRowDTOs = new ArrayList();
-
- for (RowDTO rowDTO : ruleTargetDTO.getRowDTOList()) {
- createMetaDataFromRowDTO("ruleTarget" + ruleDTO.getRuleId(), rowDTO, policyMetaDataList);
- String category = rowDTO.getCategory();
-
- if (category == null) {
- continue;
- }
-
- String attributeValue = rowDTO.getAttributeValue();
- if (attributeValue == null || attributeValue.trim().length() < 1) {
- continue;
- }
- rowDTO.setCategory(holder.getCategoryUri(category));
-
- if (rowDTO.getAttributeDataType() == null ||
- rowDTO.getAttributeDataType().trim().length() < 1 ||
- rowDTO.getAttributeDataType().trim().equals("null")) {
-
- if (holder.getDefaultDataType() != null) {
- rowDTO.setAttributeDataType(holder.getDefaultDataType());
- } else {
- rowDTO.setAttributeDataType(PolicyEditorConstants.DataType.STRING);
- }
- } else {
- if (holder.getDataTypeUri(rowDTO.getAttributeDataType()) != null) {
- rowDTO.setAttributeDataType(holder.getDataTypeUri(rowDTO.getAttributeDataType()));
- }
- }
-
- String attributeId = rowDTO.getAttributeId();
- if (attributeId == null || attributeId.trim().length() < 1 ||
- attributeId.trim().equals("null")) {
- attributeId = holder.getCategoryDefaultAttributeId(category);
- }
- rowDTO.setAttributeId(holder.getAttributeIdUri(attributeId));
- rowDTO.setFunction(holder.getFunctionUri(rowDTO.getFunction()));
- rowDTO.setPreFunction(holder.getPreFunctionUri(rowDTO.getPreFunction()));
- newTargetRowDTOs.add(rowDTO);
- }
-
- ruleTargetDTO.setRowDTOList(newTargetRowDTOs);
-
- List ruleObligationDTOs = ruleDTO.getObligationDTOs();
-
- if (ruleObligationDTOs != null) {
- for (ObligationDTO dto : ruleObligationDTOs) {
- createMetaDataFromObligation("ruleObligation" + ruleDTO.getRuleId(),
- dto, policyMetaDataList);
- if (dto.getAttributeValueDataType() == null ||
- dto.getAttributeValueDataType().trim().length() < 1 ||
- dto.getAttributeValueDataType().trim().equals("null")) {
- dto.setAttributeValueDataType(PolicyEditorConstants.DataType.STRING);
- }
- if (dto.getResultAttributeId() == null ||
- dto.getResultAttributeId().trim().length() == 0 ||
- dto.getResultAttributeId().trim().equals("null")) {
- // setting obligation id
- dto.setResultAttributeId(dto.getObligationId());
- }
- }
- ruleDTO.setObligationDTOs(ruleObligationDTOs);
- }
-
- ruleDTO.setTargetDTO(ruleTargetDTO);
- }
-
- policyDTO.setRuleDTOs(ruleDTOs);
- }
-
- if (obligationDTOs != null) {
- for (ObligationDTO dto : obligationDTOs) {
- createMetaDataFromObligation("obligation", dto, policyMetaDataList);
- if (dto.getAttributeValueDataType() == null ||
- dto.getAttributeValueDataType().trim().length() == 0 ||
- dto.getAttributeValueDataType().trim().equals("null")) {
- dto.setAttributeValueDataType(PolicyEditorConstants.DataType.STRING);
- }
- if (dto.getResultAttributeId() == null ||
- dto.getResultAttributeId().trim().length() == 0 ||
- dto.getResultAttributeId().trim().equals("null")) {
- // setting obligation id
- dto.setResultAttributeId(dto.getObligationId());
- }
- }
- policyDTO.setObligationDTOs(obligationDTOs);
- }
-
-// for(ExtendAttributeDTO attributeDTO : ruleDTO.getAttributeDTOs()){
-//
-// String id = attributeDTO.getId();
-// String selector = attributeDTO.getSelector();
-// String category = null;
-// String function = null;
-//
-// if(id == null){
-// continue;
-// }
-//
-// if(PolicyEditorConstants.DYNAMIC_SELECTOR_FUNCTION.equals(selector)){
-//
-// String attributeValue = attributeDTO.getAttributeValue();
-// if(attributeValue == null || attributeValue.trim().length() < 1){
-// continue;
-// }
-// function = attributeDTO.getFunction();
-// if(function != null){
-// function = function.replace(">", ">");
-// function = function.replace("<", "<");
-//
-// if(ruleFunctionMap.get(function) != null){// TODO
-// attributeDTO.setFunction(ruleFunctionMap.get(function));
-// }
-// }
-//
-// if(attributeDTO.getDataType() == null ||
-// attributeDTO.getDataType().trim().length() < 1 ||
-// attributeDTO.getDataType().trim().equals("null")) {
-//
-// if(category != null && defaultDataTypeMap.get(category) != null){
-// attributeDTO.setDataType((defaultDataTypeMap.
-// get(category).iterator().next()));
-// } else {
-// attributeDTO.setDataType(PolicyEditorConstants.DataType.STRING);
-// }
-// }
-//
-// } else {
-//
-// category = attributeDTO.getCategory();
-//
-// if(category == null || category.trim().length() < 1){
-// continue;
-// }
-//
-// if(categoryMap.get(category) != null){
-// attributeDTO.setCategory(categoryMap.get(category));
-// }
-//
-// if(attributeDTO.getDataType() == null ||
-// attributeDTO.getDataType().trim().length() < 1 ||
-// attributeDTO.getDataType().trim().equals("null")) {
-//
-// if(defaultDataTypeMap.get(category) != null){
-// attributeDTO.setDataType((defaultDataTypeMap.
-// get(category).iterator().next()));
-// } else {
-// attributeDTO.setDataType(PolicyEditorConstants.DataType.STRING);
-// }
-// }
-//
-// if(attributeDTO.getAttributeId() == null ||
-// attributeDTO.getAttributeId().trim().length() < 1 ||
-// attributeDTO.getAttributeId().trim().equals("null")) {
-// if(defaultAttributeIdMap.get(category) != null){
-// attributeDTO.setAttributeId((defaultAttributeIdMap.
-// get(category).iterator().next()));
-// }
-// }
-// }
-//
-//
-// ExtendAttributeDTO odlRowDTO = new ExtendAttributeDTO(attributeDTO);
-// odlRowDTO.setCategory(category);
-// odlRowDTO.setFunction(function);
-// createMetaDataFromDynamicAttribute("targetRule" + odlRowDTO.getId(), odlRowDTO,
-// policyMetaDataList);
-// //newDynamicAttributeDTOs.add(attributeDTO);
-// }
-
- return policyMetaDataList.toArray(new String[policyMetaDataList.size()]);
- }
-
- private static void createMetaDataFromPolicy(String prefix, PolicyDTO policyDTO, List metaDataList) {
- if (metaDataList != null) {
- metaDataList.add(prefix + "|" + policyDTO.getPolicyId());
- metaDataList.add(prefix + "|" + policyDTO.getRuleAlgorithm());
- if (policyDTO.getDescription() == null) {
- policyDTO.setDescription("");
- }
- metaDataList.add(prefix + "|" + policyDTO.getDescription());
- metaDataList.add(prefix + "|" + policyDTO.getVersion());
- }
- }
-
- private static void createMetaDataFromPolicySet(String prefix, PolicySetDTO policyDTO, List metaDataList) {
- if (metaDataList != null) {
- metaDataList.add(prefix + "|" + policyDTO.getPolicySetId());
- metaDataList.add(prefix + "|" + policyDTO.getPolicyCombiningAlgId());
- if (policyDTO.getDescription() == null) {
- policyDTO.setDescription("");
- }
- metaDataList.add(prefix + "|" + policyDTO.getDescription());
- metaDataList.add(prefix + "|" + policyDTO.getVersion());
- }
- }
-
- private static void createMetaDataFromRule(String prefix, RuleDTO ruleDTO, List metaDataList) {
- if (metaDataList != null) {
- metaDataList.add(prefix + "|" + ruleDTO.getRuleId());
- metaDataList.add(prefix + "|" + ruleDTO.getRuleEffect());
- metaDataList.add(prefix + "|" + ruleDTO.getRuleDescription());
- }
- }
-
- private static void createMetaDataFromRowDTO(String prefix, RowDTO rowDTO, List metaDataList) {
-
- if (metaDataList != null) {
- metaDataList.add(prefix + "|" + rowDTO.getCategory());
- metaDataList.add(prefix + "|" + rowDTO.getPreFunction());
- metaDataList.add(prefix + "|" + rowDTO.getFunction());
- metaDataList.add(prefix + "|" + rowDTO.getAttributeValue());
- metaDataList.add(prefix + "|" + rowDTO.getAttributeId());
- metaDataList.add(prefix + "|" + rowDTO.getAttributeDataType());
- metaDataList.add(prefix + "|" + rowDTO.getCombineFunction());
- }
- }
-
- private static void createMetaDataFromDynamicAttribute(String prefix, ExtendAttributeDTO dto,
- List metaDataList) {
-
- if (metaDataList != null) {
- metaDataList.add(prefix + "|" + dto.getCategory());
- metaDataList.add(prefix + "|" + dto.getSelector());
- metaDataList.add(prefix + "|" + dto.getFunction());
- metaDataList.add(prefix + "|" + dto.getAttributeValue());
- metaDataList.add(prefix + "|" + dto.getAttributeId());
- metaDataList.add(prefix + "|" + dto.getDataType());
- metaDataList.add(prefix + "|" + dto.getId());
- }
- }
-
- private static void createMetaDataFromObligation(String prefix, ObligationDTO dto,
- List metaDataList) {
-
- if (metaDataList != null) {
- metaDataList.add(prefix + "|" + dto.getType());
- metaDataList.add(prefix + "|" + dto.getObligationId());
- metaDataList.add(prefix + "|" + dto.getEffect());
- metaDataList.add(prefix + "|" + dto.getAttributeValue());
- metaDataList.add(prefix + "|" + dto.getResultAttributeId());
- metaDataList.add(prefix + "|" + dto.getAttributeValueDataType());
- }
- }
-
- private static void createMetaDataFromReference(String prefix, PolicyRefIdDTO dto,
- List metaDataList) {
- if (metaDataList != null) {
- metaDataList.add(prefix + "|" + dto.getId());
- metaDataList.add(prefix + "|" + dto.isPolicySet());
- metaDataList.add(prefix + "|" + dto.isReferenceOnly());
- }
- }
-
- public static String[] createBasicPolicyData(SimplePolicyEditorDTO policyEditorDTO) {
-
- List metaDataList = new ArrayList();
-
- metaDataList.add("policyId|" + policyEditorDTO.getPolicyId());
- metaDataList.add("category|" + policyEditorDTO.getAppliedCategory());
- metaDataList.add("policyDescription|" + policyEditorDTO.getDescription());
- metaDataList.add("userAttributeId|" + policyEditorDTO.getUserAttributeId());
- metaDataList.add("userAttributeValue|" + policyEditorDTO.getUserAttributeValue());
- metaDataList.add("function|" + policyEditorDTO.getFunction());
- metaDataList.add("actionValue|" + policyEditorDTO.getActionValue());
- metaDataList.add("resourceValue|" + policyEditorDTO.getResourceValue());
- metaDataList.add("category|" + policyEditorDTO.getAppliedCategory());
- metaDataList.add("environmentValue|" + policyEditorDTO.getEnvironmentValue());
- metaDataList.add("environmentId|" + policyEditorDTO.getEnvironmentId());
-
- List elementDTOs = policyEditorDTO.getSimplePolicyEditorElementDTOs();
-
- if (elementDTOs != null && elementDTOs.size() > 0) {
- for (int i = 0; i < elementDTOs.size(); i++) {
- SimplePolicyEditorElementDTO dto = elementDTOs.get(i);
- if (dto.getResourceValue() != null) {
- metaDataList.add("resourceValue" + i + "|" + dto.getResourceValue());
- } else {
- metaDataList.add("resourceValue" + i);
- }
- if (dto.getEnvironmentValue() != null) {
- metaDataList.add("environmentValue" + i + "|" + dto.getEnvironmentValue());
- } else {
- metaDataList.add("environmentValue" + i);
- }
- if (dto.getActionValue() != null) {
- metaDataList.add("actionValue" + i + "|" + dto.getActionValue());
- } else {
- metaDataList.add("actionValue" + i);
- }
- if (dto.getOperationType() != null) {
- metaDataList.add("operationValue" + i + "|" + dto.getOperationType());
- } else {
- metaDataList.add("operationValue" + i);
- }
- if (dto.getUserAttributeId() != null) {
- metaDataList.add("userAttributeId" + i + "|" + dto.getUserAttributeId());
- } else {
- metaDataList.add("userAttributeId" + i);
- }
- if (dto.getUserAttributeValue() != null) {
- metaDataList.add("userAttributeValue" + i + "|" + dto.getUserAttributeValue());
- } else {
- metaDataList.add("userAttributeValue" + i);
- }
- if (dto.getEnvironmentId() != null) {
- metaDataList.add("environmentId" + i + "|" + dto.getEnvironmentId());
- } else {
- metaDataList.add("environmentId" + i);
- }
- if (dto.getFunctionOnResources() != null) {
- metaDataList.add("functionOnResources" + i + "|" + dto.getFunctionOnResources());
- } else {
- metaDataList.add("functionOnResources" + i);
- }
- if (dto.getFunctionOnActions() != null) {
- metaDataList.add("functionOnActions" + i + "|" + dto.getFunctionOnActions());
- } else {
- metaDataList.add("functionOnActions" + i);
- }
- if (dto.getFunctionOnUsers() != null) {
- metaDataList.add("functionOnUsers" + i + "|" + dto.getFunctionOnUsers());
- } else {
- metaDataList.add("functionOnUsers" + i);
- }
- if (dto.getFunctionOnEnvironments() != null) {
- metaDataList.add("functionOnEnvironments" + i + "|" + dto.getFunctionOnEnvironments());
- } else {
- metaDataList.add("functionOnEnvironments" + i);
- }
-
- }
- }
- return metaDataList.toArray(new String[metaDataList.size()]);
- }
-
-////////////////////////////////////// Simple Policy Editor data ////////////////////////////////////
-
-
- public static SimplePolicyEditorDTO createSimplePolicyEditorDTO(String[] policyEditorData) {
-
- Map metaDataMap = new HashMap();
- List SimplePolicyEditorElementDTOs = new ArrayList();
-
- int i = 0;
-
- if (policyEditorData != null) {
- for (String data : policyEditorData) {
- if (data.contains("|")) {
- String identifier = data.substring(0, data.indexOf("|"));
- String value = data.substring(data.indexOf("|") + 1);
- metaDataMap.put(identifier, value);
- }
- i++;
- }
- }
-
- SimplePolicyEditorDTO policyEditorDTO = new SimplePolicyEditorDTO();
- policyEditorDTO.setPolicyId(metaDataMap.get("policyId"));
- policyEditorDTO.setAppliedCategory(metaDataMap.get("policyId"));
- policyEditorDTO.setFunction(metaDataMap.get("function"));
- policyEditorDTO.setActionValue(metaDataMap.get("actionValue"));
- policyEditorDTO.setDescription(metaDataMap.get("policyDescription"));
- policyEditorDTO.setUserAttributeId(metaDataMap.get("userAttributeId"));
- policyEditorDTO.setUserAttributeValue(metaDataMap.get("userAttributeValue"));
- policyEditorDTO.setResourceValue(metaDataMap.get("resourceValue"));
- policyEditorDTO.setEnvironmentValue(metaDataMap.get("environmentValue"));
- policyEditorDTO.setEnvironmentId(metaDataMap.get("environmentId"));
- policyEditorDTO.setAppliedCategory(metaDataMap.get("category"));
-
- i = (i - 11) / 11;
-
- for (int j = 0; j < i; j++) {
-
- SimplePolicyEditorElementDTO elementDTO = new SimplePolicyEditorElementDTO();
-
- elementDTO.setResourceValue(metaDataMap.get("resourceValue" + j));
- elementDTO.setEnvironmentValue(metaDataMap.get("environmentValue" + j));
- if (metaDataMap.get("actionValue" + j) != null) {
- elementDTO.setActionValue(metaDataMap.get("actionValue" + j));
- }
- elementDTO.setOperationType(metaDataMap.get("operationValue" + j));
- elementDTO.setUserAttributeId(metaDataMap.get("userAttributeId" + j));
- elementDTO.setUserAttributeValue(metaDataMap.get("userAttributeValue" + j));
- elementDTO.setEnvironmentId(metaDataMap.get("environmentId" + j));
- elementDTO.setFunctionOnResources(metaDataMap.get("functionOnResources" + j));
- elementDTO.setFunctionOnActions(metaDataMap.get("functionOnActions" + j));
- elementDTO.setFunctionOnUsers(metaDataMap.get("functionOnUsers" + j));
- elementDTO.setFunctionOnEnvironments(metaDataMap.get("functionOnEnvironments" + j));
-
- SimplePolicyEditorElementDTOs.add(elementDTO);
- }
-
- if (SimplePolicyEditorElementDTOs.size() > 0) {
- policyEditorDTO.setSimplePolicyEditorElementDTOs(SimplePolicyEditorElementDTOs);
- }
-
- return policyEditorDTO;
- }
-
-
-///////////////////////////////// policy Set ///////////////////////////////////////////////////////
-
-// public static PolicyElementDTO createPolicySetElementDTO(String policy)
-// throws EntitlementPolicyCreationException {
-//
-// PolicySetDTO policyElementDTO = new PolicySetDTO();
-// OMElement omElement;
-// try {
-// omElement = AXIOMUtil.stringToOM(policy);
-// } catch (XMLStreamException e) {
-// throw new EntitlementPolicyCreationException("Policy can not be converted to OMElement");
-// }
-//
-// if (omElement != null) {
-//
-// policyElementDTO.setPolicySetId(omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.POLICY_SET_ID)));
-//
-// String ruleCombiningAlgorithm = omElement.
-// getAttributeValue(new QName(EntitlementPolicyConstants.POLICY_ALGORITHM));
-//
-// try{
-// policyElementDTO.setRuleCombiningAlgorithms(ruleCombiningAlgorithm.
-// split(PolicyEditorConstants.RULE_ALGORITHM_IDENTIFIER_3)[1]);
-// } catch (Exception ignore){
-// policyElementDTO.setRuleCombiningAlgorithms(ruleCombiningAlgorithm.
-// split(PolicyEditorConstants.RULE_ALGORITHM_IDENTIFIER_1)[1]);
-// // if this is also fails, can not edit the policy
-// }
-//
-// Iterator iterator = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
-// DESCRIPTION_ELEMENT);
-//
-// if(iterator.hasNext()){
-// OMElement descriptionElement = (OMElement) iterator.next();
-// if(descriptionElement != null && descriptionElement.getText() != null){
-// policyElementDTO.setPolicyDescription(descriptionElement.getText().trim());
-// }
-// }
-//
-// }
-// return policyElementDTO;
-// }
-
-//////////////////////////////// Standard policy editor/////////////////////////////////////////////////////
-
- public static PolicyElementDTO createPolicyElementDTO(String policy)
- throws EntitlementPolicyCreationException {
-
- PolicyElementDTO policyElementDTO = new PolicyElementDTO();
- OMElement omElement;
- try {
- omElement = AXIOMUtil.stringToOM(policy);
- } catch (XMLStreamException e) {
- throw new EntitlementPolicyCreationException("Policy can not be converted to OMElement");
- }
-
- if (omElement != null) {
-
- policyElementDTO.setPolicyName(omElement.
- getAttributeValue(new QName(EntitlementPolicyConstants.POLICY_ID)));
-
- String ruleCombiningAlgorithm = omElement.
- getAttributeValue(new QName(EntitlementPolicyConstants.RULE_ALGORITHM));
-
- try {
- policyElementDTO.setRuleCombiningAlgorithms(ruleCombiningAlgorithm.
- split(PolicyEditorConstants.RULE_ALGORITHM_IDENTIFIER_3)[1]);
- } catch (Exception ignore) {
- policyElementDTO.setRuleCombiningAlgorithms(ruleCombiningAlgorithm.
- split(PolicyEditorConstants.RULE_ALGORITHM_IDENTIFIER_1)[1]);
- // if this is also fails, can not edit the policy
- }
-
- Iterator iterator = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
- DESCRIPTION_ELEMENT);
-
- if (iterator.hasNext()) {
- OMElement descriptionElement = (OMElement) iterator.next();
- if (descriptionElement != null && descriptionElement.getText() != null) {
- policyElementDTO.setPolicyDescription(descriptionElement.getText().trim());
- }
- }
-
- }
- return policyElementDTO;
- }
-
- public static List createRuleElementDTOs(String policy)
- throws EntitlementPolicyCreationException {
-
- List ruleElementDTOs = new ArrayList();
- OMElement omElement;
- try {
- omElement = AXIOMUtil.stringToOM(policy);
- } catch (XMLStreamException e) {
- throw new EntitlementPolicyCreationException("Policy can not be converted to OMElement");
- }
-
- if (omElement != null) {
- Iterator iterator2 = omElement.getChildrenWithLocalName(EntitlementPolicyConstants.
- RULE_ELEMENT);
- while (iterator2.hasNext()) {
- OMElement ruleElement = (OMElement) iterator2.next();
- ruleElementDTOs.add(createRuleDTO(ruleElement));
- }
- }
- return ruleElementDTOs;
- }
-
-
- public static RuleElementDTO createRuleDTO(OMElement omElement) {
- RuleElementDTO ruleElementDTO = new RuleElementDTO();
-
- if (omElement != null) {
- ruleElementDTO.setRuleId(omElement.
- getAttributeValue(new QName(EntitlementPolicyConstants.RULE_ID)).trim());
- ruleElementDTO.setRuleEffect(omElement.
- getAttributeValue(new QName(EntitlementPolicyConstants.RULE_EFFECT)).trim());
-
- Iterator iterator1 = omElement.
- getChildrenWithLocalName(EntitlementPolicyConstants.DESCRIPTION_ELEMENT);
-
- while (iterator1.hasNext()) {
- OMElement descriptionElement = (OMElement) iterator1.next();
- if (descriptionElement != null && descriptionElement.getText() != null) {
- ruleElementDTO.setRuleDescription(descriptionElement.getText().trim());
- }
- }
- }
-
- return ruleElementDTO;
- }
-
-
- public static void processRuleRowPolicyEditorData(List rules, String[] policyEditorData) {
-
- for (RuleDTO ruleDTO : rules) {
- List ruleList = new ArrayList();
- List ruleTargetList = new ArrayList();
- List obligationList = new ArrayList();
-
- for (String data : policyEditorData) {
- if (data.contains("|")) {
- String identifier = data.substring(0, data.indexOf("|"));
- if (identifier.startsWith("ruleTarget")) {
- String ruleId = identifier.substring(10);
- if (ruleId != null && ruleId.contains(ruleDTO.getRuleId())) {
- ruleTargetList.add(data.substring(data.indexOf("|") + 1));
- }
- } else if (identifier.startsWith("ruleObligation")) {
- String ruleId = identifier.substring(14);
- if (ruleId != null && ruleId.equals(ruleDTO.getRuleId())) {
- obligationList.add(data.substring(data.indexOf("|") + 1));
- }
- } else if (identifier.startsWith("ruleRow")) {
- String ruleId = identifier.substring(7);
- if (ruleId != null && ruleId.equals(ruleDTO.getRuleId())) {
- ruleList.add(data.substring(data.indexOf("|") + 1));
- }
- }
- }
- }
-
- ruleDTO.setRowDTOList(createRowDTO(ruleList));
- ruleDTO.getTargetDTO().setRowDTOList(createRowDTO(ruleTargetList));
- ruleDTO.setObligationDTOs(createObligationDTO(obligationList));
- ruleDTO.setCompletedRule(true);
- }
- }
-
- public static void processTargetPolicyEditorData(TargetDTO targetDTO, String[] policyEditorData) {
-
- List targetList = new ArrayList();
-
- if (policyEditorData != null) {
- for (String data : policyEditorData) {
- if (data.contains("|")) {
- String identifier = data.substring(0, data.indexOf("|"));
- if (("target").equals(identifier)) {
- targetList.add(data.substring(data.indexOf("|") + 1));
- }
- }
- }
-
- targetDTO.setRowDTOList(createRowDTO(targetList));
- }
- }
-
- public static void processPolicyEditorData(PolicyElementDTO policyElementDTO, String[] policyEditorData) {
-
- List targetList = new ArrayList();
-
- if (policyEditorData != null) {
- for (String data : policyEditorData) {
- if (data.contains("|")) {
- String identifier = data.substring(0, data.indexOf("|"));
- if (("policy").equals(identifier)) {
- targetList.add(data.substring(data.indexOf("|") + 1));
- }
- }
- }
-
- policyElementDTO.setPolicyName(targetList.get(0));
- policyElementDTO.setRuleCombiningAlgorithms(targetList.get(1));
- if (targetList.get(2) != null) {
- policyElementDTO.setPolicyDescription(targetList.get(2));
- }
- policyElementDTO.setVersion(targetList.get(3));
- }
- }
-
- public static void processObligationPolicyEditorData(List obligationDTOs,
- String[] policyEditorData) {
-
- List targetList = new ArrayList();
-
- if (policyEditorData != null) {
- for (String data : policyEditorData) {
- if (data.contains("|")) {
- String identifier = data.substring(0, data.indexOf("|"));
- if (("obligation").equals(identifier)) {
- targetList.add(data.substring(data.indexOf("|") + 1));
- }
- }
- }
-
- obligationDTOs.addAll(createObligationDTO(targetList));
- }
- }
-
- public static void processRulePolicyEditorData(List ruleDTOs,
- String[] policyEditorData) {
- List targetList = new ArrayList();
- if (policyEditorData != null) {
- for (String data : policyEditorData) {
- if (data.contains("|")) {
- String identifier = data.substring(0, data.indexOf("|"));
- if (("rule").equals(identifier)) {
- targetList.add(data.substring(data.indexOf("|") + 1));
- }
- }
- }
- ruleDTOs.addAll(createRuleDTO(targetList));
- if (ruleDTOs.size() > 0) {
- processRuleRowPolicyEditorData(ruleDTOs, policyEditorData);
- }
- }
- }
-
- public static void processReferencePolicyEditorData(List policyRefIdDTOs,
- String[] policyEditorData) {
-
- List targetList = new ArrayList();
- if (policyEditorData != null) {
- for (String data : policyEditorData) {
- if (data.contains("|")) {
- String identifier = data.substring(0, data.indexOf("|"));
- if (("reference").equals(identifier)) {
- targetList.add(data.substring(data.indexOf("|") + 1));
- }
- }
- }
-
- policyRefIdDTOs.addAll(createReferenceDTO(targetList));
- }
- }
-
- private static List createRowDTO(List list) {
- List rowDTOs = new ArrayList