Produced by Araxis Merge on 6/9/2017 3:51:30 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Jun 9 19:51:30 2017 UTC | ||
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-web\src\main\java\gov\va\nvap\web\util\file | FileUploadUtil.java | Fri Apr 21 20:03:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 89 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package go v.va.nvap. web.util.f ile; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 4 | ||||||
| 5 | import jav a.io.IOExc eption; | |||||
| 6 | import jav a.util.Arr ayList; | |||||
| 7 | import jav a.util.Has hMap; | |||||
| 8 | import jav a.util.Lis t; | |||||
| 9 | import jav a.util.Map ; | |||||
| 10 | ||||||
| 11 | import org .apache.co mmons.file upload.Fil eItem; | |||||
| 12 | ||||||
| 13 | /** | |||||
| 14 | * File up load utili ty. Uses a pache-file uploads AP I. | |||||
| 15 | * | |||||
| 16 | * @author Asha Amri traj | |||||
| 17 | */ | |||||
| 18 | public cla ss FileUpl oadUtil { | |||||
| 19 | ||||||
| 20 | /* * | |||||
| 21 | * Add file item to a list of it ems. | |||||
| 22 | * / | |||||
| 23 | pu blic stati c List<Fil eItem> add FileItem(f inal List< FileItem> fileItems, | |||||
| 24 | List<F ileItem> f ilesUpload ed) throws IOExcepti on { | |||||
| 25 | for (final Fil eItem file ItemTemp : fileItems ) { | |||||
| 26 | if (Nu llChecker. isNotEmpty (fileItemT emp) | |||||
| 27 | && !fileIt emTemp.isF ormField() ) { | |||||
| 28 | if (Null Checker.is Empty(file sUploaded) ) { | |||||
| 29 | filesUploa ded = new ArrayList< FileItem>( ); | |||||
| 30 | } | |||||
| 31 | if (Null Checker.is NotEmpty(f ileItemTem p)) { | |||||
| 32 | filesUploa ded.add(fi leItemTemp ); | |||||
| 33 | } | |||||
| 34 | } | |||||
| 35 | } | |||||
| 36 | retu rn filesUp loaded; | |||||
| 37 | } | |||||
| 38 | ||||||
| 39 | pu blic stati c List<Fil eItem> get FilesUploa ded(final List<FileI tem> fileI tems) { | |||||
| 40 | if ( NullChecke r.isEmpty( fileItems) ) { | |||||
| 41 | return null; | |||||
| 42 | } | |||||
| 43 | fina l List<Fil eItem> fil esUploaded = new Arr ayList<Fil eItem>(); | |||||
| 44 | for (final Fil eItem file Item : fil eItems) { | |||||
| 45 | if (Nu llChecker. isNotEmpty (fileItem) | |||||
| 46 | && !fileIt em.isFormF ield()) { | |||||
| 47 | if (Null Checker.is NotEmpty(f ileItem)) { | |||||
| 48 | filesUploa ded.add(fi leItem); | |||||
| 49 | } | |||||
| 50 | } | |||||
| 51 | } | |||||
| 52 | retu rn filesUp loaded; | |||||
| 53 | } | |||||
| 54 | ||||||
| 55 | pu blic stati c Map<Stri ng, String > getFormF ields( | |||||
| 56 | final List<FileI tem> fileI tems) { | |||||
| 57 | if ( NullChecke r.isEmpty( fileItems) ) { | |||||
| 58 | return null; | |||||
| 59 | } | |||||
| 60 | fina l Map<Stri ng, String > formFiel ds = new H ashMap<Str ing, Strin g>(); | |||||
| 61 | for (final Fil eItem file Item : fil eItems) { | |||||
| 62 | if (Nu llChecker. isNotEmpty (fileItem) ) { | |||||
| 63 | if (file Item.isFor mField()) { | |||||
| 64 | formFields .put(fileI tem.getFie ldName(), | |||||
| 65 | file Item.getSt ring()); | |||||
| 66 | } | |||||
| 67 | } | |||||
| 68 | } | |||||
| 69 | retu rn formFie lds; | |||||
| 70 | } | |||||
| 71 | ||||||
| 72 | /* * | |||||
| 73 | * Remove a file item from a lis t of items . | |||||
| 74 | * / | |||||
| 75 | pu blic stati c List<Fil eItem> rem oveFileIte m(final Li st<FileIte m> items, | |||||
| 76 | final String fil eName) { | |||||
| 77 | if ( NullChecke r.isNotEmp ty(items)) { | |||||
| 78 | if (Nu llChecker. isNotEmpty (fileName) ) { | |||||
| 79 | for (fin al FileIte m item : i tems) { | |||||
| 80 | if (fileNa me.equals( item.getNa me())) { | |||||
| 81 | it ems.remove (item); | |||||
| 82 | br eak; | |||||
| 83 | } | |||||
| 84 | } | |||||
| 85 | } | |||||
| 86 | } | |||||
| 87 | retu rn items; | |||||
| 88 | } | |||||
| 89 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.