public final class AddOrUpdateResourceHelper extends AbstractLogEnabled implements Component, Serviceable
Modifier and Type | Class and Description |
---|---|
static class |
AddOrUpdateResourceHelper.ResourceOperationMode
Possible add and update modes
|
static class |
AddOrUpdateResourceHelper.ResourceOperationResult
Class representing the result of a resource operation.
|
Modifier and Type | Field and Description |
---|---|
protected CurrentUserProvider |
_currentUserProvider
The current user provider.
|
protected ObservationManager |
_observationManager
Observer manager.
|
protected AmetysObjectResolver |
_resolver
The ametys resolver
|
protected ExplorerResourcesDAO |
_resourcesDAO
The resource DAO
|
static String |
ROLE
The Avalon role name
|
Constructor and Description |
---|
AddOrUpdateResourceHelper() |
getLogger, setLogger
protected ExplorerResourcesDAO _resourcesDAO
protected AmetysObjectResolver _resolver
protected CurrentUserProvider _currentUserProvider
protected ObservationManager _observationManager
public AddOrUpdateResourceHelper()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
ServiceException
public AddOrUpdateResourceHelper.ResourceOperationResult performResourceOperation(Part part, String parentId, AddOrUpdateResourceHelper.ResourceOperationMode mode)
part
- The part representing the file for this operationparentId
- The identifier of the parent collectionmode
- The operation modepublic AddOrUpdateResourceHelper.ResourceOperationResult performResourceOperation(Part part, ModifiableResourceCollection parent, AddOrUpdateResourceHelper.ResourceOperationMode mode)
part
- The part representing the file for this operationparent
- The parent collectionmode
- The operation modepublic AddOrUpdateResourceHelper.ResourceOperationResult performResourceOperation(File file, ModifiableResourceCollection parent, AddOrUpdateResourceHelper.ResourceOperationMode mode)
file
- The file for this operationparent
- The parent collectionmode
- The operation modepublic AddOrUpdateResourceHelper.ResourceOperationResult performResourceOperation(InputStream inputStream, String fileName, ModifiableResourceCollection parent, AddOrUpdateResourceHelper.ResourceOperationMode mode)
inputStream
- The data for this operationfileName
- file name requestedparent
- The parent collectionmode
- The operation modeprotected void _notifyResourcesCreated(ModifiableResourceCollection parent, List<Resource> resources)
ObservationConstants.EVENT_RESOURCE_CREATED
eventparent
- The parent collection of the resourceresources
- The created resourcesprotected void _notifyResourcesUpdated(ModifiableResourceCollection parent, Resource resource)
ObservationConstants.EVENT_RESOURCE_UPDATED
eventparent
- The parent collection of the resourceresource
- The updated resourceprivate AddOrUpdateResourceHelper.ResourceOperationResult _unzip(ModifiableResourceCollection collection, File file)
collection
- The collection where to unzipfile
- The zip fileprivate List<Resource> _unzip(ModifiableResourceCollection collection, ZipFile zipFile) throws IOException
IOException
private ModifiableResourceCollection _addCollection(ModifiableResourceCollection collection, String name)
private Resource _addZipEntry(ModifiableResourceCollection collection, ZipFile zipFile, ZipArchiveEntry zipEntry, String fileName) throws IOException
IOException