Class ResolvedFileList
- java.lang.Object
-
- de.xima.fc.workflow.processor.model.ResolvedFileList
-
- All Implemented Interfaces:
IResolvedFileList
,IResourceItemResolutionErrorProviding
public final class ResolvedFileList extends Object implements IResolvedFileList
Default POJO implementation ofIResolvedFileList
.- Since:
- 8.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R,E extends Throwable>
RcollectResult(IResolvedFileListProcessor<R,E> handler)
Iterates over all resolved resource items, processes them with the given handler, and returns the combined result of all resource items.File
getContainingDirectory()
Retrieves the directory that contains all the resolved files; and only the resolved files.Map<EResourceItemResolutionError,List<AFileListResolutionError>>
getErrors()
IReferencedFileList
getFileList()
List<IResolvedResourceItem>
getResourceItems()
Retrieves the list of resolved resource items.static IResolvedFileList
ofError(AFileListResolutionError.CannotProcessFileList error)
Creates a new POJO with the given data and no containing directory and files.static IResolvedFileList
ofSuccess(IReferencedFileList fileList, File containingDirectory, List<IResolvedResourceItem> resourceItems)
Creates a new POJO with the given data and thegetErrors()
set tonull
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.fc.interfaces.workflow.retval.IResolvedFileList
getResolvedFilesComplete, getResolvedFilesPartial
-
Methods inherited from interface de.xima.fc.interfaces.workflow.retval.IResourceItemResolutionErrorProviding
getErrors, getErrorsAttachmentFilterDoesNotMatch, getErrorsCannotProcessFileList, getErrorsCannotProcessResourceItem, getErrorsClientFileDoesNotExist, getErrorsDatabaseError, getErrorsExternalUrlCannotBeRead, getErrorsExternalUrlIsSyntacticallyInvalid, getErrorsFileCountReducedTozeroByFilterOptions, getErrorsFileSystemError, getErrorsFormFileDoesNotExist, getErrorsNodeDoesNotExist, getErrorsNodeDoesNotProvideFiles, getErrorsNodeNotExecuted, getErrorsTriggerDoesNotExist, getErrorsTriggerDoesNotProvideFiles, getErrorsTriggerNotFired, getErrorsUploadFieldDoesNotExist, getErrorsUploadFieldDoesNotProvideFiles, isHasError
-
-
-
-
Method Detail
-
collectResult
public <R,E extends Throwable> R collectResult(IResolvedFileListProcessor<R,E> handler) throws E extends Throwable
Description copied from interface:IResolvedFileList
Iterates over all resolved resource items, processes them with the given handler, and returns the combined result of all resource items. Standard use case is to convert errors to hard and soft workflow node errors and return a list of all resolved files.If you wish to use the standard error behavior for files, use
standardFileErrorsSingle
orstandardFileErrorsMultiple
. Otherwise, provide your own processor implementation, or extends theStandardErrorFileListProcessor
.- Specified by:
collectResult
in interfaceIResolvedFileList
- Type Parameters:
R
- Type of the combined result of all resource items.E
- Type of the error that may be thrown when anyerrors
are present.- Parameters:
handler
- Handler for processing the errors and the results.- Returns:
- The combined result of all resource items.
- Throws:
E
- The first error thrown by the handler.E extends Throwable
-
getContainingDirectory
public File getContainingDirectory()
Description copied from interface:IResolvedFileList
Retrieves the directory that contains all the resolved files; and only the resolved files. The directory is empty when no files were found.- Specified by:
getContainingDirectory
in interfaceIResolvedFileList
- Returns:
- A temporary directory with all the files from the given descriptor.
null
whenIResourceItemResolutionErrorProviding.getErrors()
is notnull
.
-
getErrors
public Map<EResourceItemResolutionError,List<AFileListResolutionError>> getErrors()
- Specified by:
getErrors
in interfaceIResourceItemResolutionErrorProviding
- Returns:
- All errors that occurred during the resource item's resolution.
-
getFileList
public IReferencedFileList getFileList()
- Specified by:
getFileList
in interfaceIResolvedFileList
- Returns:
- The file list that was resolved to obtain this result.
-
getResourceItems
public List<IResolvedResourceItem> getResourceItems()
Description copied from interface:IResolvedFileList
Retrieves the list of resolved resource items. This list always contains one entry for eachResourceItem
that was passed toresolveReferencedFiles
, whether any exceptions occurred while resolving that item. WhenIResourceItemResolutionErrorProviding.getErrors()
is notnull
, this list is empty.- Specified by:
getResourceItems
in interfaceIResolvedFileList
- Returns:
- A list with the resolved files.
-
ofError
public static IResolvedFileList ofError(AFileListResolutionError.CannotProcessFileList error)
Creates a new POJO with the given data and no containing directory and files.- Parameters:
error
- Value as returned bygetErrors()
.- Returns:
- New resolved file list for the given error.
-
ofSuccess
public static IResolvedFileList ofSuccess(IReferencedFileList fileList, File containingDirectory, List<IResolvedResourceItem> resourceItems)
Creates a new POJO with the given data and thegetErrors()
set tonull
.- Parameters:
fileList
- Original file list that was processed.containingDirectory
- Value as returned bygetContainingDirectory()
.resourceItems
- Value as returned bygetResourceItems()
.- Returns:
- New resolved file list for the given resolved items.
-
-