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
-
-
Constructor Summary
Constructors Constructor Description ExtractionDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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 oneString
getExtractionAbsolutePathFromContext(String context)
Get the absolute path of an extraction or an extraction from the contextMap<String,Object>
getExtractionContainerProperties(TraversableSource folder)
Get extraction container propertiesMap<String,Object>
getExtractionProperties(Extraction extraction, TraversableSource file)
Get extraction propertiesString
getExtractionRightPath(Source source)
Get the relative path of an extraction or an extraction containerMap<String,Object>
getRootProperties()
Get the root container propertiesUserIdentity
getUserIdentityByExtractionPath(FileSource extractionPath)
get the author of extractionBoolean
hasAnyAssignableDescendant(UserIdentity userIdentity, TraversableSource folder)
Check if a folder has descendant for a given userBoolean
hasAnyReadableDescendant(UserIdentity userIdentity, TraversableSource folder)
Check if a folder has a descendant in read access for a given userBoolean
hasAnyWritableDescendant(UserIdentity userIdentity, TraversableSource folder)
Check if a folder has descendant in write access for a given userboolean
hasAssignationRightOnExtractionContainer(UserIdentity userIdentity, TraversableSource folder)
Check if a user has right affectation rights on an extraction containerboolean
hasReadRightOnExtraction(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author)
Check if a user has read rights on an extractionboolean
hasReadRightOnExtractionContainer(UserIdentity userIdentity, TraversableSource folder)
Check if a user has read rights on an extraction containerboolean
hasRightAffectationRightOnExtraction(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author)
Check if a user has right affectation rights on an extraction containerboolean
hasWriteRightOnExtraction(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author)
Check if a user has write rights on an extractionboolean
hasWriteRightOnExtractionAndParent(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author, TraversableSource file)
Check if a user has write rights on an extractionboolean
hasWriteRightOnExtractionContainer(UserIdentity userIdentity, TraversableSource folder)
Check if a user has write rights on an extraction containervoid
initialize()
Map<String,Object>
moveExtractionDefinitionFile(String srcRelPath, String parentRelPath)
Move an extraction file or folder inside a given directoryMap<String,Object>
moveSource(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
-
-
-
-
Constructor Detail
-
ExtractionDAO
public ExtractionDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getRootProperties
public Map<String,Object> getRootProperties() throws IOException
Get the root container properties- Returns:
- The root container properties
- Throws:
IOException
- If an error occurred while reading folder
-
getExtractionContainerProperties
public Map<String,Object> getExtractionContainerProperties(TraversableSource folder)
Get extraction container properties- Parameters:
folder
- the source of the extraction container- Returns:
- The extraction container properties
-
getExtractionProperties
public Map<String,Object> getExtractionProperties(Extraction extraction, TraversableSource file)
Get extraction properties- Parameters:
extraction
- the extractionfile
- the source of the extraction- Returns:
- The extraction properties
-
hasAnyReadableDescendant
public Boolean hasAnyReadableDescendant(UserIdentity userIdentity, TraversableSource folder)
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
public Boolean hasAnyWritableDescendant(UserIdentity userIdentity, TraversableSource folder)
Check if a folder has descendant in write access for a given user- Parameters:
userIdentity
- the userfolder
- the source of the extraction container- Returns:
true
if the folder has descendant in write access,false
otherwise
-
hasAnyAssignableDescendant
public Boolean hasAnyAssignableDescendant(UserIdentity userIdentity, TraversableSource folder)
Check if a folder has descendant for a given user- Parameters:
userIdentity
- the userfolder
- the source of the extraction container- Returns:
true
if the folder has descendant,false
otherwise
-
hasReadRightOnExtractionContainer
public boolean hasReadRightOnExtractionContainer(UserIdentity userIdentity, TraversableSource folder)
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
-
hasWriteRightOnExtractionContainer
public boolean hasWriteRightOnExtractionContainer(UserIdentity userIdentity, TraversableSource folder)
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
-
hasAssignationRightOnExtractionContainer
public boolean hasAssignationRightOnExtractionContainer(UserIdentity userIdentity, TraversableSource folder)
Check if a user has right affectation rights on an extraction container- Parameters:
userIdentity
- the userfolder
- the source of the extraction container- Returns:
true
if the user have right affectation rights on an extraction container,false
otherwise
-
hasReadRightOnExtraction
public boolean hasReadRightOnExtraction(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author)
Check if a user has read rights on an extraction- Parameters:
userIdentity
- the userextraction
- the source for the extractionauthor
- the extraction author- Returns:
true
if the user has read rights on an extraction,false
otherwise
-
hasWriteRightOnExtraction
public boolean hasWriteRightOnExtraction(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author)
Check if a user has write rights on an extraction- Parameters:
userIdentity
- the userextraction
- the source for the extractionauthor
- the extraction author- Returns:
true
if the user has write rights on an extraction,false
otherwise
-
hasWriteRightOnExtractionAndParent
public boolean hasWriteRightOnExtractionAndParent(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author, TraversableSource file)
Check if a user has write rights on an extraction- Parameters:
userIdentity
- the userextraction
- the source for the extractionauthor
- the extraction authorfile
- file- Returns:
true
if the user has write rights on an extraction,false
otherwise
-
hasRightAffectationRightOnExtraction
public boolean hasRightAffectationRightOnExtraction(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author)
Check if a user has right affectation rights on an extraction container- Parameters:
userIdentity
- the userextraction
- the source for the extractionauthor
- the extraction author- Returns:
true
if the user has right affectation rights on an extraction,false
otherwise
-
getExtractionRightPath
public String getExtractionRightPath(Source source)
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
public String getExtractionAbsolutePathFromContext(String context) throws IOException
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
public void copyRights(String sourceContext, String targetContext)
Copy rights from one context to another one- Parameters:
sourceContext
- the source contexttargetContext
- the target context
-
deleteRights
public void deleteRights(String context)
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
public void deleteRightsRecursively(String context, TraversableSource file)
Copy rights from one context to another one- Parameters:
context
- the contextfile
- the source of the file to copy
-
getUserIdentityByExtractionPath
public UserIdentity getUserIdentityByExtractionPath(FileSource extractionPath)
get the author of extraction- Parameters:
extractionPath
- the path of the extraction- Returns:
- the author
-
-