DbGridPermissionsManager

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.openswing.swing.table.permissions.database.server
Class DbGridPermissionsManager

    java.lang.Object
      org.openswing.swing.table.permissions.java.GridPermissionsManager
          org.openswing.swing.table.permissions.database.server.DbGridPermissionsManager

public class DbGridPermissionsManager
extends GridPermissionsManager

Title: OpenSwing Framework

Description: Grid permissions manager: it manages the fetching of grid permissions. This implementation is based on database tables: it stores and retrieves user roles from a table and after that the permissions from a second table filtered by user roles and grid identifier.

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
`DbGridPermissionsManager(DbConnectionSource dbConnectionSource, DbDigestDescriptor dbDigestDescriptor, DbPermissionsDescriptor dbPermissionsDescriptor)`

Method Summary
`void` | `deleteAllGridPermissionsPerFunctionId(java.lang.String functionId)` Delete all grid permissions for the specified grid identifier, independently from the current user.
`java.lang.String` | `getLastGridDigest(java.lang.String functionId)`

`GridPermissions`

`getUserGridPermissions(java.lang.String functionId, java.util.ArrayList userRoles, java.lang.String[] columnAttributes, boolean[] columnsVisibility, boolean[] columnEditableInInsert, boolean[] columnsEditableInEdit, boolean[] columnsMandatory)`

`java.util.ArrayList` | `getUserRoles()`
`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.
`void` | `storeGridPermissionsDefaults(java.lang.String functionId, java.lang.String[] columnAttributes, boolean[] columnsVisibility, boolean[] columnEditableInInsert, boolean[] columnsEditableInEdit, boolean[] columnsMandatory)` Store in grid permissions defaults table.

Methods inherited from class org.openswing.swing.table.permissions.java.GridPermissionsManager
`getCurrentGridDigest, getUsername, setUsername`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DbGridPermissionsManager

    public DbGridPermissionsManager(DbConnectionSource dbConnectionSource,
                                    DbDigestDescriptor dbDigestDescriptor,
                                    DbPermissionsDescriptor dbPermissionsDescriptor)

Method Detail

### getUserRoles

    public final java.util.ArrayList getUserRoles()
                                           throws java.lang.Throwable

  Specified by:
    `getUserRoles` in class `GridPermissionsManager`
  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 final GridPermissions getUserGridPermissions(java.lang.String functionId,
                                                        java.util.ArrayList userRoles,
                                                        java.lang.String[] columnAttributes,
                                                        boolean[] columnsVisibility,
                                                        boolean[] columnEditableInInsert,
                                                        boolean[] columnsEditableInEdit,
                                                        boolean[] columnsMandatory)
                                                 throws java.lang.Throwable

  Specified by:
    `getUserGridPermissions` in class `GridPermissionsManager`
  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

### storeGridPermissionsDefaults

    public void storeGridPermissionsDefaults(java.lang.String functionId,
                                             java.lang.String[] columnAttributes,
                                             boolean[] columnsVisibility,
                                             boolean[] columnEditableInInsert,
                                             boolean[] columnsEditableInEdit,
                                             boolean[] columnsMandatory)
                                      throws java.lang.Throwable

  Store in grid permissions defaults table.

  Specified by:
    `storeGridPermissionsDefaults` in class `GridPermissionsManager`
  Parameters:
    `functionId` - identifier (functionId) associated to the grid
    `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
  Throws:
    `java.lang.Throwable` - throwed if storing operation does not correctly accomplished

### deleteAllGridPermissionsPerFunctionId

    public void deleteAllGridPermissionsPerFunctionId(java.lang.String functionId)
                                               throws java.lang.Throwable

  Delete all grid permissions for the specified grid identifier, independently from the current user. Grid permissions defaults are removed too. This method is automatically invoked if "grid digest" comparison lead to discover a grid change: in this case all grid permissions must be removed.

  Specified by:
    `deleteAllGridPermissionsPerFunctionId` in class `GridPermissionsManager`
  Parameters:
    `functionId` - identifier (functionId) associated to the grid
  Throws:
    `java.lang.Throwable` - throwed if deleting operation does not correctly accomplished

### storeGridDigest

    public 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.

  Specified by:
    `storeGridDigest` in class `GridPermissionsManager`
  Throws:
    `java.lang.Throwable` - throwed if storing operation does not correctly accomplished

### getLastGridDigest

    public java.lang.String getLastGridDigest(java.lang.String functionId)
                                       throws java.lang.Throwable

  Specified by:
    `getLastGridDigest` in class `GridPermissionsManager`
  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)

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD