Class ExtractionDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.extraction.execution.ExtractionDAO
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
public class ExtractionDAO
extends AbstractLogEnabled
implements Serviceable, Component, Initializable
Object representing the extraction definition file content
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
_isRoot
(TraversableSource folder) Determines if the extraction container is the root nodeboolean
canAssignRights
(UserIdentity userIdentity, TraversableSource folder) Check if a user can edit rights on an extraction containerboolean
canAssignRights
(UserIdentity userIdentity, TraversableSource extractionSrc, UserIdentity author) Check if a user has right affectation rights on an extraction containerboolean
canDelete
(UserIdentity userIdentity, TraversableSource folder) Determines if the user can delete an extraction containerboolean
canDelete
(UserIdentity userIdentity, TraversableSource extractionSrc, UserIdentity author) Checks if a user has write rights on an extractionboolean
canRead
(UserIdentity userIdentity, TraversableSource folder) Check if a user has read rights on an extraction containerboolean
canRead
(UserIdentity userIdentity, TraversableSource extractionSrc, UserIdentity author) Checks if a user has read rights on an extractionboolean
canRename
(UserIdentity userIdentity, TraversableSource folder) Determines if the user can rename an extraction containerboolean
canWrite
(UserIdentity userIdentity, TraversableSource folder) Check if a user has write rights on an extraction containerboolean
canWrite
(UserIdentity userIdentity, TraversableSource folder, boolean recursively) Check if a user has write access on an extraction containerboolean
canWrite
(UserIdentity userIdentity, TraversableSource extractionSrc, UserIdentity author) Check if a user has write rights on an extractionvoid
copyRights
(String sourceContext, String targetContext) Copy rights from one context to another onevoid
copyRightsRecursively
(String sourceContext, String targetContext, TraversableSource file) Copy rights from one context to another onevoid
deleteRights
(String context) Delete rights from a contextvoid
deleteRightsRecursively
(String context, TraversableSource file) Copy rights from one context to another oneGet the absolute path of an extraction or an extraction from the contextGet extraction container propertiesgetExtractionProperties
(Extraction extraction, TraversableSource file) Get extraction propertiesgetExtractionRightPath
(Source source) Get the relative path of an extraction or an extraction containerGet the root container propertiesgetUserIdentityByExtractionPath
(FileSource extractionPath) get the author of extractionboolean
hasAnyAssignableDescendant
(UserIdentity userIdentity, TraversableSource folder) Checks if a folder has descendants in the right assignment access for a given userhasAnyReadableDescendant
(UserIdentity userIdentity, TraversableSource folder) Check if a folder has a descendant in read access for a given userhasAnyWritableDescendant
(UserIdentity userIdentity, TraversableSource folder) Check if a folder have descendant in write access for a given userhasAnyWritableDescendant
(UserIdentity userIdentity, TraversableSource folder, boolean ignoreExtraction) Check if a folder have descendant in write access for a given uservoid
moveExtractionDefinitionFile
(String srcRelPath, String parentRelPath) Move an extraction file or folder inside a given directorymoveSource
(String srcUri, String parentTargetUri, String sourceContext, String targetContext) Move a file or foldervoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role
-
-
Constructor Details
-
ExtractionDAO
public ExtractionDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getRootProperties
Get the root container properties- Returns:
- The root container properties
- Throws:
IOException
- If an error occurred while reading folder
-
getExtractionContainerProperties
Get extraction container properties- Parameters:
folder
- the source of the extraction container- Returns:
- The extraction container properties
-
getExtractionProperties
Get extraction properties- Parameters:
extraction
- the extractionfile
- the source of the extraction- Returns:
- The extraction properties
-
hasAnyReadableDescendant
Check if a folder has a descendant in read access for a given user- Parameters:
userIdentity
- the userfolder
- the source of the extraction container- Returns:
true
if the folder has a descendant in read access,false
otherwise
-
hasAnyWritableDescendant
Check if a folder have descendant in write access for a given user- Parameters:
userIdentity
- the user identityfolder
- the source of the extraction container- Returns:
- true if the user have write right for at least one child of this container
-
hasAnyWritableDescendant
public Boolean hasAnyWritableDescendant(UserIdentity userIdentity, TraversableSource folder, boolean ignoreExtraction) Check if a folder have descendant in write access for a given user- Parameters:
userIdentity
- the user identityfolder
- the source of the extraction containerignoreExtraction
- true to ignore extraction file from search (rights will check only on containers)- Returns:
- true if the user have write right for at least one child of this container
-
hasAnyAssignableDescendant
Checks if a folder has descendants in the right assignment access for a given user- Parameters:
userIdentity
- the userfolder
- the source of the extraction container- Returns:
true
if the folder has descendant,false
otherwise
-
canRead
Check if a user has read rights on an extraction container- Parameters:
userIdentity
- the userfolder
- the source of the extraction container- Returns:
true
if the user has read rights on an extraction container,false
otherwise
-
canWrite
Check if a user has write rights on an extraction container- Parameters:
userIdentity
- the userfolder
- the source of the extraction container- Returns:
true
if the user has write rights on an extraction container,false
otherwise
-
canRename
Determines if the user can rename an extraction container- Parameters:
userIdentity
- the userfolder
- the extraction container- Returns:
- true if the user can delete the extraction container
-
canDelete
Determines if the user can delete an extraction container- Parameters:
userIdentity
- the userfolder
- the extraction container- Returns:
- true if the user can delete the extraction container
-
canWrite
Check if a user has write access on an extraction container- Parameters:
userIdentity
- the user user identityfolder
- the extraction containerrecursively
- true to check write access on all descendants recursively- Returns:
- true if the user has write access on the extraction container
-
canAssignRights
Check if a user can edit rights on an extraction container- Parameters:
userIdentity
- the userfolder
- the source of the extraction container- Returns:
- true if the user can edit rights on an extraction container
-
_isRoot
Determines if the extraction container is the root node- Parameters:
folder
- the extraction container- Returns:
- true if is root
-
canRead
public boolean canRead(UserIdentity userIdentity, TraversableSource extractionSrc, UserIdentity author) Checks if a user has read rights on an extraction- Parameters:
userIdentity
- the userextractionSrc
- the source for the extractionauthor
- the author of extraction- Returns:
true
if the user has read rights on an extraction,false
otherwise
-
canWrite
public boolean canWrite(UserIdentity userIdentity, TraversableSource extractionSrc, UserIdentity author) Check if a user has write rights on an extraction- Parameters:
userIdentity
- the userextractionSrc
- the source for the extractionauthor
- the author of extraction- Returns:
true
if the user has write rights on an extraction,false
otherwise
-
canDelete
public boolean canDelete(UserIdentity userIdentity, TraversableSource extractionSrc, UserIdentity author) Checks if a user has write rights on an extraction- Parameters:
userIdentity
- the userextractionSrc
- the source for the extractionauthor
- the author of extraction- Returns:
true
if the user has write rights on an extraction,false
otherwise
-
canAssignRights
public boolean canAssignRights(UserIdentity userIdentity, TraversableSource extractionSrc, UserIdentity author) Check if a user has right affectation rights on an extraction container- Parameters:
userIdentity
- the userextractionSrc
- the source for the extractionauthor
- the extraction author- Returns:
true
if the user has right affectation rights on an extraction,false
otherwise
-
getExtractionRightPath
Get the relative path of an extraction or an extraction container- Parameters:
source
- The source of the extraction or extraction container- Returns:
- the relative path
-
getExtractionAbsolutePathFromContext
Get the absolute path of an extraction or an extraction from the context- Parameters:
context
- The context- Returns:
- the relative path
- Throws:
IOException
- if I/O error occurred.
-
copyRights
Copy rights from one context to another one- Parameters:
sourceContext
- the source contexttargetContext
- the target context
-
deleteRights
Delete rights from a context- Parameters:
context
- the context
-
moveExtractionDefinitionFile
public Map<String,Object> moveExtractionDefinitionFile(String srcRelPath, String parentRelPath) throws IOException Move an extraction file or folder inside a given directory- Parameters:
srcRelPath
- The relative URI of file/folder to moveparentRelPath
- The URI relative of parent target file- Returns:
- a result map with the name and uri of moved file in case of success.
- Throws:
IOException
- If an error occurred manipulating the source
-
moveSource
public Map<String,Object> moveSource(String srcUri, String parentTargetUri, String sourceContext, String targetContext) throws IOException Move a file or folder- Parameters:
srcUri
- The URI of file/folder to moveparentTargetUri
- The URI of parent target filesourceContext
- the source contexttargetContext
- the target context- Returns:
- a result map with the name and uri of moved file in case of success.
- Throws:
IOException
- If an error occurred manipulating the source
-
copyRightsRecursively
public void copyRightsRecursively(String sourceContext, String targetContext, TraversableSource file) Copy rights from one context to another one- Parameters:
sourceContext
- the source contexttargetContext
- the target contextfile
- the source of the file to copy
-
deleteRightsRecursively
Copy rights from one context to another one- Parameters:
context
- the contextfile
- the source of the file to copy
-
getUserIdentityByExtractionPath
get the author of extraction- Parameters:
extractionPath
- the path of the extraction- Returns:
- the author
-