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 ClassesModifier and TypeClassDescriptionstatic enumPossible add and update modesstatic classClass representing the result of a resource operation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user provider.protected ObservationManagerObserver manager.protected AmetysObjectResolverThe ametys resolverprotected ExplorerResourcesDAOThe resource DAOprotected RightManagerThe right managerstatic final StringThe Avalon role name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_notifyResourcesCreated(ModifiableResourceCollection parent, List<Resource> resources) Fire theObservationConstants.EVENT_RESOURCE_CREATEDeventprotected void_notifyResourcesUpdated(ModifiableResourceCollection parent, Resource resource) Fire theObservationConstants.EVENT_RESOURCE_UPDATEDeventvoidcheckAddResourceRight(String folderId) Check right to add resourcesvoidCheck 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 operationvoidservice(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:
servicein 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_CREATEDevent- Parameters:
parent- The parent collection of the resourceresources- The created resources
-
_notifyResourcesUpdated
Fire theObservationConstants.EVENT_RESOURCE_UPDATEDevent- Parameters:
parent- The parent collection of the resourceresource- The updated resource
-