From a632fbfad0ddbe8b343c6abe8e28dc41e3df9b7e Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 10 Jul 2015 10:16:25 +0000
Subject: [PATCH] Code cleanup
---
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java | 37 +++++++------------------------------
1 files changed, 7 insertions(+), 30 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
index b77f18f..f46cf72 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
@@ -39,18 +39,18 @@
/**
* A class representing an ACI's targetattr keyword.
*/
-public class TargetAttr {
+class TargetAttr {
/** Enumeration representing the targetattr operator. */
- private EnumTargetOperator operator = EnumTargetOperator.EQUALITY;
+ private final EnumTargetOperator operator;
/** Flags that is set if all user attributes pattern seen "*". */
private boolean allUserAttributes;
/** Flags that is set if all operational attributes pattern seen "+". */
private boolean allOpAttributes;
/** Set of the attribute types parsed by the constructor. */
- private HashSet<AttributeType> attributes = new HashSet<>();
+ private final HashSet<AttributeType> attributes = new HashSet<>();
/** Set of the operational attribute types parsed by the constructor. */
- private HashSet<AttributeType> opAttributes = new HashSet<>();
+ private final HashSet<AttributeType> opAttributes = new HashSet<>();
/**
* Regular expression that matches one or more ATTR_NAME's separated by
@@ -132,10 +132,7 @@
throw new AciException(message);
}
} else {
- AttributeType attrType = DirectoryServer.getAttributeType(attribute);
- if (attrType == null) {
- attrType = DirectoryServer.getDefaultAttributeType(attribute);
- }
+ AttributeType attrType = DirectoryServer.getAttributeType(attribute, true);
if(attrType.isOperational())
{
opAttributes.add(attrType);
@@ -175,24 +172,6 @@
}
/**
- * Return array holding each attribute type to be evaluated
- * in the expression.
- * @return Array holding each attribute types.
- */
- public HashSet<AttributeType> getAttributes() {
- return attributes;
- }
-
- /**
- * Return array holding operational attribute types to be evaluated
- * in the expression.
- * @return Array holding attribute types.
- */
- public HashSet<AttributeType> getOpAttributes() {
- return opAttributes;
- }
-
- /**
* Decodes an targetattr expression string into a targetattr class suitable
* for evaluation.
* @param operator The operator enumeration of the expression.
@@ -200,8 +179,7 @@
* @return A TargetAttr suitable to evaluate this ACI's targetattrs.
* @throws AciException If the expression string is invalid.
*/
- public static TargetAttr decode(EnumTargetOperator operator, String expr)
- throws AciException {
+ static TargetAttr decode(EnumTargetOperator operator, String expr) throws AciException {
return new TargetAttr(operator, expr);
}
@@ -224,8 +202,7 @@
* @return The boolean result of the above tests and application
* TargetAttr's operator value applied to the test result.
*/
-
- public static boolean isApplicable(AttributeType a, TargetAttr targetAttr) {
+ static boolean isApplicable(AttributeType a, TargetAttr targetAttr) {
if(targetAttr.isAllUserAttributes() && targetAttr.isAllOpAttributes()) {
return !targetAttr.getOperator().equals(EnumTargetOperator.NOT_EQUALITY);
} else {
--
Gitblit v1.10.0