org.palo.api.ext.favoriteviews.impl
Class FavoriteViewModel

java.lang.Object
  extended by org.palo.api.ext.favoriteviews.impl.FavoriteViewModel

public class FavoriteViewModel
extends java.lang.Object

The FavoriteViewModel class provides internal methods to load and save the favorite view tree. Namely, this class checks if a cube to store bookmarks is available and creates one if that is not the case. The class will also generate the xml code for a favorite view tree and save that in the correct position in the database.

Version:
$Id: FavoriteViewModel.html,v 1.8 2009/07/09 11:01:47 ArndHouben Exp $

Constructor Summary
FavoriteViewModel()
           
 
Method Summary
 Cube createBookmarkCubeInExistingDatabase(Database db)
          If a connection is found that _does_ have an AdvancedSystem database but which does not include the bookmarks cube, this method creates the new bookmarks cube.
 Cube createBookmarkCubeInNewDatabase(Connection con)
          If a connection is found that does not (yet) have an AdvancedSystem database, the database is created in this method, then dimensions (#user and #bookmarkedViews) are added along with the entries (the current user name and "Bookmarks").
 FavoriteViewTreeNode loadFavoriteViews(Connection con)
          The method retrieves the AdvancedSystem database of the connection (or creates it, if it is not yet in the connection) and also gets the bookmark-cube from the AdvancedSystem database (or creates it, if it had not been present (for this user)).
 void storeFavoriteViews(Connection con, FavoriteViewTreeNode root)
          Stores a favorite views tree in the given connection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FavoriteViewModel

public FavoriteViewModel()
Method Detail

createBookmarkCubeInNewDatabase

public Cube createBookmarkCubeInNewDatabase(Connection con)
If a connection is found that does not (yet) have an AdvancedSystem database, the database is created in this method, then dimensions (#user and #bookmarkedViews) are added along with the entries (the current user name and "Bookmarks"). Finally a cube is created using these two dimensions. The cube is then returned.

Parameters:
con - the connection in which the new AdvancedSystem database is to be added.
Returns:
the bookmark cube of the AdvancedSystem database consisting of the user and bookmark dimensions.

createBookmarkCubeInExistingDatabase

public Cube createBookmarkCubeInExistingDatabase(Database db)
If a connection is found that _does_ have an AdvancedSystem database but which does not include the bookmarks cube, this method creates the new bookmarks cube. Dimensions will be created if necessary.

Parameters:
db - the AdvancedSystem database of the current connection.
Returns:
the newly created bookmark cube.

loadFavoriteViews

public FavoriteViewTreeNode loadFavoriteViews(Connection con)
The method retrieves the AdvancedSystem database of the connection (or creates it, if it is not yet in the connection) and also gets the bookmark-cube from the AdvancedSystem database (or creates it, if it had not been present (for this user)). Then, this methods loads all stored favorite views and transforms the xml structure to a new favorite views tree. The root of which is returned.

Parameters:
con - the connection which is being added to the bookmark model.
Returns:
the root of the favorite views tree or null if no bookmarks exist.

storeFavoriteViews

public void storeFavoriteViews(Connection con,
                               FavoriteViewTreeNode root)
Stores a favorite views tree in the given connection.

Parameters:
con - the connection which is to store the favorite views.
root - the root of the favorite views tree that is to be stored.