Produced by Araxis Merge on 6/9/2017 3:51:17 PM Eastern Daylight 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 | Fri Jun 9 19:51:17 2017 UTC | ||
| 2 | eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-svc-consent-mgmt\src\main\java\gov\va\nvap\svc\consentmgmt\jpa | AuthorityJpaController.java | Fri Apr 21 20:15:58 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 83 |
| 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 | /* | |||||
| 2 | * To chan ge this te mplate, ch oose Tools | Templat es | |||||
| 3 | * and ope n the temp late in th e editor. | |||||
| 4 | */ | |||||
| 5 | package go v.va.nvap. svc.consen tmgmt.jpa; | |||||
| 6 | ||||||
| 7 | import gov .va.nvap.s vc.consent mgmt.Autho rityContro llerInterf ace; | |||||
| 8 | import gov .va.nvap.s vc.consent mgmt.excep tions.None xistentEnt ityExcepti on; | |||||
| 9 | import gov .va.nvap.s vc.consent mgmt.stub. data.Autho rity; | |||||
| 10 | import org .springfra mework.tra nsaction.a nnotation. Transactio nal; | |||||
| 11 | ||||||
| 12 | import jav ax.persist ence.Entit yManager; | |||||
| 13 | import jav ax.persist ence.Entit yNotFoundE xception; | |||||
| 14 | import jav ax.persist ence.NoRes ultExcepti on; | |||||
| 15 | import jav ax.persist ence.Persi stenceCont ext; | |||||
| 16 | import jav ax.persist ence.Query ; | |||||
| 17 | ||||||
| 18 | /** | |||||
| 19 | * | |||||
| 20 | * @author vhaislegb erb | |||||
| 21 | */ | |||||
| 22 | public cla ss Authori tyJpaContr oller impl ements Aut horityCont rollerInte rface { | |||||
| 23 | ||||||
| 24 | @P ersistence Context(na me = "VapE ntityManag er") | |||||
| 25 | pr ivate Enti tyManager em; | |||||
| 26 | ||||||
| 27 | pu blic void create(fin al Authori ty authori ty) { | |||||
| 28 | this .em.persis t(authorit y); | |||||
| 29 | } | |||||
| 30 | ||||||
| 31 | pu blic void destroy(fi nal Long i d) throws Nonexisten tEntityExc eption { | |||||
| 32 | ||||||
| 33 | Auth ority auth ority; | |||||
| 34 | try { | |||||
| 35 | author ity = this .em.getRef erence(Aut hority.cla ss, id); | |||||
| 36 | author ity.getAut horityId() ; | |||||
| 37 | } ca tch (final EntityNot FoundExcep tion enfe) { | |||||
| 38 | throw new Nonexi stentEntit yException ("The auth ority with id " + id | |||||
| 39 | + " no lon ger exists .", enfe); | |||||
| 40 | } | |||||
| 41 | this .em.remove (authority ); | |||||
| 42 | ||||||
| 43 | } | |||||
| 44 | ||||||
| 45 | pu blic void edit(Autho rity autho rity) thro ws Nonexis tentEntity Exception, | |||||
| 46 | Except ion { | |||||
| 47 | try { | |||||
| 48 | author ity = this .em.merge( authority) ; | |||||
| 49 | } ca tch (final Exception ex) { | |||||
| 50 | final String msg = ex.getL ocalizedMe ssage(); | |||||
| 51 | if ((m sg == null ) || (msg. length() = = 0)) { | |||||
| 52 | final Lo ng id = au thority.ge tAuthority Id(); | |||||
| 53 | if (this .findAutho rity(id) = = null) { | |||||
| 54 | throw new Nonexisten tEntityExc eption( | |||||
| 55 | "The authority with id " + id | |||||
| 56 | + " no l onger exis ts."); | |||||
| 57 | } | |||||
| 58 | } | |||||
| 59 | throw ex; | |||||
| 60 | } | |||||
| 61 | } | |||||
| 62 | ||||||
| 63 | pu blic Autho rity findA uthority(f inal Long id) { | |||||
| 64 | retu rn this.em .find(Auth ority.clas s, id); | |||||
| 65 | } | |||||
| 66 | ||||||
| 67 | @O verride | |||||
| 68 | pu blic Autho rity findA uthortiyBy Oid(final String oid ) { | |||||
| 69 | try { | |||||
| 70 | final Query q = this.em.cr eateNamedQ uery("Auth ority.find ByOid"); | |||||
| 71 | q.setP arameter(" oid", oid) ; | |||||
| 72 | return (Authorit y) q.getSi ngleResult (); | |||||
| 73 | } ca tch (final NoResultE xception n re) { | |||||
| 74 | // exp ected | |||||
| 75 | return null; | |||||
| 76 | } | |||||
| 77 | } | |||||
| 78 | ||||||
| 79 | pu blic void setEntityM anager(fin al EntityM anager em) { | |||||
| 80 | this .em = em; | |||||
| 81 | } | |||||
| 82 | ||||||
| 83 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.