Class AddOrUpdateResourceHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.explorer.resources.actions.AddOrUpdateResourceHelper
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public final class AddOrUpdateResourceHelper extends AbstractLogEnabled implements Component, Serviceable
Dedicated helper in order to add or update an explorer resource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AddOrUpdateResourceHelper.ResourceOperationMode
Possible add and update modesstatic class
AddOrUpdateResourceHelper.ResourceOperationResult
Class representing the result of a resource operation.
-
Field Summary
Fields Modifier and Type Field Description protected CurrentUserProvider
_currentUserProvider
The current user provider.protected ObservationManager
_observationManager
Observer manager.protected AmetysObjectResolver
_resolver
The ametys resolverprotected ExplorerResourcesDAO
_resourcesDAO
The resource DAOprotected RightManager
_rightManager
The right managerstatic String
ROLE
The Avalon role name
-
Constructor Summary
Constructors Constructor Description AddOrUpdateResourceHelper()
-
Method Summary
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_resourcesDAO
protected ExplorerResourcesDAO _resourcesDAO
The resource DAO
-
_resolver
protected AmetysObjectResolver _resolver
The ametys resolver
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider.
-
_observationManager
protected ObservationManager _observationManager
Observer manager.
-
_rightManager
protected RightManager _rightManager
The right manager
-
-
Constructor Detail
-
AddOrUpdateResourceHelper
public AddOrUpdateResourceHelper()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
checkAddResourceRight
public void checkAddResourceRight(String folderId)
Check right to add resources- Parameters:
folderId
- the folder id to add resources
-
checkAddResourceRight
public void checkAddResourceRight(ModifiableResourceCollection folder)
Check right to add resources- Parameters:
folder
- the folder to add resources
-
performResourceOperation
public AddOrUpdateResourceHelper.ResourceOperationResult performResourceOperation(Part part, String parentId, AddOrUpdateResourceHelper.ResourceOperationMode mode)
Perform an add or update resource operation- Parameters:
part
- The part representing the file for this operationparentId
- The identifier of the parent collectionmode
- The operation mode- Returns:
- the result of the operation
-
performResourceOperation
public AddOrUpdateResourceHelper.ResourceOperationResult performResourceOperation(Part part, ModifiableResourceCollection parent, AddOrUpdateResourceHelper.ResourceOperationMode mode)
Perform an add or update resource operation- Parameters:
part
- The part representing the file for this operationparent
- The parent collectionmode
- The operation mode- Returns:
- the result of the operation
-
performResourceOperation
public AddOrUpdateResourceHelper.ResourceOperationResult performResourceOperation(File file, ModifiableResourceCollection parent, AddOrUpdateResourceHelper.ResourceOperationMode mode)
Perform an add or update resource operation- Parameters:
file
- The file for this operationparent
- The parent collectionmode
- The operation mode- Returns:
- the result of the operation
-
performResourceOperation
public AddOrUpdateResourceHelper.ResourceOperationResult performResourceOperation(InputStream inputStream, String fileName, ModifiableResourceCollection parent, AddOrUpdateResourceHelper.ResourceOperationMode mode)
Perform an add or update resource operation- Parameters:
inputStream
- The data for this operationfileName
- file name requestedparent
- The parent collectionmode
- The operation mode- Returns:
- the result of the operation
-
_notifyResourcesCreated
protected void _notifyResourcesCreated(ModifiableResourceCollection parent, List<Resource> resources)
Fire theObservationConstants.EVENT_RESOURCE_CREATED
event- Parameters:
parent
- The parent collection of the resourceresources
- The created resources
-
_notifyResourcesUpdated
protected void _notifyResourcesUpdated(ModifiableResourceCollection parent, Resource resource)
Fire theObservationConstants.EVENT_RESOURCE_UPDATED
event- Parameters:
parent
- The parent collection of the resourceresource
- The updated resource
-
-