public abstract class DirRecord extends Object implements Serializable
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:
| Modifier and Type | Field and Description |
|---|---|
static int |
changeTypeAdd |
static int |
changeTypeDelete |
static int |
changeTypeInvalid |
static int |
changeTypeModdn |
static int |
changeTypeModify |
| Constructor and Description |
|---|
DirRecord() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttr(String attr,
Object val)
Add the attribute value to the table.
|
NamingEnumeration |
attrElements(String attr)
Retrieve an enumeration of the named attribute's values.
|
boolean |
attrEquals(Attribute thisA,
Attribute that) |
int |
attrValCompare(Object val,
Attribute that,
boolean ignoreCase)
Compare the given single value with the attribute value(s).
|
int |
attrValCompare(Object val,
String attrName,
boolean ignoreCase)
Extract the target attribute from this record then
compare the given single value with the attribute value(s).
|
void |
clear()
Should be overriden to clear attributes.
|
boolean |
contains(Attribute attr)
Return true if the record contains all of the values of the given
attribute.
|
boolean |
dnEquals(DirRecord that)
Check dns for equality
|
boolean |
equals(DirRecord that)
Compare this with that.
|
boolean |
equals(DirRecord that,
String[] attrIDs)
Simpler form of equals in which attributes have the same names in both
records.
|
boolean |
equals(DirRecord that,
String[] thisAttrIDs,
String[] thatAttrIDs)
Compare this with that only looking at the named attributes.
|
boolean |
equalsAllBut(DirRecord that,
String[] attrIDs)
This compares all but the named attributes
allbut true => All must be equal except those on the list
|
Attribute |
findAttr(String attr)
Find the attribute for this record with the given name.
|
abstract Attributes |
getAttributes() |
String |
getAttrStr(String attr)
getAttrStr - return first (or only) string value for given attribute
|
Object |
getAttrVal(String attr)
getAttrVal - return first (or only) value for given attribute
"dn" is treated as an attribute name.
|
int |
getChangeType() |
String |
getDn()
return the dn for this record.
|
boolean |
getIsContent() |
ModificationItem[] |
getMods() |
void |
setAttr(String attr,
Object val)
Set the attribute value in the table.
|
void |
setChangeType(int val) |
void |
setDn(String dn)
Set the dn for this record.
|
void |
setIsContent(boolean val) |
public static final int changeTypeInvalid
public static final int changeTypeAdd
public static final int changeTypeDelete
public static final int changeTypeModify
public static final int changeTypeModdn
public abstract Attributes getAttributes() throws NamingException
NamingExceptionpublic Attribute findAttr(String attr) throws NamingException
NamingExceptionpublic void setAttr(String attr, Object val) throws NamingException
NamingExceptionpublic void clear()
public void setDn(String dn) throws NamingException
NamingExceptionpublic boolean equals(DirRecord that) throws Exception
Exceptionpublic boolean equals(DirRecord that, String[] thisAttrIDs, String[] thatAttrIDs) throws Exception
Exceptionpublic boolean equals(DirRecord that, String[] attrIDs) throws Exception
Exceptionpublic boolean equalsAllBut(DirRecord that, String[] attrIDs) throws Exception
Exceptionpublic boolean attrEquals(Attribute thisA, Attribute that) throws Exception
Exceptionpublic int attrValCompare(Object val, Attribute that, boolean ignoreCase) throws Exception
Exceptionpublic int attrValCompare(Object val, String attrName, boolean ignoreCase) throws Exception
Exceptionpublic boolean dnEquals(DirRecord that) throws Exception
Exceptionpublic void addAttr(String attr, Object val) throws NamingException
attr - String attribute nameval - Object valueNamingExceptionpublic Object getAttrVal(String attr) throws Exception
attr - String attribute nameExceptionpublic boolean contains(Attribute attr) throws Exception
attr - Attribute we're looking forExceptionpublic NamingEnumeration attrElements(String attr) throws NamingException
NamingException - If a naming exception was encountered while retrieving
the values.public String getAttrStr(String attr) throws Exception
attr - String attribute nameExceptionpublic boolean getIsContent()
public int getChangeType()
public ModificationItem[] getMods() throws Exception
Exceptionpublic void setIsContent(boolean val)
public void setChangeType(int val)
Copyright © 2015 Bedework. All rights reserved.