Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A29AFD847 for ; Wed, 12 Dec 2012 22:34:34 +0000 (UTC) Received: (qmail 62091 invoked by uid 500); 12 Dec 2012 22:34:34 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 62050 invoked by uid 500); 12 Dec 2012 22:34:34 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 62036 invoked by uid 99); 12 Dec 2012 22:34:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2012 22:34:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2012 22:34:31 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E7A3123889E0; Wed, 12 Dec 2012 22:34:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1421030 - /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/PartitionsDiffComputer.java Date: Wed, 12 Dec 2012 22:34:09 -0000 To: commits@directory.apache.org From: pamarcelot@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121212223409.E7A3123889E0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: pamarcelot Date: Wed Dec 12 22:34:08 2012 New Revision: 1421030 URL: http://svn.apache.org/viewvc?rev=1421030&view=rev Log: Fixed compilation failure due to latest changes in ApacheDS. Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/PartitionsDiffComputer.java Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/PartitionsDiffComputer.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/PartitionsDiffComputer.java?rev=1421030&r1=1421029&r2=1421030&view=diff ============================================================================== --- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/PartitionsDiffComputer.java (original) +++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/PartitionsDiffComputer.java Wed Dec 12 22:34:08 2012 @@ -22,16 +22,13 @@ package org.apache.directory.studio.apac import java.util.ArrayList; import java.util.Collections; -import java.util.HashSet; import java.util.List; -import java.util.Set; import org.apache.directory.server.core.api.entry.ClonedServerEntry; import org.apache.directory.server.core.api.filtering.EntryFilteringCursor; import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext; import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext; import org.apache.directory.server.core.api.partition.Partition; -import org.apache.directory.shared.ldap.model.constants.SchemaConstants; import org.apache.directory.shared.ldap.model.entry.Attribute; import org.apache.directory.shared.ldap.model.entry.DefaultAttribute; import org.apache.directory.shared.ldap.model.entry.DefaultModification; @@ -39,7 +36,6 @@ import org.apache.directory.shared.ldap. import org.apache.directory.shared.ldap.model.entry.Modification; import org.apache.directory.shared.ldap.model.entry.ModificationOperation; import org.apache.directory.shared.ldap.model.entry.Value; -import org.apache.directory.shared.ldap.model.exception.LdapException; import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException; import org.apache.directory.shared.ldap.model.filter.FilterParser; import org.apache.directory.shared.ldap.model.ldif.ChangeType; @@ -48,9 +44,6 @@ import org.apache.directory.shared.ldap. import org.apache.directory.shared.ldap.model.message.SearchScope; import org.apache.directory.shared.ldap.model.name.Dn; import org.apache.directory.shared.ldap.model.schema.AttributeType; -import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions; -import org.apache.directory.shared.ldap.model.schema.SchemaManager; -import org.apache.directory.shared.ldap.model.schema.SchemaUtils; import org.apache.directory.shared.ldap.model.schema.UsageEnum; @@ -216,11 +209,9 @@ public class PartitionsDiffComputer } // Creating a search operation context to get the children of the current entry - SearchOperationContext soc = new SearchOperationContext( null ); - setReturningAttributes( originalPartition.getSchemaManager(), attributeIds, soc ); - soc.setDn( originalEntry.getDn() ); - soc.setScope( SearchScope.ONELEVEL ); - soc.setFilter( FilterParser.parse( originalPartition.getSchemaManager(), "(objectClass=*)" ) ); //$NON-NLS-1$ + SearchOperationContext soc = new SearchOperationContext( null, originalEntry.getDn(), + SearchScope.ONELEVEL, + FilterParser.parse( originalPartition.getSchemaManager(), "(objectClass=*)" ), attributeIds ); soc.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS ); // Looking for the children of the current entry @@ -231,7 +222,7 @@ public class PartitionsDiffComputer originalEntries.add( ( ( ClonedServerEntry ) cursor.get() ).getClonedEntry() ); } } - + // Reversing the list to allow deletion of leafs first (otherwise we would be deleting // higher nodes with children first). // Order for modified entries does not matter. @@ -281,11 +272,9 @@ public class PartitionsDiffComputer } // Creating a search operation context to get the children of the current entry - SearchOperationContext soc = new SearchOperationContext( null ); - setReturningAttributes( destinationPartition.getSchemaManager(), attributeIds, soc ); - soc.setDn( destinationEntry.getDn() ); - soc.setScope( SearchScope.ONELEVEL ); - soc.setFilter( FilterParser.parse( destinationPartition.getSchemaManager(), "(objectClass=*)" ) ); //$NON-NLS-1$ + SearchOperationContext soc = new SearchOperationContext( null, originalEntry.getDn(), + SearchScope.ONELEVEL, + FilterParser.parse( originalPartition.getSchemaManager(), "(objectClass=*)" ), attributeIds ); soc.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS ); // Looking for the children of the current entry @@ -307,65 +296,6 @@ public class PartitionsDiffComputer /** - * Sets the returning attributes to the search operation context. - * - * @param schemaManager - * the schema manager - * @param attributeIds - * the attribute IDs - * @param soc - * the search operation context - * @throws org.apache.directory.shared.ldap.model.exception.LdapException - */ - private void setReturningAttributes( SchemaManager schemaManager, String[] attributeIds, - SearchOperationContext soc ) throws LdapException - { - if ( attributeIds != null && attributeIds.length != 0 ) - { - Set returningAttributes = new HashSet(); - - for ( String returnAttribute : attributeIds ) - { - if ( returnAttribute.equals( SchemaConstants.NO_ATTRIBUTE ) ) - { - soc.setNoAttributes( true ); - continue; - } - - if ( returnAttribute.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) ) - { - soc.setAllOperationalAttributes( true ); - continue; - } - - if ( returnAttribute.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) ) - { - soc.setAllUserAttributes( true ); - continue; - } - - String id = SchemaUtils.stripOptions( returnAttribute ); - Set options = SchemaUtils.getOptions( returnAttribute ); - - AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id ); - AttributeTypeOptions attrOptions = new AttributeTypeOptions( attributeType, options ); - - returningAttributes.add( attrOptions ); - } - - // reset the noAttrubte flag if it is already set cause that will be ignored if any other AT is requested - if ( soc.isNoAttributes() - && ( soc.isAllUserAttributes() || soc.isAllOperationalAttributes() || ( !returningAttributes.isEmpty() ) ) ) - { - soc.setNoAttributes( false ); - } - - soc.setReturningAttributes( returningAttributes ); - } - } - - - /** * Compares the two given entries. * * @param originalEntry