Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.esupportail.portal.channels.CStockage.spacesPersonalization
Class DataBaseAccess

    java.lang.Object
      org.esupportail.portal.channels.CStockage.spacesPersonalization.DataBaseAccess

public class DataBaseAccess
extends java.lang.Object

Id: DataBaseAccess.java,v 1.0 13 janv. 2005 Copyright (c) 2005 Esup Portail (www.esup-portail.org) Classes: DataBaseAccess Original Author: Yohan Colmant This class manage the access to the database, for the sharing actions.

Field Summary
`private static org.esupportail.portal.utils.database.Database` | `dataBaseAccess` The database access object
`static boolean` | `initialized` If the database parameters are still initialized
`protected static Log` | `log` Logger object

Constructor Summary
`DataBaseAccess()` Constructor Initialize the parameters for a connexion to the database

Method Summary
`int` | `addStorageAvailableSpace(java.lang.String id, java.lang.String serverName, java.lang.String xmlServer, java.lang.String fromKey)` Add sharing properties into the database
`int` | `addStorageAvailableSpaceTarget(java.lang.String targetKey, boolean targetIsUser, boolean reading, boolean writing, boolean sharing, java.lang.String serverId, java.lang.String spaceKey, boolean obliged)` Add sharing properties into the database
`int` | `addStorageUsersPreferences(java.lang.String id, java.lang.String userKey)` Add a user preference into the database
`int` | `delStorageAvailableSpace(java.lang.String id)` Delete sharing properties into the database
`int` | `delStorageAvailableSpaceTarget(java.lang.String id)` Delete sharing properties into the database
`int` | `delStorageUsersPreferences(java.lang.String id)` Delete users preferences for a shared space from the database
`int` | `delStorageUsersPreferencesForUser(java.lang.String id, java.lang.String userKey)` Delete a user preference from the database
`java.util.Vector` | `getAdministratedSpaces()` Get the servers and spaces set into the administration database
`java.util.Vector` | `getAvailableSpacesForTarget(java.lang.String targetKey, boolean targetIsUser, boolean obliged)` Get the available spaces for a group or a user
`java.util.Vector[]` | `getIdAndXmlOfSharing(java.lang.String serverName)` Get the id of shared spaces from url and path
`java.util.Vector[]` | `getIdOfSpacesWithServerName(java.lang.String serverName)` Get the id of shared spaces from url and path
`java.util.Vector` | `getKeyOfSpacesFromPreferences(java.lang.String targetKey)` Get the list of ids of spaces which has already been selected by the current user
`java.util.Vector` | `getTargetsOfAdministratedSpaces(java.lang.String idStorageAvailableSpaces, java.lang.String spaceKey)` Get the targets set into the administration database
`java.util.Vector` | `getTargetsOfAvailableSpace(java.lang.String serverName)` Get the users for whose the resource is shared
`private boolean` | `isAlreadyAvailable(org.esupportail.portal.utils.database.Query queryManager, java.lang.String serverId)` Check if the space is already shared for a specified user
`private boolean` | `isAlreadyAvailableForTarget(org.esupportail.portal.utils.database.Query queryManager, java.lang.String serverId, java.lang.String targetKey, boolean targetIsUser, java.lang.String spaceKey)` Check if the space is already shared for a specified user
`private boolean` | `isAlreadyInPreferencesForUser(org.esupportail.portal.utils.database.Query queryManager, java.lang.String id, java.lang.String userKey)` Check if the space is already in the user preferences
`int` | `updatePathOfSharing(java.lang.String serverName, java.lang.String xml, java.lang.String id)` Update the path of shared spaces
`int` | `updateReadAndWriteAndShareSpace(boolean reading, boolean writing, boolean sharing, boolean obliged, java.lang.String id)` Update the "reading" and "writing" attributes for a specifical sharing
`int` | `updateServerNameAvailableSpace(java.lang.String serverId, java.lang.String newName)` Update the name of the server of the sharing properties into the database
`int` | `updateXmlServerAvailableSpace(java.lang.String xmlServer, java.lang.String id)` Update the label of the sharing properties into the database

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

Field Detail

### log

    protected static final Log log

  Logger object

### initialized

    public static boolean initialized

  If the database parameters are still initialized

### dataBaseAccess

    private static org.esupportail.portal.utils.database.Database dataBaseAccess

  The database access object

Constructor Detail

### DataBaseAccess

    public DataBaseAccess()
                   throws PropertiesException

  Constructor Initialize the parameters for a connexion to the database

Throws:
  `PropertiesException`

Method Detail

### getTargetsOfAvailableSpace

    public java.util.Vector getTargetsOfAvailableSpace(java.lang.String serverName)
                                                throws DataBaseException

  Get the users for whose the resource is shared

  Parameters:
    `serverName` - the name of the server
  Returns:
    a vector. Each element is an array of [serverId, xmlServer, availableSpaceTargetId, targetKey, targetIsUser:'T'|'F', read:'T'|'F', write:'T'|'F', share:'T'|'F']
  Throws:
    `DataBaseException`

### isAlreadyAvailable

    private boolean isAlreadyAvailable(org.esupportail.portal.utils.database.Query queryManager,
                                       java.lang.String serverId)
                                throws DataBaseException

  Check if the space is already shared for a specified user

  Parameters:
    `queryManager` - the query manager for the database access
    `serverId` - the id of the server
  Returns:
    true if already shared, else false
  Throws:
    `DataBaseException`

### isAlreadyAvailableForTarget

    private boolean isAlreadyAvailableForTarget(org.esupportail.portal.utils.database.Query queryManager,
                                                java.lang.String serverId,
                                                java.lang.String targetKey,
                                                boolean targetIsUser,
                                                java.lang.String spaceKey)
                                         throws DataBaseException

  Check if the space is already shared for a specified user

  Parameters:
    `queryManager` - the query manager for the database access
    `serverId` - the id of the server
    `targetKey` - the key of the user we want to check
    `targetIsUser` - to know if the target of this sharing is a user or not
  Returns:
    true if already shared, else false
  Throws:
    `DataBaseException`

### addStorageAvailableSpace

    public int addStorageAvailableSpace(java.lang.String id,
                                        java.lang.String serverName,
                                        java.lang.String xmlServer,
                                        java.lang.String fromKey)
                                 throws DataBaseException

  Add sharing properties into the database

  Parameters:
    `id` - the id of the server
    `serverName` - the name of the server
    `xmlServer` - the server into an xml format
    `fromKey` - the key of the people who shares
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### addStorageAvailableSpaceTarget

    public int addStorageAvailableSpaceTarget(java.lang.String targetKey,
                                              boolean targetIsUser,
                                              boolean reading,
                                              boolean writing,
                                              boolean sharing,
                                              java.lang.String serverId,
                                              java.lang.String spaceKey,
                                              boolean obliged)
                                       throws DataBaseException

  Add sharing properties into the database

  Parameters:
    `targetKey` - the key of the target user
    `targetIsUser` - if the target is a user or not
    `reading` - if we have the reading rights
    `writing` - if we have the writing rights
    `sharing` - if we have the sharing rights
    `serverId` - theid of the server
    `spaceKey` - the key of the space
    `obliged` - if we are obliged to see this space
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### delStorageAvailableSpaceTarget

    public int delStorageAvailableSpaceTarget(java.lang.String id)
                                       throws DataBaseException

  Delete sharing properties into the database

  Parameters:
    `id` - the space id
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### delStorageAvailableSpace

    public int delStorageAvailableSpace(java.lang.String id)
                                 throws DataBaseException

  Delete sharing properties into the database

  Parameters:
    `id` - the space id
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### delStorageUsersPreferences

    public int delStorageUsersPreferences(java.lang.String id)
                                   throws DataBaseException

  Delete users preferences for a shared space from the database

  Parameters:
    `id` - the id of the sharement in the other database
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### updateReadAndWriteAndShareSpace

    public int updateReadAndWriteAndShareSpace(boolean reading,
                                               boolean writing,
                                               boolean sharing,
                                               boolean obliged,
                                               java.lang.String id)
                                        throws DataBaseException

  Update the "reading" and "writing" attributes for a specifical sharing

  Parameters:
    `reading` - the reading value 'T' or 'F'
    `writing` - the writing value 'T' or 'F'
    `sharing` - the manage value 'T' or 'F'
    `obliged` - the obliged value 'T' or 'F'
    `id` - the id of the server
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### updateXmlServerAvailableSpace

    public int updateXmlServerAvailableSpace(java.lang.String xmlServer,
                                             java.lang.String id)
                                      throws DataBaseException

  Update the label of the sharing properties into the database

  Parameters:
    `xmlServer` - the xml of the server
    `id` - the id of the server
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### getIdOfSpacesWithServerName

    public java.util.Vector[] getIdOfSpacesWithServerName(java.lang.String serverName)
                                                   throws DataBaseException

  Get the id of shared spaces from url and path

  Parameters:
    `serverName` - the name of the server
  Returns:
    the list of ids in 2 vectors: the first for the storage_available_spaces and the other for storage_available_spaces_targets
  Throws:
    `DataBaseException`

### getIdAndXmlOfSharing

    public java.util.Vector[] getIdAndXmlOfSharing(java.lang.String serverName)
                                            throws DataBaseException

  Get the id of shared spaces from url and path

  Parameters:
    `serverName` - the name of the server
  Returns:
    the list of ids and xml in 2 vectors
  Throws:
    `DataBaseException`

### updatePathOfSharing

    public int updatePathOfSharing(java.lang.String serverName,
                                   java.lang.String xml,
                                   java.lang.String id)
                            throws DataBaseException

  Update the path of shared spaces

  Parameters:
    `serverName` - the name of the server
    `xml` - the xml for the server
    `id` - the name of the server
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### getAvailableSpacesForTarget

    public java.util.Vector getAvailableSpacesForTarget(java.lang.String targetKey,
                                                        boolean targetIsUser,
                                                        boolean obliged)
                                                 throws DataBaseException

  Get the available spaces for a group or a user

  Parameters:
    `targetKey` - the key of the target
    `targetIsUser` - to know if the target of this sharing is a user or not
  Returns:
    a vector. Each element is an array of [id, url, path, label, owner, xmlSpace, read:'T'|'F', write:'T'|'F']
  Throws:
    `DataBaseException`

### addStorageUsersPreferences

    public int addStorageUsersPreferences(java.lang.String id,
                                          java.lang.String userKey)
                                   throws DataBaseException

  Add a user preference into the database

  Parameters:
    `id` - the id of the sharement in the other database
    `userKey` - the key of the user who wants to add preference into the database
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### isAlreadyInPreferencesForUser

    private boolean isAlreadyInPreferencesForUser(org.esupportail.portal.utils.database.Query queryManager,
                                                  java.lang.String id,
                                                  java.lang.String userKey)
                                           throws DataBaseException

  Check if the space is already in the user preferences

  Parameters:
    `queryManager` - the query manager to access the database
    `id` - the id of the shared space
    `userKey` - the key of the user to check
  Returns:
    true if already shared, else false
  Throws:
    `DataBaseException`

### getKeyOfSpacesFromPreferences

    public java.util.Vector getKeyOfSpacesFromPreferences(java.lang.String targetKey)
                                                   throws DataBaseException

  Get the list of ids of spaces which has already been selected by the current user

  Parameters:
    `targetKey` - the user or group target key
  Returns:
    a Vector
  Throws:
    `DataBaseException`

### delStorageUsersPreferencesForUser

    public int delStorageUsersPreferencesForUser(java.lang.String id,
                                                 java.lang.String userKey)
                                          throws DataBaseException

  Delete a user preference from the database

  Parameters:
    `id` - the id of the sharement in the other database
    `userKey` - the key of the user
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

### getAdministratedSpaces

    public java.util.Vector getAdministratedSpaces()
                                            throws DataBaseException

  Get the servers and spaces set into the administration database

  Returns:
    a vector. Each element is an array of [serverId, serverName, xmlServer]
  Throws:
    `DataBaseException`

### getTargetsOfAdministratedSpaces

    public java.util.Vector getTargetsOfAdministratedSpaces(java.lang.String idStorageAvailableSpaces,
                                                            java.lang.String spaceKey)
                                                     throws DataBaseException

  Get the targets set into the administration database

  Parameters:
    `idStorageAvailableSpaces` - the id of storage target
    `spaceKey` - the key of the space
  Returns:
    a vector. Each element is an array of [availableSpaceTargetId, targetKey, targetIsUser:'T'|'F', read:'T'|'F', write:'T'|'F', share:'T'|'F', obliged:'T'|'F']
  Throws:
    `DataBaseException`

### updateServerNameAvailableSpace

    public int updateServerNameAvailableSpace(java.lang.String serverId,
                                              java.lang.String newName)
                                       throws DataBaseException

  Update the name of the server of the sharing properties into the database

  Parameters:
    `serverId` - the id of the server
    `newName` - the new name of the server administration
  Returns:
    the result of the query
  Throws:
    `DataBaseException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD