use of com.github.zhenwei.core.asn1.ASN1Enumerated in project ldapsdk by pingidentity.
the class ModifyDNResponseProtocolOp method encodeProtocolOp.
/**
* {@inheritDoc}
*/
@Override()
@NotNull()
public ASN1Element encodeProtocolOp() {
final ArrayList<ASN1Element> elements = new ArrayList<>(4);
elements.add(new ASN1Enumerated(getResultCode()));
final String matchedDN = getMatchedDN();
if (matchedDN == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(matchedDN));
}
final String diagnosticMessage = getDiagnosticMessage();
if (diagnosticMessage == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(diagnosticMessage));
}
final List<String> referralURLs = getReferralURLs();
if (!referralURLs.isEmpty()) {
final ArrayList<ASN1Element> refElements = new ArrayList<>(referralURLs.size());
for (final String r : referralURLs) {
refElements.add(new ASN1OctetString(r));
}
elements.add(new ASN1Sequence(TYPE_REFERRALS, refElements));
}
return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_MODIFY_DN_RESPONSE, elements);
}
use of com.github.zhenwei.core.asn1.ASN1Enumerated in project ldapsdk by pingidentity.
the class CompareResponseProtocolOp method encodeProtocolOp.
/**
* {@inheritDoc}
*/
@Override()
@NotNull()
public ASN1Element encodeProtocolOp() {
final ArrayList<ASN1Element> elements = new ArrayList<>(4);
elements.add(new ASN1Enumerated(getResultCode()));
final String matchedDN = getMatchedDN();
if (matchedDN == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(matchedDN));
}
final String diagnosticMessage = getDiagnosticMessage();
if (diagnosticMessage == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(diagnosticMessage));
}
final List<String> referralURLs = getReferralURLs();
if (!referralURLs.isEmpty()) {
final ArrayList<ASN1Element> refElements = new ArrayList<>(referralURLs.size());
for (final String r : referralURLs) {
refElements.add(new ASN1OctetString(r));
}
elements.add(new ASN1Sequence(TYPE_REFERRALS, refElements));
}
return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_COMPARE_RESPONSE, elements);
}
use of com.github.zhenwei.core.asn1.ASN1Enumerated in project ldapsdk by pingidentity.
the class DeleteResponseProtocolOp method encodeProtocolOp.
/**
* {@inheritDoc}
*/
@Override()
@NotNull()
public ASN1Element encodeProtocolOp() {
final ArrayList<ASN1Element> elements = new ArrayList<>(4);
elements.add(new ASN1Enumerated(getResultCode()));
final String matchedDN = getMatchedDN();
if (matchedDN == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(matchedDN));
}
final String diagnosticMessage = getDiagnosticMessage();
if (diagnosticMessage == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(diagnosticMessage));
}
final List<String> referralURLs = getReferralURLs();
if (!referralURLs.isEmpty()) {
final ArrayList<ASN1Element> refElements = new ArrayList<>(referralURLs.size());
for (final String r : referralURLs) {
refElements.add(new ASN1OctetString(r));
}
elements.add(new ASN1Sequence(TYPE_REFERRALS, refElements));
}
return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_DELETE_RESPONSE, elements);
}
use of com.github.zhenwei.core.asn1.ASN1Enumerated in project ldapsdk by pingidentity.
the class ExtendedResponseProtocolOp method encodeProtocolOp.
/**
* {@inheritDoc}
*/
@Override()
@NotNull()
public ASN1Element encodeProtocolOp() {
final ArrayList<ASN1Element> elements = new ArrayList<>(6);
elements.add(new ASN1Enumerated(getResultCode()));
final String mdn = getMatchedDN();
if (mdn == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(mdn));
}
final String dm = getDiagnosticMessage();
if (dm == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(dm));
}
final List<String> refs = getReferralURLs();
if (!refs.isEmpty()) {
final ArrayList<ASN1Element> refElements = new ArrayList<>(refs.size());
for (final String r : refs) {
refElements.add(new ASN1OctetString(r));
}
elements.add(new ASN1Sequence(GenericResponseProtocolOp.TYPE_REFERRALS, refElements));
}
if (responseOID != null) {
elements.add(new ASN1OctetString(TYPE_RESPONSE_OID, responseOID));
}
if (responseValue != null) {
elements.add(responseValue);
}
return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_EXTENDED_RESPONSE, elements);
}
use of com.github.zhenwei.core.asn1.ASN1Enumerated in project ldapsdk by pingidentity.
the class AddResponseProtocolOp method encodeProtocolOp.
/**
* {@inheritDoc}
*/
@Override()
@NotNull()
public ASN1Element encodeProtocolOp() {
final ArrayList<ASN1Element> elements = new ArrayList<>(4);
elements.add(new ASN1Enumerated(getResultCode()));
final String matchedDN = getMatchedDN();
if (matchedDN == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(matchedDN));
}
final String diagnosticMessage = getDiagnosticMessage();
if (diagnosticMessage == null) {
elements.add(new ASN1OctetString());
} else {
elements.add(new ASN1OctetString(diagnosticMessage));
}
final List<String> referralURLs = getReferralURLs();
if (!referralURLs.isEmpty()) {
final ArrayList<ASN1Element> refElements = new ArrayList<>(referralURLs.size());
for (final String r : referralURLs) {
refElements.add(new ASN1OctetString(r));
}
elements.add(new ASN1Sequence(TYPE_REFERRALS, refElements));
}
return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_ADD_RESPONSE, elements);
}
Aggregations