Class FormFiles
java.lang.Object
com.inductiveautomation.perspective.gateway.util.FormFiles
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseAll(@Nullable Map<String, List<UploadedFile>> files) Closes everyUploadedFilein the supplied field-keyed map.static Map<String,List<UploadedFile>> groupByField(List<UploadedFilePart> parts, Map<String, FileSubmissionIndex.FieldFileEntry> fileIdIndex) Joins a flat list ofUploadedFileParts with aFileId -> FieldFileEntryindex (typically built byFileSubmissionIndex) and produces a field-keyed map ofUploadedFiles.
-
Method Details
-
groupByField
public static Map<String,List<UploadedFile>> groupByField(List<UploadedFilePart> parts, Map<String, FileSubmissionIndex.FieldFileEntry> fileIdIndex) Joins a flat list ofUploadedFileParts with aFileId -> FieldFileEntryindex (typically built byFileSubmissionIndex) and produces a field-keyed map ofUploadedFiles. Each part's owning field and user-facing display name are looked up by the part'sFileId.Parts with no matching index entry are dropped with a warn log — this can happen if a client uploads a binary whose id isn't referenced in the submission JSON. The returned files own their underlying deferred content; the caller is responsible for closing them via
closeAll(Map)once they are no longer needed. -
closeAll
Closes everyUploadedFilein the supplied field-keyed map. Tolerant of nulls.
-