Example usage for javax.naming.ldap BasicControl BasicControl

List of usage examples for javax.naming.ldap BasicControl BasicControl

Introduction

In this page you can find the example usage for javax.naming.ldap BasicControl BasicControl.

Prototype

public BasicControl(String id, boolean criticality, byte[] value) 

Source Link

Document

Constructs a control using the supplied arguments.

Usage

From source file:org.apache.directory.studio.ldapbrowser.core.jobs.ImportLdifRunnable.java

/**
 * Gets the controls.//from ww  w .  j a  v a  2  s.  com
 * 
 * @param record the LDIF record
 * 
 * @return the controls
 */
private static Control[] getControls(LdifRecord record) {
    Control[] controls = null;
    if (record instanceof LdifChangeRecord) {
        LdifChangeRecord changeRecord = (LdifChangeRecord) record;
        LdifControlLine[] controlLines = changeRecord.getControls();
        controls = new Control[controlLines.length];
        for (int i = 0; i < controlLines.length; i++) {
            LdifControlLine line = controlLines[i];
            controls[i] = new BasicControl(line.getUnfoldedOid(), line.isCritical(),
                    line.getControlValueAsBinary());
        }
    }
    return controls;
}