directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r496902 [2/3] - in /directory/sandbox/triplesec-jacc2: ./ admin-api2/src/main/java/org/safehaus/triplesec/admin/ admin-api2/src/main/java/org/safehaus/triplesec/admin/persistence/ changelog/src/main/java/org/safehaus/triplesec/changelog/bet...
Date Wed, 17 Jan 2007 00:29:27 GMT
Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewRolePanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewRolePanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewRolePanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewRolePanel.java Tue Jan 16 16:29:24 2007
@@ -25,6 +25,9 @@
 import java.awt.GridBagLayout;
 import java.util.Collections;
 import java.util.Enumeration;
+import java.util.Collection;
+import java.util.Set;
+import java.util.HashSet;
 
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
@@ -46,7 +49,8 @@
 import org.safehaus.triplesec.admin.Application;
 import org.safehaus.triplesec.admin.DataAccessException;
 import org.safehaus.triplesec.admin.Role;
-import org.safehaus.triplesec.admin.RoleModifier;
+import org.safehaus.triplesec.admin.Permission;
+import org.safehaus.triplesec.admin.persistence.PCException;
 
 
 public class NewRolePanel extends JPanel
@@ -76,8 +80,8 @@
     private JLabel jLabel2 = null;
     private JTextField applicationNameTextField = null;
     private RoleGrantsPanel roleGrantsPanel;
-    
-    
+
+
     public void setLeftTreeNavigation( LeftTreeNavigation leftTreeNavigation )
     {
         this.leftTreeNavigation = leftTreeNavigation;
@@ -97,7 +101,6 @@
     /**
      * This method initializes this
      * 
-     * @return void
      */
     private void initialize()
     {
@@ -120,7 +123,7 @@
     /**
      * This method initializes jPanel	
      * 	
-     * @return javax.swing.JPanel	
+     * @return javax.swing.JPanel
      */
     private JPanel getMainPanel()
     {
@@ -138,7 +141,7 @@
     /**
      * This method initializes jPanel	
      * 	
-     * @return javax.swing.JPanel	
+     * @return javax.swing.JPanel
      */
     private JPanel getButtonPanel()
     {
@@ -155,7 +158,7 @@
     /**
      * This method initializes jButton	
      * 	
-     * @return javax.swing.JButton	
+     * @return javax.swing.JButton
      */
     private JButton getCreateButton()
     {
@@ -178,7 +181,7 @@
     /**
      * This method initializes jPanel	
      * 	
-     * @return javax.swing.JPanel	
+     * @return javax.swing.JPanel
      */
     private JPanel getAboveButtonPanel()
     {
@@ -197,7 +200,7 @@
     /**
      * This method initializes jPanel	
      * 	
-     * @return javax.swing.JPanel	
+     * @return javax.swing.JPanel
      */
     private JPanel getNorthPanel()
     {
@@ -224,7 +227,7 @@
     /**
      * This method initializes jPanel	
      * 	
-     * @return javax.swing.JPanel	
+     * @return javax.swing.JPanel
      */
     private JPanel getSouthPanel()
     {
@@ -244,7 +247,7 @@
     /**
      * This method initializes iconLabel
      * 	
-     * @return javax.swing.JLabel	
+     * @return javax.swing.JLabel
      */
     private JLabel getIconLabel()
     {
@@ -266,7 +269,7 @@
     /**
      * This method initializes jPanel	
      * 	
-     * @return javax.swing.JPanel	
+     * @return javax.swing.JPanel
      */
     private JPanel getJPanel()
     {
@@ -328,7 +331,7 @@
     /**
      * This method initializes jTextArea	
      * 	
-     * @return javax.swing.JTextArea	
+     * @return javax.swing.JTextArea
      */
     private JTextArea getDescriptionTextArea()
     {
@@ -344,7 +347,7 @@
     /**
      * This method initializes jPanel4	
      * 	
-     * @return javax.swing.JPanel	
+     * @return javax.swing.JPanel
      */
     private JPanel getIconPanel()
     {
@@ -365,7 +368,7 @@
         existingRolesTable.setModel( new ExistingRolesTableModel() );
         DefaultMutableTreeNode appNode = ( DefaultMutableTreeNode ) node.getParent();
         Application application = ( Application ) appNode.getUserObject();
-        applicationNameTextField.setText( application.getAppRdn() );
+        applicationNameTextField.setText( application.getAppName() );
         roleGrantsPanel.populateLists( appNode, Collections.EMPTY_SET );
     }
 
@@ -392,31 +395,30 @@
         {
             return;
         }
-        
+
         DefaultMutableTreeNode appNode = ( DefaultMutableTreeNode ) node.getParent();
         Application application = ( Application ) appNode.getUserObject();
-        Role role;
-        RoleModifier modifier = application.modifier().newRole( roleNameTextField.getText() )
-            .setDescription( descriptionTextArea.getText() );
-        
+        Role role = new Role(roleNameTextField.getText(), descriptionTextArea.getText());
+
         for ( Enumeration ii = roleGrantsPanel.getRoleGrantsModel().elements(); ii.hasMoreElements(); /**/ )
         {
-            modifier.addGrant( ( String ) ii.nextElement() );
+            role.addGrant( application.getPermission(( String ) ii.nextElement() ));
         }
-        for ( Enumeration ii = roleGrantsPanel.getAvailablePermssionsModel().elements(); ii.hasMoreElements(); /**/ )
-        {
-            modifier.removeGrant( ( String ) ii.nextElement() );
-        }
-        
+        //TODO denials
+//        for ( Enumeration ii = roleGrantsPanel.getAvailablePermssionsModel().elements(); ii.hasMoreElements(); /**/ )
+//        {
+//            modifier.removeGrant( ( String ) ii.nextElement() );
+//        }
+
         try
         {
-            role = modifier.add();
+            application.addRole( role);
             DefaultMutableTreeNode roleNode = new DefaultMutableTreeNode( role );
             DefaultTreeModel model = ( DefaultTreeModel ) leftTreeNavigation.getTree().getModel();
             model.insertNodeInto( roleNode, node, 0 );
             existingRolesTableModel.fireTableDataChanged();
         }
-        catch ( DataAccessException e )
+        catch ( PCException e )
         {
             JOptionPane.showMessageDialog( this,
                 UiUtils.wrap( "Failed to create role:\n" + e.getMessage(), 79 ),
@@ -431,7 +433,7 @@
     /**
      * This method initializes jTabbedPane	
      * 	
-     * @return javax.swing.JTabbedPane	
+     * @return javax.swing.JTabbedPane
      */
     private JTabbedPane getCenterTabbedPane()
     {
@@ -445,7 +447,7 @@
         return centerTabbedPane;
     }
 
-    
+
     private RoleGrantsPanel getRoleGrantsPanel()
     {
         if ( roleGrantsPanel == null )
@@ -454,12 +456,12 @@
         }
         return roleGrantsPanel;
     }
-    
+
 
     /**
      * This method initializes jPanel3	
      * 	
-     * @return javax.swing.JPanel	
+     * @return javax.swing.JPanel
      */
     private JPanel getExistingPanelTab()
     {
@@ -482,7 +484,7 @@
     /**
      * This method initializes jScrollPane	
      * 	
-     * @return javax.swing.JScrollPane	
+     * @return javax.swing.JScrollPane
      */
     private JScrollPane getJScrollPane()
     {
@@ -498,7 +500,7 @@
     /**
      * This method initializes jTable	
      * 	
-     * @return javax.swing.JTable	
+     * @return javax.swing.JTable
      */
     private JTable getExistingRolesTable()
     {
@@ -516,7 +518,7 @@
                         return;
                     }
                     Role role = ( Role ) existingRolesTableModel.getValueAt( index, 0 );
-                    roleNameTextField.setText( "CopyOf" + role.getName() );
+                    roleNameTextField.setText( "CopyOf" + role.getRoleName() );
                     descriptionTextArea.setText( role.getDescription() );
                     roleGrantsPanel.populateLists( ( DefaultMutableTreeNode ) node.getParent(), role.getGrants() );
                 }
@@ -530,7 +532,7 @@
     /**
      * This method initializes defaultTableModel	
      * 	
-     * @return javax.swing.table.DefaultTableModel	
+     * @return javax.swing.table.DefaultTableModel
      */
     private ExistingRolesTableModel getExistingRolesTableModel()
     {
@@ -540,7 +542,7 @@
         }
         return existingRolesTableModel;
     }
-    
+
 
     class ExistingRolesTableModel extends AbstractTableModel
     {
@@ -575,15 +577,15 @@
             {
                 case ( 0 ):
                     return child.getUserObject();
-                case ( 1 ):
-                    return ( ( Role ) child.getUserObject() ).getCreatorsName();
-                case ( 2 ):
-                    return ( ( Role) child.getUserObject() ).getCreateTimestamp();
+//                case ( 1 ):
+//                    return ( ( Role ) child.getUserObject() ).getCreatorsName();
+//                case ( 2 ):
+//                    return ( ( Role) child.getUserObject() ).getCreateTimestamp();
             }
             return child.getUserObject();
         }
 
-    
+
         public String getColumnName( int columnIndex )
         {
             switch ( columnIndex )
@@ -604,7 +606,7 @@
     /**
      * This method initializes jTextField	
      * 	
-     * @return javax.swing.JTextField	
+     * @return javax.swing.JTextField
      */
     private JTextField getStatusTextField()
     {
@@ -620,7 +622,7 @@
     /**
      * This method initializes jTextField1	
      * 	
-     * @return javax.swing.JTextField	
+     * @return javax.swing.JTextField
      */
     private JTextField getRoleNameTextField()
     {
@@ -635,7 +637,7 @@
     /**
      * This method initializes jTextField	
      * 	
-     * @return javax.swing.JTextField	
+     * @return javax.swing.JTextField
      */
     private JTextField getApplicationNameTextField()
     {

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewUserPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewUserPanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewUserPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/NewUserPanel.java Tue Jan 16 16:29:24 2007
@@ -109,7 +109,6 @@
     /**
      * This method initializes this
      * 
-     * @return void
      */
     private void initialize()
     {

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionDependentsPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionDependentsPanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionDependentsPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionDependentsPanel.java Tue Jan 16 16:29:24 2007
@@ -21,13 +21,17 @@
 
 
 import javax.swing.JPanel;
+
 import java.awt.BorderLayout;
+
 import javax.swing.JButton;
+
 import java.awt.GridBagLayout;
 
 import javax.swing.JOptionPane;
 import javax.swing.JScrollPane;
 import javax.swing.JTable;
+
 import java.awt.GridBagConstraints;
 import java.util.ArrayList;
 import java.util.Enumeration;
@@ -35,9 +39,11 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.Collection;
 
 import javax.swing.table.AbstractTableModel;
 import javax.swing.tree.DefaultMutableTreeNode;
+import javax.naming.NamingException;
 
 import org.safehaus.triplesec.admin.DataAccessException;
 import org.safehaus.triplesec.admin.Permission;
@@ -56,7 +62,7 @@
     private List dependents = new ArrayList();
     private Permission permission;
     private DependencyModel dependencyModel = null;
-    
+
 
     /**
      * This is the default constructor
@@ -72,7 +78,7 @@
     {
         this.permission = ( Permission ) node.getUserObject();
         this.dependents.clear();
-        
+
         if ( node == null || node.getParent() == null || node.getParent().getParent() == null )
         {
             return;
@@ -97,16 +103,16 @@
                 profilesNode = child;
             }
         }
-        
+
         // -------------------------------------------------------------------
         // Find the role dependents
         // -------------------------------------------------------------------
-        
+
         for ( Enumeration ii = rolesNode.children(); ii.hasMoreElements(); /**/ )
         {
             DefaultMutableTreeNode child = ( DefaultMutableTreeNode ) ii.nextElement();
             Role role = ( Role ) child.getUserObject();
-            if ( role.getGrants().contains( permission.getName() ) )
+            if ( role.getGrants().contains( permission ) )
             {
                 dependents.add( child );
             }
@@ -115,40 +121,38 @@
         // -------------------------------------------------------------------
         // Find the profile dependents
         // -------------------------------------------------------------------
-        
+
         for ( Enumeration ii = profilesNode.children(); ii.hasMoreElements(); /**/ )
         {
             DefaultMutableTreeNode child = ( DefaultMutableTreeNode ) ii.nextElement();
             Profile profile = ( Profile ) ( child ).getUserObject();
-            if ( profile.getGrants().contains( permission.getName() ) || 
-                profile.getDenials().contains( permission.getName() ) )
+            if ( profile.getGrants().contains( permission ) ||
+                    profile.getDenials().contains( permission ) )
             {
                 dependents.add( child );
             }
         }
-        
+
         dependencyModel.fireTableDataChanged();
     }
-    
-    
+
+
     /**
      * This method initializes this
-     * 
-     * @return void
      */
     private void initialize()
     {
-        this.setLayout(new BorderLayout());
-        this.setSize(590, 289);
-        this.add(getCenterPanel(), java.awt.BorderLayout.CENTER);
-        this.add(getSouthPanel(), java.awt.BorderLayout.SOUTH);
+        this.setLayout( new BorderLayout() );
+        this.setSize( 590, 289 );
+        this.add( getCenterPanel(), java.awt.BorderLayout.CENTER );
+        this.add( getSouthPanel(), java.awt.BorderLayout.SOUTH );
     }
 
 
     /**
-     * This method initializes jPanel	
-     * 	
-     * @return javax.swing.JPanel	
+     * This method initializes jPanel
+     *
+     * @return javax.swing.JPanel
      */
     private JPanel getCenterPanel()
     {
@@ -159,44 +163,44 @@
             gridBagConstraints.gridy = 0;
             gridBagConstraints.weightx = 1.0;
             gridBagConstraints.weighty = 1.0;
-            gridBagConstraints.insets = new java.awt.Insets(10,10,10,10);
+            gridBagConstraints.insets = new java.awt.Insets( 10, 10, 10, 10 );
             gridBagConstraints.gridx = 0;
             centerPanel = new JPanel();
-            centerPanel.setLayout(new GridBagLayout());
-            centerPanel.add(getJScrollPane(), gridBagConstraints);
+            centerPanel.setLayout( new GridBagLayout() );
+            centerPanel.add( getJScrollPane(), gridBagConstraints );
         }
         return centerPanel;
     }
 
 
     /**
-     * This method initializes jPanel1	
-     * 	
-     * @return javax.swing.JPanel	
+     * This method initializes jPanel1
+     *
+     * @return javax.swing.JPanel
      */
     private JPanel getSouthPanel()
     {
         if ( southPanel == null )
         {
             southPanel = new JPanel();
-            southPanel.add(getRemoveButton(), null);
+            southPanel.add( getRemoveButton(), null );
         }
         return southPanel;
     }
 
 
     /**
-     * This method initializes jButton	
-     * 	
-     * @return javax.swing.JButton	
+     * This method initializes jButton
+     *
+     * @return javax.swing.JButton
      */
     private JButton getRemoveButton()
     {
         if ( removeButton == null )
         {
             removeButton = new JButton();
-            removeButton.setText("Remove");
-            removeButton.setToolTipText("Remove the link to the dependent object");
+            removeButton.setText( "Remove" );
+            removeButton.setToolTipText( "Remove the link to the dependent object" );
             removeButton.addActionListener( new java.awt.event.ActionListener()
             {
                 public void actionPerformed( java.awt.event.ActionEvent e )
@@ -204,52 +208,54 @@
                     String msg = UiUtils.wrap( "Removing dependency relationships will effect " +
                             "entities other than this permission.  You cannot automatically revert from operation.  " +
                             "Would you like to continue?", 79 );
-                    int response = JOptionPane.showOptionDialog( PermissionDependentsPanel.this, msg, 
-                        "Irreverable operation!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, 
-                        null, null, null );
+                    int response = JOptionPane.showOptionDialog( PermissionDependentsPanel.this, msg,
+                            "Irreverable operation!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
+                            null, null, null );
                     if ( response == JOptionPane.NO_OPTION )
                     {
                         return;
                     }
-                    
+
                     int[] selectedRows = dependentsTable.getSelectedRows();
                     Set removed = new HashSet();
                     for ( int ii = 0; ii < selectedRows.length; ii++ )
                     {
-                        DefaultMutableTreeNode dependentNode = 
-                            ( DefaultMutableTreeNode ) dependents.get( selectedRows[ii] ); 
+                        DefaultMutableTreeNode dependentNode =
+                                ( DefaultMutableTreeNode ) dependents.get( selectedRows[ii] );
                         Object dependent = dependentNode.getUserObject();
                         try
                         {
                             if ( dependent instanceof Role )
                             {
                                 Role role = ( Role ) dependent;
-                                dependentNode.setUserObject( role.modifier()
-                                    .removeGrant( permission.getName() ).modify() );
+                                role.removeGrant( permission );
+                                dependentNode.setUserObject( role );
                                 removed.add( dependentNode );
-                            }
-                            else if ( dependent instanceof Profile )
+                                role.getStateManager().commit();
+                            } else if ( dependent instanceof Profile )
                             {
                                 Profile profile = ( Profile ) dependent;
-                                dependentNode.setUserObject( profile.modifier().removeDenial( permission.getName() )
-                                    .removeGrant( permission.getName() ).modify() );
+                                profile.removeGrant( permission );
+                                profile.removeDenial( permission );
+                                dependentNode.setUserObject( profile );
                                 removed.add( dependentNode );
+                                profile.getStateManager().commit();
                             }
                         }
-                        catch ( DataAccessException dae )
+                        catch ( NamingException dae )
                         {
                             msg = UiUtils.wrap( "Failed to remove all dependency relationships for permission: "
-                                + dae.getMessage(), 79 );
-                            JOptionPane.showMessageDialog( PermissionDependentsPanel.this, msg, 
-                                "Dependency removal failure!", JOptionPane.ERROR_MESSAGE );
+                                    + dae.getMessage(), 79 );
+                            JOptionPane.showMessageDialog( PermissionDependentsPanel.this, msg,
+                                    "Dependency removal failure!", JOptionPane.ERROR_MESSAGE );
                         }
                     }
-                    
+
                     for ( Iterator ii = removed.iterator(); ii.hasNext(); /**/ )
                     {
                         dependents.remove( ii.next() );
                     }
-                    
+
                     if ( removed.size() > 0 )
                     {
                         dependencyModel.fireTableDataChanged();
@@ -262,52 +268,52 @@
 
 
     /**
-     * This method initializes jScrollPane	
-     * 	
-     * @return javax.swing.JScrollPane	
+     * This method initializes jScrollPane
+     *
+     * @return javax.swing.JScrollPane
      */
     private JScrollPane getJScrollPane()
     {
         if ( jScrollPane == null )
         {
             jScrollPane = new JScrollPane();
-            jScrollPane.setViewportView(getDependentsTable());
+            jScrollPane.setViewportView( getDependentsTable() );
         }
         return jScrollPane;
     }
 
 
     /**
-     * This method initializes jTable	
-     * 	
-     * @return javax.swing.JTable	
+     * This method initializes jTable
+     *
+     * @return javax.swing.JTable
      */
     private JTable getDependentsTable()
     {
         if ( dependentsTable == null )
         {
             dependentsTable = new JTable();
-            dependentsTable.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
-            dependentsTable.setToolTipText("Permission dependents");
+            dependentsTable.setSelectionMode( javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
+            dependentsTable.setToolTipText( "Permission dependents" );
             dependencyModel = new DependencyModel();
             dependentsTable.setModel( dependencyModel );
-            dependentsTable.setShowGrid(true);
+            dependentsTable.setShowGrid( true );
         }
         return dependentsTable;
     }
 
-    
+
     class DependencyModel extends AbstractTableModel
     {
         private static final long serialVersionUID = 5348529870374118604L;
-        private final String[] COLNAMES = new String[] { "Type", "Name/Id", "Nature" };
+        private final String[] COLNAMES = new String[] {"Type", "Name/Id", "Nature"};
 
 
         public String getColumnName( int columnIndex )
         {
             return COLNAMES[columnIndex];
         }
-        
+
         public int getRowCount()
         {
             return dependents.size();
@@ -323,7 +329,7 @@
             Object dependent = ( ( DefaultMutableTreeNode ) dependents.get( rowIndex ) ).getUserObject();
             if ( dependent instanceof Role )
             {
-                switch( columnIndex )
+                switch ( columnIndex )
                 {
                     case ( 0 ):
                         return "Role";
@@ -333,12 +339,11 @@
                         return "grant";
                     default:
                         throw new IndexOutOfBoundsException( "Only 3 columns present so columnIndex is invalid: "
-                            + columnIndex );
+                                + columnIndex );
                 }
-            }
-            else if ( dependent instanceof Profile )
+            } else if ( dependent instanceof Profile )
             {
-                switch( columnIndex )
+                switch ( columnIndex )
                 {
                     case ( 0 ):
                         return "Profile";
@@ -346,30 +351,27 @@
                         return dependent;
                     case ( 2 ):
                         Profile profile = ( Profile ) dependent;
-                        Set grants = profile.getGrants();
-                        Set denials = profile.getDenials();
+                        Collection<Permission> grants = profile.getGrants();
+                        Collection<Permission> denials = profile.getDenials();
                         // odd case to have permission in both grants and denials of role but it's possible
-                        if ( grants.contains( permission.getName() ) && denials.contains( permission.getName() ) )
+                        if ( grants.contains( permission ) && denials.contains( permission ) )
                         {
                             return "both";
-                        }
-                        else if ( grants.contains( permission.getName() ) )
+                        } else if ( grants.contains( permission ) )
                         {
                             return "grant";
-                        }
-                        else
+                        } else
                         {
                             return "denial";
                         }
                     default:
                         throw new IndexOutOfBoundsException( "Only 3 columns present so columnIndex is invalid: "
-                            + columnIndex );
+                                + columnIndex );
                 }
-            }
-            else
+            } else
             {
-                throw new IllegalStateException( "Only expecting Role and Profile dependents for Permissions not " 
-                    + dependent.getClass() );
+                throw new IllegalStateException( "Only expecting Role and Profile dependents for Permissions not "
+                        + dependent.getClass() );
             }
         }
     }

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionPanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/PermissionPanel.java Tue Jan 16 16:29:24 2007
@@ -37,10 +37,10 @@
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreePath;
+import javax.naming.NamingException;
 
 import org.safehaus.triplesec.admin.DataAccessException;
 import org.safehaus.triplesec.admin.Permission;
-import org.safehaus.triplesec.admin.PermissionModifier;
 
 
 public class PermissionPanel extends JPanel
@@ -75,7 +75,6 @@
     /**
      * This method initializes this
      * 
-     * @return void
      */
     private void initialize()
     {
@@ -405,9 +404,9 @@
 
     private void setPermissionFields()
     {
-        generalPanel.setFields( permission );
+//        generalPanel.setFields( permission );
         applicationNameTextField.setText( permission.getApplicationRdn() );
-        permissionNameTextField.setText( permission.getName() );
+        permissionNameTextField.setText( permission.getPermissionId() );
         descriptionTextArea.setText( permission.getDescription() );
     }
 
@@ -456,6 +455,18 @@
 
     public void saveAction()
     {
+        permission.setDescription(descriptionTextArea.getText() );
+        permission.setPermissionId(permissionNameTextField.getText() );
+        try
+        {
+            permission.getStateManager().commit();
+        } catch ( NamingException e )
+        {
+            JOptionPane.showMessageDialog( this, UiUtils.wrap( "Failed to modify permission:\n" + e.getMessage(),
+                79 ), "Permission modification failure!", JOptionPane.ERROR_MESSAGE );
+            return;
+        }
+/*
         PermissionModifier modifier = permission.modifier().setDescription( descriptionTextArea.getText() );
         if ( modifier.isUpdateNeeded() )
         {
@@ -487,6 +498,7 @@
                 return;
             }
         }
+*/
 
         node.setUserObject( permission );
         setPermissionFields();
@@ -555,21 +567,21 @@
             {
                 public void actionPerformed( java.awt.event.ActionEvent e )
                 {
-                    try
-                    {
-                        permission.modifier().delete();
+//                    try
+//                    {
+                        permission.getStateManager().getEntityManager().remove( permission);
                         DefaultMutableTreeNode parentNode = ( DefaultMutableTreeNode ) node.getParent();
                         DefaultTreeModel treeModel = ( DefaultTreeModel ) tree.getModel();
                         treeModel.removeNodeFromParent( node );
                         TreePath path = new TreePath( parentNode.getPath() );
                         tree.setSelectionPaths( new TreePath[] { path } );
-                    }
-                    catch ( DataAccessException e1 )
-                    {
-                        JOptionPane.showMessageDialog( PermissionPanel.this, 
-                            "Failed to delete permission: " + e1.getMessage(), "Delete Failed", 
-                            JOptionPane.ERROR_MESSAGE );
-                    }
+//                    }
+//                    catch ( DataAccessException e1 )
+//                    {
+//                        JOptionPane.showMessageDialog( PermissionPanel.this,
+//                            "Failed to delete permission: " + e1.getMessage(), "Delete Failed",
+//                            JOptionPane.ERROR_MESSAGE );
+//                    }
                 }
             } );
         }

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfilePanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfilePanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfilePanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfilePanel.java Tue Jan 16 16:29:24 2007
@@ -21,6 +21,7 @@
 
 
 import javax.swing.JPanel;
+
 import java.awt.BorderLayout;
 
 import javax.swing.DefaultComboBoxModel;
@@ -35,6 +36,7 @@
 import java.awt.GridBagConstraints;
 import java.util.Enumeration;
 import java.util.Set;
+import java.util.Collection;
 
 import javax.swing.JTextField;
 import javax.swing.JTextArea;
@@ -44,11 +46,15 @@
 
 import org.safehaus.triplesec.admin.DataAccessException;
 import org.safehaus.triplesec.admin.Profile;
-import org.safehaus.triplesec.admin.ProfileModifier;
 import org.safehaus.triplesec.admin.User;
+import org.safehaus.triplesec.admin.Permission;
+import org.safehaus.triplesec.admin.Role;
+import org.safehaus.triplesec.admin.Application;
+import org.safehaus.triplesec.admin.persistence.PCException;
 
 import javax.swing.JComboBox;
 import javax.swing.JCheckBox;
+import javax.naming.NamingException;
 
 
 public class ProfilePanel extends JPanel
@@ -100,8 +106,6 @@
 
     /**
      * This method initializes this
-     * 
-     * @return void
      */
     private void initialize()
     {
@@ -115,15 +119,15 @@
         this.setLayout( new GridBagLayout() );
         this.setSize( 550, 417 );
         this.setBorder( javax.swing.BorderFactory.createTitledBorder( null, "Existing Profile",
-            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION,
-            null, null ) );
+                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION,
+                null, null ) );
         this.add( getMainPanel(), gridBagConstraints );
     }
 
 
     /**
      * This method initializes jPanel
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getMainPanel()
@@ -141,7 +145,7 @@
 
     /**
      * This method initializes jPanel
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getButtonPanel()
@@ -160,7 +164,7 @@
 
     /**
      * This method initializes jButton
-     * 
+     *
      * @return javax.swing.JButton
      */
     private JButton getRevertButton()
@@ -180,8 +184,8 @@
                     catch ( DataAccessException e1 )
                     {
                         JOptionPane.showMessageDialog( ProfilePanel.this,
-                            "Failed to access application permissions for profile: " + profile.getId() + "\n\n"
-                                + e1.getMessage(), "Data access error", JOptionPane.ERROR_MESSAGE );
+                                "Failed to access application permissions for profile: " + profile.getProfileId() + "\n\n"
+                                        + e1.getMessage(), "Data access error", JOptionPane.ERROR_MESSAGE );
                     }
                 }
             } );
@@ -192,7 +196,7 @@
 
     /**
      * This method initializes jButton
-     * 
+     *
      * @return javax.swing.JButton
      */
     private JButton getSaveButton()
@@ -215,7 +219,7 @@
 
     /**
      * This method initializes jPanel
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getAboveButtonPanel()
@@ -234,7 +238,7 @@
 
     /**
      * This method initializes jPanel
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getNorthPanel()
@@ -261,7 +265,7 @@
 
     /**
      * This method initializes jTabbedPane
-     * 
+     *
      * @return javax.swing.JTabbedPane
      */
     private JTabbedPane getCenterTabbedPane()
@@ -280,7 +284,7 @@
 
     /**
      * This method initializes jPanel
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getSouthPanel()
@@ -290,8 +294,8 @@
             southPanel = new JPanel();
             southPanel.setLayout( new BorderLayout() );
             southPanel.setBorder( javax.swing.BorderFactory.createTitledBorder( null, "Description",
-                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
-                javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
+                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
             southPanel.add( getDescriptionTextArea(), java.awt.BorderLayout.NORTH );
         }
         return southPanel;
@@ -300,7 +304,7 @@
 
     /**
      * This method initializes jPanel
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private GeneralPanel getGeneralPanel()
@@ -310,19 +314,19 @@
             GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
             gridBagConstraints6.gridx = 1;
             gridBagConstraints6.fill = java.awt.GridBagConstraints.HORIZONTAL;
-            gridBagConstraints6.insets = new java.awt.Insets(0,0,0,05);
+            gridBagConstraints6.insets = new java.awt.Insets( 0, 0, 0, 05 );
             gridBagConstraints6.gridy = 4;
             GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
             gridBagConstraints5.gridx = 0;
             gridBagConstraints5.fill = java.awt.GridBagConstraints.HORIZONTAL;
-            gridBagConstraints5.insets = new java.awt.Insets(0,0,0,5);
+            gridBagConstraints5.insets = new java.awt.Insets( 0, 0, 0, 5 );
             gridBagConstraints5.gridy = 4;
             jLabel3 = new JLabel();
-            jLabel3.setText("Disabled:");
-            jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
+            jLabel3.setText( "Disabled:" );
+            jLabel3.setHorizontalAlignment( javax.swing.SwingConstants.RIGHT );
             generalPanel = new GeneralPanel();
-            generalPanel.add(jLabel3, gridBagConstraints5);
-            generalPanel.add(getDisabledCheckBox(), gridBagConstraints6);
+            generalPanel.add( jLabel3, gridBagConstraints5 );
+            generalPanel.add( getDisabledCheckBox(), gridBagConstraints6 );
         }
         return generalPanel;
     }
@@ -330,7 +334,7 @@
 
     /**
      * This method initializes iconLabel
-     * 
+     *
      * @return javax.swing.JLabel
      */
     private JLabel getIconLabel()
@@ -339,7 +343,7 @@
         {
             iconLabel = new JLabel();
             iconLabel.setIcon( new ImageIcon( getClass().getResource(
-                "/org/safehaus/triplesec/admin/swing/profile2_48x48.png" ) ) );
+                    "/org/safehaus/triplesec/admin/swing/profile2_48x48.png" ) ) );
             iconLabel.setPreferredSize( new java.awt.Dimension( 48, 48 ) );
             iconLabel.setText( "" );
             iconLabel.setVerticalTextPosition( javax.swing.SwingConstants.BOTTOM );
@@ -352,7 +356,7 @@
 
     /**
      * This method initializes jPanel
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getJPanel()
@@ -413,7 +417,7 @@
 
     /**
      * This method initializes jTextArea
-     * 
+     *
      * @return javax.swing.JTextArea
      */
     private JTextArea getDescriptionTextArea()
@@ -429,7 +433,7 @@
 
     /**
      * This method initializes jPanel4
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getJPanel4()
@@ -451,9 +455,9 @@
             return;
         }
         disabledCheckBox.setSelected( profile.isDisabled() );
-        generalPanel.setFields( profile );
-        applicationNameTextField.setText( profile.getApplicationName() );
-        profileIdTextField.setText( profile.getId() );
+//        generalPanel.setFields( profile );
+//        applicationNameTextField.setText( profile.getApplicationName() );
+        profileIdTextField.setText( profile.getProfileId() );
         descriptionTextArea.setText( profile.getDescription() );
 
         DefaultMutableTreeNode applicationNode = ( DefaultMutableTreeNode ) node.getParent().getParent();
@@ -462,11 +466,11 @@
         // load the grants, denials and roles into respective panels
         // -------------------------------------------------------------------
 
-        Set grants = profile.getGrants();
+        Collection<Permission> grants = profile.getGrants();
         profileGrantsPanel.populateLists( applicationNode, grants );
-        Set denials = profile.getDenials();
+        Collection<Permission> denials = profile.getDenials();
         profileDenialsPanel.populateLists( applicationNode, denials );
-        Set roles = profile.getRoles();
+        Collection<Role> roles = profile.getRoles();
         profileRolesPanel.populateLists( applicationNode, roles );
 
         // -------------------------------------------------------------------
@@ -476,7 +480,7 @@
         usersComboBoxModel.removeAllElements();
         DefaultMutableTreeNode rootNode = ( DefaultMutableTreeNode ) applicationNode.getParent().getParent();
         DefaultMutableTreeNode usersNode = null;
-        for ( Enumeration ii = rootNode.children(); ii.hasMoreElements(); /**/)
+        for ( Enumeration ii = rootNode.children(); ii.hasMoreElements(); /**/ )
         {
             DefaultMutableTreeNode child = ( DefaultMutableTreeNode ) ii.nextElement();
             if ( child.getUserObject() instanceof String )
@@ -488,7 +492,7 @@
             }
         }
 
-        for ( Enumeration ii = usersNode.children(); ii.hasMoreElements(); /**/)
+        for ( Enumeration ii = usersNode.children(); ii.hasMoreElements(); /**/ )
         {
             DefaultMutableTreeNode userNode = ( DefaultMutableTreeNode ) ii.nextElement();
             usersComboBoxModel.addElement( ( ( User ) userNode.getUserObject() ).getId() );
@@ -519,7 +523,7 @@
         catch ( DataAccessException e )
         {
             JOptionPane.showMessageDialog( ProfilePanel.this, "Failed to access application permissions for profile: "
-                + profile.getId() + "\n\n" + e.getMessage(), "Data access error", JOptionPane.ERROR_MESSAGE );
+                    + profile.getProfileId() + "\n\n" + e.getMessage(), "Data access error", JOptionPane.ERROR_MESSAGE );
         }
     }
 
@@ -548,66 +552,50 @@
         }
 
         // change the description and add remove values from list views then see if anything changed
-        ProfileModifier modifier = profile.modifier().setDescription( descriptionTextArea.getText() );
-        modifier.setUser( ( String ) usersComboBox.getSelectedItem() );
-        modifier.setDisable( disabledCheckBox.isSelected() );
-        for ( Enumeration ii = profileGrantsPanel.getAvailableModel().elements(); ii.hasMoreElements(); /**/)
+        profile.setProfileId( profileIdTextField.getText() );
+        profile.setDescription( descriptionTextArea.getText() );
+        profile.setUser( ( String ) usersComboBox.getSelectedItem() );
+        profile.setDisabled( disabledCheckBox.isSelected() );
+        Application application = ( Application ) profile.getStateManager().getParent().getPc();
+        for ( Enumeration ii = profileGrantsPanel.getAvailableModel().elements(); ii.hasMoreElements(); /**/ )
         {
-            modifier.removeGrant( ( String ) ii.nextElement() );
+            profile.removeGrant( application.getPermission( ( String ) ii.nextElement() ) );
         }
-        for ( Enumeration ii = profileGrantsPanel.getExistingModel().elements(); ii.hasMoreElements(); /**/)
+        for ( Enumeration ii = profileGrantsPanel.getExistingModel().elements(); ii.hasMoreElements(); /**/ )
         {
-            modifier.addGrant( ( String ) ii.nextElement() );
+            profile.addGrant( application.getPermission( ( String ) ii.nextElement() ) );
         }
 
-        for ( Enumeration ii = profileDenialsPanel.getAvailableModel().elements(); ii.hasMoreElements(); /**/)
+        for ( Enumeration ii = profileDenialsPanel.getAvailableModel().elements(); ii.hasMoreElements(); /**/ )
         {
-            modifier.removeDenial( ( String ) ii.nextElement() );
+            profile.removeDenial( application.getPermission( ( String ) ii.nextElement() ) );
         }
-        for ( Enumeration ii = profileDenialsPanel.getExistingModel().elements(); ii.hasMoreElements(); /**/)
+        for ( Enumeration ii = profileDenialsPanel.getExistingModel().elements(); ii.hasMoreElements(); /**/ )
         {
-            modifier.addDenial( ( String ) ii.nextElement() );
+            profile.addDenial( application.getPermission( ( String ) ii.nextElement() ) );
         }
 
-        for ( Enumeration ii = profileRolesPanel.getAvailableRolesModel().elements(); ii.hasMoreElements(); /**/)
+        for ( Enumeration ii = profileRolesPanel.getAvailableRolesModel().elements(); ii.hasMoreElements(); /**/ )
         {
-            modifier.removeRole( ( String ) ii.nextElement() );
+            profile.removeRole( application.getRole( ( String ) ii.nextElement() ) );
         }
-        for ( Enumeration ii = profileRolesPanel.getProfileRolesModel().elements(); ii.hasMoreElements(); /**/)
+        for ( Enumeration ii = profileRolesPanel.getProfileRolesModel().elements(); ii.hasMoreElements(); /**/ )
         {
-            modifier.addRole( ( String ) ii.nextElement() );
+            profile.addRole( application.getRole( ( String ) ii.nextElement() ) );
         }
 
-        if ( modifier.isUpdateNeeded() )
+        try
         {
-            try
-            {
-                profile = modifier.modify();
-            }
-            catch ( DataAccessException e )
-            {
-                JOptionPane.showMessageDialog( this,
+            profile.getStateManager().commit();
+        }
+        catch ( NamingException e )
+        {
+            JOptionPane.showMessageDialog( this,
                     UiUtils.wrap( "Failed to modify profile:\n" + e.getMessage(), 79 ),
                     "Profile modification failure!", JOptionPane.ERROR_MESSAGE );
-                return;
-            }
+            return;
         }
 
-        if ( !profile.getId().equals( profileIdTextField.getText() ) )
-        {
-            try
-            {
-                profile = profile.modifier().rename( profileIdTextField.getText() );
-                ( ( DefaultTreeModel ) tree.getModel() ).valueForPathChanged( new TreePath( node.getPath() ), profile );
-            }
-            catch ( DataAccessException e )
-            {
-                JOptionPane.showMessageDialog( this,
-                    UiUtils.wrap( "Failed to rename profile:\n" + e.getMessage(), 79 ), "Profile rename failure!",
-                    JOptionPane.ERROR_MESSAGE );
-                return;
-            }
-        }
 
         node.setUserObject( profile );
         try
@@ -617,14 +605,14 @@
         catch ( DataAccessException e )
         {
             JOptionPane.showMessageDialog( ProfilePanel.this, "Failed to access application permissions for profile: "
-                + profile.getId() + "\n\n" + e.getMessage(), "Data access error", JOptionPane.ERROR_MESSAGE );
+                    + profile.getProfileId() + "\n\n" + e.getMessage(), "Data access error", JOptionPane.ERROR_MESSAGE );
         }
     }
 
 
     /**
      * This method initializes jPanel5
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private ProfilePermissionsPanel getProfileGrantsPanel()
@@ -639,7 +627,7 @@
 
     /**
      * This method initializes jPanel5
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private ProfilePermissionsPanel getProfileDenialsPanel()
@@ -651,7 +639,7 @@
         return profileDenialsPanel;
     }
 
-    
+
     private ProfileRolesPanel getProfileRolesPanel()
     {
         if ( profileRolesPanel == null )
@@ -660,12 +648,12 @@
         }
         return profileRolesPanel;
     }
-    
+
 
     /**
-     * This method initializes jTextField	
-     * 	
-     * @return javax.swing.JTextField	
+     * This method initializes jTextField
+     *
+     * @return javax.swing.JTextField
      */
     private JTextField getStatusTextField()
     {
@@ -679,9 +667,9 @@
 
 
     /**
-     * This method initializes jTextField	
-     * 	
-     * @return javax.swing.JTextField	
+     * This method initializes jTextField
+     *
+     * @return javax.swing.JTextField
      */
     private JTextField getApplicationNameTextField()
     {
@@ -695,9 +683,9 @@
 
 
     /**
-     * This method initializes jButton	
-     * 	
-     * @return javax.swing.JButton	
+     * This method initializes jButton
+     *
+     * @return javax.swing.JButton
      */
     private JButton getDeleteButton()
     {
@@ -711,18 +699,18 @@
                 {
                     try
                     {
-                        profile.modifier().delete();
+                        profile.getStateManager().getEntityManager().remove( profile );
                         DefaultMutableTreeNode parentNode = ( DefaultMutableTreeNode ) node.getParent();
                         DefaultTreeModel treeModel = ( DefaultTreeModel ) tree.getModel();
                         treeModel.removeNodeFromParent( node );
                         TreePath path = new TreePath( parentNode.getPath() );
                         tree.setSelectionPaths( new TreePath[]
-                            { path } );
+                                {path} );
                     }
-                    catch ( DataAccessException e1 )
+                    catch ( PCException e1 )
                     {
                         JOptionPane.showMessageDialog( ProfilePanel.this, "Failed to delete profile: "
-                            + e1.getMessage(), "Delete Failed", JOptionPane.ERROR_MESSAGE );
+                                + e1.getMessage(), "Delete Failed", JOptionPane.ERROR_MESSAGE );
                     }
                 }
             } );
@@ -732,9 +720,9 @@
 
 
     /**
-     * This method initializes jPanel1	
-     * 	
-     * @return javax.swing.JPanel	
+     * This method initializes jPanel1
+     *
+     * @return javax.swing.JPanel
      */
     private JPanel getJPanel1()
     {
@@ -765,9 +753,9 @@
 
 
     /**
-     * This method initializes jTextField	
-     * 	
-     * @return javax.swing.JTextField	
+     * This method initializes jTextField
+     *
+     * @return javax.swing.JTextField
      */
     private JTextField getJTextField()
     {
@@ -780,9 +768,9 @@
 
 
     /**
-     * This method initializes jComboBox	
-     * 	
-     * @return javax.swing.JComboBox	
+     * This method initializes jComboBox
+     *
+     * @return javax.swing.JComboBox
      */
     private JComboBox getJComboBox()
     {
@@ -797,9 +785,9 @@
 
 
     /**
-     * This method initializes jCheckBox	
-     * 	
-     * @return javax.swing.JCheckBox	
+     * This method initializes jCheckBox
+     *
+     * @return javax.swing.JCheckBox
      */
     private JCheckBox getDisabledCheckBox()
     {

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfilePermissionsPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfilePermissionsPanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfilePermissionsPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfilePermissionsPanel.java Tue Jan 16 16:29:24 2007
@@ -26,6 +26,7 @@
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.Collection;
 
 import javax.swing.DefaultListModel;
 import javax.swing.ImageIcon;
@@ -55,7 +56,7 @@
     private DefaultListModel existingModel = null; // @jve:decl-index=0:visual-constraint=""
     private final boolean forGrants;
 
-    
+
     /**
      * This is the default constructor
      */
@@ -78,12 +79,12 @@
     }
 
 
-    public void populateLists( DefaultMutableTreeNode applicationNode, Set existing )
+    public void populateLists( DefaultMutableTreeNode applicationNode, Collection<Permission> existing )
     {
         // -------------------------------------------------------------------
         // clear both lists and find the permissions container for the app
         // -------------------------------------------------------------------
-        
+
         availableModel.clear();
         existingModel.clear();
         if ( applicationNode == null )
@@ -100,26 +101,26 @@
                 break;
             }
         }
-        
+
         // -------------------------------------------------------------------
         // load both lists: do not include perms as available if in grants
         // -------------------------------------------------------------------
-        
-        for ( Enumeration ii = permissionsNode.children(); ii.hasMoreElements(); /**/)
+
+        for ( Enumeration ii = permissionsNode.children(); ii.hasMoreElements(); /**/ )
         {
             Permission permission = ( Permission ) ( ( DefaultMutableTreeNode ) ii.nextElement() ).getUserObject();
-            if ( ! existing.contains( permission.getName() ) )
+            if ( ! existing.contains( permission ) )
             {
-                availableModel.addElement( permission.getName() );
+                availableModel.addElement( permission );
             }
         }
-        for ( Iterator ii = existing.iterator(); ii.hasNext(); /**/)
+        for ( Iterator ii = existing.iterator(); ii.hasNext(); /**/ )
         {
             existingModel.addElement( ii.next() );
         }
     }
-    
-    
+
+
     public DefaultListModel getAvailableModel()
     {
         return availableModel;
@@ -134,8 +135,6 @@
 
     /**
      * This method initializes this
-     * 
-     * @return void
      */
     private void initialize()
     {
@@ -149,7 +148,7 @@
 
     /**
      * This method initializes jPanel5
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getAvailablePanel()
@@ -162,14 +161,13 @@
             if ( forGrants )
             {
                 title = "Available Grants";
-            }
-            else
+            } else
             {
                 title = "Available Denials";
             }
             jPanel5.setBorder( javax.swing.BorderFactory.createTitledBorder( null, title,
-                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
-                javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
+                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
             jPanel5.setPreferredSize( new java.awt.Dimension( 200, 35 ) );
             jPanel5.add( getJScrollPane(), java.awt.BorderLayout.CENTER );
         }
@@ -179,7 +177,7 @@
 
     /**
      * This method initializes jPanel6
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getButtonPanel()
@@ -204,7 +202,7 @@
 
     /**
      * This method initializes jPanel7
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getExistingPanel()
@@ -218,15 +216,14 @@
             if ( forGrants )
             {
                 title = "Available Grants";
-            }
-            else
+            } else
             {
                 title = "Available Denials";
             }
             jPanel7.setBorder( javax.swing.BorderFactory.createTitledBorder( null, title,
-                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
-                javax.swing.border.TitledBorder.DEFAULT_POSITION,
-                new java.awt.Font( "Dialog", java.awt.Font.BOLD, 12 ), new java.awt.Color( 51, 51, 51 ) ) );
+                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+                    javax.swing.border.TitledBorder.DEFAULT_POSITION,
+                    new java.awt.Font( "Dialog", java.awt.Font.BOLD, 12 ), new java.awt.Color( 51, 51, 51 ) ) );
             jPanel7.add( getJScrollPane1(), java.awt.BorderLayout.CENTER );
         }
         return jPanel7;
@@ -235,7 +232,7 @@
 
     /**
      * This method initializes jButton
-     * 
+     *
      * @return javax.swing.JButton
      */
     private JButton getAddPermissionButton()
@@ -247,14 +244,13 @@
             if ( forGrants )
             {
                 tooltip = "Add selected permissions to profile grants";
-            }
-            else
+            } else
             {
                 tooltip = "Add selected permissions to profile denials";
             }
             addButton.setToolTipText( tooltip );
             addButton.setIcon( new ImageIcon( getClass().getResource(
-                "/org/safehaus/triplesec/admin/swing/rightarrow_16x16.png" ) ) );
+                    "/org/safehaus/triplesec/admin/swing/rightarrow_16x16.png" ) ) );
             addButton.addActionListener( new java.awt.event.ActionListener()
             {
                 public void actionPerformed( java.awt.event.ActionEvent e )
@@ -279,7 +275,7 @@
 
     /**
      * This method initializes jButton1
-     * 
+     *
      * @return javax.swing.JButton
      */
     private JButton getRemovePermissionButton()
@@ -291,14 +287,13 @@
             if ( forGrants )
             {
                 tooltip = "Remove selected permissions from profile grants";
-            }
-            else
+            } else
             {
                 tooltip = "Remove selected permissions from profile denials";
             }
             removeButton.setToolTipText( tooltip );
             removeButton.setIcon( new ImageIcon( getClass().getResource(
-                "/org/safehaus/triplesec/admin/swing/leftarrow_16x16.png" ) ) );
+                    "/org/safehaus/triplesec/admin/swing/leftarrow_16x16.png" ) ) );
             removeButton.addActionListener( new java.awt.event.ActionListener()
             {
                 public void actionPerformed( java.awt.event.ActionEvent e )
@@ -322,9 +317,9 @@
 
 
     /**
-     * This method initializes jScrollPane  
-     *  
-     * @return javax.swing.JScrollPane  
+     * This method initializes jScrollPane
+     *
+     * @return javax.swing.JScrollPane
      */
     private JScrollPane getJScrollPane()
     {
@@ -338,9 +333,9 @@
 
 
     /**
-     * This method initializes jScrollPane1 
-     *  
-     * @return javax.swing.JScrollPane  
+     * This method initializes jScrollPane1
+     *
+     * @return javax.swing.JScrollPane
      */
     private JScrollPane getJScrollPane1()
     {
@@ -355,7 +350,7 @@
 
     /**
      * This method initializes jList
-     * 
+     *
      * @return javax.swing.JList
      */
     private JList getApplicationPermissions()
@@ -368,8 +363,7 @@
             if ( forGrants )
             {
                 tooltip = "Application permissions assignable to profile grants";
-            }
-            else
+            } else
             {
                 tooltip = "Application permissions assignable to profile denials";
             }
@@ -382,7 +376,7 @@
 
     /**
      * This method initializes jList1
-     * 
+     *
      * @return javax.swing.JList
      */
     private JList getProfileGrants()
@@ -394,8 +388,7 @@
             if ( forGrants )
             {
                 tooltip = "Permissions already assigned to profile grants";
-            }
-            else
+            } else
             {
                 tooltip = "Permissions already assigned to profile denials";
             }
@@ -408,7 +401,7 @@
 
     /**
      * This method initializes defaultListModel
-     * 
+     *
      * @return javax.swing.DefaultListModel
      */
     private DefaultListModel getDefaultListModel()
@@ -423,7 +416,7 @@
 
     /**
      * This method initializes defaultListModel1
-     * 
+     *
      * @return javax.swing.DefaultListModel
      */
     private DefaultListModel getDefaultListModel1()

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfileRolesPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfileRolesPanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfileRolesPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProfileRolesPanel.java Tue Jan 16 16:29:24 2007
@@ -26,6 +26,7 @@
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.Collection;
 
 import javax.swing.DefaultListModel;
 import javax.swing.ImageIcon;
@@ -54,7 +55,7 @@
     private DefaultListModel availableModel = null; // @jve:decl-index=0:visual-constraint=""
     private DefaultListModel existingModel = null; // @jve:decl-index=0:visual-constraint=""
 
-    
+
     /**
      * This is the default constructor
      */
@@ -64,18 +65,18 @@
         initialize();
     }
 
-    
-    public void populateLists( DefaultMutableTreeNode applicationNode, Set roles )
+
+    public void populateLists( DefaultMutableTreeNode applicationNode, Collection<Role> roles )
     {
         if ( applicationNode == null )
         {
             return;
         }
-        
+
         // -------------------------------------------------------------------
         // Find the Roles container under the application and clear lists
         // -------------------------------------------------------------------
-        
+
         availableModel.clear();
         existingModel.clear();
         DefaultMutableTreeNode rolesNode = null;
@@ -88,46 +89,44 @@
                 break;
             }
         }
-        
+
         // -------------------------------------------------------------------
         // Fill up the available roles list and the existing roles list
         // -------------------------------------------------------------------
-        
-        for ( Enumeration ii = rolesNode.children(); ii.hasMoreElements(); /**/)
+
+        for ( Enumeration ii = rolesNode.children(); ii.hasMoreElements(); /**/ )
         {
             Role role = ( Role ) ( ( DefaultMutableTreeNode ) ii.nextElement() ).getUserObject();
-            if ( !roles.contains( role.getName() ) )
+            if ( !roles.contains( role ) )
             {
-                availableModel.addElement( role.getName() );
+                availableModel.addElement( role );
             }
         }
-        for ( Iterator ii = roles.iterator(); ii.hasNext(); /**/)
+        for ( Iterator ii = roles.iterator(); ii.hasNext(); /**/ )
         {
             existingModel.addElement( ii.next() );
         }
     }
-    
+
 
     public DefaultListModel getAvailableRolesModel()
     {
         return availableModel;
     }
-    
-    
+
+
     public DefaultListModel getProfileRolesModel()
     {
         return existingModel;
     }
-    
-    
+
+
     /**
      * This method initializes this
-     * 
-     * @return void
      */
     private void initialize()
     {
-        this.setSize(613, 254);
+        this.setSize( 613, 254 );
         setLayout( new BorderLayout() );
         add( getAvailableRolesPanel(), java.awt.BorderLayout.WEST );
         add( getButtonPanel(), java.awt.BorderLayout.CENTER );
@@ -137,7 +136,7 @@
 
     /**
      * This method initializes jPanel5
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getAvailableRolesPanel()
@@ -147,8 +146,8 @@
             jPanelRoles5 = new JPanel();
             jPanelRoles5.setLayout( new BorderLayout() );
             jPanelRoles5.setBorder( javax.swing.BorderFactory.createTitledBorder( null, "Available Roles",
-                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
-                javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
+                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null ) );
             jPanelRoles5.setPreferredSize( new java.awt.Dimension( 200, 35 ) );
             jPanelRoles5.add( getJScrollPane4(), java.awt.BorderLayout.CENTER );
         }
@@ -158,7 +157,7 @@
 
     /**
      * This method initializes jPanel6
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getButtonPanel()
@@ -183,7 +182,7 @@
 
     /**
      * This method initializes jPanel7
-     * 
+     *
      * @return javax.swing.JPanel
      */
     private JPanel getExistingRolesPanel()
@@ -194,9 +193,9 @@
             jPanelRoles7.setLayout( new BorderLayout() );
             jPanelRoles7.setPreferredSize( new java.awt.Dimension( 200, 10 ) );
             jPanelRoles7.setBorder( javax.swing.BorderFactory.createTitledBorder( null, "Profile Roles",
-                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
-                javax.swing.border.TitledBorder.DEFAULT_POSITION,
-                new java.awt.Font( "Dialog", java.awt.Font.BOLD, 12 ), new java.awt.Color( 51, 51, 51 ) ) );
+                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+                    javax.swing.border.TitledBorder.DEFAULT_POSITION,
+                    new java.awt.Font( "Dialog", java.awt.Font.BOLD, 12 ), new java.awt.Color( 51, 51, 51 ) ) );
             jPanelRoles7.add( getJScrollPane5(), java.awt.BorderLayout.CENTER );
         }
         return jPanelRoles7;
@@ -205,7 +204,7 @@
 
     /**
      * This method initializes jButton
-     * 
+     *
      * @return javax.swing.JButton
      */
     private JButton getAddRolesButton()
@@ -215,7 +214,7 @@
             addButton = new JButton();
             addButton.setToolTipText( "Add selected roles to profile" );
             addButton.setIcon( new ImageIcon( getClass().getResource(
-                "/org/safehaus/triplesec/admin/swing/rightarrow_16x16.png" ) ) );
+                    "/org/safehaus/triplesec/admin/swing/rightarrow_16x16.png" ) ) );
             addButton.addActionListener( new java.awt.event.ActionListener()
             {
                 public void actionPerformed( java.awt.event.ActionEvent e )
@@ -240,7 +239,7 @@
 
     /**
      * This method initializes jButton1
-     * 
+     *
      * @return javax.swing.JButton
      */
     private JButton getRemoveRolesButton()
@@ -250,7 +249,7 @@
             removeButton = new JButton();
             removeButton.setToolTipText( "Remove selected roles from profile" );
             removeButton.setIcon( new ImageIcon( getClass().getResource(
-                "/org/safehaus/triplesec/admin/swing/leftarrow_16x16.png" ) ) );
+                    "/org/safehaus/triplesec/admin/swing/leftarrow_16x16.png" ) ) );
             removeButton.addActionListener( new java.awt.event.ActionListener()
             {
                 public void actionPerformed( java.awt.event.ActionEvent e )
@@ -274,9 +273,9 @@
 
 
     /**
-     * This method initializes jScrollPane4 
-     *  
-     * @return javax.swing.JScrollPane  
+     * This method initializes jScrollPane4
+     *
+     * @return javax.swing.JScrollPane
      */
     private JScrollPane getJScrollPane4()
     {
@@ -290,9 +289,9 @@
 
 
     /**
-     * This method initializes jScrollPane5 
-     *  
-     * @return javax.swing.JScrollPane  
+     * This method initializes jScrollPane5
+     *
+     * @return javax.swing.JScrollPane
      */
     private JScrollPane getJScrollPane5()
     {
@@ -307,7 +306,7 @@
 
     /**
      * This method initializes jList1
-     * 
+     *
      * @return javax.swing.JList
      */
     private JList getProfileRoles()
@@ -324,7 +323,7 @@
 
     /**
      * This method initializes jList
-     * 
+     *
      * @return javax.swing.JList
      */
     private JList getApplicationRoles()
@@ -342,7 +341,7 @@
 
     /**
      * This method initializes defaultListModel
-     * 
+     *
      * @return javax.swing.DefaultListModel
      */
     private DefaultListModel getRolesDefaultListModel()
@@ -357,7 +356,7 @@
 
     /**
      * This method initializes defaultListModel1
-     * 
+     *
      * @return javax.swing.DefaultListModel
      */
     private DefaultListModel getRolesDefaultListModel1()

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProvisioningPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProvisioningPanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProvisioningPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/ProvisioningPanel.java Tue Jan 16 16:29:24 2007
@@ -176,7 +176,6 @@
     /**
      * This method initializes this
      * 
-     * @return void
      */
     private void initialize()
     {

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/RoleDependentsPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/RoleDependentsPanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/RoleDependentsPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/RoleDependentsPanel.java Tue Jan 16 16:29:24 2007
@@ -20,15 +20,9 @@
 package org.safehaus.triplesec.admin.swing;
 
 
-import javax.swing.JPanel;
 import java.awt.BorderLayout;
-import javax.swing.JButton;
-import java.awt.GridBagLayout;
-
-import javax.swing.JOptionPane;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
 import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashSet;
@@ -36,10 +30,15 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.naming.NamingException;
+import javax.swing.JButton;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
 import javax.swing.table.AbstractTableModel;
 import javax.swing.tree.DefaultMutableTreeNode;
 
-import org.safehaus.triplesec.admin.DataAccessException;
 import org.safehaus.triplesec.admin.Profile;
 import org.safehaus.triplesec.admin.Role;
 
@@ -55,7 +54,7 @@
     private List dependents = new ArrayList();
     private Role role;
     private DependencyModel dependencyModel = null;
-    
+
 
     /**
      * This is the default constructor
@@ -71,7 +70,7 @@
     {
         this.role = ( Role ) node.getUserObject();
         this.dependents.clear();
-        
+
         if ( node == null || node.getParent() == null || node.getParent().getParent() == null )
         {
             return;
@@ -92,43 +91,41 @@
                 break;
             }
         }
-        
+
         // -------------------------------------------------------------------
         // Find the profile dependents
         // -------------------------------------------------------------------
-        
+
         for ( Enumeration ii = profilesNode.children(); ii.hasMoreElements(); /**/ )
         {
             DefaultMutableTreeNode child = ( DefaultMutableTreeNode ) ii.nextElement();
             Profile profile = ( Profile ) ( child ).getUserObject();
-            if ( profile.getRoles().contains( role.getName() ) )
+            if ( profile.getRoles().contains( role ) )
             {
                 dependents.add( child );
             }
         }
-        
+
         dependencyModel.fireTableDataChanged();
     }
-    
-    
+
+
     /**
      * This method initializes this
-     * 
-     * @return void
      */
     private void initialize()
     {
-        this.setLayout(new BorderLayout());
-        this.setSize(590, 289);
-        this.add(getCenterPanel(), java.awt.BorderLayout.CENTER);
-        this.add(getSouthPanel(), java.awt.BorderLayout.SOUTH);
+        this.setLayout( new BorderLayout() );
+        this.setSize( 590, 289 );
+        this.add( getCenterPanel(), java.awt.BorderLayout.CENTER );
+        this.add( getSouthPanel(), java.awt.BorderLayout.SOUTH );
     }
 
 
     /**
-     * This method initializes jPanel	
-     * 	
-     * @return javax.swing.JPanel	
+     * This method initializes jPanel
+     *
+     * @return javax.swing.JPanel
      */
     private JPanel getCenterPanel()
     {
@@ -139,44 +136,44 @@
             gridBagConstraints.gridy = 0;
             gridBagConstraints.weightx = 1.0;
             gridBagConstraints.weighty = 1.0;
-            gridBagConstraints.insets = new java.awt.Insets(10,10,10,10);
+            gridBagConstraints.insets = new java.awt.Insets( 10, 10, 10, 10 );
             gridBagConstraints.gridx = 0;
             centerPanel = new JPanel();
-            centerPanel.setLayout(new GridBagLayout());
-            centerPanel.add(getJScrollPane(), gridBagConstraints);
+            centerPanel.setLayout( new GridBagLayout() );
+            centerPanel.add( getJScrollPane(), gridBagConstraints );
         }
         return centerPanel;
     }
 
 
     /**
-     * This method initializes jPanel1	
-     * 	
-     * @return javax.swing.JPanel	
+     * This method initializes jPanel1
+     *
+     * @return javax.swing.JPanel
      */
     private JPanel getSouthPanel()
     {
         if ( southPanel == null )
         {
             southPanel = new JPanel();
-            southPanel.add(getRemoveButton(), null);
+            southPanel.add( getRemoveButton(), null );
         }
         return southPanel;
     }
 
 
     /**
-     * This method initializes jButton	
-     * 	
-     * @return javax.swing.JButton	
+     * This method initializes jButton
+     *
+     * @return javax.swing.JButton
      */
     private JButton getRemoveButton()
     {
         if ( removeButton == null )
         {
             removeButton = new JButton();
-            removeButton.setText("Remove");
-            removeButton.setToolTipText("Remove the link to the dependent object");
+            removeButton.setText( "Remove" );
+            removeButton.setToolTipText( "Remove the link to the dependent object" );
             removeButton.addActionListener( new java.awt.event.ActionListener()
             {
                 public void actionPerformed( java.awt.event.ActionEvent e )
@@ -184,40 +181,42 @@
                     String msg = UiUtils.wrap( "Removing dependency relationships will effect " +
                             "entities other than this role.  You cannot automatically revert from operation.  " +
                             "Would you like to continue?", 79 );
-                    int response = JOptionPane.showOptionDialog( RoleDependentsPanel.this, msg, 
-                        "Irreverable operation!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, 
-                        null, null, null );
+                    int response = JOptionPane.showOptionDialog( RoleDependentsPanel.this, msg,
+                            "Irreverable operation!", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
+                            null, null, null );
                     if ( response == JOptionPane.NO_OPTION )
                     {
                         return;
                     }
-                    
+
                     int[] selectedRows = dependentsTable.getSelectedRows();
                     Set removed = new HashSet();
                     for ( int ii = 0; ii < selectedRows.length; ii++ )
                     {
-                        DefaultMutableTreeNode dependentNode = 
-                            ( DefaultMutableTreeNode ) dependents.get( selectedRows[ii] ); 
+                        DefaultMutableTreeNode dependentNode =
+                                ( DefaultMutableTreeNode ) dependents.get( selectedRows[ii] );
                         Profile profile = ( Profile ) dependentNode.getUserObject();
                         try
                         {
-                            dependentNode.setUserObject( profile.modifier().removeRole( role.getName() ).modify() );
+                            profile.removeRole( role );
+                            dependentNode.setUserObject( profile );
                             removed.add( dependentNode );
+                            profile.getStateManager().commit();
                         }
-                        catch ( DataAccessException dae )
+                        catch ( NamingException dae )
                         {
                             msg = UiUtils.wrap( "Failed to remove all dependency relationships for role: "
-                                + dae.getMessage(), 79 );
-                            JOptionPane.showMessageDialog( RoleDependentsPanel.this, msg, 
-                                "Dependency removal failure!", JOptionPane.ERROR_MESSAGE );
+                                    + dae.getMessage(), 79 );
+                            JOptionPane.showMessageDialog( RoleDependentsPanel.this, msg,
+                                    "Dependency removal failure!", JOptionPane.ERROR_MESSAGE );
                         }
                     }
-                    
+
                     for ( Iterator ii = removed.iterator(); ii.hasNext(); /**/ )
                     {
                         dependents.remove( ii.next() );
                     }
-                    
+
                     if ( removed.size() > 0 )
                     {
                         dependencyModel.fireTableDataChanged();
@@ -230,52 +229,52 @@
 
 
     /**
-     * This method initializes jScrollPane	
-     * 	
-     * @return javax.swing.JScrollPane	
+     * This method initializes jScrollPane
+     *
+     * @return javax.swing.JScrollPane
      */
     private JScrollPane getJScrollPane()
     {
         if ( jScrollPane == null )
         {
             jScrollPane = new JScrollPane();
-            jScrollPane.setViewportView(getDependentsTable());
+            jScrollPane.setViewportView( getDependentsTable() );
         }
         return jScrollPane;
     }
 
 
     /**
-     * This method initializes jTable	
-     * 	
-     * @return javax.swing.JTable	
+     * This method initializes jTable
+     *
+     * @return javax.swing.JTable
      */
     private JTable getDependentsTable()
     {
         if ( dependentsTable == null )
         {
             dependentsTable = new JTable();
-            dependentsTable.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
-            dependentsTable.setToolTipText("Role dependents");
+            dependentsTable.setSelectionMode( javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
+            dependentsTable.setToolTipText( "Role dependents" );
             dependencyModel = new DependencyModel();
             dependentsTable.setModel( dependencyModel );
-            dependentsTable.setShowGrid(true);
+            dependentsTable.setShowGrid( true );
         }
         return dependentsTable;
     }
 
-    
+
     class DependencyModel extends AbstractTableModel
     {
         private static final long serialVersionUID = 5348529870374118604L;
-        private final String[] COLNAMES = new String[] { "Profile Id" };
+        private final String[] COLNAMES = new String[] {"Profile Id"};
 
 
         public String getColumnName( int columnIndex )
         {
             return COLNAMES[columnIndex];
         }
-        
+
         public int getRowCount()
         {
             return dependents.size();
@@ -291,30 +290,28 @@
             Object dependent = ( ( DefaultMutableTreeNode ) dependents.get( rowIndex ) ).getUserObject();
             if ( dependent instanceof Role )
             {
-                switch( columnIndex )
+                switch ( columnIndex )
                 {
                     case ( 0 ):
                         return dependent;
                     default:
                         throw new IndexOutOfBoundsException( "Only 1 column present so columnIndex is invalid: "
-                            + columnIndex );
+                                + columnIndex );
                 }
-            }
-            else if ( dependent instanceof Profile )
+            } else if ( dependent instanceof Profile )
             {
-                switch( columnIndex )
+                switch ( columnIndex )
                 {
                     case ( 0 ):
                         return dependent;
                     default:
                         throw new IndexOutOfBoundsException( "Only 1 columns present so columnIndex is invalid: "
-                            + columnIndex );
+                                + columnIndex );
                 }
-            }
-            else
+            } else
             {
-                throw new IllegalStateException( "Only expecting Profile dependents for Permissions not " 
-                    + dependent.getClass() );
+                throw new IllegalStateException( "Only expecting Profile dependents for Permissions not "
+                        + dependent.getClass() );
             }
         }
     }

Modified: directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/RoleGrantsPanel.java
URL: http://svn.apache.org/viewvc/directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/RoleGrantsPanel.java?view=diff&rev=496902&r1=496901&r2=496902
==============================================================================
--- directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/RoleGrantsPanel.java (original)
+++ directory/sandbox/triplesec-jacc2/swing-admin/src/main/java/org/safehaus/triplesec/admin/swing/RoleGrantsPanel.java Tue Jan 16 16:29:24 2007
@@ -26,6 +26,7 @@
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.Collection;
 
 import javax.swing.DefaultListModel;
 import javax.swing.ImageIcon;
@@ -64,7 +65,7 @@
     }
     
     
-    public void populateLists( DefaultMutableTreeNode applicationNode, Set grants )
+    public void populateLists( DefaultMutableTreeNode applicationNode, Collection<Permission> grants )
     {
         applicationPermissionsModel.clear();
         grantsModel.clear();
@@ -93,9 +94,9 @@
         for ( Enumeration ii = permissionsNode.children(); ii.hasMoreElements(); /**/ )
         {
             Permission permission = ( Permission ) ( ( DefaultMutableTreeNode ) ii.nextElement() ).getUserObject();
-            if ( ! grants.contains( permission.getName() ) )
+            if ( ! grants.contains( permission ) )
             {
-                applicationPermissionsModel.addElement( permission.getName() );
+                applicationPermissionsModel.addElement( permission );
             }
         }
         
@@ -128,7 +129,6 @@
     /**
      * This method initializes this
      * 
-     * @return void
      */
     private void initialize()
     {



Mime
View raw message