public class CloudFileActionService extends Object implements org.picocontainer.Startable
| Modifier and Type | Class and Description |
|---|---|
protected class |
CloudFileActionService.LinkRemoveListener
Act on ecd:cloudFileLinkGroup property removal on a cloud file symlink and
then unshare the file from the group where it was shared by the link.
|
protected class |
CloudFileActionService.LinkTrashListener
Act on Cloud File symlink trashing.
|
| Modifier and Type | Field and Description |
|---|---|
protected org.exoplatform.clouddrive.CloudDriveService |
cloudDrives
The cloud drive.
|
protected org.exoplatform.services.cms.CmsService |
cmsService
The cms service.
|
protected org.exoplatform.services.cms.drives.ManageDriveService |
documentDrives
The document drives.
|
static String |
ECD_CLOUDFILELINK
The Constant ECD_CLOUDFILELINK.
|
static String |
ECD_SHAREIDENTITY
The Constant ECD_SHAREIDENTITY.
|
protected static String |
EXO_OWNEABLE
The Constant EXO_OWNEABLE.
|
protected static String |
EXO_PRIVILEGEABLE
The Constant EXO_PRIVILEGEABLE.
|
protected static String |
EXO_TRASHFOLDER
The Constant EXO_TRASHFOLDER.
|
protected org.exoplatform.clouddrive.jcr.NodeFinder |
finder
Node finder facade on actual storage implementation.
|
protected String |
groupsPath
The groups path.
|
protected org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator |
hierarchyCreator
The hierarchy creator.
|
protected org.exoplatform.services.jcr.RepositoryService |
jcrService
The jcr service.
|
protected org.exoplatform.services.cms.link.LinkManager |
linkManager
The link manager.
|
protected org.exoplatform.services.listener.ListenerService |
listenerService
The listener service.
|
protected static org.exoplatform.services.log.Log |
LOG
The Constant LOG.
|
protected static String[] |
MANAGER_PERMISSION
The Constant MANAGER_PERMISSION.
|
protected static String |
MIX_VERSIONABLE
The Constant MIX_VERSIONABLE.
|
protected org.exoplatform.services.organization.OrganizationService |
orgService
The org service.
|
protected static String[] |
READER_PERMISSION
The Constant READER_PERMISSION.
|
protected Map<String,String> |
removedLinks
Symlink to cloud file UUID mappings.
|
protected Map<String,String> |
removedShared
Cloud file UUID to shared group/user name mappings.
|
protected org.exoplatform.services.jcr.ext.app.SessionProviderService |
sessionProviders
The session providers.
|
static String |
SHARE_CLOUD_FILES_SPACES
The Constant SHARE_CLOUD_FILES_SPACES.
|
protected static String |
SPACES_GROUP
The Constant SPACES_GROUP.
|
protected org.exoplatform.services.cms.documents.TrashService |
trash
The trash.
|
protected String |
usersPath
The users path.
|
protected org.exoplatform.clouddrive.ThreadExecutor |
workerExecutor
Trashed symlinks removal workers.
|
| Constructor and Description |
|---|
CloudFileActionService(org.exoplatform.clouddrive.CloudDriveService cloudDrives,
org.exoplatform.services.jcr.RepositoryService jcrService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders,
org.exoplatform.services.organization.OrganizationService orgService,
org.exoplatform.clouddrive.jcr.NodeFinder finder,
org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator,
org.exoplatform.services.cms.link.LinkManager linkManager,
org.exoplatform.services.cms.drives.ManageDriveService documentDrives,
org.exoplatform.services.cms.documents.TrashService trash,
org.exoplatform.services.listener.ListenerService listeners,
org.exoplatform.services.cms.CmsService cmsService)
Instantiates a new cloud file action service.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
documentName(javax.jcr.Node document)
Find pretty name of the document.
|
javax.jcr.NodeIterator |
getCloudFileLinks(javax.jcr.Node targetNode,
String shareIdentity,
boolean useSystemSession)
Gets the cloud file links.
|
javax.jcr.NodeIterator |
getCloudFileLinks(javax.jcr.Node targetNode,
String shareIdentity,
String scopePath,
boolean useSystemSession)
Gets the cloud file links.
|
org.exoplatform.services.cms.drives.DriveData |
getGroupDrive(String groupId)
Gets the group drive.
|
protected String |
getMembershipName(String membershipType)
Gets organizational membership name by its type name.
|
org.exoplatform.services.cms.drives.DriveData |
getUserDrive(String userName)
Gets the user drive.
|
javax.jcr.Node |
getUserProfileNode(String userName)
Gets the user profile node (a node where /Private and /Public nodes live).
|
javax.jcr.Node |
getUserPublicNode(String userName)
Gets the user public node.
|
protected void |
initCloudFileLink(javax.jcr.Node fileNode,
String identity,
String targetPath,
boolean canEdit)
Initialize the cloud file link node (mixin node type and permissions).
|
boolean |
isGroupDrive(org.exoplatform.services.cms.drives.DriveData drive)
Checks if is group drive.
|
boolean |
isGroupPath(String path)
Checks if is group path.
|
boolean |
isUserDrive(org.exoplatform.services.cms.drives.DriveData drive)
Checks if is user drive.
|
boolean |
isUserPath(String path)
Checks if is user path.
|
protected void |
listenFileLinks()
Listen file links.
|
javax.jcr.Node |
markRemoveLink(javax.jcr.Node linkNode)
Mark remove link.
|
protected void |
removeLinks(javax.jcr.Node fileNode,
String identity)
Removes the links.
|
protected void |
removePermission(javax.jcr.Node node,
String permIdentity)
Removes the permission of an identity on given node.
|
protected void |
removeWritePermissions(org.exoplatform.services.jcr.core.ExtendedNode target,
String groupOrUserId)
Remove write permissions for all kinds of membership for this group or
user.
|
protected void |
setGroupFilePermission(javax.jcr.Node fileNode,
String groupId,
boolean forcePrivilegeable)
Adds the group permission for cloud file.
|
protected void |
setLinkPermission(javax.jcr.Node linkNode,
String ownerId,
String sharedIdentity,
boolean canEdit)
Adds the permission for a cloud file link: user who shared and to whom or
group manager have full permissions, others can read only.
|
protected void |
setUserFilePermission(javax.jcr.Node fileNode,
String userId,
boolean forcePrivilegeable)
Adds the user permission.
|
void |
shareToGroup(javax.jcr.Node fileNode,
String groupId,
boolean canEdit)
Share cloud file to a group by its ID and create a symlink in the target
space.
|
void |
shareToUser(javax.jcr.Node fileNode,
String userId,
boolean canEdit)
Share cloud file to an user by its ID.
|
void |
start() |
void |
stop() |
protected javax.jcr.Session |
systemSession()
System session in default workspace of current JCR repository.
|
void |
unshareToSpace(javax.jcr.Node fileNode,
String groupId)
Unshare to space.
|
void |
unshareToUser(javax.jcr.Node fileNode,
String userId)
Unshare to user.
|
public static final String ECD_CLOUDFILELINK
public static final String ECD_SHAREIDENTITY
public static final String SHARE_CLOUD_FILES_SPACES
protected static final org.exoplatform.services.log.Log LOG
protected static final String SPACES_GROUP
protected static final String EXO_OWNEABLE
protected static final String EXO_PRIVILEGEABLE
protected static final String MIX_VERSIONABLE
protected static final String EXO_TRASHFOLDER
protected static final String[] READER_PERMISSION
protected static final String[] MANAGER_PERMISSION
protected final org.exoplatform.clouddrive.CloudDriveService cloudDrives
protected final org.exoplatform.services.jcr.RepositoryService jcrService
protected final org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator
protected final org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders
protected final org.exoplatform.services.organization.OrganizationService orgService
protected final org.exoplatform.services.cms.link.LinkManager linkManager
protected final org.exoplatform.services.cms.drives.ManageDriveService documentDrives
protected final org.exoplatform.services.cms.documents.TrashService trash
protected final org.exoplatform.services.listener.ListenerService listenerService
protected final org.exoplatform.services.cms.CmsService cmsService
protected final Map<String,String> removedShared
protected final org.exoplatform.clouddrive.jcr.NodeFinder finder
protected final org.exoplatform.clouddrive.ThreadExecutor workerExecutor
protected final String groupsPath
protected final String usersPath
public CloudFileActionService(org.exoplatform.clouddrive.CloudDriveService cloudDrives,
org.exoplatform.services.jcr.RepositoryService jcrService,
org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders,
org.exoplatform.services.organization.OrganizationService orgService,
org.exoplatform.clouddrive.jcr.NodeFinder finder,
org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator hierarchyCreator,
org.exoplatform.services.cms.link.LinkManager linkManager,
org.exoplatform.services.cms.drives.ManageDriveService documentDrives,
org.exoplatform.services.cms.documents.TrashService trash,
org.exoplatform.services.listener.ListenerService listeners,
org.exoplatform.services.cms.CmsService cmsService)
cloudDrives - the cloud drivejcrService - the jcr servicesessionProviders - the session providersorgService - the org servicefinder - the finderhierarchyCreator - the hierarchy creatorlinkManager - the link managerdocumentDrives - the document drivestrash - the trashlisteners - the listenerscmsService - the cms servicepublic boolean isGroupDrive(org.exoplatform.services.cms.drives.DriveData drive)
drive - the drivepublic boolean isUserDrive(org.exoplatform.services.cms.drives.DriveData drive)
drive - the drivepublic boolean isGroupPath(String path)
path - the pathpublic boolean isUserPath(String path)
path - the pathpublic org.exoplatform.services.cms.drives.DriveData getGroupDrive(String groupId) throws Exception
groupId - the group idException - the exceptionpublic org.exoplatform.services.cms.drives.DriveData getUserDrive(String userName) throws Exception
userName - the user nameException - the exceptionpublic javax.jcr.Node getUserPublicNode(String userName) throws Exception
userName - the user nameException - the exceptionpublic javax.jcr.Node getUserProfileNode(String userName) throws Exception
userName - the user nameException - the exceptionpublic void shareToUser(javax.jcr.Node fileNode,
String userId,
boolean canEdit)
throws javax.jcr.RepositoryException
fileNode - the file nodeuserId - the user idcanEdit - the can edit flag, if true then user should be
able to modify the shared link node, read-only link otherwisejavax.jcr.RepositoryException - the repository exceptionpublic void unshareToUser(javax.jcr.Node fileNode,
String userId)
throws javax.jcr.RepositoryException
fileNode - the file nodeuserId - the user idjavax.jcr.RepositoryException - the repository exceptionpublic void shareToGroup(javax.jcr.Node fileNode,
String groupId,
boolean canEdit)
throws javax.jcr.RepositoryException
fileNode - the file nodegroupId - the group idcanEdit - the can edit flag, if true then group members
should be able to modify the shared link node, read-only link
otherwisejavax.jcr.RepositoryException - the repository exceptionpublic void unshareToSpace(javax.jcr.Node fileNode,
String groupId)
throws javax.jcr.RepositoryException
fileNode - the file nodegroupId - the group idjavax.jcr.RepositoryException - the repository exceptionpublic javax.jcr.Node markRemoveLink(javax.jcr.Node linkNode)
throws org.exoplatform.clouddrive.NotCloudDriveException,
org.exoplatform.clouddrive.DriveRemovedException,
javax.jcr.RepositoryException,
org.exoplatform.clouddrive.CloudDriveException
linkNode - the link nodeorg.exoplatform.clouddrive.NotCloudDriveException - the not cloud drive exceptionorg.exoplatform.clouddrive.DriveRemovedException - the drive removed exceptionjavax.jcr.RepositoryException - the repository exceptionorg.exoplatform.clouddrive.CloudDriveException - the cloud drive exceptionpublic void start()
start in interface org.picocontainer.Startablepublic void stop()
stop in interface org.picocontainer.Startableprotected void listenFileLinks()
throws javax.jcr.RepositoryException
javax.jcr.RepositoryException - the repository exceptionprotected String documentName(javax.jcr.Node document) throws javax.jcr.RepositoryException
document - the documentjavax.jcr.RepositoryException - the repository exceptionprotected javax.jcr.Session systemSession()
throws javax.jcr.RepositoryException
javax.jcr.RepositoryException - the repository exceptionprotected void removeLinks(javax.jcr.Node fileNode,
String identity)
throws javax.jcr.RepositoryException
fileNode - the file nodeidentity - the shared identityjavax.jcr.RepositoryException - the repository exceptionpublic javax.jcr.NodeIterator getCloudFileLinks(javax.jcr.Node targetNode,
String shareIdentity,
String scopePath,
boolean useSystemSession)
throws javax.jcr.RepositoryException
targetNode - the target nodeshareIdentity - the share identityscopePath - the scope path (only nodes from this sub-tree will be
searched)useSystemSession - the use system sessionjavax.jcr.RepositoryException - the repository exceptionprotected String getMembershipName(String membershipType)
membershipType - the membership typeprotected void removePermission(javax.jcr.Node node,
String permIdentity)
node - the node, expected ExtendedNode herepermIdentity - the identity, it should include membership if actual
(e.g. for space it's *:/space/my_team, but simply
john for an user)protected void setUserFilePermission(javax.jcr.Node fileNode,
String userId,
boolean forcePrivilegeable)
throws javax.jcr.RepositoryException
fileNode - the file nodeuserId - the user idforcePrivilegeable - if need force adding of exo:privilegeable mixin
to the nodejavax.jcr.RepositoryException - the repository exceptionprotected void setGroupFilePermission(javax.jcr.Node fileNode,
String groupId,
boolean forcePrivilegeable)
throws javax.jcr.RepositoryException
fileNode - the nodegroupId - the group idforcePrivilegeable - if need force adding of exo:privilegeable mixin
to the nodejavax.jcr.RepositoryException - the repository exceptionprotected void setLinkPermission(javax.jcr.Node linkNode,
String ownerId,
String sharedIdentity,
boolean canEdit)
throws AccessControlException,
javax.jcr.RepositoryException
linkNode - the nodeownerId - the owner idsharedIdentity - the group idcanEdit - the can edit flagAccessControlException - the access control exceptionjavax.jcr.RepositoryException - the repository exceptionprotected void initCloudFileLink(javax.jcr.Node fileNode,
String identity,
String targetPath,
boolean canEdit)
fileNode - the file nodeidentity - the identity this link was shared totargetPath - the target pathcanEdit - the can edit flagprotected void removeWritePermissions(org.exoplatform.services.jcr.core.ExtendedNode target,
String groupOrUserId)
throws javax.jcr.RepositoryException
target - the targetgroupOrUserId - the group or user idjavax.jcr.RepositoryException - the repository exceptionpublic javax.jcr.NodeIterator getCloudFileLinks(javax.jcr.Node targetNode,
String shareIdentity,
boolean useSystemSession)
throws javax.jcr.RepositoryException
targetNode - the target nodeshareIdentity - the share identityuseSystemSession - the use system sessionjavax.jcr.RepositoryException - the repository exceptionCopyright © 2003–2018 eXo Platform SAS. All rights reserved.