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 | RequestConverter.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 | RequestConverter.java | Wed Dec 20 22:08:56 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 386 |
| 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.util.Arr ayList; | |
| 4 | import jav a.util.Lis t; | |
| 5 | ||
| 6 | import org .apache.co mmons.lang 3.StringUt ils; | |
| 7 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 8 | import org .springfra mework.cor e.convert. converter. Converter; | |
| 9 | import org .springfra mework.ste reotype.Co mponent; | |
| 10 | ||
| 11 | import gov .va.genisi s2.common. enums.Work flowStatus Enum; | |
| 12 | import gov .va.genisi s2.dto.Req uestDTO; | |
| 13 | import gov .va.genisi s2.model.D ataType; | |
| 14 | import gov .va.genisi s2.model.R equest; | |
| 15 | import gov .va.genisi s2.model.R equestType ; | |
| 16 | import gov .va.genisi s2.model.S ource; | |
| 17 | import gov .va.genisi s2.model.S tudyApprov al; | |
| 18 | import gov .va.genisi s2.util.Da teUtil; | |
| 19 | ||
| 20 | /** | |
| 21 | * This cl ass is use d to conve rt Request DTO to Req uest entit y and vice -versa. | |
| 22 | * | |
| 23 | * @author P II | |
| 24 | * | |
| 25 | */ | |
| 26 | @Component | |
| 27 | public cla ss Request Converter implements Converter <Request, RequestDTO > { | |
| 28 | ||
| 29 | @A utowired | |
| 30 | pr ivate Requ estTypeCon verter req uestTypeCo nverter; | |
| 31 | ||
| 32 | @A utowired | |
| 33 | pr ivate Stud yApprovalC onverter s tudyApprov alConverte r; | |
| 34 | ||
| 35 | @A utowired | |
| 36 | pr ivate Sour ceConverte r sourceCo nverter; | |
| 37 | ||
| 38 | @A utowired | |
| 39 | pr ivate Data TypeConver ter dataTy peConverte r; | |
| 40 | ||
| 41 | ||
| 42 | @O verride | |
| 43 | pu blic Reque stDTO conv ert(Reques t request) { | |
| 44 | Requ estDTO req uestDto = new Reques tDTO(); | |
| 45 | ||
| 46 | requ estDto.set Id(request .getId()); | |
| 47 | requ estDto.set ProcessId( request.ge tProcessId ()); | |
| 48 | requ estDto.set Title(requ est.getTit le()); | |
| 49 | requ estDto.set Descriptio n(request. getDescrip tion()); | |
| 50 | requ estDto.set StatusDesc ription(re quest.getS tatusDescr iption()); | |
| 51 | requ estDto.set CreatedOn( request.ge tCreatedOn ()); | |
| 52 | requ estDto.set ModifiedOn (request.g etModified On()); | |
| 53 | requ estDto.set CreatedBy( request.ge tCreatedBy ()); | |
| 54 | requ estDto.set ModifiedBy (request.g etModified By()); | |
| 55 | requ estDto.set ApproverId (request.g etApprover Id()); | |
| 56 | requ estDto.set TaskId(req uest.getTa skId()); | |
| 57 | ||
| 58 | requ estDto.set RequestTyp eId(reques t.getReque stTypeId() ); | |
| 59 | if ( null != re quest.getR equestType ()) { | |
| 60 | reques tDto.setRe questType( requestTyp eConverter .convert(r equest.get RequestTyp e())); | |
| 61 | } | |
| 62 | if ( request.ge tDataTypeI d() !=null ) | |
| 63 | requ estDto.set DataTypeId (request.g etDataType Id()); | |
| 64 | ||
| 65 | if ( null != re quest.getD ataType()) { | |
| 66 | reques tDto.setDa taType(dat aTypeConve rter.conve rt(request .getDataTy pe())); | |
| 67 | } | |
| 68 | ||
| 69 | requ estDto.set StudyAppro valId(requ est.getStu dyApproval Id()); | |
| 70 | if ( null != re quest.getS tudyApprov al()) { | |
| 71 | reques tDto.setSt udyApprova l(studyApp rovalConve rter.conve rt(request .getStudyA pproval()) ); | |
| 72 | } | |
| 73 | ||
| 74 | if(r equest.get SourceId() != null) | |
| 75 | requ estDto.set SourceId(r equest.get SourceId() ); | |
| 76 | if ( null != re quest.getS ource()) { | |
| 77 | reques tDto.setSo urce(sourc eConverter .convert(r equest.get Source())) ; | |
| 78 | } | |
| 79 | ||
| 80 | retu rn request Dto; | |
| 81 | } | |
| 82 | ||
| 83 | pu blic Reque st convert (RequestDT O requestD to) { | |
| 84 | Requ est reques t = new Re quest(); | |
| 85 | ||
| 86 | requ est.setId( requestDto .getId()); | |
| 87 | requ est.setPro cessId(0); | |
| 88 | requ est.setTit le(request Dto.getTit le()); | |
| 89 | requ est.setDes cription(r equestDto. getDescrip tion()); | |
| 90 | requ est.setSta tusDescrip tion("Draf t"); | |
| 91 | requ est.setCre atedOn(Dat eUtil.getT odaysDate( )); | |
| 92 | requ est.setMod ifiedOn(re questDto.g etModified On()); | |
| 93 | requ est.setCre atedBy(req uestDto.ge tCreatedBy ()); | |
| 94 | requ est.setMod ifiedBy(re questDto.g etModified By()); | |
| 95 | requ est.setApp roverId(re questDto.g etApprover Id()); | |
| 96 | requ est.setTas kId(reques tDto.getTa skId()); | |
| 97 | requ est.setDat aTypeId(0) ; | |
| 98 | requ est.setSou rceId(0); | |
| 99 | ||
| 100 | if ( requestDto .getDataTy peId() > 0 ) { | |
| 101 | reques t.setDataT ypeId(requ estDto.get DataTypeId ()); | |
| 102 | DataTy pe dataTyp e = new Da taType(); | |
| 103 | dataTy pe.setId(r equestDto. getDataTyp eId()); | |
| 104 | reques t.setDataT ype(dataTy pe); | |
| 105 | } | |
| 106 | ||
| 107 | if ( requestDto .getReques tTypeId() > 0) { | |
| 108 | reques t.setReque stTypeId(r equestDto. getRequest TypeId()); | |
| 109 | ||
| 110 | Reques tType requ estType = new Reques tType(); | |
| 111 | reques tType.setI d(requestD to.getRequ estTypeId( )); | |
| 112 | reques t.setReque stType(req uestType); | |
| 113 | } | |
| 114 | ||
| 115 | if ( requestDto .getSource Id() > 0) { | |
| 116 | reques t.setSourc eId(reques tDto.getSo urceId()); | |
| 117 | ||
| 118 | Source source = new Source (); | |
| 119 | source .setId(req uestDto.ge tSourceId( )); | |
| 120 | reques t.setSourc e(source); | |
| 121 | } | |
| 122 | ||
| 123 | if ( requestDto .getStudyA pprovalId( ) > 0) { | |
| 124 | reques t.setStudy ApprovalId (requestDt o.getStudy ApprovalId ()); | |
| 125 | ||
| 126 | StudyA pproval st udyApprova l = new St udyApprova l(); | |
| 127 | studyA pproval.se tId(reques tDto.getSt udyApprova lId()); | |
| 128 | reques t.setStudy Approval(s tudyApprov al); | |
| 129 | } | |
| 130 | ||
| 131 | retu rn request ; | |
| 132 | } | |
| 133 | ||
| 134 | pu blic List< RequestDTO > convertR equests(Li st<Request > requests ) { | |
| 135 | List <RequestDT O> request Dtos = nul l; | |
| 136 | ||
| 137 | if ( !requests. isEmpty()) { | |
| 138 | reques tDtos = ne w ArrayLis t<>(); | |
| 139 | for (R equest req uest : req uests) { | |
| 140 | requestD tos.add(co nvert(requ est)); | |
| 141 | } | |
| 142 | } | |
| 143 | ||
| 144 | retu rn request Dtos; | |
| 145 | } | |
| 146 | ||
| 147 | pu blic Reque st populat eRequest(i nt id, Req uestDTO ch angeReques tIn, Strin g operatio n, Request databaseR equest, | |
| 148 | Reques t changeRe quest) { | |
| 149 | ||
| 150 | if ( StringUtil s.equalsIg noreCase(o peration, WorkflowSt atusEnum.R ETURNTODDM .getDesc() )) { | |
| 151 | change Request.se tStatusDes cription(W orkflowSta tusEnum.SU BMITTED.ge tDesc()); | |
| 152 | } el se if (!St ringUtils. equalsIgno reCase(ope ration, "U pdate")) { | |
| 153 | change Request.se tStatusDes cription(o peration); | |
| 154 | } | |
| 155 | ||
| 156 | if ( changeRequ est.getPro cessId() = = 0) | |
| 157 | change Request.se tProcessId (databaseR equest.get ProcessId( )); | |
| 158 | ||
| 159 | if ( changeRequ est.getSou rce() == n ull) | |
| 160 | change Request.se tSource(da tabaseRequ est.getSou rce()); | |
| 161 | ||
| 162 | if ( changeRequ est.getStu dyApproval () == null ) | |
| 163 | change Request.se tStudyAppr oval(datab aseRequest .getStudyA pproval()) ; | |
| 164 | ||
| 165 | if ( changeRequ est.getReq uestType() == null) | |
| 166 | change Request.se tRequestTy pe(databas eRequest.g etRequestT ype()); | |
| 167 | ||
| 168 | if ( changeRequ est.getDat aType() == null) | |
| 169 | change Request.se tDataType( databaseRe quest.getD ataType()) ; | |
| 170 | ||
| 171 | ||
| 172 | if ( StringUtil s.isBlank( changeRequ est.getSta tusDescrip tion())) | |
| 173 | change Request.se tStatusDes cription(d atabaseReq uest.getSt atusDescri ption()); | |
| 174 | ||
| 175 | if ( StringUtil s.isBlank( changeRequ est.getTit le())) | |
| 176 | change Request.se tTitle(dat abaseReque st.getTitl e()); | |
| 177 | ||
| 178 | if ( StringUtil s.isBlank( changeRequ est.getDes cription() )) | |
| 179 | change Request.se tDescripti on(databas eRequest.g etDescript ion()); | |
| 180 | ||
| 181 | chan geRequest. setModifie dOn(DateUt il.getToda ysDate()); | |
| 182 | chan geRequest. setModifie dBy(change RequestIn. getCreated By()); | |
| 183 | ||
| 184 | chan geRequest. setCreated By(databas eRequest.g etCreatedB y()); | |
| 185 | chan geRequest. setCreated On(databas eRequest.g etCreatedO n()); | |
| 186 | chan geRequest. setApprove rId(databa seRequest. getApprove rId()); | |
| 187 | ||
| 188 | chan geRequest. setId(id); | |
| 189 | ||
| 190 | retu rn changeR equest; | |
| 191 | } | |
| 192 | ||
| 193 | ||
| 194 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.