directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1687693 - /directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
Date Fri, 26 Jun 2015 07:37:55 GMT
Author: elecharny
Date: Fri Jun 26 07:37:55 2015
New Revision: 1687693

URL: http://svn.apache.org/r1687693
Log:
Used the OrderedTable for AuthIdRewrite and AuthzRegexp

Modified:
    directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java

Modified: directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java?rev=1687693&r1=1687692&r2=1687693&view=diff
==============================================================================
--- directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
(original)
+++ directory/studio/trunk/plugins/openldap.config.editor/src/main/java/org/apache/directory/studio/openldap/config/editor/pages/OptionsPage.java
Fri Jun 26 07:37:55 2015
@@ -40,6 +40,8 @@ import org.apache.directory.studio.openl
 import org.apache.directory.studio.openldap.config.editor.OpenLDAPServerConfigurationEditor;
 import org.apache.directory.studio.openldap.config.editor.wrappers.AllowFeatureDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.DisallowFeatureDecorator;
+import org.apache.directory.studio.openldap.config.editor.wrappers.OrderedStringValueDecorator;
+import org.apache.directory.studio.openldap.config.editor.wrappers.OrderedStringValueWrapper;
 import org.apache.directory.studio.openldap.config.editor.wrappers.RequireConditionDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.RestrictOperationDecorator;
 import org.apache.directory.studio.openldap.config.editor.wrappers.StringValueDecorator;
@@ -175,10 +177,10 @@ public class OptionsPage extends OpenLDA
 
     // The Authz regexp and rewrite rules
     /** The olcAuthIDRewrite parameter */
-    private TableWidget<StringValueWrapper> authIdRewriteTableWidget;
+    private TableWidget<OrderedStringValueWrapper> authIdRewriteTableWidget;
 
     /** The olcAuthzRegexp parameter */
-    private TableWidget<StringValueWrapper> authzRegexpTableWidget;
+    private TableWidget<OrderedStringValueWrapper> authzRegexpTableWidget;
 
     // The miscellaneous parameters
     /** The olcArgsFile parameter */
@@ -291,9 +293,9 @@ public class OptionsPage extends OpenLDA
         {
             List<String> authIdRewrites = new ArrayList<String>();
             
-            for ( StringValueWrapper authIdRewrite : authIdRewriteTableWidget.getElements()
)
+            for ( OrderedStringValueWrapper authIdRewrite : authIdRewriteTableWidget.getElements()
)
             {
-                authIdRewrites.add( authIdRewrite.getValue() );
+                authIdRewrites.add( authIdRewrite.toString() );
             }
             
             getConfiguration().getGlobal().setOlcAuthIDRewrite( authIdRewrites );
@@ -310,9 +312,9 @@ public class OptionsPage extends OpenLDA
         {
             List<String> authzRegexps = new ArrayList<String>();
             
-            for ( StringValueWrapper authzRegexp : authzRegexpTableWidget.getElements() )
+            for ( OrderedStringValueWrapper authzRegexp : authzRegexpTableWidget.getElements()
)
             {
-                authzRegexps.add( authzRegexp.getValue() );
+                authzRegexps.add( authzRegexp.toString() );
             }
             
             getConfiguration().getGlobal().setOlcAuthzRegexp( authzRegexps );
@@ -645,8 +647,8 @@ public class OptionsPage extends OpenLDA
         Composite composite = createSectionComposite( toolkit, section, 2, false );
 
         // The olcAuthIdRewrite parameter table
-        authIdRewriteTableWidget = new TableWidget<StringValueWrapper>( 
-            new StringValueDecorator( composite.getShell() , "authIdRewrite") );
+        authIdRewriteTableWidget = new TableWidget<OrderedStringValueWrapper>( 
+            new OrderedStringValueDecorator( composite.getShell() , "authIdRewrite") );
 
         authIdRewriteTableWidget.createOrderedWidgetWithEdit( composite, toolkit );
         authIdRewriteTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE,
true, false, 2, 1 ) );
@@ -679,8 +681,8 @@ public class OptionsPage extends OpenLDA
         Composite composite = createSectionComposite( toolkit, section, 2, false );
 
         // The olcAuthzRegexp parameter table
-        authzRegexpTableWidget = new TableWidget<StringValueWrapper>( 
-            new StringValueDecorator( composite.getShell(), "AuthzRegexp" ) );
+        authzRegexpTableWidget = new TableWidget<OrderedStringValueWrapper>( 
+            new OrderedStringValueDecorator( composite.getShell(), "AuthzRegexp" ) );
 
         authzRegexpTableWidget.createOrderedWidgetWithEdit( composite, toolkit );
         authzRegexpTableWidget.getControl().setLayoutData( new GridData( SWT.FILL, SWT.NONE,
true, false, 2, 1 ) );
@@ -894,24 +896,24 @@ public class OptionsPage extends OpenLDA
      */
     private void refreshAuthIdRewrites( OlcGlobal global )
     {
-        List<OlcDatabaseConfig> authIdRewrites = getConfiguration().getDatabases();
+        List<String> authIdRewrites = global.getOlcAuthIDRewrite();
 
         if ( authIdRewrites != null )
         {
             int nbElements = authIdRewrites.size();
-            List<StringValueWrapper> rewrites = new ArrayList<StringValueWrapper>(
nbElements );
+            List<OrderedStringValueWrapper> rewrites = new ArrayList<OrderedStringValueWrapper>(
nbElements );
             int[] valuePrefixes = new int[nbElements];
             Map<Integer, String> values = new HashMap<Integer, String>(nbElements);
             int pos = 0;
 
             // First gather the values
-            for ( OlcDatabaseConfig rewrite : authIdRewrites )
+            for ( String rewrite : authIdRewrites )
             {
                 // Parse the prefix, and set the element at the right place
-                int prefix = OpenLdapConfigurationPluginUtils.getOrderingPrefix( rewrite.getOlcDatabase()
);
+                int prefix = OpenLdapConfigurationPluginUtils.getOrderingPrefix( rewrite
);
                 
                 valuePrefixes[pos++] = prefix;
-                values.put( prefix, OpenLdapConfigurationPluginUtils.stripOrderingPrefix(
rewrite.getOlcDatabase() ) );
+                values.put( prefix, OpenLdapConfigurationPluginUtils.stripOrderingPrefix(
rewrite ) );
             }
 
             // Now, order them
@@ -921,7 +923,7 @@ public class OptionsPage extends OpenLDA
             for ( int prefix : valuePrefixes )
             {
                 String value = values.get( prefix );
-                rewrites.add( new StringValueWrapper( value, true ) );
+                rewrites.add( new OrderedStringValueWrapper( prefix, value, true ) );
             }
 
             authIdRewriteTableWidget.setElements( rewrites );
@@ -929,7 +931,7 @@ public class OptionsPage extends OpenLDA
         else
         {
             // Store an empty list
-            List<StringValueWrapper> rewrites = new ArrayList<StringValueWrapper>();
+            List<OrderedStringValueWrapper> rewrites = new ArrayList<OrderedStringValueWrapper>();
             
             authIdRewriteTableWidget.setElements( rewrites );
         }
@@ -938,24 +940,24 @@ public class OptionsPage extends OpenLDA
     
     private void refreshAuthzRegexps( OlcGlobal global )
     {
-        List<String> authzRegexps = global.getOlcRestrict();
+        List<String> authzRegexps = global.getOlcAuthzRegexp();
 
         if ( authzRegexps != null )
         {
             int nbElements = authzRegexps.size();
-            List<StringValueWrapper> regexps = new ArrayList<StringValueWrapper>(
nbElements );
+            List<OrderedStringValueWrapper> regexps = new ArrayList<OrderedStringValueWrapper>(
nbElements );
             int[] valuePrefixes = new int[nbElements];
             Map<Integer, String> values = new HashMap<Integer, String>(nbElements);
             int pos = 0;
 
             // First gather the values
-            for ( String rewrite : authzRegexps )
+            for ( String regexp : authzRegexps )
             {
                 // Parse the prefix, and set the element at the right place
-                int prefix = OpenLdapConfigurationPluginUtils.getOrderingPrefix( rewrite
);
+                int prefix = OpenLdapConfigurationPluginUtils.getOrderingPrefix( regexp );
                 
                 valuePrefixes[pos] = prefix;
-                values.put( prefix, OpenLdapConfigurationPluginUtils.stripOrderingPrefix(
rewrite ) );
+                values.put( prefix, OpenLdapConfigurationPluginUtils.stripOrderingPrefix(
regexp ) );
             }
 
             // Now, order them
@@ -965,7 +967,7 @@ public class OptionsPage extends OpenLDA
             for ( int prefix : valuePrefixes )
             {
                 String value = values.get( prefix );
-                regexps.add( new StringValueWrapper( value, true ) );
+                regexps.add( new OrderedStringValueWrapper( prefix, value, true ) );
             }
 
             authzRegexpTableWidget.setElements( regexps );
@@ -973,7 +975,7 @@ public class OptionsPage extends OpenLDA
         else
         {
             // Store an empty list
-            List<StringValueWrapper> regexps = new ArrayList<StringValueWrapper>();
+            List<OrderedStringValueWrapper> regexps = new ArrayList<OrderedStringValueWrapper>();
             
             authzRegexpTableWidget.setElements( regexps );
         }



Mime
View raw message