Class LdapResultDsml
- java.lang.Object
-
- org.apache.directory.api.dsmlv2.response.LdapResultDsml
-
- All Implemented Interfaces:
DsmlDecorator<LdapResult>
,LdapResult
public class LdapResultDsml extends Object implements DsmlDecorator<LdapResult>, LdapResult
DSML Decorator for the LdapResult class.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description LdapResultDsml(LdapApiService codec, LdapResult result, Message message)
Creates a new instance of LdapResultDsml.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReferral(LdapUrl referral)
Add a referralLdapResult
getDecorated()
Gets the Message this DsmlDecorator decorates.String
getDiagnosticMessage()
Gets the descriptive diagnostic message associated with the error code.Dn
getMatchedDn()
Get the matched DnReferral
getReferral()
Gets the Referral associated with this LdapResult if the resultCode property is set to the REFERRAL ResultCodeEnum.List<String>
getReferrals()
Get the referralsResultCodeEnum
getResultCode()
Get the result codeboolean
isDefaultSuccess()
Tells if the LdapResult is a success, with no added information.boolean
isReferral()
Gets whether or not this result represents a Referral.void
setDiagnosticMessage(String diagnosticMessage)
Sets the descriptive diagnostic message associated with the error code.void
setMatchedDn(Dn matchedDn)
Set the Matched Dnvoid
setReferral(Referral referral)
Sets the Referral associated with this LdapResult if the resultCode property is set to the REFERRAL ResultCodeEnum.void
setResultCode(ResultCodeEnum resultCode)
Set the result codeorg.dom4j.Element
toDsml(org.dom4j.Element root)
Converts the request/reponse to its XML representation in the DSMLv2 format
-
-
-
Constructor Detail
-
LdapResultDsml
public LdapResultDsml(LdapApiService codec, LdapResult result, Message message)
Creates a new instance of LdapResultDsml.- Parameters:
codec
- The LDAP Service to useresult
- the LdapResult to decoratemessage
- the associated message
-
-
Method Detail
-
toDsml
public org.dom4j.Element toDsml(org.dom4j.Element root)
Converts the request/reponse to its XML representation in the DSMLv2 format- Specified by:
toDsml
in interfaceDsmlDecorator<LdapResult>
- Parameters:
root
- the root dom4j Element- Returns:
- the dom4j Element corresponding to the entry.
-
getDiagnosticMessage
public String getDiagnosticMessage()
Gets the descriptive diagnostic message associated with the error code. May be null for SUCCESS, COMPARETRUE, COMPAREFALSE and REFERRAL operations.- Specified by:
getDiagnosticMessage
in interfaceLdapResult
- Returns:
- the descriptive diagnostic message.
-
setDiagnosticMessage
public void setDiagnosticMessage(String diagnosticMessage)
Sets the descriptive diagnostic message associated with the error code. May be null for SUCCESS, COMPARETRUE, and COMPAREFALSE operations.- Specified by:
setDiagnosticMessage
in interfaceLdapResult
- Parameters:
diagnosticMessage
- the descriptive diagnostic message.
-
getMatchedDn
public Dn getMatchedDn()
Get the matched Dn- Specified by:
getMatchedDn
in interfaceLdapResult
- Returns:
- Returns the matchedDN.
-
setMatchedDn
public void setMatchedDn(Dn matchedDn)
Set the Matched Dn- Specified by:
setMatchedDn
in interfaceLdapResult
- Parameters:
matchedDn
- The matchedDn to set.- See Also:
LdapResult.getMatchedDn()
-
getReferrals
public List<String> getReferrals()
Get the referrals- Returns:
- Returns the referrals.
-
addReferral
public void addReferral(LdapUrl referral)
Add a referral- Parameters:
referral
- The referral to add.
-
getResultCode
public ResultCodeEnum getResultCode()
Get the result code- Specified by:
getResultCode
in interfaceLdapResult
- Returns:
- Returns the resultCode.
-
setResultCode
public void setResultCode(ResultCodeEnum resultCode)
Set the result code- Specified by:
setResultCode
in interfaceLdapResult
- Parameters:
resultCode
- The resultCode to set.
-
getDecorated
public LdapResult getDecorated()
Gets the Message this DsmlDecorator decorates.- Specified by:
getDecorated
in interfaceDsmlDecorator<LdapResult>
- Returns:
- The decorated Message instance
-
isReferral
public boolean isReferral()
Gets whether or not this result represents a Referral. For referrals the error code is set to REFERRAL and the referral property is not null.- Specified by:
isReferral
in interfaceLdapResult
- Returns:
- true if this result represents a referral.
-
getReferral
public Referral getReferral()
Gets the Referral associated with this LdapResult if the resultCode property is set to the REFERRAL ResultCodeEnum.- Specified by:
getReferral
in interfaceLdapResult
- Returns:
- the referral on REFERRAL resultCode, null on all others.
-
setReferral
public void setReferral(Referral referral)
Sets the Referral associated with this LdapResult if the resultCode property is set to the REFERRAL ResultCodeEnum. Setting this property will result in a true return from isReferral and the resultCode should be set to REFERRAL.- Specified by:
setReferral
in interfaceLdapResult
- Parameters:
referral
- optional referral on REFERRAL errors.
-
isDefaultSuccess
public boolean isDefaultSuccess()
Tells if the LdapResult is a success, with no added information. The MatchedDn will be empty, as the diagnostic message and the referral. The ResultCode will always be 0.- Specified by:
isDefaultSuccess
in interfaceLdapResult
- Returns:
- True if the LdapResult is SUCCESS.
-
-