org.apache.directory.api.dsmlv2.reponse
Class LdapResultDsml

java.lang.Object
  extended by org.apache.directory.api.dsmlv2.reponse.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
LdapResultDsml(LdapApiService codec, LdapResult result, Message message)
          Creates a new instance of LdapResultDsml.
 
Method Summary
 void addReferral(LdapUrl referral)
          Add a referral
 LdapResult getDecorated()
          Gets the Message this DsmlDecorator decorates.
 String getDiagnosticMessage()
          Gets the descriptive diagnostic message associated with the error code.
 Dn getMatchedDn()
          Get the matched Dn
 Referral getReferral()
          Gets the Referral associated with this LdapResult if the resultCode property is set to the REFERRAL ResultCodeEnum.
 List<String> getReferrals()
          Get the referrals
 ResultCodeEnum getResultCode()
          Get the result code
 boolean 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 Dn
 void 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 code
 org.dom4j.Element toDsml(org.dom4j.Element root)
          Converts the request/reponse to its XML representation in the DSMLv2 format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapResultDsml

public LdapResultDsml(LdapApiService codec,
                      LdapResult result,
                      Message message)
Creates a new instance of LdapResultDsml.

Parameters:
result - the LdapResult to decorate
message - the associated message
the - ldap codec service
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 interface DsmlDecorator<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 interface LdapResult
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 interface LdapResult
Parameters:
diagnosticMessage - the descriptive diagnostic message.

getMatchedDn

public Dn getMatchedDn()
Get the matched Dn

Specified by:
getMatchedDn in interface LdapResult
Returns:
Returns the matchedDN.

setMatchedDn

public void setMatchedDn(Dn matchedDn)
Set the Matched Dn

Specified by:
setMatchedDn in interface LdapResult
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 interface LdapResult
Returns:
Returns the resultCode.

setResultCode

public void setResultCode(ResultCodeEnum resultCode)
Set the result code

Specified by:
setResultCode in interface LdapResult
Parameters:
resultCode - The resultCode to set.

getDecorated

public LdapResult getDecorated()
Gets the Message this DsmlDecorator decorates.

Specified by:
getDecorated in interface DsmlDecorator<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 interface LdapResult
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 interface LdapResult
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 interface LdapResult
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 interface LdapResult
Returns:
True if the LdapResult is SUCCESS.


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.