org.openswing.swing.table.profiles.database.server
Class DbGridProfileManager

java.lang.Object
  extended byorg.openswing.swing.table.profiles.java.GridProfileManager
      extended byorg.openswing.swing.table.profiles.database.server.DbGridProfileManager

public class DbGridProfileManager
extends org.openswing.swing.table.profiles.java.GridProfileManager

Title: OpenSwing Framework

Description: Grid profile manager: it manages grid profile storing and fetching. This implementation is based on database tables: it stores and retrieves user profiles from a table filtered by "username".

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
DbGridProfileManager(DbConnectionSource dbConnectionSource, DbActiveProfileDescriptor dbActiveProfileDescriptor, DbDigestDescriptor dbDigestDescriptor, DbProfileDescriptor dbProfileDescriptor)
           
 
Method Summary
 void deleteAllGridProfileIds(java.lang.String functionId)
          Delete all grid profiles identifiers for the current user.
 void deleteAllGridProfiles(java.lang.String functionId)
          Delete all grid profiles, independently from the current user.
 void deleteUserProfile(java.lang.String functionId, java.lang.Object id)
          Delete the specified grid profile.
 org.openswing.swing.table.profiles.java.GridProfile getDefaultProfile(java.lang.String functionId)
           
 java.lang.String getLastGridDigest(java.lang.String functionId)
           
 java.lang.Object getLastGridProfileId(java.lang.String functionId)
           
 org.openswing.swing.table.profiles.java.GridProfile getUserProfile(java.lang.String functionId, java.lang.Object id)
           
 java.util.ArrayList getUserProfiles(java.lang.String functionId)
           
 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 storeGridProfileId(java.lang.String functionId, java.lang.Object id)
          Store the current profile identifier in action.
 java.lang.Object storeUserProfile(org.openswing.swing.table.profiles.java.GridProfile profile)
          Store the specified grid profile.
 
Methods inherited from class org.openswing.swing.table.profiles.java.GridProfileManager
getCurrentGridDigest, getUsername, setUsername
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbGridProfileManager

public DbGridProfileManager(DbConnectionSource dbConnectionSource,
                            DbActiveProfileDescriptor dbActiveProfileDescriptor,
                            DbDigestDescriptor dbDigestDescriptor,
                            DbProfileDescriptor dbProfileDescriptor)
Method Detail

getUserProfiles

public java.util.ArrayList getUserProfiles(java.lang.String functionId)
                                    throws java.lang.Throwable
Parameters:
functionId - identifier (functionId) associated to the grid
Returns:
list of GridProfileDescription objects
Throws:
java.lang.Throwable - throwed if fetching operation does not correctly accomplished

getDefaultProfile

public final org.openswing.swing.table.profiles.java.GridProfile getDefaultProfile(java.lang.String functionId)
                                                                            throws java.lang.Throwable
Returns:
default user profile; null if the default profile has not been yet stored
Throws:
java.lang.Throwable - throwed if fetching operation does not correctly accomplished

getUserProfile

public org.openswing.swing.table.profiles.java.GridProfile getUserProfile(java.lang.String functionId,
                                                                          java.lang.Object id)
                                                                   throws java.lang.Throwable
Parameters:
id - grid profile identifier
Returns:
user profile
Throws:
java.lang.Throwable - throwed if fetching operation does not correctly accomplished

storeUserProfile

public java.lang.Object storeUserProfile(org.openswing.swing.table.profiles.java.GridProfile profile)
                                  throws java.lang.Throwable
Store the specified grid profile.

Parameters:
profile - profile to store
Returns:
profile id
Throws:
java.lang.Throwable - throwed if storing operation does not correctly accomplished Note: if profile.getId() is null then this method must define id property.

deleteUserProfile

public void deleteUserProfile(java.lang.String functionId,
                              java.lang.Object id)
                       throws java.lang.Throwable
Delete the specified grid profile.

Parameters:
id - grid profile identifier
Throws:
java.lang.Throwable - throwed if deleting operation does not correctly accomplished

deleteAllGridProfiles

public void deleteAllGridProfiles(java.lang.String functionId)
                           throws java.lang.Throwable
Delete all grid profiles, independently from the current user. This method is automatically invoked if "grid digest" comparison lead to discover a grid change: in this case all grid profiles must be removed.

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.

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
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 profiles 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)

getLastGridProfileId

public java.lang.Object getLastGridProfileId(java.lang.String functionId)
                                      throws java.lang.Throwable
Returns:
retrieve the last profile identifier in action
Throws:
java.lang.Throwable - throwed if fetching operation does not correctly accomplished Note: this method returns null if no profile identifier has been yet stored (i.e. this is the first time the grid is being viewed)

storeGridProfileId

public void storeGridProfileId(java.lang.String functionId,
                               java.lang.Object id)
                        throws java.lang.Throwable
Store the current profile identifier in action.

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

deleteAllGridProfileIds

public void deleteAllGridProfileIds(java.lang.String functionId)
                             throws java.lang.Throwable
Delete all grid profiles identifiers for the current user. 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