Class DirRecord
java.lang.Object
org.bedework.carddav.server.dirHandlers.ldap.DirRecord
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BasicDirRecord
This class represents a directory record which may be built from a
number of attributes, retrieved as a search result or read from some input
stream.
We will implement some aspects of the ldif as defined in RFC 2849 within this class. These will be related to the content vs change records. By default, a DirRecord object will be a content record. However, we will allow the creation of change type records. Having this defined here allows applications to pass around DirRecord objects without any idea of the underlying implementation.
Currently the following is implemented:
- content records Consist of a dn with an associated set of attributes with values. No attribute options are implemented. Encoded strings may be converted incorrectly (need to check locale specifics)
- change records.
- add: Implemented. Look just like content records.
- delete: Implemented. Consist of a dn only.
- all others are unimplemented.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the attribute value to the table.attrElements(String attr) Retrieve an enumeration of the named attribute's values.booleanattrEquals(Attribute thisA, Attribute that) intattrValCompare(Object val, String attrName, boolean ignoreCase) Extract the target attribute from this record then compare the given single value with the attribute value(s).intattrValCompare(Object val, Attribute that, boolean ignoreCase) Compare the given single value with the attribute value(s).voidclear()Should be overriden to clear attributes.booleanReturn true if the record contains all of the values of the given attribute.booleanCheck dns for equalitybooleanCompare this with that.booleanSimpler form of equals in which attributes have the same names in both records.booleanCompare this with that only looking at the named attributes.booleanequalsAllBut(DirRecord that, String[] attrIDs) This compares all but the named attributes allbut true => All must be equal except those on the listFind the attribute for this record with the given name.abstract AttributesgetAttrStr(String attr) getAttrStr - return first (or only) string value for given attributegetAttrVal(String attr) getAttrVal - return first (or only) value for given attribute "dn" is treated as an attribute name.intgetDn()return the dn for this record.booleangetMods()getName()return the name for this record.voidSet the attribute value in the table.voidsetChangeType(int val) voidSet the dn for this record.voidsetIsContent(boolean val) voidSet the name for this record.
-
Field Details
-
changeTypeInvalid
public static final int changeTypeInvalid- See Also:
-
changeTypeAdd
public static final int changeTypeAdd- See Also:
-
changeTypeDelete
public static final int changeTypeDelete- See Also:
-
changeTypeModify
public static final int changeTypeModify- See Also:
-
changeTypeModdn
public static final int changeTypeModdn- See Also:
-
-
Constructor Details
-
DirRecord
public DirRecord()
-
-
Method Details
-
getAttributes
- Returns:
- Attributes
-
findAttr
Find the attribute for this record with the given name.- Parameters:
attr- name- Returns:
- Attribute
-
setAttr
Set the attribute value in the table. Replaces any existing value(s) This does not write back to the directory- Parameters:
attr- nameval- and value
-
clear
public void clear()Should be overriden to clear attributes. -
setName
Set the name for this record.- Parameters:
val- name
-
getName
return the name for this record.- Returns:
- String
-
setDn
Set the dn for this record.- Parameters:
val- the dn for this record.
-
getDn
return the dn for this record.- Returns:
- String
-
equals
Compare this with that. Return true if they are equal.- Parameters:
that- DirRecord- Returns:
- boolean
-
equals
Compare this with that only looking at the named attributes. For this method, the dns must be equal and the values of the named attributes must be equal but their names may differ. The two arrays of attrIDs must be non-null and of the same length or an exception is raised. If there are no attributes in both records they are considered equal. If there are no attributes in only one record they are unequal. Zero length attrID lists means only the dn is compared.- Parameters:
that-thisAttrIDs-thatAttrIDs-- Returns:
- boolean
-
equals
Simpler form of equals in which attributes have the same names in both records.- Parameters:
that-attrIDs-- Returns:
- boolean
-
equalsAllBut
This compares all but the named attributes allbut true => All must be equal except those on the list- Parameters:
that-attrIDs-- Returns:
- boolean
-
attrEquals
- Parameters:
thisA-that-- Returns:
- boolean
-
attrValCompare
Compare the given single value with the attribute value(s).- Parameters:
val-that-ignoreCase-- Returns:
- -2 for not equal or not present in multi-valued attribute -1 for val < that 0 for val = that 1 for val > that 2 for val present in multi-valued attr
-
attrValCompare
Extract the target attribute from this record then compare the given single value with the attribute value(s).- Parameters:
val-attrName-ignoreCase-- Returns:
- -2 for not equal or not present in multi-valued attribute -1 for val < that 0 for val = that 1 for val > that 2 for val present in multi-valued attr
-
dnEquals
Check dns for equality- Parameters:
that- other dn- Returns:
- boolean
-
addAttr
Add the attribute value to the table. If an attribute already exists add it to the end of its values.- Parameters:
attr- String attribute nameval- Object value
-
getAttrVal
getAttrVal - return first (or only) value for given attribute "dn" is treated as an attribute name.- Parameters:
attr- String attribute name- Returns:
- Object attribute value
-
contains
Return true if the record contains all of the values of the given attribute.- Parameters:
attr- Attribute we're looking for- Returns:
- boolean true if we found it
-
attrElements
Retrieve an enumeration of the named attribute's values. The behaviour of this enumeration is unspecified if the the attribute's values are added, changed, or removed while the enumeration is in progress. If the attribute values are ordered, the enumeration's items will be ordered.Each element of the enumeration is a possibly null Object. The object's class is the class of the attribute value. The element is null if the attribute's value is null. If the attribute has zero values, an empty enumeration is returned.
- Parameters:
attr-- Returns:
- NamingEnumeration
-
getAttrStr
getAttrStr - return first (or only) string value for given attribute- Parameters:
attr- String attribute name- Returns:
- String attribute value
-
getIsContent
public boolean getIsContent()- Returns:
- boolean
-
getChangeType
public int getChangeType()- Returns:
- int
-
getMods
- Returns:
- ModificationItem[]
-
setIsContent
public void setIsContent(boolean val) - Parameters:
val- true if is content
-
setChangeType
public void setChangeType(int val) - Parameters:
val-
-