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
Modifier and TypeClassDescriptionstatic enum
Possible add and update modesstatic class
Class representing the result of a resource operation. -
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user provider.protected ObservationManager
Observer manager.protected AmetysObjectResolver
The ametys resolverprotected ExplorerResourcesDAO
The resource DAOprotected RightManager
The right managerstatic final String
The Avalon role name -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_notifyResourcesCreated
(ModifiableResourceCollection parent, List<Resource> resources) Fire theObservationConstants.EVENT_RESOURCE_CREATED
eventprotected void
_notifyResourcesUpdated
(ModifiableResourceCollection parent, Resource resource) Fire theObservationConstants.EVENT_RESOURCE_UPDATED
eventvoid
checkAddResourceRight
(String folderId) Check right to add resourcesvoid
Check right to add resourcesperformResourceOperation
(File file, ModifiableResourceCollection parent, AddOrUpdateResourceHelper.ResourceOperationMode mode) Perform an add or update resource operationperformResourceOperation
(InputStream inputStream, String fileName, ModifiableResourceCollection parent, AddOrUpdateResourceHelper.ResourceOperationMode mode) Perform an add or update resource operationperformResourceOperation
(Part part, String parentId, AddOrUpdateResourceHelper.ResourceOperationMode mode) Perform an add or update resource operationperformResourceOperation
(Part part, ModifiableResourceCollection parent, AddOrUpdateResourceHelper.ResourceOperationMode mode) Perform an add or update resource operationvoid
service
(ServiceManager serviceManager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role name -
_resourcesDAO
The resource DAO -
_resolver
The ametys resolver -
_currentUserProvider
The current user provider. -
_observationManager
Observer manager. -
_rightManager
The right manager
-
-
Constructor Details
-
AddOrUpdateResourceHelper
public AddOrUpdateResourceHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
checkAddResourceRight
Check right to add resources- Parameters:
folderId
- the folder id to add resources
-
checkAddResourceRight
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
Fire theObservationConstants.EVENT_RESOURCE_UPDATED
event- Parameters:
parent
- The parent collection of the resourceresource
- The updated resource
-