You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2007/01/16 16:28:11 UTC
svn commit: r496727 -
/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java
Author: pamarcelot
Date: Tue Jan 16 07:28:11 2007
New Revision: 496727
URL: http://svn.apache.org/viewvc?view=rev&rev=496727
Log:
Updating the Export DSML Job to handle Controls in the Search Request.
Modified:
directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java
Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java?view=diff&rev=496727&r1=496726&r2=496727
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java Tue Jan 16 07:28:11 2007
@@ -30,6 +30,7 @@
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.model.Control;
import org.apache.directory.ldapstudio.browser.core.model.IConnection;
import org.apache.directory.ldapstudio.browser.core.model.ISearch;
import org.apache.directory.ldapstudio.browser.core.model.SearchParameter;
@@ -187,8 +188,6 @@
}
// Filter
- // PresentFilter presentFilter = new PresentFilter();
- // presentFilter.setAttributeDescription( "objectclass" );
searchRequest.setFilter( convertToSharedLdapFilter( searchParameter.getFilter() ) );
// Attributes
@@ -198,6 +197,14 @@
searchRequest.addAttribute( returningAttributes[i] );
}
+ // Controls
+ List<org.apache.directory.shared.ldap.codec.Control> sharedLdapControls = convertToSharedLdapControls( searchParameter
+ .getControls() );
+ for ( int i = 0; i < sharedLdapControls.size(); i++ )
+ {
+ searchRequest.addControl( sharedLdapControls.get( i ) );
+ }
+
// Executing the request
Document xmlRequest = DocumentHelper.createDocument();
Element rootElement = xmlRequest.addElement( "batchRequest" );
@@ -414,5 +421,45 @@
assertion.setAssertionValue( node.getValue() );
return avaFilter;
+ }
+
+
+ /**
+ * Converts the given array of Controls into their corresponding representation in the Shared LDAP Model.
+ *
+ * @param controls
+ * the array of Controls to convert
+ * @return
+ * a List of Shared LDAP Control Objects corresponding to the given Controls
+ */
+ private List<org.apache.directory.shared.ldap.codec.Control> convertToSharedLdapControls( Control[] controls )
+ {
+ List<org.apache.directory.shared.ldap.codec.Control> returnList = new ArrayList<org.apache.directory.shared.ldap.codec.Control>();
+
+ for ( int i = 0; i < controls.length; i++ )
+ {
+ returnList.add( convertToSharedLDAP( controls[i] ) );
+ }
+
+ return returnList;
+ }
+
+
+ /**
+ * Converts the given Control into its corresponding representation in the Shared LDAP Model.
+ *
+ * @param control
+ * the Control to convert
+ * @return
+ * the corresponding Control in the Shared LDAP Model
+ */
+ private static org.apache.directory.shared.ldap.codec.Control convertToSharedLDAP( Control control )
+ {
+ org.apache.directory.shared.ldap.codec.Control sharedLdapControl = new org.apache.directory.shared.ldap.codec.Control();
+
+ sharedLdapControl.setControlType( control.getOid() );
+ sharedLdapControl.setControlValue( control.getControlValue() );
+
+ return sharedLdapControl;
}
}