- return null;
- }
-
- @Override
- public int size() {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("size: " + this.policies.size());
- }
- return this.policies.size();
- }
-
- @Override
- public boolean containsId(Object itemId) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("containsId: " + itemId);
- }
- return this.policies.contains(itemId);
- }
-
- @Override
- public Object addItem() {
- throw new UnsupportedOperationException("Cannot add an empty policy.");
- }
-
- @Override
- public boolean removeItem(Object itemId) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("removeItem: " + itemId);
- }
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- StdPDPPolicy pdpPolicy = null;
- try {
- pdpPolicy = mapper.readValue(itemId.toString() , StdPDPPolicy.class);
- for(int i = 0; i< policies.size(); i++){
- if(policies.get(i).getId().equalsIgnoreCase(pdpPolicy.getId())){
- return this.policies.remove(this.policies.get(i));
- }
- }
- } catch (Exception e) {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Exception Occured While Mapping the Removing Policy from PDP Group to Std Policy"+e);
- }
- return this.policies.remove(itemId);
- }
-
- @Override
- public boolean addContainerProperty(Object propertyId, Class<?> type,
- Object defaultValue) {
- return false;
- }
-
- @Override
- public boolean removeContainerProperty(Object propertyId) {
- return false;
- }
-
- @Override
- public boolean removeAllItems() {
- return false;
- }
-
- @Override
- public int indexOfId(Object itemId) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("indexOfId: " + itemId);
- }
- return this.policies.indexOf(itemId);
- }
-
- @Override
- public Object getIdByIndex(int index) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("getIdByIndex: " + index);
- }
- return this.policies.get(index);
- }
-
- @Override
- public List<?> getItemIds(int startIndex, int numberOfItems) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("getItemIds: " + startIndex + " " + numberOfItems);
- }
- if (numberOfItems < 0) {
- throw new IllegalArgumentException();
- }
- return this.policies.subList(startIndex, startIndex + numberOfItems);
- }
-
- @Override
- public Object addItemAt(int index) {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("addItemAt: " + index);
- }
- return null;
- }
-
- public class PDPPolicyItem {
- private final PDPPolicy policy;
-
- public PDPPolicyItem(PDPPolicy itemId) {
- this.policy = itemId;
- }
-
- public String getId() {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("getId: " + this.policy);
- }
- return this.policy.getId();
- }
-
- public String getName() {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("getName: " + this.policy);
- }
- return this.policy.getName();
- }
-
- public String getVersion() {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("getVersion: " + this.policy);
- }
- return this.policy.getVersion();
- }
-
- public String getDescription() {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("getDescription: " + this.policy);
- }
- return this.policy.getDescription();
- }
-
- public boolean getRoot() {
- if (LOGGER.isTraceEnabled()) {
- LOGGER.trace("isRoot: " + this.policy);
- }
- return this.policy.isRoot();
- }
-
- public void setRoot(Boolean root) {
- ((StdPDPPolicy)this.policy).setRoot(root);
- }
-
- }
+ return null;
+ }
+
+ @Override
+ public int size() {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("size: " + this.policies.size());
+ }
+ return this.policies.size();
+ }
+
+ @Override
+ public boolean containsId(Object itemId) {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("containsId: " + itemId);
+ }
+ return this.policies.contains(itemId);
+ }
+
+ @Override
+ public Object addItem() {
+ throw new UnsupportedOperationException("Cannot add an empty policy.");
+ }
+
+ @Override
+ public boolean removeItem(Object itemId) {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("removeItem: " + itemId);
+ }
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ StdPDPPolicy pdpPolicy = null;
+ try {
+ pdpPolicy = mapper.readValue(itemId.toString() , StdPDPPolicy.class);
+ for(int i = 0; i< policies.size(); i++){
+ if(policies.get(i).getId().equalsIgnoreCase(pdpPolicy.getId())){
+ return this.policies.remove(this.policies.get(i));
+ }
+ }
+ } catch (Exception e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Exception Occured While Mapping the Removing Policy from PDP Group to Std Policy"+e);
+ }
+ return this.policies.remove(itemId);
+ }
+
+ @Override
+ public boolean addContainerProperty(Object propertyId, Class<?> type,
+ Object defaultValue) {
+ return false;
+ }
+
+ @Override
+ public boolean removeContainerProperty(Object propertyId) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAllItems() {
+ return false;
+ }
+
+ @Override
+ public int indexOfId(Object itemId) {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("indexOfId: " + itemId);
+ }
+ return this.policies.indexOf(itemId);
+ }
+
+ @Override
+ public Object getIdByIndex(int index) {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("getIdByIndex: " + index);
+ }
+ return this.policies.get(index);
+ }
+
+ @Override
+ public List<?> getItemIds(int startIndex, int numberOfItems) {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("getItemIds: " + startIndex + " " + numberOfItems);
+ }
+ if (numberOfItems < 0) {
+ throw new IllegalArgumentException();
+ }
+ return this.policies.subList(startIndex, startIndex + numberOfItems);
+ }
+
+ @Override
+ public Object addItemAt(int index) {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("addItemAt: " + index);
+ }
+ return null;
+ }
+
+ public class PDPPolicyItem {
+ private final PDPPolicy policy;
+
+ public PDPPolicyItem(PDPPolicy itemId) {
+ this.policy = itemId;
+ }
+
+ public String getId() {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("getId: " + this.policy);
+ }
+ return this.policy.getId();
+ }
+
+ public String getName() {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("getName: " + this.policy);
+ }
+ return this.policy.getName();
+ }
+
+ public String getVersion() {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("getVersion: " + this.policy);
+ }
+ return this.policy.getVersion();
+ }
+
+ public String getDescription() {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("getDescription: " + this.policy);
+ }
+ return this.policy.getDescription();
+ }
+
+ public boolean getRoot() {
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("isRoot: " + this.policy);
+ }
+ return this.policy.isRoot();
+ }
+
+ public void setRoot(Boolean root) {
+ ((StdPDPPolicy)this.policy).setRoot(root);
+ }
+
+ }