| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | | |
| | | |
| | | import static org.opends.messages.ProtocolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.types.*; |
| | | |
| | | |
| | | /** |
| | | * This class defines the data structures and methods to use when interacting |
| | | * with an LDAP attribute, which is the basic unit of information in an LDAP |
| | |
| | | public class LDAPAttribute |
| | | extends RawAttribute |
| | | { |
| | | // The set of values for this attribute. |
| | | private ArrayList<ByteString> values; |
| | | /** The set of values for this attribute. */ |
| | | private List<ByteString> values; |
| | | |
| | | // The attribute type for this attribute. |
| | | /** The attribute type for this attribute. */ |
| | | private String attributeType; |
| | | |
| | | |
| | |
| | | */ |
| | | public LDAPAttribute(Attribute attribute) |
| | | { |
| | | if (attribute.hasOptions()) |
| | | { |
| | | StringBuilder attrName = new StringBuilder(attribute.getName()); |
| | | for (String o : attribute.getOptions()) |
| | | { |
| | | attrName.append(";"); |
| | | attrName.append(o); |
| | | } |
| | | |
| | | this.attributeType = attrName.toString(); |
| | | } |
| | | else |
| | | { |
| | | this.attributeType = attribute.getName(); |
| | | } |
| | | this.attributeType = attribute.getNameWithOptions(); |
| | | |
| | | if (attribute.isVirtual()) |
| | | { |
| | |
| | | * |
| | | * @return The attribute type for this attribute. |
| | | */ |
| | | @Override |
| | | public String getAttributeType() |
| | | { |
| | | return attributeType; |
| | |
| | | * |
| | | * @param attributeType The attribute type for this attribute. |
| | | */ |
| | | @Override |
| | | public void setAttributeType(String attributeType) |
| | | { |
| | | this.attributeType = attributeType; |
| | |
| | | * |
| | | * @return The set of values for this attribute. |
| | | */ |
| | | public ArrayList<ByteString> getValues() |
| | | @Override |
| | | public List<ByteString> getValues() |
| | | { |
| | | return values; |
| | | } |
| | |
| | | * @throws LDAPException If the provided value is invalid according to the |
| | | * attribute syntax. |
| | | */ |
| | | @Override |
| | | public Attribute toAttribute() |
| | | throws LDAPException |
| | | { |
| | |
| | | * |
| | | * @param buffer The buffer to which the information should be appended. |
| | | */ |
| | | @Override |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append("LDAPAttribute(type="); |
| | |
| | | * @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); |