Produced by Araxis Merge on 6/9/2017 3:51:25 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:25 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-web\src\main\java\gov\va\nvap\web\dao | OrganizationDAO.java | Fri Apr 21 20:03:30 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 121 |
| 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.nvap. web.dao; | |||||
| 2 | ||||||
| 3 | import gov .va.nvap.s vc.consent mgmt.stub. data.Organ ization; | |||||
| 4 | import jav a.util.Has hMap; | |||||
| 5 | import jav a.util.Lis t; | |||||
| 6 | import jav ax.persist ence.Entit yManager; | |||||
| 7 | import jav ax.persist ence.Persi stenceCont ext; | |||||
| 8 | import jav ax.persist ence.Query ; | |||||
| 9 | import org .springfra mework.tra nsaction.a nnotation. Transactio nal; | |||||
| 10 | ||||||
| 11 | /** | |||||
| 12 | * | |||||
| 13 | * @author Johann So nnenberg | |||||
| 14 | */ | |||||
| 15 | public cla ss Organiz ationDAO { | |||||
| 16 | /** | |||||
| 17 | * Enti ty Manager instance. | |||||
| 18 | */ | |||||
| 19 | @Persi stenceCont ext | |||||
| 20 | privat e EntityMa nager em; | |||||
| 21 | ||||||
| 22 | /** | |||||
| 23 | * Set the entit y manager (Injected by Spring) . | |||||
| 24 | */ | |||||
| 25 | public void setE ntityManag er(final E ntityManag er em) { | |||||
| 26 | th is.em = em ; | |||||
| 27 | } | |||||
| 28 | ||||||
| 29 | public Organizat ion getOrg anization( final Long orgId) { | |||||
| 30 | re turn this. em.find(Or ganization .class, or gId); | |||||
| 31 | } | |||||
| 32 | ||||||
| 33 | @Trans actional | |||||
| 34 | public Organizat ion create (final Org anization o) | |||||
| 35 | throws E xception { | |||||
| 36 | tr y { | |||||
| 37 | this.em. persist(o) ; | |||||
| 38 | } catch (fin al Excepti on ex) { | |||||
| 39 | throw ex ; | |||||
| 40 | } | |||||
| 41 | re turn o; | |||||
| 42 | } | |||||
| 43 | ||||||
| 44 | @Trans actional | |||||
| 45 | public Organizat ion update (final Org anization o) | |||||
| 46 | throws E xception { | |||||
| 47 | tr y { | |||||
| 48 | this.em. merge(o); | |||||
| 49 | } catch (fin al Excepti on ex) { | |||||
| 50 | throw ex ; | |||||
| 51 | } | |||||
| 52 | re turn o; | |||||
| 53 | } | |||||
| 54 | ||||||
| 55 | public HashMap l istAllOrga nizations( final Inte ger maxRow s, final I nteger sta rtRow, Str ing sortBy , String s ortOrder) { | |||||
| 56 | St ring query = "SELECT o FROM Or ganization o WHERE 1 = 1"; | |||||
| 57 | St ring count Query = "S ELECT COUN T(o.orgId) FROM Orga nization o WHERE 1 = 1"; | |||||
| 58 | St ring query Params = " "; | |||||
| 59 | ||||||
| 60 | // handle the sort by | |||||
| 61 | In teger sort = sortBy. isEmpty() ? 7 : Inte ger.parseI nt(sortBy) ; | |||||
| 62 | ||||||
| 63 | sw itch (sort ) { | |||||
| 64 | case 0: | |||||
| 65 | quer yParams = queryParam s + " ORDE R BY o.act ive"; | |||||
| 66 | brea k; | |||||
| 67 | case 1: | |||||
| 68 | quer yParams = queryParam s + " ORDE R BY lower (o.oorgPho neNumber)" ; | |||||
| 69 | brea k; | |||||
| 70 | case 2: | |||||
| 71 | quer yParams = queryParam s + " ORDE R BY lower (o.orgComm unityIdPre fix)"; | |||||
| 72 | brea k; | |||||
| 73 | case 3: | |||||
| 74 | quer yParams = queryParam s + " ORDE R BY o.org ConsumerOn ly"; | |||||
| 75 | brea k; | |||||
| 76 | case 4: | |||||
| 77 | quer yParams = queryParam s + " ORDE R BY lower (o.orgCont act)"; | |||||
| 78 | brea k; | |||||
| 79 | case 5: | |||||
| 80 | quer yParams = queryParam s + " ORDE R BY lower (o.orgDoma in)"; | |||||
| 81 | brea k; | |||||
| 82 | case 6: | |||||
| 83 | quer yParams = queryParam s + " ORDE R BY lower (o.orgName )"; | |||||
| 84 | brea k; | |||||
| 85 | case 7: | |||||
| 86 | quer yParams = queryParam s + " ORDE R BY lower (o.orgNumb er)"; | |||||
| 87 | brea k; | |||||
| 88 | case 8: | |||||
| 89 | quer yParams = queryParam s + " ORDE R BY lower (o.orgOid) "; | |||||
| 90 | brea k; | |||||
| 91 | case 9: | |||||
| 92 | quer yParams = queryParam s + " ORDE R BY o.isT rustedClin icalSource "; | |||||
| 93 | brea k; | |||||
| 94 | default: | |||||
| 95 | quer yParams = queryParam s + " ORDE R BY lower (o.orgName ) ASC"; | |||||
| 96 | brea k; | |||||
| 97 | } | |||||
| 98 | ||||||
| 99 | // handle the sort orde r | |||||
| 100 | so rtOrder = sortOrder. isEmpty() ? " DESC" : " " + so rtOrder; | |||||
| 101 | qu eryParams = queryPar ams + sort Order; | |||||
| 102 | ||||||
| 103 | qu ery = quer y + queryP arams; | |||||
| 104 | co untQuery = countQuer y + queryP arams; | |||||
| 105 | ||||||
| 106 | Qu ery q = em .createQue ry(query). setFirstRe sult(start Row); | |||||
| 107 | ||||||
| 108 | if ( maxRows != -1 ) // set the ma x rows if we have it | |||||
| 109 | { | |||||
| 110 | q.setMax Results(ma xRows); | |||||
| 111 | } | |||||
| 112 | ||||||
| 113 | Qu ery cq = e m.createQu ery(countQ uery); | |||||
| 114 | ||||||
| 115 | Ha shMap hm = new HashM ap(); | |||||
| 116 | hm .put("resu lts", (Lis t<Organiza tion>) q.g etResultLi st()); | |||||
| 117 | hm .put("coun t", (Long) cq.getSin gleResult( )); | |||||
| 118 | ||||||
| 119 | re turn hm; | |||||
| 120 | } | |||||
| 121 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.