directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1721967 - /directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
Date Mon, 28 Dec 2015 18:02:14 GMT
Author: elecharny
Date: Mon Dec 28 18:02:13 2015
New Revision: 1721967

URL: http://svn.apache.org/viewvc?rev=1721967&view=rev
Log:
Made the LDIF file anonymization working for changes

Modified:
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java?rev=1721967&r1=1721966&r2=1721967&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdifAnonymizer.java
Mon Dec 28 18:02:13 2015
@@ -504,6 +504,61 @@ public class LdifAnonymizer
                 
                 try
                 {
+                    if ( ldifEntry.isEntry() && !ldifEntry.isChangeAdd() )
+                    {
+                        // process a full entry. Add changes aren't preocessed ghere.
+                        Entry newEntry = anonymizeEntry( ldifEntry );
+                        
+                        writer.write( LdifUtils.convertToLdif( newEntry ) );
+                        writer.write( "\n" );
+                    }
+                    else if ( ldifEntry.isChangeDelete() )
+                    {
+                        // A Delete operation
+                        LdifEntry newLdifEntry = anonymizeChangeDelete( ldifEntry );
+
+                        if ( ldifEntry != null )
+                        {
+                            writer.write( newLdifEntry.toString() );
+                            writer.write( "\n" );
+                        }
+                    }
+                    else if ( ldifEntry.isChangeAdd() )
+                    {
+                        // A Add operation
+                        LdifEntry newLdifEntry = anonymizeChangeAdd( ldifEntry );
+
+                        if ( ldifEntry != null )
+                        {
+                            writer.write( newLdifEntry.toString() );
+                            writer.write( "\n" );
+                        }
+                    }
+                    else if ( ldifEntry.isChangeModify() )
+                    {
+                        // A Modify operation
+                        LdifEntry newLdifEntry = anonymizeChangeModify( ldifEntry );
+
+                        if ( ldifEntry != null )
+                        {
+                            writer.write( newLdifEntry.toString() );
+                            writer.write( "\n" );
+                        }
+                    }
+                    else if ( ldifEntry.isChangeModDn() ||  ldifEntry.isChangeModRdn() )
+                    {
+                        // A MODDN operation
+                        LdifEntry newLdifEntry = anonymizeChangeModDn( ldifEntry );
+
+                        if ( ldifEntry != null )
+                        {
+                            writer.write( newLdifEntry.toString() );
+                            writer.write( "\n" );
+                        }
+                    }
+
+                    
+                    /*
                     Entry entry = ldifEntry.getEntry();
                     Entry newEntry = new DefaultEntry( schemaManager );
     
@@ -553,6 +608,7 @@ public class LdifAnonymizer
                     newEntry.setDn( anonymizedDn );
                     writer.write( LdifUtils.convertToLdif( newEntry ) );
                     writer.write( "\n" );
+                    */
 
                     System.out.print( '.' );
                     



Mime
View raw message