Produced by Araxis Merge on 12/20/2017 5:56:12 PM Eastern Standard 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 | Genisis_2.0_v6_bld6.zip\Source Code\UI\Services\src\main\java\gov\va\genisis2\converter | AttachmentConverter.java | Thu Dec 14 19:57:07 2017 UTC |
| 2 | Genisis_2.0_v6_bld6.zip\Source Code\UI\Services\src\main\java\gov\va\genisis2\converter | AttachmentConverter.java | Wed Dec 20 22:08:16 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 230 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| 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.genis is2.conver ter; | |
| 2 | ||
| 3 | import jav a.io.File; | |
| 4 | import jav a.io.IOExc eption; | |
| 5 | ||
| 6 | import org .apache.co mmons.lang 3.StringUt ils; | |
| 7 | import org .json.JSON Object; | |
| 8 | import org .springfra mework.cor e.convert. converter. Converter; | |
| 9 | import org .springfra mework.ste reotype.Co mponent; | |
| 10 | import org .springfra mework.web .multipart .Multipart File; | |
| 11 | ||
| 12 | import gov .va.genisi s2.dto.Att achmentDTO ; | |
| 13 | import gov .va.genisi s2.model.A ttachment; | |
| 14 | ||
| 15 | /** | |
| 16 | * This cl ass is use d to conve rt Attache mentDTO to Attacheme nt entity and | |
| 17 | * vice-ve rsa. | |
| 18 | * | |
| 19 | * @author PII | |
| 20 | * | |
| 21 | */ | |
| 22 | @Component | |
| 23 | public cla ss Attachm entConvert er impleme nts Conver ter<Attach ment, Atta chmentDTO> { | |
| 24 | ||
| 25 | @O verride | |
| 26 | pu blic Attac hmentDTO c onvert(Att achment at tachment) { | |
| 27 | ||
| 28 | Atta chmentDTO attachment DTO = new Attachment DTO(); | |
| 29 | atta chmentDTO. setAttachm entId(atta chment.get Attachment Id()); | |
| 30 | atta chmentDTO. setName(at tachment.g etName()); | |
| 31 | atta chmentDTO. setFileDat a(attachme nt.getFile Data()); | |
| 32 | atta chmentDTO. setRequest Id(attachm ent.getReq uest().get Id()); | |
| 33 | atta chmentDTO. setCreated By(attachm ent.getCre atedBy()); | |
| 34 | atta chmentDTO. setCreated On(attachm ent.getCre atedOn()); | |
| 35 | atta chmentDTO. setStatus( attachment .getStatus ()); | |
| 36 | atta chmentDTO. setDescrip tion(attac hment.getD escription ()); | |
| 37 | atta chmentDTO. setType(at tachment.g etType()); | |
| 38 | //at tachmentDT O.setTaskI d("1"); | |
| 39 | retu rn attachm entDTO; | |
| 40 | } | |
| 41 | ||
| 42 | ||
| 43 | pu blic Attac hmentDTO c onvertToAt tachmentDT O(String j sonString, Multipart File file) { | |
| 44 | ||
| 45 | Atta chmentDTO attachment DTO = new Attachment DTO(); | |
| 46 | ||
| 47 | byte [] bytes = null; | |
| 48 | Stri ng fileXtn = StringU tils.EMPTY ; | |
| 49 | Stri ng filePri maryName = StringUti ls.EMPTY; | |
| 50 | Stri ng fileNam e = String Utils.EMPT Y; | |
| 51 | if ( !file.isEm pty()) { | |
| 52 | try { | |
| 53 | fileXtn = file.get OriginalFi lename().s plit("\\." )[1]; | |
| 54 | fileName = file.ge tOriginalF ilename(). split("\\. ")[0]; | |
| 55 | fileName = file.ge tOriginalF ilename(); | |
| 56 | bytes = file.getBy tes(); | |
| 57 | } catc h (IOExcep tion e) { | |
| 58 | // TODO Auto-gener ated catch block | |
| 59 | e.printS tackTrace( ); | |
| 60 | } | |
| 61 | } | |
| 62 | /*{ | |
| 63 | "requestId " : 1, | |
| 64 | "comment": "This is comment fo r request 123444 hel lo", | |
| 65 | "status": "Sent", | |
| 66 | "createdBy ": "datama nager1" | |
| 67 | }*/ | |
| 68 | ||
| 69 | JSON Object jso n = new JS ONObject(j sonString) ; | |
| 70 | int requestId = (int) js on.get("re questId"); | |
| 71 | Stri ng created By = (Stri ng) json.g et("create dBy"); | |
| 72 | Stri ng status = (String) json.get( "status"); | |
| 73 | ||
| 74 | atta chmentDTO. setName(fi leName); | |
| 75 | atta chmentDTO. setFileDat a(bytes); | |
| 76 | atta chmentDTO. setRequest Id(request Id); | |
| 77 | atta chmentDTO. setCreated By(created By); | |
| 78 | // atta chmentDTO. setCreated On(attachm ent.getCre atedOn()); | |
| 79 | atta chmentDTO. setStatus( status); | |
| 80 | // atta chmentDTO. setDescrip tion(attac hment.getD escription ()); | |
| 81 | atta chmentDTO. setType(fi leXtn); | |
| 82 | ||
| 83 | ||
| 84 | ||
| 85 | ||
| 86 | /*at tachmentDT O.setAttac hmentId(at tachment.g etAttachme ntId()); | |
| 87 | atta chmentDTO. setName(at tachment.g etName()); | |
| 88 | atta chmentDTO. setFileDat a(attachme nt.getFile Data()); | |
| 89 | atta chmentDTO. setRequest Id(attachm ent.getReq uest().get Id()); | |
| 90 | atta chmentDTO. setCreated By(attachm ent.getCre atedBy()); | |
| 91 | atta chmentDTO. setCreated On(attachm ent.getCre atedOn()); | |
| 92 | atta chmentDTO. setStatus( attachment .getStatus ()); | |
| 93 | atta chmentDTO. setDescrip tion(attac hment.getD escription ()); | |
| 94 | atta chmentDTO. setType(at tachment.g etType()); | |
| 95 | //at tachmentDT O.setTaskI d("1"); | |
| 96 | */ retu rn attachm entDTO; | |
| 97 | } | |
| 98 | ||
| 99 | ||
| 100 | pu blic Attac hment conv ert(Attach mentDTO at tachmentDt o) { | |
| 101 | ||
| 102 | Atta chment att achment = new Attach ment(); | |
| 103 | atta chment.set Attachment Id(attachm entDto.get Attachment Id()); | |
| 104 | atta chment.set Name(attac hmentDto.g etName()); | |
| 105 | atta chment.set FileData(a ttachmentD to.getFile Data()); | |
| 106 | atta chment.set RequestId( attachment Dto.getReq uestId()); | |
| 107 | atta chment.set CreatedBy( attachment Dto.getCre atedBy()); | |
| 108 | atta chment.set CreatedOn( attachment Dto.getCre atedOn()); | |
| 109 | atta chment.set Status(att achmentDto .getStatus ()); | |
| 110 | atta chment.set Descriptio n(attachme ntDto.getD escription ()); | |
| 111 | atta chment.set Type(attac hmentDto.g etType()); | |
| 112 | // atta chment.set TaskId("1" ); | |
| 113 | retu rn attachm ent; | |
| 114 | } | |
| 115 | ||
| 116 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.