org.openswing.swing.table.permissions.java
Class GridPermissionsManager

java.lang.Object
  extended byorg.openswing.swing.table.permissions.java.GridPermissionsManager
Direct Known Subclasses:
DbGridPermissionsManager

public abstract class GridPermissionsManager
extends java.lang.Object

Title: OpenSwing Framework

Description: Grid permissions manager: it manages grid permissions fetching.

Copyright: Copyright (C) 2006 Mauro Carniel

This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it


Constructor Summary
GridPermissionsManager()
           
 
Method Summary
abstract  void deleteAllGridPermissionsPerFunctionId(java.lang.String functionId)
          Delete all grid permissions for the specified grid identifier.
 java.lang.String getCurrentGridDigest(java.lang.String[] columnNames, java.lang.String functionId)
           
abstract  java.lang.String getLastGridDigest(java.lang.String functionId)
           
abstract  GridPermissions getUserGridPermissions(java.lang.String functionId, java.util.ArrayList userRoles, java.lang.String[] columnAttributes, boolean[] columnsVisibility, boolean[] columnEditableInInsert, boolean[] columnsEditbleInEdit, boolean[] columnsMandatory)
           
 java.lang.String getUsername()
           
abstract  java.util.ArrayList getUserRoles()
           
 void setUsername(java.lang.String username)
          Set the current logged user.
abstract  void storeGridDigest(java.lang.String functionId, java.lang.String gridDigest)
          Store the "grid digest", i.e. a value that globally identify the current grid configuration.
abstract  void storeGridPermissionsDefaults(java.lang.String functionId, java.lang.String[] columnAttributes, java.lang.String[] headerColumnNames, boolean[] columnsVisibility, boolean[] columnEditableInInsert, boolean[] columnsEditableInEdit, boolean[] columnsMandatory)
          Store in grid permissions defaults table.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridPermissionsManager

public GridPermissionsManager()
Method Detail

getUserRoles

public abstract java.util.ArrayList getUserRoles()
                                          throws java.lang.Throwable
Returns:
list of role identifiers associated to the specified user (Object[] values)
Throws:
java.lang.Throwable - throwed if fetching operation does not correctly accomplished

getUserGridPermissions

public abstract GridPermissions getUserGridPermissions(java.lang.String functionId,
                                                       java.util.ArrayList userRoles,
                                                       java.lang.String[] columnAttributes,
                                                       boolean[] columnsVisibility,
                                                       boolean[] columnEditableInInsert,
                                                       boolean[] columnsEditbleInEdit,
                                                       boolean[] columnsMandatory)
                                                throws java.lang.Throwable
Parameters:
functionId - identifier (functionId) associated to the grid
userRoles - list of role identifiers associated to the specified user
columnAttributes - list of attribute names, that identify columns
columnsVisibility - define which columns are visible
columnEditableInInsert - define which columns are editable on insert; used to correctly define GridPermissions content: a column will be marked as NOT editable if currently editable but NOT the inverse
columnsMandatory - define which columns are required on insert/edit mode; used to correctly define GridPermissions content: a column will be marked as required if currently not required but NOT the inverse
Returns:
GridPermissions object, built starting from user roles for the specified grid identifier
Throws:
java.lang.Throwable - throwed if fetching operation does not correctly accomplished

getLastGridDigest

public abstract java.lang.String getLastGridDigest(java.lang.String functionId)
                                            throws java.lang.Throwable
Returns:
retrieve the "grid digest", i.e. a value that globally identify the current grid configuration; this digest is used to check if grid columns have been changed from last grid execution: in this case all grid permissions will be deleted
Throws:
java.lang.Throwable - throwed if fetching operation does not correctly accomplished Note: this method returns null if no digest has been yet stored (i.e. this is the first time the grid is being viewed)

getCurrentGridDigest

public final java.lang.String getCurrentGridDigest(java.lang.String[] columnNames,
                                                   java.lang.String functionId)
                                            throws java.lang.Throwable
Returns:
retrieve the "grid digest", i.e. a value that globally identifies the current grid configuration; this digest is used to check if grid columns have been changed from last grid execution: in this case all grid permissions will be deleted
Throws:
java.lang.Throwable - throwed if fetching operation does not correctly accomplished

storeGridPermissionsDefaults

public abstract void storeGridPermissionsDefaults(java.lang.String functionId,
                                                  java.lang.String[] columnAttributes,
                                                  java.lang.String[] headerColumnNames,
                                                  boolean[] columnsVisibility,
                                                  boolean[] columnEditableInInsert,
                                                  boolean[] columnsEditableInEdit,
                                                  boolean[] columnsMandatory)
                                           throws java.lang.Throwable
Store in grid permissions defaults table.

Parameters:
functionId - identifier (functionId) associated to the grid
columnAttributes - list of attribute names, that identify columns
headerColumnNames - list of keys for columns, that will be translated
columnsVisibility - define which columns are visible
columnEditableInInsert - define which columns are editable on insert; used to correctly define GridPermissions content: a column will be marked as NOT editable if currently editable but NOT the inverse
columnsMandatory - define which columns are required on insert/edit mode; used to correctly define GridPermissions content: a column will be marked as required if currently not required but NOT the inverse
Throws:
java.lang.Throwable - throwed if storing operation does not correctly accomplished

storeGridDigest

public abstract void storeGridDigest(java.lang.String functionId,
                                     java.lang.String gridDigest)
                              throws java.lang.Throwable
Store the "grid digest", i.e. a value that globally identify the current grid configuration.

Throws:
java.lang.Throwable - throwed if storing operation does not correctly accomplished

deleteAllGridPermissionsPerFunctionId

public abstract void deleteAllGridPermissionsPerFunctionId(java.lang.String functionId)
                                                    throws java.lang.Throwable
Delete all grid permissions for the specified grid identifier. This method is automatically invoked if "grid digest" comparison lead to discover a grid change.

Throws:
java.lang.Throwable - throwed if storing operation does not correctly accomplished

getUsername

public final java.lang.String getUsername()
Returns:
current logged user

setUsername

public final void setUsername(java.lang.String username)
Set the current logged user.

Parameters:
username - logged username