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\term-service\src\main\java\gov\va\genisis2\ts\controller | TermServiceController.java | Thu Dec 14 19:57:15 2017 UTC |
| 2 | Genisis_2.0_v7_bld7.zip\TS\Service\term-service\src\main\java\gov\va\genisis2\ts\controller | TermServiceController.java | Thu Dec 21 22:10:29 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1260 |
| Changed | 1 | 4 |
| 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.ts.con troller; | |
| 2 | ||
| 3 | import jav a.util.Arr ayList; | |
| 4 | import jav a.util.Lis t; | |
| 5 | ||
| 6 | import org .apache.lo gging.log4 j.LogManag er; | |
| 7 | import org .apache.lo gging.log4 j.Logger; | |
| 8 | import org .apache.so lr.client. solrj.Solr Client; | |
| 9 | import org .apache.so lr.client. solrj.impl .HttpSolrC lient; | |
| 10 | import org .owasp.esa pi.ESAPI; | |
| 11 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 12 | import org .springfra mework.cor e.Paramete rizedTypeR eference; | |
| 13 | import org .springfra mework.htt p.HttpEnti ty; | |
| 14 | import org .springfra mework.htt p.HttpHead ers; | |
| 15 | import org .springfra mework.htt p.HttpMeth od; | |
| 16 | import org .springfra mework.htt p.HttpStat us; | |
| 17 | import org .springfra mework.htt p.MediaTyp e; | |
| 18 | import org .springfra mework.htt p.Response Entity; | |
| 19 | import org .springfra mework.web .bind.anno tation.Cro ssOrigin; | |
| 20 | import org .springfra mework.web .bind.anno tation.Exc eptionHand ler; | |
| 21 | import org .springfra mework.web .bind.anno tation.Pat hVariable; | |
| 22 | import org .springfra mework.web .bind.anno tation.Req uestBody; | |
| 23 | import org .springfra mework.web .bind.anno tation.Req uestMappin g; | |
| 24 | import org .springfra mework.web .bind.anno tation.Req uestMethod ; | |
| 25 | import org .springfra mework.web .bind.anno tation.Req uestParam; | |
| 26 | import org .springfra mework.web .bind.anno tation.Res ponseBody; | |
| 27 | import org .springfra mework.web .bind.anno tation.Res tControlle r; | |
| 28 | import org .springfra mework.web .client.Ht tpClientEr rorExcepti on; | |
| 29 | import org .springfra mework.web .client.Re stTemplate ; | |
| 30 | ||
| 31 | import com .fasterxml .jackson.d atabind.Ob jectMapper ; | |
| 32 | ||
| 33 | import gov .va.genisi s2.ts.comm on.dto.Boo kmarkDTO; | |
| 34 | import gov .va.genisi s2.ts.comm on.dto.Con ceptMappin gDTO; | |
| 35 | import gov .va.genisi s2.ts.comm on.dto.Dat aElementDT O; | |
| 36 | import gov .va.genisi s2.ts.comm on.dto.Lab elDTO; | |
| 37 | import gov .va.genisi s2.ts.comm on.dto.Res ponseWrapp er; | |
| 38 | import gov .va.genisi s2.ts.comm on.dto.Tri pleDTO; | |
| 39 | import gov .va.genisi s2.ts.comm on.dto.Upd ateRespons eDTO; | |
| 40 | import gov .va.genisi s2.ts.comm on.dto.Upd ateTripleD TO; | |
| 41 | import gov .va.genisi s2.ts.comm on.enums.E rrorEnum; | |
| 42 | import gov .va.genisi s2.ts.comm on.excepti on.TSDupli cateDataEx ception; | |
| 43 | import gov .va.genisi s2.ts.comm on.excepti on.TSInern alSystemEx ception; | |
| 44 | import gov .va.genisi s2.ts.comm on.excepti on.TSNoDat aFoundExce ption; | |
| 45 | import gov .va.genisi s2.ts.dto. ConceptCar dDTO; | |
| 46 | import gov .va.genisi s2.ts.dto. SolrDTO; | |
| 47 | import gov .va.genisi s2.ts.serv ice.IConce ptCardServ ice; | |
| 48 | import gov .va.genisi s2.ts.serv ice.IDataE lementServ ice; | |
| 49 | import gov .va.genisi s2.ts.serv ice.IMappi ngService; | |
| 50 | import gov .va.genisi s2.ts.serv ice.ISolrS ervice; | |
| 51 | import gov .va.genisi s2.ts.serv ice.IUpdat eTripleSer vice; | |
| 52 | import gov .va.genisi s2.ts.util s.TSProper tiesUtil; | |
| 53 | import io. swagger.an notations. ApiOperati on; | |
| 54 | import io. swagger.an notations. ApiRespons e; | |
| 55 | import io. swagger.an notations. ApiRespons es; | |
| 56 | ||
| 57 | /** | |
| 58 | * REST co ntroller c lass for T erminology Service | |
| 59 | * | |
| 60 | * @author PII | |
| 61 | * @author P II | |
| 62 | * | |
| 63 | */ | |
| 64 | @CrossOrig in(origins = "*") | |
| 65 | @RestContr oller | |
| 66 | @RequestMa pping("/") | |
| 67 | public cla ss TermSer viceContro ller { | |
| 68 | ||
| 69 | pr ivate stat ic final L ogger LOGG ER = LogMa nager.getL ogger(Term ServiceCon troller.cl ass); | |
| 70 | ||
| 71 | pr ivate fina l RestTemp late restT emplate = new RestTe mplate(); | |
| 72 | pr ivate Http Headers js onHeaders; | |
| 73 | ||
| 74 | @A utowired | |
| 75 | pr ivate ICon ceptCardSe rvice conc eptCardSer vice; | |
| 76 | ||
| 77 | @A utowired | |
| 78 | pr ivate IUpd ateTripleS ervice upd ateTripleS ervice; | |
| 79 | ||
| 80 | @A utowired | |
| 81 | pr ivate ISol rService s olrService ; | |
| 82 | ||
| 83 | @A utowired | |
| 84 | pr ivate IMap pingServic e mappingS ervice; | |
| 85 | ||
| 86 | @A utowired | |
| 87 | pr ivate TSPr opertiesUt il propsUt il; | |
| 88 | ||
| 89 | @A utowired | |
| 90 | pr ivate IDat aElementSe rvice data ElementSer vice; | |
| 91 | ||
| 92 | @R equestMapp ing(value = "/search es", metho d = Reques tMethod.GE T, consume s = "appli cation/jso n", produc es = "appl ication/js on") | |
| 93 | @R esponseBod y | |
| 94 | @A piOperatio n(value = "Gets the concetps f rom solr b y a search phrase", notes = "R eturns the concepts from solr that match es the pro vided sear ch phrase" , consumes = "applic ation/json ", produce s = "appli cation/jso n", respon se = Strin g.class, t ags = { "C oncept API " }) | |
| 95 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 96 | pu blic Respo nseEntity< ResponseWr apper> get ConceptsOn SearchPhra se(@Reques tParam(val ue = "sear chPhrase", required = true) St ring searc hPhrase, @ RequestPar am(default Value = "0 ") String start, @Re questParam (defaultVa lue = "20" ) String r ows) { | |
| 97 | if ( LOGGER.isI nfoEnabled ()) { | |
| 98 | LOGGER .info("get ConceptsOn SearchPhra se"); | |
| 99 | } | |
| 100 | ||
| 101 | fina l String u ri = Strin g.format(p ropsUtil.g etSolrSear chServiceE ndpoint(), start, ro ws, search Phrase); | |
| 102 | ||
| 103 | Http Entity<Str ing> httpE ntity = ne w HttpEnti ty<String> (createJso nHeaders() ); | |
| 104 | ||
| 105 | Resp onseEntity <String> s olrRespons eEntity; | |
| 106 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 107 | Resp onseWrappe r wrapper = null; | |
| 108 | try { | |
| 109 | solrRe sponseEnti ty = restT emplate.ex change(uri , HttpMeth od.GET, ht tpEntity, String.cla ss); | |
| 110 | ||
| 111 | if (so lrResponse Entity.get StatusCode () == Http Status.OK) { | |
| 112 | String s olrRespons eBody = so lrResponse Entity.get Body(); | |
| 113 | SolrDTO solrDto = new Object Mapper().r eadValue(s olrRespons eBody, Sol rDTO.class ); | |
| 114 | conceptC ardService .populateC onceptName (solrDto); | |
| 115 | conceptC ardService .populateB aselineSur veyIndex(s olrDto); | |
| 116 | wrapper = new gov. va.genisis 2.ts.commo n.dto.Resp onseWrappe r(solrDto) ; | |
| 117 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 118 | } | |
| 119 | } ca tch (HttpC lientError Exception e) { | |
| 120 | LOGGER .error("Er ror in fet ching conc ept mappin gs " + e.g etResponse BodyAsStri ng(), e); | |
| 121 | wrappe r = new Re sponseWrap per(e.getR esponseBod yAsString( )); | |
| 122 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, e.getStat usCode()); | |
| 123 | } ca tch (Excep tion e) { | |
| 124 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 125 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 126 | } | |
| 127 | ||
| 128 | retu rn respons eEntityWit hWrapper; | |
| 129 | } | |
| 130 | ||
| 131 | @R equestMapp ing(value = "/concep t-cards", method = R equestMeth od.GET, co nsumes = " applicatio n/json", p roduces = "applicati on/json") | |
| 132 | @R esponseBod y | |
| 133 | @A piOperatio n(value = "Gets the concetp ca rd details by concep t URI", no tes = "Ret urns the c oncept car d details for a give n concept URI", cons umes = "ap plication/ json", pro duces = "a pplication /json", re sponse = S tring.clas s, tags = { "Concept API" }) | |
| 134 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 135 | pu blic Respo nseEntity< ResponseWr apper> get ConceptCar dsOnConcep tUri(@Requ estParam(v alue = "co nceptUri", required = true) St ring conce ptUri) { | |
| 136 | if ( LOGGER.isI nfoEnabled ()) { | |
| 137 | LOGGER .info("get ConceptCar dsOnConcep tUri"); | |
| 138 | } | |
| 139 | ||
| 140 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 141 | Resp onseWrappe r wrapper = null; | |
| 142 | try { | |
| 143 | String decodedCo nceptUri = java.net. URLDecoder .decode(co nceptUri, "UTF-8"); | |
| 144 | ||
| 145 | Concep tCardDTO c onceptCard Dto = conc eptCardSer vice.getCo nceptCards OnConceptU ri(decoded ConceptUri ); | |
| 146 | ||
| 147 | if (nu ll != conc eptCardDto ) { | |
| 148 | wrapper = new Resp onseWrappe r(conceptC ardDto); | |
| 149 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 150 | } | |
| 151 | } ca tch (Excep tion e) { | |
| 152 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 153 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 154 | } | |
| 155 | ||
| 156 | retu rn respons eEntityWit hWrapper; | |
| 157 | } | |
| 158 | ||
| 159 | @R equestMapp ing(value = "/bookma rks", meth od = Reque stMethod.P OST, consu mes = "app lication/j son", prod uces = "ap plication/ json") | |
| 160 | @R esponseBod y | |
| 161 | @A piOperatio n(value = "Create Bo okmark", n otes = "Ad d a bookma rked conce pt", consu mes = "app lication/j son", prod uces = "ap plication/ json", res ponse = St ring.class , tags = { "Bookmark s API" }) | |
| 162 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 163 | pu blic Respo nseEntity< ResponseWr apper> cre ateBookmar k(@Request Body Bookm arkDTO boo kmarkDto) { | |
| 164 | if ( LOGGER.isI nfoEnabled ()) { | |
| 165 | LOGGER .info("add Bookmark") ; | |
| 166 | } | |
| 167 | Http Entity<Boo kmarkDTO> httpEntity = new Htt pEntity<Bo okmarkDTO> (bookmarkD to, create JsonHeader s()); | |
| 168 | ||
| 169 | Resp onseEntity <BookmarkD TO> respon seEntity = null; | |
| 170 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 171 | Resp onseWrappe r wrapper = null; | |
| 172 | try { | |
| 173 | // Ter minologySe rviceConst ants.Bookm arkingServ iceUri + " /bookmarks " | |
| 174 | respon seEntity = restTempl ate.exchan ge(propsUt il.getMsCr eateBookma rksUri(), HttpMethod .POST, htt pEntity, B ookmarkDTO .class); | |
| 175 | ||
| 176 | if (re sponseEnti ty.getStat usCode() = = HttpStat us.CREATED ) { | |
| 177 | Bookmark DTO return edDto = (B ookmarkDTO ) response Entity.get Body(); | |
| 178 | wrapper = new Resp onseWrappe r(returned Dto); | |
| 179 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. CREATED); | |
| 180 | } | |
| 181 | } ca tch (HttpC lientError Exception e) { | |
| 182 | LOGGER .error("Er ror in cre ating book mark " + e .getRespon seBodyAsSt ring(), e) ; | |
| 183 | wrappe r = new Re sponseWrap per(e.getR esponseBod yAsString( )); | |
| 184 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, e.getStat usCode()); | |
| 185 | } ca tch (Excep tion e) { | |
| 186 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 187 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 188 | } | |
| 189 | ||
| 190 | retu rn respons eEntityWit hWrapper; | |
| 191 | } | |
| 192 | ||
| 193 | @R equestMapp ing(value = "/bookma rks/{usern ame:.+}", method = R equestMeth od.GET, co nsumes = " applicatio n/json", p roduces = "applicati on/json") | |
| 194 | @R esponseBod y | |
| 195 | @A piOperatio n(value = "Fetch Boo kmark and Label By U sername", notes = "R etruns the list of b ookmarks l abel for a given Use rname", co nsumes = " applicatio n/json", p roduces = "applicati on/json", response = String.cl ass, tags = { "Bookm arks API" }) | |
| 196 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 197 | pu blic Respo nseEntity< ResponseWr apper> ret reiveBookm arksByUser name(@Path Variable S tring user name) { | |
| 198 | if ( LOGGER.isI nfoEnabled ()) { | |
| 199 | LOGGER .info("get BookmarksO nUserName" ); | |
| 200 | } | |
| 201 | Http Entity<Boo kmarkDTO> httpEntity = new Htt pEntity<Bo okmarkDTO> (createJso nHeaders() ); | |
| 202 | ||
| 203 | Resp onseEntity <List<Book markDTO>> responseEn tity = nul l; | |
| 204 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 205 | Resp onseWrappe r wrapper = null; | |
| 206 | try { | |
| 207 | respon seEntity = restTempl ate.exchan ge(propsUt il.getMsGe tBookmarks ByUsername Uri(), Htt pMethod.GE T, httpEnt ity, new P arameteriz edTypeRefe rence<List <BookmarkD TO>>() { | |
| 208 | }, use rname); | |
| 209 | if (re sponseEnti ty.getStat usCode() = = HttpStat us.OK) { | |
| 210 | List<Boo kmarkDTO> bookmarkDt o = (List< BookmarkDT O>) respon seEntity.g etBody(); | |
| 211 | ||
| 212 | for (Boo kmarkDTO b : bookmar kDto) { | |
| 213 | b.setHasMa pping(mapp ingService .hasMappin g(b.getCon ceptUri()) ); | |
| 214 | } | |
| 215 | wrapper = new Resp onseWrappe r(bookmark Dto); | |
| 216 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 217 | } | |
| 218 | } ca tch (HttpC lientError Exception e) { | |
| 219 | LOGGER .error("Er ror in fet ching book marks for username " + e.getRe sponseBody AsString() , e); | |
| 220 | wrappe r = new Re sponseWrap per(e.getR esponseBod yAsString( )); | |
| 221 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, e.getStat usCode()); | |
| 222 | } ca tch (Excep tion e) { | |
| 223 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 224 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 225 | } | |
| 226 | ||
| 227 | retu rn respons eEntityWit hWrapper; | |
| 228 | } | |
| 229 | ||
| 230 | @R equestMapp ing(value = "/bookma rks/labels /{label}", method = RequestMet hod.GET, c onsumes = "applicati on/json", produces = "applicat ion/json") | |
| 231 | @R esponseBod y | |
| 232 | @A piOperatio n(value = "Fetch Boo kmark by l abel", not es = "Retr uns the li st of book marks for a given la bel", cons umes = "ap plication/ json", pro duces = "a pplication /json", re sponse = S tring.clas s, tags = { "Bookmar ks API" }) | |
| 233 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 234 | pu blic Respo nseEntity< ResponseWr apper> ret reiveBookm arksByLabe l(@PathVar iable Stri ng label) { | |
| 235 | if ( LOGGER.isI nfoEnabled ()) { | |
| 236 | LOGGER .info("ret reiveBookm arksByLabe l"); | |
| 237 | } | |
| 238 | Http Entity<Boo kmarkDTO> httpEntity = new Htt pEntity<Bo okmarkDTO> (createJso nHeaders() ); | |
| 239 | ||
| 240 | Resp onseEntity <List<Book markDTO>> responseEn tity = nul l; | |
| 241 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 242 | Resp onseWrappe r wrapper = null; | |
| 243 | try { | |
| 244 | respon seEntity = restTempl ate.exchan ge(propsUt il.getMsGe tBookmarks ByLabelUri (), HttpMe thod.GET, httpEntity , new Para meterizedT ypeReferen ce<List<Bo okmarkDTO> >() { | |
| 245 | }, lab el); | |
| 246 | if (re sponseEnti ty.getStat usCode() = = HttpStat us.OK) { | |
| 247 | List<Boo kmarkDTO> bookmarkDt o = (List< BookmarkDT O>) respon seEntity.g etBody(); | |
| 248 | wrapper = new Resp onseWrappe r(bookmark Dto); | |
| 249 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 250 | } | |
| 251 | } ca tch (HttpC lientError Exception e) { | |
| 252 | LOGGER .error("Er ror in fet ching book marks by l abel " + e .getRespon seBodyAsSt ring(), e) ; | |
| 253 | wrappe r = new Re sponseWrap per(e.getR esponseBod yAsString( )); | |
| 254 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, e.getStat usCode()); | |
| 255 | } ca tch (Excep tion e) { | |
| 256 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 257 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 258 | } | |
| 259 | ||
| 260 | retu rn respons eEntityWit hWrapper; | |
| 261 | } | |
| 262 | ||
| 263 | @R equestMapp ing(value = "/bookma rks/{id}", method = RequestMet hod.DELETE , consumes = "applic ation/json ", produce s = "appli cation/jso n") | |
| 264 | @R esponseBod y | |
| 265 | @A piOperatio n(value = "UnLabel B ookmarked Concept", notes = "D elete a la bel from a bookmark" , consumes = "applic ation/json ", produce s = "appli cation/jso n", respon se = Strin g.class, t ags = { "B ookmarks A PI" }) | |
| 266 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 267 | pu blic Respo nseEntity< ResponseWr apper> del eteBookmar k(@PathVar iable int id) { | |
| 268 | if ( LOGGER.isI nfoEnabled ()) { | |
| 269 | LOGGER .info("del eteBookmar ksOnId"); | |
| 270 | } | |
| 271 | ||
| 272 | Http Entity<Int eger> http Entity = n ew HttpEnt ity<Intege r>(createJ sonHeaders ()); | |
| 273 | ||
| 274 | Resp onseEntity <Integer> responseEn tity = nul l; | |
| 275 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 276 | Resp onseWrappe r wrapper = null; | |
| 277 | try { | |
| 278 | respon seEntity = restTempl ate.exchan ge(propsUt il.getMsDe leteBookma rksByIdUri (), HttpMe thod.DELET E, httpEnt ity, Integ er.class, id); | |
| 279 | ||
| 280 | if (re sponseEnti ty.getStat usCode() = = HttpStat us.OK) { | |
| 281 | Integer returnedId = (Intege r) respons eEntity.ge tBody(); | |
| 282 | wrapper = new Resp onseWrappe r(returned Id); | |
| 283 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 284 | } | |
| 285 | } ca tch (HttpC lientError Exception e) { | |
| 286 | LOGGER .error("Er ror in del eting book mark " + e .getRespon seBodyAsSt ring(), e) ; | |
| 287 | wrappe r = new Re sponseWrap per(e.getR esponseBod yAsString( )); | |
| 288 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, e.getStat usCode()); | |
| 289 | } ca tch (Excep tion e) { | |
| 290 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 291 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 292 | } | |
| 293 | ||
| 294 | retu rn respons eEntityWit hWrapper; | |
| 295 | } | |
| 296 | ||
| 297 | @R equestMapp ing(value = "/bookma rks/{id}/l abels", me thod = Req uestMethod .POST, con sumes = "a pplication /json", pr oduces = " applicatio n/json") | |
| 298 | @R esponseBod y | |
| 299 | @A piOperatio n(value = "Label Boo kmarked Co ncept", no tes = "Add a label t o a bookma rk", consu mes = "app lication/j son", prod uces = "ap plication/ json", res ponse = St ring.class , tags = { "Bookmark s API" }) | |
| 300 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 301 | pu blic Respo nseEntity< ResponseWr apper> lab elBookmark edConcept( @PathVaria ble int id , @Request Body Label DTO labelD to) { | |
| 302 | if ( LOGGER.isI nfoEnabled ()) { | |
| 303 | LOGGER .info("add LabelToBoo kmark"); | |
| 304 | } | |
| 305 | ||
| 306 | Http Entity<Lab elDTO> htt pEntity = new HttpEn tity<Label DTO>(label Dto, creat eJsonHeade rs()); | |
| 307 | ||
| 308 | Resp onseEntity <BookmarkD TO> respon seEntity = null; | |
| 309 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 310 | Resp onseWrappe r wrapper = null; | |
| 311 | try { | |
| 312 | respon seEntity = restTempl ate.exchan ge(propsUt il.getMsCr eateBookma rksWithLab elUri(), H ttpMethod. POST, http Entity, Bo okmarkDTO. class, id) ; | |
| 313 | ||
| 314 | if (re sponseEnti ty.getStat usCode() = = HttpStat us.CREATED ) { | |
| 315 | Bookmark DTO return edDto = (B ookmarkDTO ) response Entity.get Body(); | |
| 316 | wrapper = new Resp onseWrappe r(returned Dto); | |
| 317 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. CREATED); | |
| 318 | } | |
| 319 | } ca tch (HttpC lientError Exception e) { | |
| 320 | LOGGER .error("Er ror in add ing label to bookmar k", e); | |
| 321 | wrappe r = new Re sponseWrap per("Error in adding label to bookmark") ; | |
| 322 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, e.getStat usCode()); | |
| 323 | } ca tch (Excep tion e) { | |
| 324 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 325 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 326 | } | |
| 327 | ||
| 328 | retu rn respons eEntityWit hWrapper; | |
| 329 | } | |
| 330 | ||
| 331 | @R equestMapp ing(value = "/bookma rks/{id}/l abels", me thod = Req uestMethod .DELETE, c onsumes = "applicati on/json", produces = "applicat ion/json") | |
| 332 | @R esponseBod y | |
| 333 | @A piOperatio n(value = "Label Boo kmarked Co ncept", no tes = "Add a label t o a bookma rk", consu mes = "app lication/j son", prod uces = "ap plication/ json", res ponse = St ring.class , tags = { "Bookmark s API" }) | |
| 334 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 335 | pu blic Respo nseEntity< ResponseWr apper> unL abelBookma rkedConcep t(@PathVar iable int id, @Reque stParam(va lue = "lab elName", r equired = true) Stri ng labelNa me) { | |
| 336 | if ( LOGGER.isI nfoEnabled ()) { | |
| 337 | LOGGER .info("rem oveLabelFr omBookmark "); | |
| 338 | } | |
| 339 | Http Entity<?> httpEntity = new Htt pEntity<>( createJson Headers()) ; | |
| 340 | ||
| 341 | Resp onseEntity <BookmarkD TO> respon seEntity = null; | |
| 342 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 343 | Resp onseWrappe r wrapper = null; | |
| 344 | try { | |
| 345 | respon seEntity = restTempl ate.exchan ge(propsUt il.getMsDe leteBookma rksByLabel Uri(), Htt pMethod.DE LETE, http Entity, Bo okmarkDTO. class, id, labelName ); | |
| 346 | ||
| 347 | if (re sponseEnti ty.getStat usCode() = = HttpStat us.OK) { | |
| 348 | Bookmark DTO bookma rkDto = (B ookmarkDTO ) response Entity.get Body(); | |
| 349 | wrapper = new Resp onseWrappe r(bookmark Dto); | |
| 350 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 351 | } | |
| 352 | } ca tch (HttpC lientError Exception e) { | |
| 353 | LOGGER .error("Er ror in rem voing labe l from boo kmark " + e.getRespo nseBodyAsS tring(), e ); | |
| 354 | wrappe r = new Re sponseWrap per(e.getR esponseBod yAsString( )); | |
| 355 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, e.getStat usCode()); | |
| 356 | } ca tch (Excep tion e) { | |
| 357 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 358 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 359 | } | |
| 360 | ||
| 361 | retu rn respons eEntityWit hWrapper; | |
| 362 | } | |
| 363 | ||
| 364 | @R equestMapp ing(value = "/labels /{username :.+}", met hod = Requ estMethod. GET, consu mes = "app lication/j son", prod uces = "ap plication/ json") | |
| 365 | @R esponseBod y | |
| 366 | @A piOperatio n(value = "Get lable s by Usern ame", note s = "Retri eve lables by Userna me", consu mes = "app lication/j son", prod uces = "ap plication/ json", res ponse = St ring.class , tags = { "Bookmark s API" }) | |
| 367 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 368 | pu blic Respo nseEntity< ResponseWr apper> ret reiveLabel sByUsernam e(@PathVar iable Stri ng usernam e) { | |
| 369 | if ( LOGGER.isI nfoEnabled ()) { | |
| 370 | LOGGER .info("ret reiveLabel sByUsernam e"); | |
| 371 | } | |
| 372 | Http Entity<?> httpEntity = new Htt pEntity<>( createJson Headers()) ; | |
| 373 | ||
| 374 | Resp onseEntity <List<Labe lDTO>> res ponseEntit y = null; | |
| 375 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 376 | Resp onseWrappe r wrapper = null; | |
| 377 | try { | |
| 378 | respon seEntity = restTempl ate.exchan ge(propsUt il.getMsGe tBookmarks LabelByUse rnameUri() , HttpMeth od.GET, ht tpEntity, new Parame terizedTyp eReference <List<Labe lDTO>>() { | |
| 379 | }, use rname); | |
| 380 | if (re sponseEnti ty.getStat usCode() = = HttpStat us.OK) { | |
| 381 | List<Lab elDTO> lab elDto = (L ist<LabelD TO>) respo nseEntity. getBody(); | |
| 382 | wrapper = new Resp onseWrappe r(labelDto ); | |
| 383 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 384 | } | |
| 385 | } ca tch (HttpC lientError Exception e) { | |
| 386 | LOGGER .error("Er ror in fet ching labe ls for use rname " + e.getRespo nseBodyAsS tring(), e ); | |
| 387 | wrappe r = new Re sponseWrap per(e.getR esponseBod yAsString( )); | |
| 388 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, e.getStat usCode()); | |
| 389 | } ca tch (Excep tion e) { | |
| 390 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 391 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 392 | } | |
| 393 | ||
| 394 | retu rn respons eEntityWit hWrapper; | |
| 395 | } | |
| 396 | ||
| 397 | @R equestMapp ing(value = "/concep t-history- stack-top" , method = RequestMe thod.DELET E, consume s = "appli cation/jso n", produc es = "appl ication/js on") | |
| 398 | @R esponseBod y | |
| 399 | @A piOperatio n(value = "Pops the history fo r the conc ept card", notes = " Pops the s tack of Co ncept URIs associate d with the concept c ard, and r eturns the new URI", consumes = "applica tion/json" , produces = "applic ation/json ", respons e = String .class, ta gs = { "Co ncept API" }) | |
| 400 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 401 | pu blic Respo nseEntity< String> po pConceptCa rdHistory( ) { | |
| 402 | if ( LOGGER.isI nfoEnabled ()) { | |
| 403 | LOGGER .info("pop ConceptCar dHistory") ; | |
| 404 | } | |
| 405 | ||
| 406 | Stri ng json = "{\"respon se\":null, \"message\ ":null}"; | |
| 407 | retu rn new Res ponseEntit y<String>( json, Http Status.OK) ; | |
| 408 | } | |
| 409 | ||
| 410 | @R equestMapp ing(value = "/mappin gs", metho d = Reques tMethod.GE T, consume s = "appli cation/jso n", produc es = "appl ication/js on") | |
| 411 | @R esponseBod y | |
| 412 | @A piOperatio n(value = "Fetch Con cept Mappi ngs by Con cept-URI", notes = " Returns co nnect mapp ing detail s by conce ptUri", co nsumes = " applicatio n/json", p roduces = "applicati on/json", response = String.cl ass, tags = { "Mappi ng API" }) | |
| 413 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 414 | pu blic Respo nseEntity< ResponseWr apper> get ConceptMap pingByConc eptUriWith ResponseWr apper(@Req uestParam( value = "c onceptUri" , required = true) S tring conc eptUri) { | |
| 415 | if ( LOGGER.isI nfoEnabled ()) { | |
| 416 | LOGGER .info("get ConceptMap pingByConc eptUriWith ResponseWr apper"); | |
| 417 | } | |
| 418 | ||
| 419 | Http Entity<Con ceptMappin gDTO> http Entity = n ew HttpEnt ity<Concep tMappingDT O>(createJ sonHeaders ()); | |
| 420 | ||
| 421 | Resp onseEntity <ConceptMa ppingDTO> responseEn tity = nul l; | |
| 422 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 423 | Resp onseWrappe r wrapper = null; | |
| 424 | try { | |
| 425 | respon seEntity = restTempl ate.exchan ge(propsUt il.getMsGe tConceptMa ppingUriBy ConceptUri (), HttpMe thod.GET, httpEntity , ConceptM appingDTO. class, con ceptUri); | |
| 426 | if (re sponseEnti ty.getStat usCode() = = HttpStat us.OK) { | |
| 427 | ConceptM appingDTO conceptMap pingDto = (ConceptMa ppingDTO) responseEn tity.getBo dy(); | |
| 428 | wrapper = new Resp onseWrappe r(conceptM appingDto) ; | |
| 429 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 430 | } | |
| 431 | } ca tch (HttpC lientError Exception e) { | |
| 432 | LOGGER .error("Er ror in fet ching conc ept mappin gs " + e.g etResponse BodyAsStri ng(), e); | |
| 433 | wrappe r = new Re sponseWrap per(e.getR esponseBod yAsString( )); | |
| 434 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, e.getStat usCode()); | |
| 435 | } ca tch (Excep tion e) { | |
| 436 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 437 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age(), e); | |
| 438 | } | |
| 439 | ||
| 440 | retu rn respons eEntityWit hWrapper; | |
| 441 | } | |
| 442 | ||
| 443 | @R equestMapp ing(value = "/dataEl ements", m ethod = Re questMetho d.GET, con sumes = "a pplication /json", pr oduces = " applicatio n/json") | |
| 444 | @R esponseBod y | |
| 445 | @A piOperatio n(value = "Fetch dat a elements ", notes = "Returns all data e lements in the Fusek i database ", consume s = "appli cation/jso n", produc es = "appl ication/js on", respo nse = Stri ng.class, tags = { " Concept AP I" }) | |
| 446 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 447 | pu blic Respo nseEntity< ResponseWr apper> get DataElemen ts() { | |
| 448 | if ( LOGGER.isI nfoEnabled ()) { | |
| 449 | LOGGER .info("get DataElemen ts"); | |
| 450 | } | |
| 451 | ||
| 452 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 453 | Resp onseWrappe r wrapper = null; | |
| 454 | try { | |
| 455 | List< DataElemen tDTO> data Elements = dataEleme ntService. getDataEle ments(); | |
| 456 | ||
| 457 | if (nu ll != data Elements) { | |
| 458 | wrapper = new Resp onseWrappe r(dataElem ents); | |
| 459 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 460 | } | |
| 461 | } ca tch (Excep tion e) { | |
| 462 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 463 | throw new TSIner nalSystemE xception(E rrorEnum.I NTERNAL_SY S_ERROR.ge tErrorMess age()); | |
| 464 | } | |
| 465 | ||
| 466 | retu rn respons eEntityWit hWrapper; | |
| 467 | ||
| 468 | } | |
| 469 | ||
| 470 | @R equestMapp ing(value = "/mappin gs", metho d = Reques tMethod.PO ST, consum es = "appl ication/js on", produ ces = "app lication/j son") | |
| 471 | @R esponseBod y | |
| 472 | @A piOperatio n(value = "Creates C oncept Map ping", not es = "Crea tes a new concept ma pping", co nsumes = " applicatio n/json", p roduces = "applicati on/json", response = String.cl ass, tags = { "Mappi ng API" }) | |
| 473 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 474 | pu blic Respo nseEntity< ResponseWr apper> cre ateConcept Mapping(@R equestBody ConceptMa ppingDTO c onceptMapp ingDto) { | |
| 475 | if ( LOGGER.isI nfoEnabled ()) { | |
| 476 | LOGGER .info("cre ateConcept Mapping"); | |
| 477 | } | |
| 478 | ||
| 479 | retu rn createR eposneEnti ty(null, H ttpStatus. METHOD_NOT _ALLOWED); | |
| 480 | } | |
| 481 | ||
| 482 | @R equestMapp ing(value = "/update ", method = RequestM ethod.POST , consumes = "applic ation/json ", produce s = "appli cation/jso n") | |
| 483 | @R esponseBod y | |
| 484 | @A piOperatio n(value = "Adds trip les to Apa che Jena/F useki", no tes = "Add s triples to Apache Jena/Fusek i", consum es = "appl ication/js on", produ ces = "app lication/j son", resp onse = Str ing.class, tags = { "CLI API" }) | |
| 485 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 486 | pu blic Respo nseEntity< ResponseWr apper> upd ateTripleA dd(@Reques tBody Upda teTripleDT O updateTr ipleDTO) { | |
| 487 | if ( LOGGER.isI nfoEnabled ()) { | |
| 488 | LOGGER .info("upd ateTriples "); | |
| 489 | } | |
| 490 | ||
| 491 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 492 | Resp onseWrappe r wrapper = null; | |
| 493 | try { | |
| 494 | List<U pdateRespo nseDTO> re ponseList = updateTr ipleServic e.addTripl e(updateTr ipleDTO); | |
| 495 | ||
| 496 | if (nu ll != repo nseList) { | |
| 497 | wrapper = new Resp onseWrappe r(reponseL ist); | |
| 498 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 499 | ||
| 500 | if (upda teTripleDT O.isUpdate SolrIndex( )) { | |
| 501 | // solr up date | |
| 502 | List<Tripl eDTO> conc epts = upd ateTripleD TO.getProp erties(); | |
| 503 | List<Conce ptCardDTO> conceptCa rds = new ArrayList< ConceptCar dDTO>(); | |
| 504 | try (SolrC lient solr = new Htt pSolrClien t(propsUti l.getSolrS erviceEndp oint())) { | |
| 505 | ||
| 506 | fo r (TripleD TO concept : concept s) { | |
| 507 | ||
| 508 | // r emove angl e brackets | |
| 509 | Stri ng subject = concept .getS().re placeAll(" \\<|\\>", ""); | |
| 510 | conc eptCards.a dd(concept CardServic e.getConce ptCardsOnC onceptUri( subject)); | |
| 511 | } | |
| 512 | so lrService. addTripleT oSolrDocum ent(concep tCards, so lr); | |
| 513 | } catch (E xception e ) { | |
| 514 | LO GGER.error (e.getMess age()); | |
| 515 | } | |
| 516 | } | |
| 517 | } | |
| 518 | } ca tch (Excep tion e) { | |
| 519 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 520 | wrappe r = new Re sponseWrap per(e.getM essage()); | |
| 521 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, HttpStatu s.BAD_REQU EST); | |
| 522 | } | |
| 523 | ||
| 524 | retu rn respons eEntityWit hWrapper; | |
| 525 | } | |
| 526 | ||
| 527 | @R equestMapp ing(value = "/update ", method = RequestM ethod.DELE TE, consum es = "appl ication/js on", produ ces = "app lication/j son") | |
| 528 | @R esponseBod y | |
| 529 | @A piOperatio n(value = "Removes t riples to Apache Jen a/Fuseki", notes = " Removes tr iples to A pache Jena /Fuseki", consumes = "applicat ion/json", produces = "applica tion/json" , response = String. class, tag s = { "CLI API" }) | |
| 530 | @A piResponse s({ @ApiRe sponse(cod e = 200, m essage = " Success", response = String.cl ass) }) | |
| 531 | pu blic Respo nseEntity< ResponseWr apper> upd ateTripleD elete(@Req uestBody U pdateTripl eDTO updat eTripleDTO ) { | |
| 532 | if ( LOGGER.isI nfoEnabled ()) { | |
| 533 | LOGGER .info("upd ateTriples "); | |
| 534 | } | |
| 535 | ||
| 536 | Resp onseEntity <ResponseW rapper> re sponseEnti tyWithWrap per = null ; | |
| 537 | Resp onseWrappe r wrapper = null; | |
| 538 | try { | |
| 539 | List<U pdateRespo nseDTO> re ponseList = updateTr ipleServic e.deleteTr iple(updat eTripleDTO ); | |
| 540 | ||
| 541 | if (nu ll != repo nseList) { | |
| 542 | wrapper = new Resp onseWrappe r(reponseL ist); | |
| 543 | response EntityWith Wrapper = createRepo sneEntity( wrapper, H ttpStatus. OK); | |
| 544 | ||
| 545 | if (upda teTripleDT O.isUpdate SolrIndex( )) { | |
| 546 | // solr up date | |
| 547 | List<Tripl eDTO> conc epts = upd ateTripleD TO.getProp erties(); | |
| 548 | List<Strin g> concept Uris = new ArrayList <String>() ; | |
| 549 | try (SolrC lient solr = new Htt pSolrClien t(propsUti l.getSolrS erviceEndp oint())) { | |
| 550 | ||
| 551 | fo r (TripleD TO concept : concept s) { | |
| 552 | ||
| 553 | // r emove angl e brackets | |
| 554 | conc eptUris.ad d(concept. getS().rep laceAll("\ \<|\\>", " ")); | |
| 555 | } | |
| 556 | so lrService. deleteTrip leToSolrDo cument(con ceptUris, solr); | |
| 557 | } catch (E xception e ) { | |
| 558 | LO GGER.error (e.getMess age()); | |
| 559 | } | |
| 560 | } | |
| 561 | } | |
| 562 | } ca tch (Excep tion e) { | |
| 563 | LOGGER .error(Err orEnum.INT ERNAL_SYS_ ERROR.getE rrorMessag e(), e); | |
| 564 | wrappe r = new Re sponseWrap per(e.getM essage()); | |
| 565 | respon seEntityWi thWrapper = createRe posneEntit y(wrapper, HttpStatu s.BAD_REQU EST); | |
| 566 | } | |
| 567 | ||
| 568 | retu rn respons eEntityWit hWrapper; | |
| 569 | } | |
| 570 | ||
| 571 | /* * | |
| 572 | * No data f ound excep tion. | |
| 573 | * | |
| 574 | * @param ex | |
| 575 | * the ex | |
| 576 | * @return t he respons e entity | |
| 577 | * / | |
| 578 | @E xceptionHa ndler({ TS NoDataFoun dException .class }) | |
| 579 | pu blic Respo nseEntity< Object> ex ceptionHan dler(TSNoD ataFoundEx ception ex ) { | |
| 580 | retu rn new Res ponseEntit y<Object>( | |
| 581 | ESAPI.en coder().en codeForHTM L( ex.getM essage( )) , HttpStat us.NOT_FOU ND); | |
| 582 | } | |
| 583 | ||
| 584 | /* * | |
| 585 | * Duplicate data exce ption for create API calls | |
| 586 | * | |
| 587 | * @param ex | |
| 588 | * the ex | |
| 589 | * @return t he respons e entity | |
| 590 | * / | |
| 591 | @E xceptionHa ndler({ TS DuplicateD ataExcepti on.class } ) | |
| 592 | pu blic Respo nseEntity< Object> ex ceptionHan dler(TSDup licateData Exception ex) { | |
| 593 | retu rn new Res ponseEntit y<Object>( | |
| 594 | ESAPI.en coder().en codeForHTM L( ex.getM essage( )) , HttpStat us.BAD_REQ UEST); | |
| 595 | } | |
| 596 | ||
| 597 | /* * | |
| 598 | * Internal System Err or excepti on | |
| 599 | * | |
| 600 | * @param ex | |
| 601 | * the ex | |
| 602 | * @return t he respons e entity | |
| 603 | * / | |
| 604 | @E xceptionHa ndler({ TS InernalSys temExcepti on.class } ) | |
| 605 | pu blic Respo nseEntity< Object> ex ceptionHan dler(TSIne rnalSystem Exception ex) { | |
| 606 | retu rn new Res ponseEntit y<Object>( ErrorEnum. INTERNAL_S YS_ERROR.g etErrorMes sage(), Ht tpStatus.I NTERNAL_SE RVER_ERROR ); | |
| 607 | } | |
| 608 | ||
| 609 | pr ivate Http Headers cr eateJsonHe aders() { | |
| 610 | if ( jsonHeader s == null) { | |
| 611 | jsonHe aders = ne w HttpHead ers(); | |
| 612 | jsonHe aders.setC ontentType (MediaType .APPLICATI ON_JSON); | |
| 613 | jsonHe aders.set( "Accept-En coding", " applicatio n/json"); | |
| 614 | } | |
| 615 | ||
| 616 | retu rn jsonHea ders; | |
| 617 | } | |
| 618 | ||
| 619 | /* * | |
| 620 | * Creates t he respons e wrapper. | |
| 621 | * | |
| 622 | * @param wr apper | |
| 623 | * the wrap per | |
| 624 | * @return t he respons e entity | |
| 625 | * / | |
| 626 | pr ivate Resp onseEntity <ResponseW rapper> cr eateReposn eEntity(Re sponseWrap per wrappe r, HttpSta tus httpSt atus) { | |
| 627 | Http Headers re sponseHead ers = new HttpHeader s(); | |
| 628 | resp onseHeader s.add("Pra gma", "No- cache"); | |
| 629 | resp onseHeader s.add("Cac he-Control ", "no-cac he"); | |
| 630 | retu rn new Res ponseEntit y<Response Wrapper>(w rapper, re sponseHead ers, httpS tatus); | |
| 631 | } | |
| 632 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.