From e8cead474d5ce2b933d931f0c4743a78e68d9cfc Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 18 Aug 2015 09:39:52 +0000
Subject: [PATCH] Replaced uses of StringBuilder.append(Utils.joinAsString(String, Collection)) with the more efficient Utils.joinAsString(StringBuilder, String, Collection).
---
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/CompareResponseProtocolOp.java | 65 ---
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/DeleteResponseProtocolOp.java | 67 ---
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java | 74 ----
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyResponseProtocolOp.java | 64 ---
opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java | 187 ++++--------
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/AddResponseProtocolOp.java | 65 ---
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyDNResponseProtocolOp.java | 65 ---
opendj-server-legacy/src/test/java/org/opends/server/types/TestAttributeType.java | 6
opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java | 2
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchRequestProtocolOp.java | 43 --
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchResultDoneProtocolOp.java | 65 ---
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java | 44 --
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/BindResponseProtocolOp.java | 70 ---
opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java | 60 ---
14 files changed, 158 insertions(+), 719 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/AddResponseProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/AddResponseProtocolOp.java
index 5cbc02a..c80cc59 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/AddResponseProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/AddResponseProtocolOp.java
@@ -26,16 +26,15 @@
*/
package org.opends.server.protocols.ldap;
-import org.forgerock.i18n.LocalizableMessage;
-
-import java.util.List;
import java.io.IOException;
+import java.util.List;
-import org.forgerock.opendj.io.*;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.util.Utils;
import org.opends.server.types.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -51,13 +50,10 @@
/** The matched DN for this response. */
private DN matchedDN;
-
/** The result code for this response. */
private int resultCode;
-
/** The set of referral URLs for this response. */
private List<String> referralURLs;
-
/** The error message for this response. */
private LocalizableMessage errorMessage;
@@ -71,10 +67,6 @@
public AddResponseProtocolOp(int resultCode)
{
this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- referralURLs = null;
}
@@ -90,9 +82,6 @@
{
this.resultCode = resultCode;
this.errorMessage = errorMessage;
-
- matchedDN = null;
- referralURLs = null;
}
@@ -164,36 +153,19 @@
return referralURLs;
}
-
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
+ @Override
public byte getType()
{
return OP_TYPE_ADD_RESPONSE;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
+ @Override
public String getProtocolOpName()
{
return "Add Response";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
+ @Override
public void write(ASN1Writer stream) throws IOException
{
stream.writeStartSequence(OP_TYPE_ADD_RESPONSE);
@@ -230,14 +202,7 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
+ @Override
public void toString(StringBuilder buffer)
{
buffer.append("AddResponse(resultCode=");
@@ -255,23 +220,14 @@
if (referralURLs != null && !referralURLs.isEmpty())
{
buffer.append(", referralURLs={");
- buffer.append(Utils.joinAsString(", ", referralURLs));
+ Utils.joinAsString(buffer, ", ", referralURLs);
buffer.append("}");
}
buffer.append(")");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
+ @Override
public void toString(StringBuilder buffer, int indent)
{
StringBuilder indentBuf = new StringBuilder(indent);
@@ -321,4 +277,3 @@
}
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/BindResponseProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/BindResponseProtocolOp.java
index 3462cb5..800ffd9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/BindResponseProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/BindResponseProtocolOp.java
@@ -25,17 +25,17 @@
* Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.server.protocols.ldap;
-import org.forgerock.i18n.LocalizableMessage;
-import java.util.List;
import java.io.IOException;
+import java.util.List;
-import org.forgerock.opendj.io.*;
-import org.opends.server.types.DN;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.util.Utils;
+import org.opends.server.types.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -54,13 +54,10 @@
/** The matched DN for this response. */
private DN matchedDN;
-
/** The result code for this response. */
private int resultCode;
-
/** The set of referral URLs for this response. */
private List<String> referralURLs;
-
/** The error message for this response. */
private LocalizableMessage errorMessage;
@@ -74,11 +71,6 @@
public BindResponseProtocolOp(int resultCode)
{
this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- referralURLs = null;
- serverSASLCredentials = null;
}
@@ -94,10 +86,6 @@
{
this.resultCode = resultCode;
this.errorMessage = errorMessage;
-
- matchedDN = null;
- referralURLs = null;
- serverSASLCredentials = null;
}
@@ -117,8 +105,6 @@
this.errorMessage = errorMessage;
this.matchedDN = matchedDN;
this.referralURLs = referralURLs;
-
- serverSASLCredentials = null;
}
@@ -207,36 +193,19 @@
return serverSASLCredentials;
}
-
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
+ @Override
public byte getType()
{
return OP_TYPE_BIND_RESPONSE;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
+ @Override
public String getProtocolOpName()
{
return "Bind Response";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
+ @Override
public void write(ASN1Writer stream) throws IOException
{
stream.writeStartSequence(OP_TYPE_BIND_RESPONSE);
@@ -279,14 +248,7 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
+ @Override
public void toString(StringBuilder buffer)
{
buffer.append("BindResponse(resultCode=");
@@ -305,7 +267,7 @@
if (referralURLs != null && !referralURLs.isEmpty())
{
buffer.append(", referralURLs={");
- buffer.append(Utils.joinAsString(", ", referralURLs));
+ Utils.joinAsString(buffer, ", ", referralURLs);
buffer.append("}");
}
@@ -318,16 +280,7 @@
buffer.append(")");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
+ @Override
public void toString(StringBuilder buffer, int indent)
{
StringBuilder indentBuf = new StringBuilder(indent);
@@ -386,4 +339,3 @@
}
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/CompareResponseProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/CompareResponseProtocolOp.java
index f4ee2f9..b7a0055 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/CompareResponseProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/CompareResponseProtocolOp.java
@@ -26,16 +26,15 @@
*/
package org.opends.server.protocols.ldap;
-import org.forgerock.i18n.LocalizableMessage;
-
-import java.util.List;
import java.io.IOException;
+import java.util.List;
-import org.forgerock.opendj.io.*;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.util.Utils;
import org.opends.server.types.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -51,13 +50,10 @@
/** The matched DN for this response. */
private DN matchedDN;
-
/** The result code for this response. */
private int resultCode;
-
/** The set of referral URLs for this response. */
private List<String> referralURLs;
-
/** The error message for this response. */
private LocalizableMessage errorMessage;
@@ -71,10 +67,6 @@
public CompareResponseProtocolOp(int resultCode)
{
this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- referralURLs = null;
}
@@ -90,9 +82,6 @@
{
this.resultCode = resultCode;
this.errorMessage = errorMessage;
-
- matchedDN = null;
- referralURLs = null;
}
@@ -165,36 +154,19 @@
return referralURLs;
}
-
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
+ @Override
public byte getType()
{
return OP_TYPE_COMPARE_RESPONSE;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
+ @Override
public String getProtocolOpName()
{
return "Compare Response";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
+ @Override
public void write(ASN1Writer stream) throws IOException
{
stream.writeStartSequence(OP_TYPE_COMPARE_RESPONSE);
@@ -231,14 +203,7 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
+ @Override
public void toString(StringBuilder buffer)
{
buffer.append("CompareResponse(resultCode=");
@@ -257,23 +222,14 @@
if (referralURLs != null && !referralURLs.isEmpty())
{
buffer.append(", referralURLs={");
- buffer.append(Utils.joinAsString(", ", referralURLs));
+ Utils.joinAsString(buffer, ", ", referralURLs);
buffer.append("}");
}
buffer.append(")");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
+ @Override
public void toString(StringBuilder buffer, int indent)
{
StringBuilder indentBuf = new StringBuilder(indent);
@@ -323,4 +279,3 @@
}
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/DeleteResponseProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/DeleteResponseProtocolOp.java
index ce7b322..9db6363 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/DeleteResponseProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/DeleteResponseProtocolOp.java
@@ -26,16 +26,15 @@
*/
package org.opends.server.protocols.ldap;
-import org.forgerock.i18n.LocalizableMessage;
-
-import java.util.List;
import java.io.IOException;
+import java.util.List;
-import org.forgerock.opendj.io.*;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.util.Utils;
import org.opends.server.types.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -50,17 +49,12 @@
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
-
/** The matched DN for this response. */
private DN matchedDN;
-
/** The result code for this response. */
private int resultCode;
-
/** The set of referral URLs for this response. */
private List<String> referralURLs;
-
/** The error message for this response. */
private LocalizableMessage errorMessage;
@@ -74,10 +68,6 @@
public DeleteResponseProtocolOp(int resultCode)
{
this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- referralURLs = null;
}
@@ -93,9 +83,6 @@
{
this.resultCode = resultCode;
this.errorMessage = errorMessage;
-
- matchedDN = null;
- referralURLs = null;
}
@@ -168,36 +155,19 @@
return referralURLs;
}
-
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
+ @Override
public byte getType()
{
return OP_TYPE_DELETE_RESPONSE;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
+ @Override
public String getProtocolOpName()
{
return "Delete Response";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
+ @Override
public void write(ASN1Writer stream) throws IOException
{
stream.writeStartSequence(OP_TYPE_DELETE_RESPONSE);
@@ -234,14 +204,7 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
+ @Override
public void toString(StringBuilder buffer)
{
buffer.append("DeleteResponse(resultCode=");
@@ -260,23 +223,14 @@
if (referralURLs != null && !referralURLs.isEmpty())
{
buffer.append(", referralURLs={");
- buffer.append(Utils.joinAsString(", ", referralURLs));
+ Utils.joinAsString(buffer, ", ", referralURLs);
buffer.append("}");
}
buffer.append(")");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
+ @Override
public void toString(StringBuilder buffer, int indent)
{
StringBuilder indentBuf = new StringBuilder(indent);
@@ -326,4 +280,3 @@
}
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java
index d71c53e..7c57c7c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java
@@ -26,17 +26,16 @@
*/
package org.opends.server.protocols.ldap;
-import org.forgerock.i18n.LocalizableMessage;
-
-import java.util.List;
import java.io.IOException;
+import java.util.List;
-import org.forgerock.opendj.io.*;
-import org.opends.server.types.DN;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.util.Utils;
+import org.opends.server.types.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -55,13 +54,10 @@
/** The matched DN for this response. */
private DN matchedDN;
-
/** The result code for this response. */
private int resultCode;
-
/** The set of referral URLs for this response. */
private List<String> referralURLs;
-
/** The error message for this response. */
private LocalizableMessage errorMessage;
@@ -78,12 +74,6 @@
public ExtendedResponseProtocolOp(int resultCode)
{
this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- referralURLs = null;
- oid = null;
- value = null;
}
@@ -99,11 +89,6 @@
{
this.resultCode = resultCode;
this.errorMessage = errorMessage;
-
- matchedDN = null;
- referralURLs = null;
- oid = null;
- value = null;
}
@@ -123,9 +108,6 @@
this.errorMessage = errorMessage;
this.matchedDN = matchedDN;
this.referralURLs = referralURLs;
-
- oid = null;
- value = null;
}
@@ -228,36 +210,19 @@
return value;
}
-
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
+ @Override
public byte getType()
{
return OP_TYPE_EXTENDED_RESPONSE;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
+ @Override
public String getProtocolOpName()
{
return "Extended Response";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
+ @Override
public void write(ASN1Writer stream) throws IOException
{
stream.writeStartSequence(OP_TYPE_EXTENDED_RESPONSE);
@@ -304,14 +269,7 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
+ @Override
public void toString(StringBuilder buffer)
{
buffer.append("ExtendedResponse(resultCode=");
@@ -330,7 +288,7 @@
if (referralURLs != null && !referralURLs.isEmpty())
{
buffer.append(", referralURLs={");
- buffer.append(Utils.joinAsString(", ", referralURLs));
+ Utils.joinAsString(buffer, ", ", referralURLs);
buffer.append("}");
}
if (oid != null && oid.length() > 0)
@@ -347,16 +305,7 @@
buffer.append(")");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
+ @Override
public void toString(StringBuilder buffer, int indent)
{
StringBuilder indentBuf = new StringBuilder(indent);
@@ -422,4 +371,3 @@
}
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyDNResponseProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyDNResponseProtocolOp.java
index 1a069b8..d00c0f2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyDNResponseProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyDNResponseProtocolOp.java
@@ -26,16 +26,15 @@
*/
package org.opends.server.protocols.ldap;
-import org.forgerock.i18n.LocalizableMessage;
-
-import java.util.List;
import java.io.IOException;
+import java.util.List;
-import org.forgerock.opendj.io.*;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.util.Utils;
import org.opends.server.types.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -51,13 +50,10 @@
/** The matched DN for this response. */
private DN matchedDN;
-
/** The result code for this response. */
private int resultCode;
-
/** The set of referral URLs for this response. */
private List<String> referralURLs;
-
/** The error message for this response. */
private LocalizableMessage errorMessage;
@@ -71,10 +67,6 @@
public ModifyDNResponseProtocolOp(int resultCode)
{
this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- referralURLs = null;
}
@@ -90,9 +82,6 @@
{
this.resultCode = resultCode;
this.errorMessage = errorMessage;
-
- matchedDN = null;
- referralURLs = null;
}
@@ -164,36 +153,19 @@
return referralURLs;
}
-
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
+ @Override
public byte getType()
{
return OP_TYPE_MODIFY_DN_RESPONSE;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
+ @Override
public String getProtocolOpName()
{
return "Modify DN Response";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
+ @Override
public void write(ASN1Writer stream) throws IOException
{
stream.writeStartSequence(OP_TYPE_MODIFY_DN_RESPONSE);
@@ -230,14 +202,7 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
+ @Override
public void toString(StringBuilder buffer)
{
buffer.append("ModifyDNResponse(resultCode=");
@@ -256,23 +221,14 @@
if (referralURLs != null && ! referralURLs.isEmpty())
{
buffer.append(", referralURLs={");
- buffer.append(Utils.joinAsString(", ", referralURLs));
+ Utils.joinAsString(buffer, ", ", referralURLs);
buffer.append("}");
}
buffer.append(")");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
+ @Override
public void toString(StringBuilder buffer, int indent)
{
StringBuilder indentBuf = new StringBuilder(indent);
@@ -322,4 +278,3 @@
}
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyResponseProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyResponseProtocolOp.java
index 8e2ea95..166992f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyResponseProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ModifyResponseProtocolOp.java
@@ -26,16 +26,15 @@
*/
package org.opends.server.protocols.ldap;
-import org.forgerock.i18n.LocalizableMessage;
-
-import java.util.List;
import java.io.IOException;
+import java.util.List;
-import org.forgerock.opendj.io.*;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.util.Utils;
import org.opends.server.types.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -51,13 +50,10 @@
/** The matched DN for this response. */
private DN matchedDN;
-
/** The result code for this response. */
private int resultCode;
-
/** The set of referral URLs for this response. */
private List<String> referralURLs;
-
/** The error message for this response. */
private LocalizableMessage errorMessage;
@@ -71,10 +67,6 @@
public ModifyResponseProtocolOp(int resultCode)
{
this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- referralURLs = null;
}
@@ -90,9 +82,6 @@
{
this.resultCode = resultCode;
this.errorMessage = errorMessage;
-
- matchedDN = null;
- referralURLs = null;
}
@@ -163,35 +152,19 @@
return referralURLs;
}
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
+ @Override
public byte getType()
{
return OP_TYPE_MODIFY_RESPONSE;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
+ @Override
public String getProtocolOpName()
{
return "Modify Response";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
+ @Override
public void write(ASN1Writer stream) throws IOException
{
stream.writeStartSequence(OP_TYPE_MODIFY_RESPONSE);
@@ -228,14 +201,7 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
+ @Override
public void toString(StringBuilder buffer)
{
buffer.append("ModifyResponse(resultCode=");
@@ -254,23 +220,14 @@
if (referralURLs != null && ! referralURLs.isEmpty())
{
buffer.append(", referralURLs={");
- buffer.append(Utils.joinAsString(", ", referralURLs));
+ Utils.joinAsString(buffer, ", ", referralURLs);
buffer.append("}");
}
buffer.append(")");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
+ @Override
public void toString(StringBuilder buffer, int indent)
{
StringBuilder indentBuf = new StringBuilder(indent);
@@ -320,4 +277,3 @@
}
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchRequestProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchRequestProtocolOp.java
index 776a53e..6ba7329 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchRequestProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchRequestProtocolOp.java
@@ -33,9 +33,9 @@
import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
-import org.opends.server.types.RawFilter;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.util.Utils;
+import org.opends.server.types.RawFilter;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -207,38 +207,18 @@
return attributes;
}
-
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
@Override
public byte getType()
{
return OP_TYPE_SEARCH_REQUEST;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
@Override
public String getProtocolOpName()
{
return "Search Request";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
@Override
public void write(ASN1Writer stream) throws IOException
{
@@ -261,14 +241,6 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
@Override
public void toString(StringBuilder buffer)
{
@@ -284,22 +256,12 @@
if (attributes != null && ! attributes.isEmpty())
{
- buffer.append(Utils.joinAsString(", ", attributes));
+ Utils.joinAsString(buffer, ", ", attributes);
}
buffer.append("})");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
@Override
public void toString(StringBuilder buffer, int indent)
{
@@ -333,4 +295,3 @@
}
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchResultDoneProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchResultDoneProtocolOp.java
index 26604bb..b37106a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchResultDoneProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchResultDoneProtocolOp.java
@@ -26,16 +26,15 @@
*/
package org.opends.server.protocols.ldap;
-import org.forgerock.i18n.LocalizableMessage;
-
-import java.util.List;
import java.io.IOException;
+import java.util.List;
-import org.forgerock.opendj.io.*;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.util.Utils;
import org.opends.server.types.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -51,13 +50,10 @@
/** The matched DN for this response. */
private DN matchedDN;
-
/** The result code for this response. */
private int resultCode;
-
/** The set of referral URLs for this response. */
private List<String> referralURLs;
-
/** The error message for this response. */
private LocalizableMessage errorMessage;
@@ -71,10 +67,6 @@
public SearchResultDoneProtocolOp(int resultCode)
{
this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- referralURLs = null;
}
@@ -90,9 +82,6 @@
{
this.resultCode = resultCode;
this.errorMessage = errorMessage;
-
- matchedDN = null;
- referralURLs = null;
}
@@ -165,36 +154,19 @@
return referralURLs;
}
-
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
+ @Override
public byte getType()
{
return OP_TYPE_SEARCH_RESULT_DONE;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
+ @Override
public String getProtocolOpName()
{
return "Search Result Done";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
+ @Override
public void write(ASN1Writer stream) throws IOException
{
stream.writeStartSequence(OP_TYPE_SEARCH_RESULT_DONE);
@@ -231,14 +203,7 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
+ @Override
public void toString(StringBuilder buffer)
{
buffer.append("SearchResultDone(resultCode=");
@@ -257,23 +222,14 @@
if (referralURLs != null && !referralURLs.isEmpty())
{
buffer.append(", referralURLs={");
- buffer.append(Utils.joinAsString(", ", referralURLs));
+ Utils.joinAsString(buffer, ", ", referralURLs);
buffer.append("}");
}
buffer.append(")");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
+ @Override
public void toString(StringBuilder buffer, int indent)
{
StringBuilder indentBuf = new StringBuilder(indent);
@@ -323,4 +279,3 @@
}
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
index 204b3f1..57fcef4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
@@ -407,10 +407,9 @@
buffer.append("Attribute(");
buffer.append(getNameWithOptions());
buffer.append(", {");
- buffer.append(Utils.joinAsString(", ", values));
+ Utils.joinAsString(buffer, ", ", values);
buffer.append("})");
}
-
}
@@ -453,18 +452,12 @@
this.normalizedOptions = normalizedOptions;
}
-
-
- /** {@inheritDoc} */
@Override
public Set<String> getOptions()
{
return options;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasOption(String option)
{
@@ -472,9 +465,6 @@
return normalizedOptions.contains(s);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasOptions()
{
@@ -504,54 +494,36 @@
super(attributeType, name, values);
}
-
-
- /** {@inheritDoc} */
@Override
public String getNameWithOptions()
{
return getName();
}
-
-
- /** {@inheritDoc} */
@Override
public Set<String> getOptions()
{
return Collections.emptySet();
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasAllOptions(Collection<String> options)
{
return options == null || options.isEmpty();
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasOption(String option)
{
return false;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasOptions()
{
return false;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean optionsEqual(Set<String> options)
{
@@ -598,18 +570,12 @@
this.normalizedOption = toLowerCase(option);
}
-
-
- /** {@inheritDoc} */
@Override
public Set<String> getOptions()
{
return option;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasOption(String option)
{
@@ -617,9 +583,6 @@
return normalizedOption.equals(s);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasOptions()
{
@@ -1770,13 +1733,10 @@
return CollectionUtils.newArrayList(toAttribute());
}
-
- /** {@inheritDoc} */
@Override
public final String toString()
{
StringBuilder builder = new StringBuilder();
-
builder.append("AttributeBuilder(");
builder.append(name);
@@ -1787,7 +1747,7 @@
}
builder.append(", {");
- builder.append(Utils.joinAsString(", ", values));
+ Utils.joinAsString(builder, ", ", values);
builder.append("})");
return builder.toString();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java
index 77021b9..56da283 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2012-2014 ForgeRock AS.
+ * Portions Copyright 2012-2015 ForgeRock AS.
*/
package org.opends.server.types;
@@ -55,13 +55,10 @@
/** The attribute type. */
private final AttributeType attributeType;
-
/** The entry with which this virtual attribute is associated. */
private final Entry entry;
-
/** The virtual attribute provider for this virtual attribute. */
private final VirtualAttributeProvider<?> provider;
-
/** The virtual attribute rule for this virtual attribute. */
private final VirtualAttributeRule rule;
@@ -87,60 +84,42 @@
this.provider = rule.getProvider();
}
-
-
- /** {@inheritDoc} */
@Override
public ConditionResult approximatelyEqualTo(ByteString assertionValue)
{
return provider.approximatelyEqualTo(entry, rule, assertionValue);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean contains(ByteString value)
{
return provider.hasValue(entry, rule, value);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean containsAll(Collection<ByteString> values)
{
return provider.hasAllValues(entry, rule, values);
}
- /** {@inheritDoc} */
@Override
public ConditionResult matchesEqualityAssertion(ByteString assertionValue)
{
return provider.matchesEqualityAssertion(entry, rule, assertionValue);
}
-
- /** {@inheritDoc} */
@Override
public AttributeType getAttributeType()
{
return attributeType;
}
-
-
- /** {@inheritDoc} */
@Override
public String getNameWithOptions()
{
return getName();
}
-
-
- /** {@inheritDoc} */
@Override
public Set<String> getOptions()
{
@@ -161,81 +140,54 @@
return rule;
}
-
-
- /** {@inheritDoc} */
@Override
public ConditionResult greaterThanOrEqualTo(ByteString assertionValue)
{
return provider.greaterThanOrEqualTo(entry, rule, assertionValue);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasAllOptions(Collection<String> options)
{
return options == null || options.isEmpty();
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasOption(String option)
{
return false;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean hasOptions()
{
return false;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean isEmpty()
{
return !provider.hasValue(entry, rule);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean isVirtual()
{
return true;
}
-
-
- /** {@inheritDoc} */
@Override
public Iterator<ByteString> iterator()
{
return provider.getValues(entry, rule).iterator();
}
-
-
- /** {@inheritDoc} */
@Override
public ConditionResult lessThanOrEqualTo(ByteString assertionValue)
{
return provider.lessThanOrEqualTo(entry, rule, assertionValue);
}
-
-
- /** {@inheritDoc} */
@Override
public ConditionResult matchesSubstring(ByteString subInitial,
List<ByteString> subAny, ByteString subFinal)
@@ -243,18 +195,12 @@
return provider.matchesSubstring(entry, rule, subInitial, subAny, subFinal);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean optionsEqual(Set<String> options)
{
return options == null || options.isEmpty();
}
-
-
- /** {@inheritDoc} */
@Override
public int size()
{
@@ -265,15 +211,13 @@
return provider.hasValue(entry, rule) ? 1 : 0;
}
- /** {@inheritDoc} */
@Override
public void toString(StringBuilder buffer)
{
buffer.append("VirtualAttribute(");
buffer.append(getAttributeType().getNameOrOID());
buffer.append(", {");
- buffer.append(Utils.joinAsString(", ", this));
+ Utils.joinAsString(buffer, ", ", this);
buffer.append("})");
}
-
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java b/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java
index 88afa04..be524cf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttributeRule.java
@@ -26,6 +26,8 @@
*/
package org.opends.server.types;
+import static org.forgerock.util.Reject.*;
+
import java.util.Collection;
import java.util.Set;
@@ -38,8 +40,6 @@
import org.opends.server.api.VirtualAttributeProvider;
import org.opends.server.core.DirectoryServer;
-import static org.forgerock.util.Reject.*;
-
/**
* This class defines a virtual attribute rule, which associates a
* virtual attribute provider with its associated configuration,
@@ -60,43 +60,21 @@
/** The attribute type for which the values should be generated. */
private final AttributeType attributeType;
-
- /**
- * The set of base DNs for branches that are eligible to have this virtual
- * attribute.
- */
+ /** The set of base DNs for branches that are eligible to have this virtual attribute. */
private final Set<DN> baseDNs;
-
- /**
- * The scope of entries eligible to have this virtual attribute, under the
- * base DNs.
- */
+ /** The scope of entries eligible to have this virtual attribute, under the base DNs. */
private final SearchScope scope;
-
- /**
- * The set of DNs for groups whose members are eligible to have this virtual
- * attribute.
- */
+ /** The set of DNs for groups whose members are eligible to have this virtual attribute. */
private final Set<DN> groupDNs;
-
- /**
- * The set of search filters for entries that are eligible to have this
- * virtual attribute.
- */
+ /** The set of search filters for entries that are eligible to have this virtual attribute. */
private final Set<SearchFilter> filters;
-
/** The virtual attribute provider used to generate the values. */
- private final VirtualAttributeProvider<
- ? extends VirtualAttributeCfg> provider;
-
+ private final VirtualAttributeProvider<? extends VirtualAttributeCfg> provider;
/**
* The behavior that should be exhibited for entries that already have real
* values for the target attribute.
*/
- private final VirtualAttributeCfgDefn.ConflictBehavior
- conflictBehavior;
-
-
+ private final VirtualAttributeCfgDefn.ConflictBehavior conflictBehavior;
/**
* Creates a new virtual attribute rule with the provided information.
@@ -139,8 +117,6 @@
this.conflictBehavior = conflictBehavior;
}
-
-
/**
* Retrieves the attribute type for which the values should be generated.
*
@@ -151,10 +127,7 @@
return attributeType;
}
-
-
/**
- *
* Retrieves the virtual attribute provider used to generate the values.
*
* @return The virtual attribute provider to use to generate the values.
@@ -165,8 +138,6 @@
return provider;
}
-
-
/**
* Retrieves the set of base DNs for branches that are eligible to
* have this virtual attribute.
@@ -179,7 +150,6 @@
return baseDNs;
}
-
/**
* Retrieves the scope of entries in the base DNs that are eligible
* to have this virtual attribute.
@@ -192,8 +162,6 @@
return scope;
}
-
-
/**
* Retrieves the set of DNs for groups whose members are eligible to
* have this virtual attribute.
@@ -206,8 +174,6 @@
return groupDNs;
}
-
-
/**
* Retrieves the set of search filters for entries that are eligible
* to have this virtual attribute.
@@ -220,8 +186,6 @@
return filters;
}
-
-
/**
* Retrieves the behavior that the server should exhibit for entries
* that already have one or more real values for the target attribute.
@@ -236,8 +200,6 @@
return conflictBehavior;
}
-
-
/**
* Indicates whether this virtual attribute rule applies to the
* provided entry, taking into account the eligibility requirements
@@ -261,94 +223,80 @@
return false;
}
- // If there are any base DNs defined, then the entry must be below
- // one of them.
- DN entryDN = entry.getName();
- if (! baseDNs.isEmpty())
+ // If there are any base DNs defined, then the entry must be below one of them.
+ if (!baseDNs.isEmpty() && !matchesAnyBaseDN(entry.getName()))
{
- boolean found = false;
- for (DN dn : baseDNs)
- {
- if (entryDN.matchesBaseAndScope(dn , scope))
- {
- found = true;
- break;
- }
- }
-
- if (! found)
- {
- return false;
- }
+ return false;
}
- // If there are any search filters defined, then the entry must
- // match one of them.
- if (! filters.isEmpty())
+ // If there are any search filters defined, then the entry must match one of them.
+ if (!filters.isEmpty() && !matchesAnyFilter(entry))
{
- boolean found = false;
- for (SearchFilter filter : filters)
- {
- try
- {
- if (filter.matchesEntry(entry))
- {
- found = true;
- break;
- }
- }
- catch (Exception e)
- {
- logger.traceException(e);
- }
- }
-
- if (! found)
- {
- return false;
- }
+ return false;
}
// If there are any group memberships defined, then the entry must
// be a member of one of them.
- if (! groupDNs.isEmpty())
+ if (!groupDNs.isEmpty() && !isMemberOfAnyGroup(entry))
{
- boolean found = false;
- for (DN dn : groupDNs)
- {
- try
- {
- Group group =
- DirectoryServer.getGroupManager().getGroupInstance(dn);
- if (group != null && group.isMember(entry))
- {
- found = true;
- break;
- }
- }
- catch (Exception e)
- {
- logger.traceException(e);
- }
- }
-
- if (! found)
- {
- return false;
- }
+ return false;
}
// If we've gotten here, then the rule is applicable.
return true;
}
+ private boolean matchesAnyBaseDN(DN entryDN)
+ {
+ for (DN dn : baseDNs)
+ {
+ if (entryDN.matchesBaseAndScope(dn, scope))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ private boolean matchesAnyFilter(Entry entry)
+ {
+ for (SearchFilter filter : filters)
+ {
+ try
+ {
+ if (filter.matchesEntry(entry))
+ {
+ return true;
+ }
+ }
+ catch (Exception e)
+ {
+ logger.traceException(e);
+ }
+ }
+ return false;
+ }
- /**
- * Retrieves a string representation of this virtual attribute rule.
- *
- * @return A string representation of this virtual attribute rule.
- */
+ private boolean isMemberOfAnyGroup(Entry entry)
+ {
+ for (DN dn : groupDNs)
+ {
+ try
+ {
+ Group<?> group = DirectoryServer.getGroupManager().getGroupInstance(dn);
+ if (group != null && group.isMember(entry))
+ {
+ return true;
+ }
+ }
+ catch (Exception e)
+ {
+ logger.traceException(e);
+ }
+ }
+ return false;
+ }
+
@Override
public String toString()
{
@@ -357,8 +305,6 @@
return buffer.toString();
}
-
-
/**
* Appends a string representation of this virtual attribute rule to
* the provided buffer.
@@ -390,9 +336,8 @@
if (!col.isEmpty())
{
buffer.append("\"");
- buffer.append(Utils.joinAsString("\", \"", col));
+ Utils.joinAsString(buffer, "\", \"", col);
buffer.append("\"");
}
}
}
-
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/TestAttributeType.java b/opendj-server-legacy/src/test/java/org/opends/server/types/TestAttributeType.java
index 04ce84d..8c11d31 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/TestAttributeType.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/TestAttributeType.java
@@ -32,9 +32,9 @@
import java.util.Map;
import org.forgerock.opendj.ldap.schema.AttributeUsage;
-import org.forgerock.util.Utils;
-import org.forgerock.opendj.ldap.schema.Syntax;
import org.forgerock.opendj.ldap.schema.MatchingRule;
+import org.forgerock.opendj.ldap.schema.Syntax;
+import org.forgerock.util.Utils;
import org.opends.server.core.DirectoryServer;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
@@ -155,7 +155,7 @@
else
{
definition.append("( '");
- definition.append(Utils.joinAsString("' '", nameSet));
+ Utils.joinAsString(definition, "' '", nameSet);
definition.append("' )");
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java b/opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java
index ab45526..2fc6b1d 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/TestObjectClass.java
@@ -134,7 +134,7 @@
else
{
definition.append("( '");
- definition.append(Utils.joinAsString("' '", nameSet));
+ Utils.joinAsString(definition, "' '", nameSet);
definition.append("' )");
}
}
--
Gitblit v1.10.0