org.esupportail.portal.channels.CStockage.channelAction.classic.sharing
Class SharingTool

java.lang.Object
  extended byorg.esupportail.portal.channels.CStockage.channelAction.classic.sharing.SharingTool

public class SharingTool
extends java.lang.Object

Id: SharingTool.java,v 1.0 13 janv. 2005 Copyright (c) 2005 Esup Portail (www.esup-portail.org) Classes: SharingTool Original Author: Yohan Colmant This class is a tool used to manage the sharing actions


Field Summary
private  DirectorySharingProperties currentDirectorySharingProperties
          The sharing directory properties of the current directory
private  DataBaseAccess dbAccess
          The object used to access the database
 
Constructor Summary
SharingTool()
          Constructor
 
Method Summary
 void addStorageAvailableSpaceGroup(Space currentSpace, java.lang.String serverUrl, java.lang.String path, java.lang.String label, GroupForSharing group, java.lang.String ownerUserKey, java.lang.String xmlSpace)
          Add sharing properties for the groups into the database
 void addStorageAvailableSpaceUser(Space currentSpace, java.lang.String serverUrl, java.lang.String path, java.lang.String label, UserForSharing user, java.lang.String ownerUserKey, java.lang.String xmlSpace)
          Add sharing properties for the user into the database
 void addStorageUsersPreferences(java.lang.String id, java.lang.String userKey)
          Add a user preference into the database from a user
 void delStorageAvailableSpaceForGroup(Space currentSpace, GroupForSharing group)
          Delete sharing properties for groups into the database
 void delStorageAvailableSpaceForSpecifiedPath(java.lang.String url, java.lang.String path)
          Delete sharing properties for url and path into the database
 void delStorageAvailableSpaceForUser(Space currentSpace, UserForSharing user)
          Delete sharing properties for users into the database
 void delStorageUsersPreferences(java.lang.String id)
          Delete users preferences for a shared space from the database
 void delStorageUsersPreferencesForUser(java.lang.String id, java.lang.String userKey)
          Delete a user preference from the database
 java.util.Vector getAvailableSpacesForGroup(java.lang.String targetKey, java.lang.String userPortalLogin)
          Get the available spaces for a group
private  java.util.Vector getAvailableSpacesForTarget(java.lang.String targetKey, boolean targetIsUser, java.lang.String userPortalLogin)
          Get the available spaces for a user or a group
 java.util.Vector getAvailableSpacesForUser(java.lang.String targetKey, java.lang.String userPortalLogin)
          Get the available spaces for a user
 DirectorySharingProperties getCurrentDirectorySharingProperties()
           
 java.util.Vector getIdOfSpaceFromPreferencesUser(java.lang.String target)
          Get the list of ids of spaces which has already been selected by the current user from users table
 java.util.Vector getTargetsOfAvailableSpaceForGroup(java.lang.String serverUrl, java.lang.String path)
          Get the groups for whose the resource is shared
 java.util.Vector getTargetsOfAvailableSpaceForUser(java.lang.String serverUrl, java.lang.String path)
          Get the users for whose the resource is shared
 void setCurrentDirectorySharingProperties(DirectorySharingProperties currentDirectorySharingProperties)
           
 void updateLabelAvailableSpace(java.lang.String newLabel, java.lang.String serverUrl, java.lang.String path)
          Update the label of the sharing properties into the database for users
 void updatePathOfSharing(java.lang.String url, java.lang.String oldPath, java.lang.String newPath)
          Update the path of shared spaces
 void updateReadAndWriteAndManageSpaceGroup(Space currentSpace, java.lang.String serverUrl, java.lang.String path, GroupForSharing group)
          Update the "reading" and "writing" attributes for a specifical sharing for a group
 void updateReadAndWriteAndManageSpaceUser(Space currentSpace, java.lang.String serverUrl, java.lang.String path, UserForSharing user)
          Update the "reading" and "writing" attributes for a specifical sharing for a user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbAccess

private DataBaseAccess dbAccess
The object used to access the database


currentDirectorySharingProperties

private DirectorySharingProperties currentDirectorySharingProperties
The sharing directory properties of the current directory

Constructor Detail

SharingTool

public SharingTool()
            throws PropertiesException
Constructor

Throws:
PropertiesException
Method Detail

getCurrentDirectorySharingProperties

public DirectorySharingProperties getCurrentDirectorySharingProperties()
Returns:
Returns the currentDirectorySharingProperties.

setCurrentDirectorySharingProperties

public void setCurrentDirectorySharingProperties(DirectorySharingProperties currentDirectorySharingProperties)
Parameters:
currentDirectorySharingProperties - The currentDirectorySharingProperties to set.

addStorageAvailableSpaceUser

public void addStorageAvailableSpaceUser(Space currentSpace,
                                         java.lang.String serverUrl,
                                         java.lang.String path,
                                         java.lang.String label,
                                         UserForSharing user,
                                         java.lang.String ownerUserKey,
                                         java.lang.String xmlSpace)
                                  throws DataBaseException,
                                         AclAccessException,
                                         AclWriteException,
                                         AclReadException,
                                         NotSupportedAclException,
                                         PropertiesException
Add sharing properties for the user into the database

Parameters:
serverUrl - the url of the server
path - the resource path
label - the space's label
user - the target user
ownerUserKey - the key of the owner
xmlSpace - the space into an xml format
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

addStorageAvailableSpaceGroup

public void addStorageAvailableSpaceGroup(Space currentSpace,
                                          java.lang.String serverUrl,
                                          java.lang.String path,
                                          java.lang.String label,
                                          GroupForSharing group,
                                          java.lang.String ownerUserKey,
                                          java.lang.String xmlSpace)
                                   throws DataBaseException,
                                          AclAccessException,
                                          AclWriteException,
                                          AclReadException,
                                          NotSupportedAclException,
                                          PropertiesException
Add sharing properties for the groups into the database

Parameters:
serverUrl - the url of the server
path - the resource path
label - the space's label
group - the target group
ownerUserKey - the key of the owner
xmlSpace - the space into an xml format
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

delStorageAvailableSpaceForUser

public void delStorageAvailableSpaceForUser(Space currentSpace,
                                            UserForSharing user)
                                     throws DataBaseException,
                                            AclAccessException,
                                            AclWriteException,
                                            AclReadException,
                                            NotSupportedAclException,
                                            PropertiesException
Delete sharing properties for users into the database

Parameters:
currentSpace - the current space
user - we want to delete preferences
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

delStorageAvailableSpaceForGroup

public void delStorageAvailableSpaceForGroup(Space currentSpace,
                                             GroupForSharing group)
                                      throws DataBaseException,
                                             AclAccessException,
                                             AclWriteException,
                                             AclReadException,
                                             NotSupportedAclException,
                                             PropertiesException
Delete sharing properties for groups into the database

Parameters:
currentSpace - the current space
group - the group we want to delete sharing
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

getTargetsOfAvailableSpaceForUser

public java.util.Vector getTargetsOfAvailableSpaceForUser(java.lang.String serverUrl,
                                                          java.lang.String path)
                                                   throws DataBaseException
Get the users for whose the resource is shared

Parameters:
serverUrl - the url of the server
path - the path of the resource
Returns:
a vector. Each element is an array of [id, label, targetKey, read:'T'|'F', write:'T'|'F', manage:'T'|'F']
Throws:
DataBaseException

getTargetsOfAvailableSpaceForGroup

public java.util.Vector getTargetsOfAvailableSpaceForGroup(java.lang.String serverUrl,
                                                           java.lang.String path)
                                                    throws DataBaseException
Get the groups for whose the resource is shared

Parameters:
serverUrl - the url of the server
path - the path of the resource
Returns:
a vector. Each element is an array of [id, label, targetKey, targetIsUser:'T'|'F', read:'T'|'F', write:'T'|'F', manage:'T'|'F']
Throws:
DataBaseException

updateLabelAvailableSpace

public void updateLabelAvailableSpace(java.lang.String newLabel,
                                      java.lang.String serverUrl,
                                      java.lang.String path)
                               throws DataBaseException
Update the label of the sharing properties into the database for users

Parameters:
newLabel - the new label of the shared spaces
serverUrl - the url of the server
path - the resource path
Throws:
DataBaseException

updateReadAndWriteAndManageSpaceUser

public void updateReadAndWriteAndManageSpaceUser(Space currentSpace,
                                                 java.lang.String serverUrl,
                                                 java.lang.String path,
                                                 UserForSharing user)
                                          throws DataBaseException,
                                                 AclAccessException,
                                                 AclWriteException,
                                                 AclReadException,
                                                 NotSupportedAclException,
                                                 PropertiesException
Update the "reading" and "writing" attributes for a specifical sharing for a user

Parameters:
currentSpace - the current space
serverUrl - the url of the server
path - the resource path
user - the target user
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

updateReadAndWriteAndManageSpaceGroup

public void updateReadAndWriteAndManageSpaceGroup(Space currentSpace,
                                                  java.lang.String serverUrl,
                                                  java.lang.String path,
                                                  GroupForSharing group)
                                           throws DataBaseException,
                                                  AclAccessException,
                                                  AclWriteException,
                                                  AclReadException,
                                                  NotSupportedAclException,
                                                  PropertiesException
Update the "reading" and "writing" attributes for a specifical sharing for a group

Parameters:
currentSpace - the current space
serverUrl - the url of the server
path - the resource path
group - the target group
Throws:
DataBaseException
AclAccessException
AclWriteException
AclReadException
NotSupportedAclException
PropertiesException

getAvailableSpacesForTarget

private java.util.Vector getAvailableSpacesForTarget(java.lang.String targetKey,
                                                     boolean targetIsUser,
                                                     java.lang.String userPortalLogin)
                                              throws PropertiesException,
                                                     DataBaseException
Get the available spaces for a user or a group

Parameters:
targetKey - the key of the target
targetIsUser - if we get spaces for user, the value is true, for a group, the value is false
userPortalLogin - the login of the user in the portal
Returns:
a vector. Each element is an array of [id, url, path, label, owner, xmlSpace, read:'T'|'F', write:'T'|'F']
Throws:
PropertiesException
DataBaseException

getAvailableSpacesForUser

public java.util.Vector getAvailableSpacesForUser(java.lang.String targetKey,
                                                  java.lang.String userPortalLogin)
                                           throws DataBaseException,
                                                  PropertiesException
Get the available spaces for a user

Parameters:
targetKey - the key of the target
userPortalLogin - the login of the user in the portal
Returns:
a vector. Each element is an array of [url, path, label, owner, xmlSpace, read:'T'|'F', write:'T'|'F']
Throws:
DataBaseException
PropertiesException

getAvailableSpacesForGroup

public java.util.Vector getAvailableSpacesForGroup(java.lang.String targetKey,
                                                   java.lang.String userPortalLogin)
                                            throws DataBaseException,
                                                   PropertiesException
Get the available spaces for a group

Parameters:
targetKey - the key of the target
Returns:
a vector. Each element is an array of [url, path, label, owner, xmlSpace, read:'T'|'F', write:'T'|'F']
Throws:
DataBaseException
PropertiesException

addStorageUsersPreferences

public void addStorageUsersPreferences(java.lang.String id,
                                       java.lang.String userKey)
                                throws DataBaseException
Add a user preference into the database from a user

Parameters:
id - the id of the sharement in the other database
userKey - the login of the user in the portal
Throws:
DataBaseException

getIdOfSpaceFromPreferencesUser

public java.util.Vector getIdOfSpaceFromPreferencesUser(java.lang.String target)
                                                 throws DataBaseException
Get the list of ids of spaces which has already been selected by the current user from users table

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

delStorageUsersPreferencesForUser

public void 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
Throws:
DataBaseException

delStorageUsersPreferences

public void 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
Throws:
DataBaseException

delStorageAvailableSpaceForSpecifiedPath

public void delStorageAvailableSpaceForSpecifiedPath(java.lang.String url,
                                                     java.lang.String path)
                                              throws DataBaseException
Delete sharing properties for url and path into the database

Parameters:
url - the url of the space
path - the path of the space
Throws:
DataBaseException

updatePathOfSharing

public void updatePathOfSharing(java.lang.String url,
                                java.lang.String oldPath,
                                java.lang.String newPath)
                         throws DataBaseException
Update the path of shared spaces

Parameters:
url - the url of the space
oldPath - the old path of the space
newPath - the new path of the space
Returns:
the result of the query
Throws:
DataBaseException