directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject [09/27] directory-fortress-commander git commit: change package structure and names, pom improvements, license
Date Tue, 11 Nov 2014 20:35:19 GMT
http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/src/main/java/org/openldap/commander/panel/SDDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/openldap/commander/panel/SDDetailPanel.java b/src/main/java/org/openldap/commander/panel/SDDetailPanel.java
deleted file mode 100644
index 69a943f..0000000
--- a/src/main/java/org/openldap/commander/panel/SDDetailPanel.java
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * This work is part of OpenLDAP Software <http://www.openldap.org/>.
- *
- * Copyright 1998-2014 The OpenLDAP Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the OpenLDAP
- * Public License.
- *
- * A copy of this license is available in the file LICENSE in the
- * top-level directory of the distribution or, alternatively, at
- * <http://www.OpenLDAP.org/license.html>.
- */
-
-package org.openldap.commander.panel;
-
-import com.googlecode.wicket.jquery.ui.form.spinner.Spinner;
-import com.googlecode.wicket.kendo.ui.form.button.AjaxButton;
-import com.googlecode.wicket.kendo.ui.form.combobox.ComboBox;
-import org.apache.log4j.Logger;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.attributes.AjaxCallListener;
-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.FormComponentPanel;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.openldap.commander.GlobalIds;
-import org.openldap.commander.GlobalUtils;
-import org.openldap.commander.SaveModelEvent;
-import org.openldap.commander.SecureIndicatingAjaxButton;
-import org.openldap.commander.SelectModelEvent;
-import org.openldap.fortress.AdminMgr;
-import org.openldap.fortress.rbac.SDSet;
-import org.openldap.fortress.rbac.UserRole;
-import org.openldap.fortress.util.attr.VUtil;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Shawn McKinney
- * @version $Rev$
- * Date: 6/13/13
- */
-public class SDDetailPanel extends FormComponentPanel
-{
-    @SpringBean
-    private AdminMgr adminMgr;
-    private static final String MEMBERS_SELECTION = "membersSelection";
-    private static final Logger log = Logger.getLogger(SDDetailPanel.class.getName());
-    private Form editForm;
-    private Displayable display;
-    private boolean isStatic;
-
-    public Form getForm()
-    {
-        return this.editForm;
-    }
-
-    public SDDetailPanel(String id, Displayable display, boolean isStatic)
-    {
-        super(id);
-        this.adminMgr.setAdmin( GlobalUtils.getRbacSession( this ) );
-        this.isStatic = isStatic;
-        this.editForm = new SDDetailForm(GlobalIds.EDIT_FIELDS, new CompoundPropertyModel<SDSet>(new
SDSet()));
-        this.display = display;
-        add(editForm);
-    }
-
-    public class SDDetailForm extends Form
-    {
-        private String internalId;
-        private ComboBox<String> membersCB;
-        private String membersSelection;
-        private Component component;
-        private List<String> members = new ArrayList<String>();
-        private UserRole roleConstraint = new UserRole();
-
-        public SDDetailForm(String id, final IModel<SDSet> model)
-        {
-            super(id, model);
-            String opNameAdd;
-            String opNameUpdate;
-            String opNameDelete;
-            if(isStatic)
-            {
-                opNameAdd = "createSsdSet";
-                opNameUpdate = "updateSsdSet";
-                opNameDelete = "deleteSsdSet";
-            }
-            else
-            {
-                opNameAdd = "createDsdSet";
-                opNameUpdate = "updateDsdSet";
-                opNameDelete = "deleteDsdSet";
-            }
-
-            add( new SecureIndicatingAjaxButton( GlobalIds.ADD, GlobalIds.ADMIN_MGR, opNameAdd
)
-            {
-                @Override
-                protected void onSubmit(AjaxRequestTarget target, Form form)
-                {
-                    log.debug(".onSubmit Add");
-                    SDSet sdSet = (SDSet)form.getModel().getObject();
-                    updateEntityWithComboData(sdSet);
-                    try
-                    {
-                        if(isStatic)
-                        {
-                            adminMgr.createSsdSet(sdSet);
-                        }
-                        else
-                        {
-                            adminMgr.createDsdSet(sdSet);
-                        }
-                        SaveModelEvent.send(getPage(), this, sdSet, target, SaveModelEvent.Operations.ADD);
-                        component = editForm;
-                        String msg = "SDSet: " + sdSet.getName() + " has been added";
-                        display.setMessage(msg);
-                    }
-                    catch (org.openldap.fortress.SecurityException se)
-                    {
-                        String error = ".onSubmit caught SecurityException=" + se;
-                        log.error(error);
-                        display.setMessage(error);
-                        display.display();
-                    }
-                }
-
-                @Override
-                public void onError(AjaxRequestTarget target, Form form)
-                {
-                    log.info("SDDetailPanel.add.onError");
-                    target.add();
-                }
-                @Override
-                protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-                {
-                    super.updateAjaxAttributes( attributes );
-                    AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                    {
-                        @Override
-                        public CharSequence getFailureHandler( Component component )
-                        {
-                            return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                        }
-                    };
-                    attributes.getAjaxCallListeners().add( ajaxCallListener );
-                }
-            });
-            add( new SecureIndicatingAjaxButton( GlobalIds.COMMIT, GlobalIds.ADMIN_MGR, opNameUpdate
)
-            {
-                @Override
-                protected void onSubmit(AjaxRequestTarget target, Form form)
-                {
-                    log.debug(".onSubmit Commit");
-                    SDSet sdSet = (SDSet)form.getModel().getObject();
-                    try
-                    {
-                        updateEntityWithComboData(sdSet);
-                        if(isStatic)
-                            adminMgr.updateSsdSet(sdSet);
-                        else
-                            adminMgr.updateDsdSet(sdSet);
-                        String msg = "SDSet: " + sdSet.getName() + " has been updated";
-                        SaveModelEvent.send(getPage(), this, sdSet, target, SaveModelEvent.Operations.UPDATE);
-                        component = editForm;
-                        display.setMessage(msg);
-                        membersSelection = "";
-                    }
-                    catch (org.openldap.fortress.SecurityException se)
-                    {
-                        String error = ".onSubmit caught SecurityException=" + se;
-                        log.error(error);
-                        display.setMessage(error);
-                        display.display();
-                    }
-                }
-
-                @Override
-                public void onError(AjaxRequestTarget target, Form form)
-                {
-                    log.warn("SDDetailPanel.commmit.onError");
-                }
-                @Override
-                protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-                {
-                    super.updateAjaxAttributes( attributes );
-                    AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                    {
-                        @Override
-                        public CharSequence getFailureHandler( Component component )
-                        {
-                            return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                        }
-                    };
-                    attributes.getAjaxCallListeners().add( ajaxCallListener );
-                }
-            });
-
-            add( new SecureIndicatingAjaxButton( GlobalIds.DELETE, GlobalIds.ADMIN_MGR, opNameDelete
)
-            {
-                @Override
-                protected void onSubmit(AjaxRequestTarget target, Form form)
-                {
-                    log.debug(".onSubmit Delete");
-                    SDSet sdSet = (SDSet)form.getModel().getObject();
-
-                    try
-                    {
-                        SDSet newSdSet = new SDSet();
-                        if(isStatic)
-                        {
-                            adminMgr.deleteSsdSet(sdSet);
-                            newSdSet.setType(SDSet.SDType.STATIC);
-                        }
-                        else
-                        {
-                            adminMgr.deleteDsdSet(sdSet);
-                            newSdSet.setType(SDSet.SDType.DYNAMIC);
-                        }
-                        form.setModelObject( newSdSet );
-                        modelChanged();
-                        String msg = "SDSet: " + sdSet.getName() + " has been deleted";
-                        membersSelection = "";
-                        members = new ArrayList<String>();
-                        membersCB = new ComboBox<String>( "members", new PropertyModel<String>(
editForm, MEMBERS_SELECTION ),members );
-                        editForm.addOrReplace( membersCB );
-                        component = editForm;
-                        SaveModelEvent.send(getPage(), this, sdSet, target, SaveModelEvent.Operations.DELETE);
-                        display.setMessage(msg);
-                    }
-                    catch (org.openldap.fortress.SecurityException se)
-                    {
-                        String error = ".onSubmit caught SecurityException=" + se;
-                        log.error(error);
-                        display.setMessage(error);
-                        display.display();
-                    }
-                }
-
-                @Override
-                public void onError(AjaxRequestTarget target, Form form)
-                {
-                    log.warn("SDDetailPanel.delete.onError");
-                }
-                @Override
-                protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-                {
-                    super.updateAjaxAttributes( attributes );
-                    AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                    {
-                        @Override
-                        public CharSequence getFailureHandler( Component component )
-                        {
-                            return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                        }
-                    };
-                    attributes.getAjaxCallListeners().add( ajaxCallListener );
-                }
-            });
-
-            add(new AjaxSubmitLink(GlobalIds.CANCEL)
-            {
-                @Override
-                protected void onSubmit(AjaxRequestTarget target, Form form)
-                {
-                    SDSet sdSet = new SDSet();
-                    if(isStatic)
-                        sdSet.setType(SDSet.SDType.STATIC);
-                    else
-                        sdSet.setType(SDSet.SDType.DYNAMIC);
-                    setModelObject(sdSet);
-                    membersSelection = "";
-                    members = new ArrayList<String>();
-                    membersCB = new ComboBox<String>( "members", new PropertyModel<String>(
form, MEMBERS_SELECTION ),members );
-                    editForm.addOrReplace( membersCB );
-                    component = editForm;
-                    String msg = "SDSet cancelled input form";
-                    display.setMessage(msg);
-                }
-
-                @Override
-                public void onError(AjaxRequestTarget target, Form form)
-                {
-                    log.warn("SDDetailPanel.cancel.onError");
-                }
-                @Override
-                protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-                {
-                    super.updateAjaxAttributes( attributes );
-                    AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                    {
-                        @Override
-                        public CharSequence getFailureHandler( Component component )
-                        {
-                            return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                        }
-                    };
-                    attributes.getAjaxCallListeners().add( ajaxCallListener );
-                }
-            });
-
-            if(isStatic)
-            {
-                add( new Label( "sdAssignmentsLabel", "Static Separation of Duties Detail"
) );
-            }
-            else
-            {
-                add( new Label( "sdAssignmentsLabel", "Dynamic Separation of Duties Detail"
) );
-            }
-
-            TextField name = new TextField("name");
-            add(name);
-            TextField description = new TextField("description");
-            description.setRequired(false);
-            add(description);
-            add(new Spinner<Integer>("cardinality"));
-            Label iid = new Label("id");
-            add(iid);
-            membersCB = new ComboBox<String>( "members", new PropertyModel<String>(
this, MEMBERS_SELECTION ), members );
-            membersCB.setOutputMarkupId(true);
-            add(membersCB);
-            addRoleSearchModal();
-
-            add( new AjaxButton( "members.delete" )
-            {
-                private static final long serialVersionUID = 1L;
-
-                @Override
-                protected void onSubmit( AjaxRequestTarget target, Form<?> form )
-                {
-                    String msg = "clicked on members.delete";
-                    if ( VUtil.isNotNullOrEmpty( membersSelection ) )
-                    {
-                        msg += " selection:" + membersSelection;
-                        SDSet sdSet = ( SDSet ) form.getModel().getObject();
-                        if ( sdSet.getMembers() != null )
-                        {
-                            sdSet.getMembers().remove( membersSelection );
-                            members.remove(  membersSelection );
-                            membersSelection = "";
-                            component = editForm;
-                            msg += ", was removed from local, commit to persist changes on
server";
-                        }
-                        else
-                        {
-                            msg += ", no action taken because role does not have members
set";
-                        }
-                    }
-                    else
-                    {
-                        msg += ", no action taken because members selection is empty";
-                    }
-                    display.setMessage( msg );
-                    log.debug( msg );
-                }
-                @Override
-                protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-                {
-                    super.updateAjaxAttributes( attributes );
-                    AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                    {
-                        @Override
-                        public CharSequence getFailureHandler( Component component )
-                        {
-                            return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                        }
-                    };
-                    attributes.getAjaxCallListeners().add( ajaxCallListener );
-                }
-            } );
-        }
-
-        private void addRoleSearchModal()
-        {
-            final ModalWindow rolesModalWindow;
-            add( rolesModalWindow = new ModalWindow( "rolesmodal" ) );
-            final RoleSearchModalPanel roleSearchModalPanel = new RoleSearchModalPanel( rolesModalWindow.getContentId(),
rolesModalWindow, false );
-            rolesModalWindow.setContent( roleSearchModalPanel );
-            rolesModalWindow.setWindowClosedCallback( new ModalWindow.WindowClosedCallback()
-            {
-                @Override
-                public void onClose( AjaxRequestTarget target )
-                {
-                    roleConstraint = roleSearchModalPanel.getRoleSelection();
-                    if ( roleConstraint != null )
-                    {
-                        membersSelection = roleConstraint.getName();
-                        component = editForm;
-                        //target.add( membersCB );
-                    }
-                }
-            } );
-
-            add( new AjaxButton( "roles.search" )
-            {
-                private static final long serialVersionUID = 1L;
-
-                @Override
-                protected void onSubmit( AjaxRequestTarget target, Form<?> form )
-                {
-                    String msg = "clicked on roles search";
-                    msg += membersSelection != null ? ": " + membersSelection : "";
-                    roleSearchModalPanel.setRoleSearchVal( membersSelection );
-                    display.setMessage( msg );
-                    log.debug( msg );
-                    target.prependJavaScript( GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE
);
-                    rolesModalWindow.show( target );
-                }
-                @Override
-                protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-                {
-                    super.updateAjaxAttributes( attributes );
-                    AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                    {
-                        @Override
-                        public CharSequence getFailureHandler( Component component )
-                        {
-                            return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                        }
-                    };
-                    attributes.getAjaxCallListeners().add( ajaxCallListener );
-                }
-            } );
-
-            rolesModalWindow.setTitle( "RBAC Role Selection Modal" );
-            rolesModalWindow.setInitialWidth( 700 );
-            rolesModalWindow.setInitialHeight( 450 );
-            rolesModalWindow.setCookieName( "role-assign-modal" );
-        }
-
-        private void updateEntityWithComboData(SDSet sdSet)
-        {
-            if(VUtil.isNotNullOrEmpty(membersSelection))
-            {
-                sdSet.setMember(membersSelection);
-                members.add( membersSelection );
-            }
-        }
-
-        @Override
-        public void onEvent(final IEvent<?> event)
-        {
-            if (event.getPayload() instanceof SelectModelEvent)
-            {
-                SelectModelEvent modelEvent = (SelectModelEvent) event.getPayload();
-                SDSet sdSet = (SDSet) modelEvent.getEntity();
-                this.setModelObject(sdSet);
-                if(VUtil.isNotNullOrEmpty(sdSet.getMembers()))
-                {
-                    members = new ArrayList<String>(sdSet.getMembers());
-                    membersCB = new ComboBox<String>( "members", new PropertyModel<String>(
this, MEMBERS_SELECTION ),members );
-                }
-                else
-                {
-                    members = new ArrayList<String>();
-                    membersCB = new ComboBox<String>( "members", new PropertyModel<String>(
this, MEMBERS_SELECTION ),members );
-                }
-                editForm.addOrReplace(membersCB);
-                String msg = "SDSet: " + sdSet.getName() + " has been selected";
-                log.debug(msg);
-                display.setMessage(msg);
-                component = editForm;
-            }
-            else if (event.getPayload() instanceof AjaxRequestTarget)
-            {
-                // only add the form to ajax target if something has changed...
-                if (component != null)
-                {
-                    AjaxRequestTarget target = ((AjaxRequestTarget) event.getPayload());
-                    log.debug(".onEvent AjaxRequestTarget: " + target.toString());
-                    target.add(component);
-                    component = null;
-                }
-
-                display.display((AjaxRequestTarget) event.getPayload());
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/src/main/java/org/openldap/commander/panel/SDListPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/openldap/commander/panel/SDListPanel.java b/src/main/java/org/openldap/commander/panel/SDListPanel.java
deleted file mode 100644
index 5b88911..0000000
--- a/src/main/java/org/openldap/commander/panel/SDListPanel.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * This work is part of OpenLDAP Software <http://www.openldap.org/>.
- *
- * Copyright 1998-2014 The OpenLDAP Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the OpenLDAP
- * Public License.
- *
- * A copy of this license is available in the file LICENSE in the
- * top-level directory of the distribution or, alternatively, at
- * <http://www.OpenLDAP.org/license.html>.
- */
-
-package org.openldap.commander.panel;
-
-import com.inmethod.grid.IGridColumn;
-import com.inmethod.grid.SizeUnit;
-import com.inmethod.grid.column.PropertyColumn;
-import com.inmethod.grid.treegrid.TreeGrid;
-import org.apache.log4j.Logger;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.attributes.AjaxCallListener;
-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.form.FormComponentPanel;
-import org.apache.wicket.markup.html.form.Radio;
-import org.apache.wicket.markup.html.form.RadioGroup;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
-import org.openldap.commander.GlobalIds;
-import org.openldap.commander.GlobalUtils;
-import org.openldap.commander.SDListModel;
-import org.openldap.commander.SaveModelEvent;
-import org.openldap.commander.SecureIndicatingAjaxButton;
-import org.openldap.commander.SecureIndicatingAjaxLink;
-import org.openldap.commander.SelectModelEvent;
-import org.openldap.fortress.rbac.FortEntity;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.Model;
-import org.openldap.fortress.rbac.SDSet;
-import org.openldap.fortress.rbac.UserRole;
-import org.openldap.fortress.util.attr.VUtil;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeNode;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- *
- * @author Shawn McKinney
- * @version $Rev$
- */
-public class SDListPanel extends FormComponentPanel
-{
-    private static final Logger log = Logger.getLogger(SDListPanel.class.getName());
-    private Form listForm;
-    private DefaultTreeModel treeModel;
-    private DefaultMutableTreeNode node;
-    private TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String> grid;
-    private DefaultMutableTreeNode rootNode;
-    private String searchVal;
-    private String searchLabel;
-    private String opName;
-    private char selectedRadioButton;
-    private TextField searchValFld;
-    private RadioGroup radioGroup;
-    private static final char NAMES = 'N';
-    private static final char ROLES = 'R';
-
-    public SDListPanel(String id, final boolean isStatic)
-    {
-        super(id);
-        SDSet sdSet = new SDSet();
-        sdSet.setName("");
-        if(isStatic)
-        {
-            sdSet.setType(SDSet.SDType.STATIC);
-            searchLabel = "SSD Name";
-            opName = "ssdRoleSets";
-        }
-        else
-        {
-            sdSet.setType(SDSet.SDType.DYNAMIC);
-            searchLabel = "DSD Name";
-            opName = "dsdRoleSets";
-        }
-        SDListModel sdListModel = new SDListModel(sdSet, GlobalUtils.getRbacSession( this
));
-        setDefaultModel(sdListModel);
-        List<IGridColumn<DefaultTreeModel, DefaultMutableTreeNode, String>> columns
=
-            new ArrayList<IGridColumn<DefaultTreeModel, DefaultMutableTreeNode, String>>();
-        columns.add(new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode, String,
String>(
-            Model.of(searchLabel), "userObject.name"));
-
-        PropertyColumn description = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode,
String, String>(
-                    Model.of("Description"), "userObject.Description");
-
-        description.setInitialSize(300);
-        columns.add(description);
-
-        PropertyColumn cardinality = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode,
String, String>(
-                    Model.of("Cardinality"), "userObject.Cardinality");
-        cardinality.setInitialSize(100);
-        columns.add(cardinality);
-
-        PropertyColumn members = new PropertyColumn<DefaultTreeModel, DefaultMutableTreeNode,
String, String>(
-                    Model.of("Members"), "userObject.members");
-        members.setInitialSize(600);
-        columns.add(members);
-
-        List<SDSet> sdSets = (List<SDSet>) getDefaultModel().getObject();
-        treeModel = createTreeModel(sdSets);
-        grid = new TreeGrid<DefaultTreeModel, DefaultMutableTreeNode, String>("sdtreegrid",
treeModel, columns)
-        {
-            @Override
-            public void selectItem(IModel itemModel, boolean selected)
-            {
-                node = (DefaultMutableTreeNode) itemModel.getObject();
-                if(!node.isRoot())
-                {
-                    SDSet sdSet = (SDSet) node.getUserObject();
-                    log.debug("TreeGrid.addGrid.selectItem selected sdSet =" + sdSet.getName());
-                    if (super.isItemSelected(itemModel))
-                    {
-                        log.debug("TreeGrid.addGrid.selectItem item is selected");
-                        super.selectItem(itemModel, false);
-                    }
-                    else
-                    {
-                        super.selectItem(itemModel, true);
-                        SelectModelEvent.send(getPage(), this, sdSet);
-                    }
-                }
-            }
-        };
-        grid.setContentHeight(50, SizeUnit.EM);
-        grid.setAllowSelectMultiple(false);
-        grid.setClickRowToSelect(true);
-        grid.setClickRowToDeselect(false);
-        grid.setSelectToEdit(false);
-        // expand the root node
-        grid.getTreeState().expandNode((TreeNode) treeModel.getRoot());
-        this.listForm = new Form("form");
-        this.listForm.add(grid);
-        grid.setOutputMarkupId(true);
-
-        radioGroup = new RadioGroup("searchOptions",  new PropertyModel(this, "selectedRadioButton"));
-        add(radioGroup);
-        Radio nameRb = new Radio("nameRb", new Model(new Character(NAMES)));
-        radioGroup.add(nameRb);
-        Radio roleRb = new Radio("roleRb", new Model(new Character(ROLES)));
-        radioGroup.add(roleRb);
-        addRoleSearchModal(roleRb);
-        radioGroup.setOutputMarkupId( true );
-        radioGroup.setRenderBodyOnly( false );
-        searchValFld = new TextField(GlobalIds.SEARCH_VAL, new PropertyModel<String>(this,
GlobalIds.SEARCH_VAL));
-        searchValFld.setOutputMarkupId( true );
-        AjaxFormComponentUpdatingBehavior ajaxUpdater = new AjaxFormComponentUpdatingBehavior(GlobalIds.ONBLUR)
-        {
-          @Override
-          protected void onUpdate(final AjaxRequestTarget target)
-          {
-              target.add( searchValFld );
-          }
-        };
-        searchValFld.add(ajaxUpdater);
-        radioGroup.add( searchValFld );
-        this.listForm.add(radioGroup);
-        selectedRadioButton = NAMES;
-        this.listForm.add( new SecureIndicatingAjaxButton( GlobalIds.SEARCH, GlobalIds.REVIEW_MGR,
opName )
-        {
-            @Override
-            protected void onSubmit(AjaxRequestTarget target, Form form)
-            {
-                log.debug(".search onSubmit");
-                info("Searching SDSets...");
-                if(!VUtil.isNotNullOrEmpty(searchVal))
-                {
-                    searchVal = "";
-                }
-                final SDSet srchSd = new SDSet();
-                if(isStatic)
-                {
-                    srchSd.setType(SDSet.SDType.STATIC);
-                }
-                else
-                {
-                    srchSd.setType(SDSet.SDType.DYNAMIC);
-                }
-                switch(selectedRadioButton)
-                {
-                    case NAMES:
-                        log.debug(".onSubmit NAMES RB selected");
-                        srchSd.setName(searchVal);
-                        break;
-                    case ROLES:
-                        log.debug(".onSubmit ROLES RB selected");
-                        srchSd.setMember(searchVal);
-                        break;
-                }
-
-                setDefaultModel(new SDListModel(srchSd, GlobalUtils.getRbacSession( this
)));
-                treeModel.reload();
-                rootNode.removeAllChildren();
-                List<SDSet> sdSets = (List<SDSet>) getDefaultModelObject();
-                if(VUtil.isNotNullOrEmpty(sdSets))
-                {
-                    for (SDSet sdSet : sdSets)
-                        rootNode.add(new DefaultMutableTreeNode(sdSet));
-                    info("Search returned " + sdSets.size() + " matching objects");
-                }
-                else
-                {
-                    info("No matching objects found");
-                }
-                target.add(grid);
-            }
-
-            @Override
-            public void onError(AjaxRequestTarget target, Form form)
-            {
-                log.warn(".search.onError");
-                target.add();
-            }
-            @Override
-            protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-            {
-                super.updateAjaxAttributes( attributes );
-                AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                {
-                    @Override
-                    public CharSequence getFailureHandler( Component component )
-                    {
-                        return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                    }
-                };
-                attributes.getAjaxCallListeners().add( ajaxCallListener );
-            }
-        });
-        add(this.listForm);
-    }
-
-    private void addRoleSearchModal(Radio roleRb)
-    {
-        final ModalWindow rolesModalWindow;
-        listForm.add( rolesModalWindow = new ModalWindow( "rolesearchmodal" ) );
-        final RoleSearchModalPanel roleSearchModalPanel = new RoleSearchModalPanel( rolesModalWindow.getContentId(),
rolesModalWindow, false );
-        rolesModalWindow.setContent( roleSearchModalPanel );
-        rolesModalWindow.setWindowClosedCallback( new ModalWindow.WindowClosedCallback()
-        {
-            @Override
-            public void onClose( AjaxRequestTarget target )
-            {
-                UserRole roleConstraint = roleSearchModalPanel.getRoleSelection();
-                if ( roleConstraint != null )
-                {
-                    log.debug( "modal selected:" + roleConstraint.getName());
-                    searchVal = roleConstraint.getName();
-                    selectedRadioButton = ROLES;
-                    target.add( radioGroup );
-                }
-            }
-        } );
-
-        roleRb.add( new SecureIndicatingAjaxLink( "roleAssignLinkLbl", GlobalIds.REVIEW_MGR,
"findRoles" )
-        {
-            public void onClick(AjaxRequestTarget target)
-            {
-                String msg = "clicked on roles search";
-                msg += "roleSelection: " + searchVal;
-                roleSearchModalPanel.setRoleSearchVal( searchVal );
-                log.debug( msg );
-                target.prependJavaScript( GlobalIds.WICKET_WINDOW_UNLOAD_CONFIRMATION_FALSE
);
-                rolesModalWindow.show( target );
-            }
-            @Override
-            protected void updateAjaxAttributes( AjaxRequestAttributes attributes )
-            {
-                super.updateAjaxAttributes( attributes );
-                AjaxCallListener ajaxCallListener = new AjaxCallListener()
-                {
-                    @Override
-                    public CharSequence getFailureHandler( Component component )
-                    {
-                        return GlobalIds.WINDOW_LOCATION_REPLACE_COMMANDER_HOME_HTML;
-                    }
-                };
-                attributes.getAjaxCallListeners().add( ajaxCallListener );
-            }
-        });
-
-        rolesModalWindow.setTitle( "RBAC Role Search Modal" );
-        rolesModalWindow.setInitialWidth( 700 );
-        rolesModalWindow.setInitialHeight( 450 );
-        rolesModalWindow.setCookieName( "role-assign-modal" );
-    }
-
-    @Override
-    public void onEvent(IEvent event)
-    {
-        if (event.getPayload() instanceof SaveModelEvent)
-        {
-            SaveModelEvent modelEvent = (SaveModelEvent) event.getPayload();
-            switch(modelEvent.getOperation())
-            {
-                case ADD:
-                    add(modelEvent.getEntity());
-                    break;
-                case UPDATE:
-                    modelChanged();
-                    break;
-                case DELETE:
-                    prune();
-                    break;
-                default:
-                    break;
-            }
-            AjaxRequestTarget target = ((SaveModelEvent) event.getPayload()).getAjaxRequestTarget();
-            target.add(grid);
-            log.debug(".onEvent SaveModelEvent: " + target.toString());
-        }
-    }
-
-    private void removeSelectedItems(TreeGrid<DefaultTreeModel, DefaultMutableTreeNode,
String> grid)
-    {
-        Collection<IModel<DefaultMutableTreeNode>> selected = grid.getSelectedItems();
-        for (IModel<DefaultMutableTreeNode> model : selected)
-        {
-            DefaultMutableTreeNode node = model.getObject();
-            treeModel.removeNodeFromParent(node);
-            SDSet sdSet = (SDSet) node.getUserObject();
-            log.debug(".removeSelectedItems sdset node: " + sdSet.getName());
-            List<SDSet> sdSets = ((List<SDSet>) getDefaultModel().getObject());
-            sdSets.remove(sdSet.getName());
-        }
-    }
-
-    private DefaultTreeModel createTreeModel(List<SDSet> sdSets)
-    {
-        DefaultTreeModel model;
-        SDSet root = new SDSet();
-        //root.setName(searchLabel);
-        rootNode = new DefaultMutableTreeNode(root);
-        model = new DefaultTreeModel(rootNode);
-        if (sdSets == null)
-            log.debug("no SDSets found");
-        else
-        {
-            log.debug("SDSets found:" + sdSets.size());
-            for (SDSet sdSet : sdSets)
-                rootNode.add(new DefaultMutableTreeNode(sdSet));
-        }
-        return model;
-    }
-
-    public void add(FortEntity entity)
-    {
-        if (getDefaultModelObject() != null)
-        {
-            List<SDSet> sdSets = ((List<SDSet>) getDefaultModelObject());
-            sdSets.add((SDSet) entity);
-            treeModel.insertNodeInto(new DefaultMutableTreeNode(entity), rootNode, sdSets.size());
-        }
-    }
-
-    public void prune()
-    {
-        removeSelectedItems(grid);
-    }
-}

http://git-wip-us.apache.org/repos/asf/directory-fortress-commander/blob/547b9ccd/src/main/java/org/openldap/commander/panel/UserAuditDetailPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/openldap/commander/panel/UserAuditDetailPanel.java b/src/main/java/org/openldap/commander/panel/UserAuditDetailPanel.java
deleted file mode 100644
index 770e484..0000000
--- a/src/main/java/org/openldap/commander/panel/UserAuditDetailPanel.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * This work is part of OpenLDAP Software <http://www.openldap.org/>.
- *
- * Copyright 1998-2014 The OpenLDAP Foundation.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the OpenLDAP
- * Public License.
- *
- * A copy of this license is available in the file LICENSE in the
- * top-level directory of the distribution or, alternatively, at
- * <http://www.OpenLDAP.org/license.html>.
- */
-
-package org.openldap.commander.panel;
-
-import org.apache.log4j.Logger;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.FormComponentPanel;
-import org.apache.wicket.model.IModel;
-import org.openldap.commander.GlobalIds;
-import org.openldap.fortress.rbac.User;
-
-/**
- * @author Shawn McKinney
- * @version $Rev$
- * Date: 8/10/13
- */
-public class UserAuditDetailPanel extends FormComponentPanel
-{
-    private static final Logger LOG = Logger.getLogger(UserAuditDetailPanel.class.getName());
-
-    public UserAuditDetailPanel(String id, final IModel userModel)
-    {
-        super(id, userModel);
-        add( new Label( GlobalIds.USER_ID ) );
-        add( new Label( GlobalIds.DESCRIPTION ) );
-        add( new Label( GlobalIds.NAME ) );
-        add( new Label( GlobalIds.OU ) );
-        add( new Label( GlobalIds.TITLE ) );
-        add( new Label( GlobalIds.ADDRESS_ADDRESSES ) );
-        add( new Label( GlobalIds.ADDRESS_CITY ) );
-        add( new Label( GlobalIds.ADDRESS_STATE ) );
-        add( new Label( GlobalIds.ADDRESS_COUNTRY ) );
-        add( new JpegImage( GlobalIds.JPEGPHOTO )
-        {
-            @Override
-            protected byte[] getPhoto()
-            {
-                User user = (User)getModelObject();
-                return user.getJpegPhoto();
-            }
-        } );
-        setOutputMarkupId( true );
-
-    }
-
-}
\ No newline at end of file


Mime
View raw message