Search in sources :

Example 26 with ASN1Enumerated

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);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) ASN1Element(com.unboundid.asn1.ASN1Element) ArrayList(java.util.ArrayList) ASN1OctetString(com.unboundid.asn1.ASN1OctetString) NotNull(com.unboundid.util.NotNull)

Example 27 with ASN1Enumerated

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);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) ASN1Element(com.unboundid.asn1.ASN1Element) ArrayList(java.util.ArrayList) ASN1OctetString(com.unboundid.asn1.ASN1OctetString) NotNull(com.unboundid.util.NotNull)

Example 28 with ASN1Enumerated

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);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) ASN1Element(com.unboundid.asn1.ASN1Element) ArrayList(java.util.ArrayList) ASN1OctetString(com.unboundid.asn1.ASN1OctetString) NotNull(com.unboundid.util.NotNull)

Example 29 with ASN1Enumerated

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);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) ASN1Element(com.unboundid.asn1.ASN1Element) ArrayList(java.util.ArrayList) ASN1OctetString(com.unboundid.asn1.ASN1OctetString) NotNull(com.unboundid.util.NotNull)

Example 30 with ASN1Enumerated

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);
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1Sequence(com.unboundid.asn1.ASN1Sequence) ASN1Enumerated(com.unboundid.asn1.ASN1Enumerated) ASN1Element(com.unboundid.asn1.ASN1Element) ArrayList(java.util.ArrayList) ASN1OctetString(com.unboundid.asn1.ASN1OctetString) NotNull(com.unboundid.util.NotNull)

Aggregations

ASN1Enumerated (com.unboundid.asn1.ASN1Enumerated)95 ASN1Sequence (com.unboundid.asn1.ASN1Sequence)95 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)92 Test (org.testng.annotations.Test)62 ASN1Element (com.unboundid.asn1.ASN1Element)59 ArrayList (java.util.ArrayList)32 NotNull (com.unboundid.util.NotNull)30 ASN1Integer (com.unboundid.asn1.ASN1Integer)21 ExtendedRequest (com.unboundid.ldap.sdk.ExtendedRequest)15 ASN1Boolean (com.unboundid.asn1.ASN1Boolean)12 IOException (java.io.IOException)12 ASN1Set (com.unboundid.asn1.ASN1Set)11 Control (com.unboundid.ldap.sdk.Control)9 ASN1Enumerated (org.bouncycastle.asn1.ASN1Enumerated)9 ASN1Enumerated (com.github.zhenwei.core.asn1.ASN1Enumerated)6 ExtendedResult (com.unboundid.ldap.sdk.ExtendedResult)6 DEROctetString (org.bouncycastle.asn1.DEROctetString)6 DERSequence (org.bouncycastle.asn1.DERSequence)6 IntermediateResponse (com.unboundid.ldap.sdk.IntermediateResponse)5 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)5