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 voidcopyRights(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 oneStringgetExtractionAbsolutePathFromContext(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 propertiesStringgetExtractionRightPath(Source source)Get the relative path of an extraction or an extraction containerMap<String,Object>getRootProperties()Get the root container propertiesUserIdentitygetUserIdentityByExtractionPath(FileSource extractionPath)get the author of extractionBooleanhasAnyAssignableDescendant(UserIdentity userIdentity, TraversableSource folder)Check if a folder has descendant for a given userBooleanhasAnyReadableDescendant(UserIdentity userIdentity, TraversableSource folder)Check if a folder has a descendant in read access for a given userBooleanhasAnyWritableDescendant(UserIdentity userIdentity, TraversableSource folder)Check if a folder has descendant in write access for a given userbooleanhasAssignationRightOnExtractionContainer(UserIdentity userIdentity, TraversableSource folder)Check if a user has right affectation rights on an extraction containerbooleanhasReadRightOnExtraction(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author)Check if a user has read rights on an extractionbooleanhasReadRightOnExtractionContainer(UserIdentity userIdentity, TraversableSource folder)Check if a user has read rights on an extraction containerbooleanhasRightAffectationRightOnExtraction(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author)Check if a user has right affectation rights on an extraction containerbooleanhasWriteRightOnExtraction(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author)Check if a user has write rights on an extractionbooleanhasWriteRightOnExtractionAndParent(UserIdentity userIdentity, TraversableSource extraction, UserIdentity author, TraversableSource file)Check if a user has write rights on an extractionbooleanhasWriteRightOnExtractionContainer(UserIdentity userIdentity, TraversableSource folder)Check if a user has write rights on an extraction containervoidinitialize()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 foldervoidservice(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:
servicein interfaceServiceable- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initializein 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:
trueif the folder has a descendant in read access,falseotherwise
-
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:
trueif the folder has descendant in write access,falseotherwise
-
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:
trueif the folder has descendant,falseotherwise
-
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:
trueif the user has read rights on an extraction container,falseotherwise
-
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:
trueif the user has write rights on an extraction container,falseotherwise
-
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:
trueif the user have right affectation rights on an extraction container,falseotherwise
-
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:
trueif the user has read rights on an extraction,falseotherwise
-
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:
trueif the user has write rights on an extraction,falseotherwise
-
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:
trueif the user has write rights on an extraction,falseotherwise
-
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:
trueif the user has right affectation rights on an extraction,falseotherwise
-
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
-
-