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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_isRoot(TraversableSource folder) Determines if the extraction container is the root nodebooleancanAssignRights(UserIdentity userIdentity, TraversableSource source) Check if a user can edit rights on an extraction container or an extraction filebooleancanDelete(UserIdentity userIdentity, TraversableSource source) Determines if the user can delete an extraction container or the extraction filebooleancanRead(UserIdentity userIdentity, TraversableSource source) Check if a user has read rights on an extraction container or filebooleancanRename(UserIdentity userIdentity, TraversableSource folder) Determines if the user can rename an extraction containerbooleancanWrite(UserIdentity userIdentity, TraversableSource source) Check if a user has write rights on an extraction container or an extractionbooleancanWrite(UserIdentity userIdentity, TraversableSource source, boolean recursively) Check if a user has write access on an extraction containervoidcopyRights(String sourceContext, String targetContext) Copy rights from one context to another onevoidcopyRightsRecursively(String sourceContext, String targetContext, TraversableSource file) Copy rights from one context to another onevoiddeleteRights(String context) Delete rights from a contextvoiddeleteRightsRecursively(String context, TraversableSource file) Copy rights from one context to another onegetAuthor(FileSource extractionPath) Get the author of extractionGet extraction container propertiesgetExtractionProperties(Extraction extraction, TraversableSource file) Get extraction propertiesGet the path for rights of an extraction container or filegetExtractionSource(String rightContext) Get the source corresponding to the right context of an extraction container or filegetFilteredPath(String path, String value) Get the path of all children that match the provided value.Get the root container propertiesbooleanhasAnyAssignableDescendant(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 uservoidmoveOrRenameExtractionDefinitionFile(String srcRelPath, String targetRelPath) Move an extraction file or folder inside a given directoryvoidservice(ServiceManager manager) static StringRemove the last separator from the uri if it has anyMethods 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:
servicein interfaceServiceable- Throws:
ServiceException
-
initialize
- Specified by:
initializein 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:
trueif the folder has a descendant in read access,falseotherwise
-
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:
trueif the folder has descendant,falseotherwise
-
canRead
Check if a user has read rights on an extraction container or file- Parameters:
userIdentity- the usersource- the source of the extraction container or file- Returns:
trueif the user has read rights on an extraction container,falseotherwise
-
canWrite
Check if a user has write rights on an extraction container or an extraction- Parameters:
userIdentity- the usersource- the source of the extraction file or extration container- Returns:
trueif the user has write rights on an extraction container,falseotherwise
-
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 or the extraction file- Parameters:
userIdentity- the usersource- the extraction container or the extraction file- 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 identitysource- the extraction container or the extraction filerecursively- 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 or an extraction file- Parameters:
userIdentity- the usersource- the source of the extraction container or file- Returns:
- true if the user can edit rights on an extraction container or file
-
_isRoot
Determines if the extraction container is the root node- Parameters:
folder- the extraction container- Returns:
- true if is root
-
getExtractionRightPath
Get the path for rights of an extraction container or file- Parameters:
source- the source of extraction container or file- Returns:
- the path for rights
-
getExtractionSource
Get the source corresponding to the right context of an extraction container or file- Parameters:
rightContext- The rights context such as '/extraction-dir/path/to/file- Returns:
- the resolved source file or null if the given context is not an extraction context
- Throws:
IOException- if an error occured
-
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
-
moveOrRenameExtractionDefinitionFile
public Map<String,Object> moveOrRenameExtractionDefinitionFile(String srcRelPath, String targetRelPath) throws IOException Move an extraction file or folder inside a given directory- Parameters:
srcRelPath- The relative URI of file/folder to movetargetRelPath- The target relative URI of file/folder to move- 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
-
getAuthor
Get the author of extraction- Parameters:
extractionPath- the path of the extraction- Returns:
- the author
-
trimLastFileSeparator
Remove the last separator from the uri if it has any- Parameters:
uri- the uri- Returns:
- the uri without any ending separator
-
getFilteredPath
Get the path of all children that match the provided value.- Parameters:
path- the path to the extraction to consider as rootvalue- the value- Returns:
- the list of path
-