Produced by Araxis Merge on 12/8/2017 1:33:39 PM Central 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 | PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\main\java\gov\va\med\fee\controller | PrivacyRestrictionsController.java | Fri Dec 8 17:53:56 2017 UTC |
| 2 | PC_CP4_CiF.zip\FPPS_Backend\fpps_app\src\main\java\gov\va\med\fee\controller | PrivacyRestrictionsController.java | Fri Dec 8 18:28:16 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 286 |
| 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.med.f ee.control ler; | |
| 2 | ||
| 3 | import jav a.util.Arr ayList; | |
| 4 | import jav a.util.Lis t; | |
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | import jav ax.validat ion.Valid; | |
| 9 | import jav ax.validat ion.constr aints.NotN ull; | |
| 10 | ||
| 11 | import org .apache.lo gging.log4 j.LogManag er; | |
| 12 | import org .apache.lo gging.log4 j.Logger; | |
| 13 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 14 | import org .springfra mework.htt p.HttpStat us; | |
| 15 | import org .springfra mework.htt p.Response Entity; | |
| 16 | import org .springfra mework.val idation.Bi ndingResul t; | |
| 17 | import org .springfra mework.web .bind.anno tation.Pat hVariable; | |
| 18 | import org .springfra mework.web .bind.anno tation.Req uestBody; | |
| 19 | import org .springfra mework.web .bind.anno tation.Req uestMappin g; | |
| 20 | import org .springfra mework.web .bind.anno tation.Req uestMethod ; | |
| 21 | import org .springfra mework.web .bind.anno tation.Res tControlle r; | |
| 22 | import gov .va.med.do main.fee.P rivacyToPe rson; | |
| 23 | import gov .va.med.fe e.exceptio ns.Generic Exception; | |
| 24 | import gov .va.med.fe e.model.re quest.Priv acyRestric tionReques t; | |
| 25 | import gov .va.med.fe e.service. IPrivacyRe strictionS ervice; | |
| 26 | import gov .va.med.fe e.vo.Error Vo; | |
| 27 | ||
| 28 | /** | |
| 29 | * | |
| 30 | * @author DN S YIBRIK | |
| 31 | * email : yibrieked ir@gmail.c om | |
| 32 | * | |
| 33 | */ | |
| 34 | ||
| 35 | @RestContr oller | |
| 36 | @RequestMa pping("/ap i/v1/priva cyRestrict ions") | |
| 37 | public cla ss Privacy Restrictio nsControll er { | |
| 38 | ||
| 39 | @A utowired | |
| 40 | IP rivacyRest rictionSer vice priva cyRestrict ionService ; | |
| 41 | ||
| 42 | pr ivate stat ic final L ogger log = LogManag er.getLogg er(Privacy Restrictio nsControll er.class); | |
| 43 | ||
| 44 | ||
| 45 | /* * | |
| 46 | * | |
| 47 | * @return l ist of pri vacyRestri ctions fro m DB | |
| 48 | * A rest GE T Method t o get all privacy re strictions | |
| 49 | * / | |
| 50 | ||
| 51 | @Reque stMapping( method = R equestMeth od.GET) | |
| 52 | public ResponseE ntity<?> g etAll() { | |
| 53 | List <PrivacyTo Person> re sult = nul l; | |
| 54 | Resp onseEntity <?> result Response = null; | |
| 55 | try { | |
| 56 | result = privacy Restrictio nService.g etAllRestr ictions(); | |
| 57 | ||
| 58 | result Response = new Respo nseEntity< List<Priva cyToPerson >>(result, HttpStatu s.OK); | |
| 59 | log.in fo("Succes sfully get ting all P rivacyRest riction : "); | |
| 60 | ||
| 61 | } ca tch (Gener icExceptio n e) { | |
| 62 | log.er ror("There was an er ror in Get ting all P rivacyRest rictions, please con tact suppo rt.", e); | |
| 63 | } | |
| 64 | retu rn resultR esponse; | |
| 65 | } | |
| 66 | ||
| 67 | /** | |
| 68 | * | |
| 69 | * @pa ram reques tId | |
| 70 | * @re turn boole an respons e : True i f the priv acy to per son is rem oved from DB | |
| 71 | */ | |
| 72 | ||
| 73 | @Reque stMapping( value = "d elete/{req uestId}", method = R equestMeth od.DELETE) | |
| 74 | public ResponseE ntity<?> d elete(@Pat hVariable( "requestId ") int req uestId) { | |
| 75 | bool ean result = false; | |
| 76 | Resp onseEntity <?> result Response = null; | |
| 77 | try { | |
| 78 | result = privacy Restrictio nService.d eleteRestr iction(req uestId); | |
| 79 | if(res ult){ | |
| 80 | log.info ("Successf ully delet ed Privacy Restrictio n for requ est id: " + requestI d); | |
| 81 | return r esultRespo nse = new ResponseEn tity<Boole an>(result , HttpStat us.OK); | |
| 82 | ||
| 83 | }else{ | |
| 84 | ||
| 85 | log.info ("Successf ully delet ed Privacy Restrictio n for requ est id: " + requestI d); | |
| 86 | return r esultRespo nse = new ResponseEn tity<Boole an>(result , HttpStat us.OK); | |
| 87 | ||
| 88 | } | |
| 89 | ||
| 90 | } ca tch (Gener icExceptio n e) { | |
| 91 | log.er ror("There was an er ror in del eting Priv ecyRestric tion, plea se contact support." + requestI d, e); | |
| 92 | } | |
| 93 | retu rn resultR esponse; | |
| 94 | } | |
| 95 | /** | |
| 96 | * | |
| 97 | * @pa ram req | |
| 98 | * @re turn respo nse String " Privacy restricti on added" | |
| 99 | * @th rows Gener icExceptio n | |
| 100 | */ | |
| 101 | ||
| 102 | @Reque stMapping( value = "/ create", m ethod = Re questMetho d.POST) | |
| 103 | publi c Response Entity<?> createPriv acyRestric tion(@Requ estBody @V alid Priva cyRestrict ionRequest req,Bindi ngResult b r )t hrows Gene ricExcepti on { | |
| 104 | ||
| 105 | ||
| 106 | bo olean resu lt = false ; | |
| 107 | Re sponseEnti ty<?> resu ltResponse = null; | |
| 108 | if (br.hasErr ors()) { | |
| 109 | throw new Generi cException ("Request has valida tion error s","", Htt pStatus.BA D_REQUEST) ; | |
| 110 | ||
| 111 | }els e{ | |
| 112 | ||
| 113 | tr y { | |
| 114 | ||
| 115 | Stri ng claims = privacyR estriction Service.ch eckClaim(r eq.getNtNa me(), req. getSsn()); | |
| 116 | if(! claims.equ alsIgnoreC ase("")){ | |
| 117 | log.er ror("ERR", "Error:\n User has assigned c laims asso ciated wit h that SSN . These cl aims must be reroute d before a restricti on can be added\n:"+ claims); | |
| 118 | return new Resp onseEntity <Boolean>( result, Ht tpStatus.B AD_REQUEST ); | |
| 119 | } | |
| 120 | if(priva cyRestrict ionService .checkExis t(req.getN tName(), r eq.getSsn( ))){ | |
| 121 | log. error("ERR ", "Error: \n That NT Username is already restricte d from tha t SSN."); | |
| 122 | retu rn new Re sponseEnti ty<Boolean >(result, HttpStatus .BAD_REQUE ST); | |
| 123 | } | |
| 124 | ||
| 125 | resu lt = priv acyRestric tionServic e.addPriva cyRestrict ion(req); | |
| 126 | if(r esult){ | |
| 127 | ||
| 128 | resul tResponse = new Resp onseEntity <Boolean>( result, Ht tpStatus.C REATED); | |
| 129 | log.i nfo("Succe ssfully cr eated Priv acyRestric tion : " + req.toStr ing()); | |
| 130 | }els e{ | |
| 131 | ||
| 132 | result Response = new Respo nseEntity< Boolean>(r esult, Htt pStatus.BA D_REQUEST) ; | |
| 133 | log. error(" cr eating Pri vacyRestri ction Fail ed: " + re q.toString ()); | |
| 134 | } | |
| 135 | ||
| 136 | ||
| 137 | } catch (Gen ericExcept ion e) { | |
| 138 | log.erro r("There w as an erro r in creat ing app us er request , please c ontact sup port." + r eq.toStrin g(), e); | |
| 139 | } | |
| 140 | re turn resul tResponse; | |
| 141 | } | |
| 142 | } | |
| 143 | ||
| 144 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.