Produced by Araxis Merge on 12/21/2017 6:15:13 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_v7_bld7.zip\TS\Service\mapping-service\src\main\java\gov\va\genisis2\ms\controller | MappingServiceController.java | Thu Dec 14 19:57:16 2017 UTC |
| 2 | Genisis_2.0_v7_bld7.zip\TS\Service\mapping-service\src\main\java\gov\va\genisis2\ms\controller | MappingServiceController.java | Thu Dec 21 22:06:13 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 248 |
| 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.ms.con troller; | |
| 2 | ||
| 3 | import org .apache.lo gging.log4 j.LogManag er; | |
| 4 | import org .apache.lo gging.log4 j.Logger; | |
| 5 | import org .owasp.esa pi.ESAPI; | |
| 6 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 7 | import org .springfra mework.dat a.jpa.repo sitory.con fig.Enable JpaReposit ories; | |
| 8 | import org .springfra mework.htt p.HttpStat us; | |
| 9 | import org .springfra mework.htt p.Response Entity; | |
| 10 | import org .springfra mework.web .bind.anno tation.Cro ssOrigin; | |
| 11 | import org .springfra mework.web .bind.anno tation.Exc eptionHand ler; | |
| 12 | import org .springfra mework.web .bind.anno tation.Req uestBody; | |
| 13 | import org .springfra mework.web .bind.anno tation.Req uestMappin g; | |
| 14 | import org .springfra mework.web .bind.anno tation.Req uestMethod ; | |
| 15 | import org .springfra mework.web .bind.anno tation.Req uestParam; | |
| 16 | import org .springfra mework.web .bind.anno tation.Res ponseBody; | |
| 17 | import org .springfra mework.web .bind.anno tation.Res tControlle r; | |
| 18 | ||
| 19 | import gov .va.genisi s2.ms.data .model.Con ceptMappin g; | |
| 20 | import gov .va.genisi s2.ms.serv ice.IConce ptMappingS ervice; | |
| 21 | import gov .va.genisi s2.ts.comm on.dto.Con ceptMappin gDTO; | |
| 22 | import gov .va.genisi s2.ts.comm on.enums.E rrorEnum; | |
| 23 | import gov .va.genisi s2.ts.comm on.excepti on.TSDupli cateDataEx ception; | |
| 24 | import gov .va.genisi s2.ts.comm on.excepti on.TSInern alSystemEx ception; | |
| 25 | import gov .va.genisi s2.ts.comm on.excepti on.TSNoDat aFoundExce ption; | |
| 26 | ||
| 27 | /** | |
| 28 | * Spring REST Contr oller clas s for Term inology Ma pping serv ice | |
| 29 | * | |
| 30 | * @author P II | |
| 31 | * | |
| 32 | */ | |
| 33 | @CrossOrig in(origins = "*") | |
| 34 | @RestContr oller | |
| 35 | @RequestMa pping("/") | |
| 36 | @EnableJpa Repositori es("gov.va .genisis2. ms.data.re pository") | |
| 37 | public cla ss Mapping ServiceCon troller { | |
| 38 | ||
| 39 | pr ivate stat ic final L ogger LOGG ER = LogMa nager.getL ogger(Mapp ingService Controller .class); | |
| 40 | ||
| 41 | @A utowired | |
| 42 | pr ivate ICon ceptMappin gService c onceptMapp ingService ; | |
| 43 | ||
| 44 | @R equestMapp ing(value = "/mappin gs", metho d = Reques tMethod.GE T, consume s = "appli cation/jso n", produc es = "appl ication/js on") | |
| 45 | @R esponseBod y | |
| 46 | pu blic Respo nseEntity< ConceptMap pingDTO> g etConceptM appingByCo nceptUri(@ RequestPar am(value = "conceptU ri", requi red = true ) String c onceptUri) { | |
| 47 | if ( LOGGER.isI nfoEnabled ()) { | |
| 48 | LOGGER .info("get ConceptMap pingByConc eptUri"); | |
| 49 | } | |
| 50 | ||
| 51 | Conc eptMapping DTO concep tMappingDt o = null; | |
| 52 | try { | |
| 53 | concep tMappingDt o = concep tMappingSe rvice.getC onceptMapp ingByConce ptUri(conc eptUri); | |
| 54 | } ca tch (Excep tion e) { | |
| 55 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 56 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 57 | } | |
| 58 | ||
| 59 | if ( null == co nceptMappi ngDto) { | |
| 60 | LOGGER .error(Str ing.format (ErrorEnum .CONCEPT_M APPING_NO_ DATA_FOUND _ERROR.get ErrorMessa ge(), conc eptUri)); | |
| 61 | throw new TSNoDa taFoundExc eption(Str ing.format (ErrorEnum .CONCEPT_M APPING_NO_ DATA_FOUND _ERROR.get ErrorMessa ge(), conc eptUri)); | |
| 62 | } el se { | |
| 63 | return new Respo nseEntity< ConceptMap pingDTO>(c onceptMapp ingDto, Ht tpStatus.O K); | |
| 64 | } | |
| 65 | } | |
| 66 | ||
| 67 | @S uppressWar nings("raw types") | |
| 68 | @R equestMapp ing(value = "/mappin gs", metho d = Reques tMethod.PO ST, consum es = "appl ication/js on", produ ces = "app lication/j son") | |
| 69 | @R esponseBod y | |
| 70 | pu blic Respo nseEntity createConc eptMapping (@RequestB ody Concep tMappingDT O conceptM appingDto) { | |
| 71 | if ( LOGGER.isI nfoEnabled ()) { | |
| 72 | LOGGER .info("cre ateConcept Mapping"); | |
| 73 | } | |
| 74 | ||
| 75 | try { | |
| 76 | Concep tMapping e xistingCon ceptMappin g = concep tMappingSe rvice.remo veConceptM apping(con ceptMappin gDto); | |
| 77 | concep tMappingSe rvice.crea teConceptM apping(con ceptMappin gDto, exis tingConcep tMapping); | |
| 78 | } ca tch (TSDup licateData Exception ex) { | |
| 79 | throw ex; | |
| 80 | } ca tch (Excep tion e) { | |
| 81 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 82 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 83 | } | |
| 84 | ||
| 85 | retu rn new Res ponseEntit y<>(HttpSt atus.CREAT ED); | |
| 86 | } | |
| 87 | ||
| 88 | /* * | |
| 89 | * No data f ound excep tion. | |
| 90 | * | |
| 91 | * @param ex | |
| 92 | * the ex | |
| 93 | * @return t he respons e entity | |
| 94 | * / | |
| 95 | @E xceptionHa ndler({ TS NoDataFoun dException .class }) | |
| 96 | pu blic Respo nseEntity< Object> ex ceptionHan dler(TSNoD ataFoundEx ception ex ) { | |
| 97 | retu rn new Res ponseEntit y<Object>( | |
| 98 | ESAPI.en coder().en codeForHTM L( ex.getM essage( )) , HttpStat us.NOT_FOU ND); | |
| 99 | } | |
| 100 | ||
| 101 | /* * | |
| 102 | * Duplicate data exce ption for create API calls | |
| 103 | * | |
| 104 | * @param ex | |
| 105 | * the ex | |
| 106 | * @return t he respons e entity | |
| 107 | * / | |
| 108 | @E xceptionHa ndler({ TS DuplicateD ataExcepti on.class } ) | |
| 109 | pu blic Respo nseEntity< Object> ex ceptionHan dler(TSDup licateData Exception ex) { | |
| 110 | retu rn new Res ponseEntit y<Object>( | |
| 111 | ESAPI.en coder().en codeForHTM L(ex.getMe ssage()), HttpStatus .BAD_REQUE ST); | |
| 112 | } | |
| 113 | ||
| 114 | /* * | |
| 115 | * Internal System Err or excepti on | |
| 116 | * | |
| 117 | * @param ex | |
| 118 | * the ex | |
| 119 | * @return t he respons e entity | |
| 120 | * / | |
| 121 | @E xceptionHa ndler({ TS InernalSys temExcepti on.class } ) | |
| 122 | pu blic Respo nseEntity< Object> ex ceptionHan dler(TSIne rnalSystem Exception ex) { | |
| 123 | retu rn new Res ponseEntit y<Object>( ErrorEnum. INTERNAL_S YS_ERROR.g etErrorMes sage(), Ht tpStatus.I NTERNAL_SE RVER_ERROR ); | |
| 124 | } | |
| 125 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.