Produced by Araxis Merge on 6/9/2017 3:51:18 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:18 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\stub\dao | MailNotificationDAO.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 | 155 |
| 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. svc.consen tmgmt.stub .dao; | |||||
| 2 | ||||||
| 3 | import sta tic gov.va .nvap.comm on.date.Da teUtil.voi dTime; | |||||
| 4 | import gov .va.nvap.c ommon.vali dation.Nul lChecker; | |||||
| 5 | import gov .va.nvap.s vc.consent mgmt.stub. data.MailN otificatio n; | |||||
| 6 | import jav a.util.Arr ayList; | |||||
| 7 | import jav a.util.Dat e; | |||||
| 8 | import jav a.util.Lis t; | |||||
| 9 | import jav ax.persist ence.Entit yManager; | |||||
| 10 | import jav ax.persist ence.NoRes ultExcepti on; | |||||
| 11 | import jav ax.persist ence.Persi stenceCont ext; | |||||
| 12 | import jav ax.persist ence.Query ; | |||||
| 13 | import org .springfra mework.tra nsaction.a nnotation. Transactio nal; | |||||
| 14 | ||||||
| 15 | /** | |||||
| 16 | * | |||||
| 17 | * @author Johann So nnenberg | |||||
| 18 | * @since 04/05/0201 6 | |||||
| 19 | */ | |||||
| 20 | public cla ss MailNot ificationD AO { | |||||
| 21 | ||||||
| 22 | @Persi stenceCont ext | |||||
| 23 | privat e EntityMa nager em; | |||||
| 24 | ||||||
| 25 | public void setE ntityManag er(EntityM anager ent ityManager ) { | |||||
| 26 | th is.em = en tityManage r; | |||||
| 27 | } | |||||
| 28 | ||||||
| 29 | @Trans actional | |||||
| 30 | public Long crea te(MailNot ification m) throws Exception { | |||||
| 31 | tr y { | |||||
| 32 | boolean exists = f alse; | |||||
| 33 | ||||||
| 34 | // Strip time from the sentD ate proper ty. | |||||
| 35 | m.setSen tDate(void Time(m.get SentDate() )); | |||||
| 36 | ||||||
| 37 | //check to see if we already have a ma il notific ation for the date s upplied fo r either a delayed c onsent or a regular consent | |||||
| 38 | if (Null Checker.is NullOrEmpt y(m.getCon sentDirId( ))) { | |||||
| 39 | exis ts = this. existByDel ayedConsen tId(m.getD elayedCons entId().ge tDelayedCo nsentId(), m.getSent Date()); | |||||
| 40 | } else { | |||||
| 41 | exis ts = this. existByCon sentDirId( m.getConse ntDirId(). getConsent DirId(), m .getSentDa te()); | |||||
| 42 | } | |||||
| 43 | ||||||
| 44 | //only a dd one if one does n ot already exist | |||||
| 45 | if (!exi sts) { | |||||
| 46 | this .em.persis t(m); | |||||
| 47 | } | |||||
| 48 | } catch (fin al Excepti on ex) { | |||||
| 49 | throw ex ; | |||||
| 50 | } | |||||
| 51 | ||||||
| 52 | re turn m.get MailNotifi cationId() ; | |||||
| 53 | } | |||||
| 54 | ||||||
| 55 | @Trans actional | |||||
| 56 | public MailNotif ication up date(MailN otificatio n m) throw s Exceptio n { | |||||
| 57 | tr y { | |||||
| 58 | // Strip time from the sentD ate proper ty. | |||||
| 59 | m.setSen tDate(void Time(m.get SentDate() )); | |||||
| 60 | ||||||
| 61 | this.em. merge(m); | |||||
| 62 | } catch (fin al Excepti on ex) { | |||||
| 63 | throw ex ; | |||||
| 64 | } | |||||
| 65 | ||||||
| 66 | re turn m; | |||||
| 67 | } | |||||
| 68 | ||||||
| 69 | @Trans actional | |||||
| 70 | public void dele te(MailNot ification m) throws Exception { | |||||
| 71 | tr y { | |||||
| 72 | m = this .em.merge( m); | |||||
| 73 | this.em. remove(m); | |||||
| 74 | } catch (fin al Excepti on ex) { | |||||
| 75 | throw ex ; | |||||
| 76 | } | |||||
| 77 | } | |||||
| 78 | ||||||
| 79 | public MailNotif ication fi nd(final L ong id) { | |||||
| 80 | re turn this. em.find(Ma ilNotifica tion.class , id); | |||||
| 81 | } | |||||
| 82 | ||||||
| 83 | @Trans actional | |||||
| 84 | public List<Mail Notificati on> findBy ConsentDir Id(String consentDir Id) { | |||||
| 85 | tr y { | |||||
| 86 | final Qu ery q = th is.em.crea teQuery("S ELECT m FR OM MailNot ification m WHERE m. consentDir Id.consent DirId = :c onsentDirI d ORDER BY m.sentDat e ASC"); | |||||
| 87 | q.setPar ameter("co nsentDirId ", Long.pa rseLong(co nsentDirId )); | |||||
| 88 | ||||||
| 89 | return ( List<MailN otificatio n>) q.getR esultList( ); | |||||
| 90 | } catch (fin al NoResul tException nre) { | |||||
| 91 | return n ew ArrayLi st<MailNot ification> (); | |||||
| 92 | } | |||||
| 93 | } | |||||
| 94 | ||||||
| 95 | @Trans actional | |||||
| 96 | public List<Mail Notificati on> findBy DelayedCon sentId(Str ing delaye dConsentId ) { | |||||
| 97 | tr y { | |||||
| 98 | final Qu ery q = th is.em.crea teQuery("S ELECT m FR OM MailNot ification m WHERE m. delayedCon sentId.del ayedConsen tId = :del ayedConsen tId ORDER BY m.sentD ate ASC"); | |||||
| 99 | q.setPar ameter("de layedConse ntId", Lon g.parseLon g(delayedC onsentId)) ; | |||||
| 100 | ||||||
| 101 | return ( List<MailN otificatio n>) q.getR esultList( ); | |||||
| 102 | } catch (fin al NoResul tException nre) { | |||||
| 103 | return n ew ArrayLi st<MailNot ification> (); | |||||
| 104 | } | |||||
| 105 | } | |||||
| 106 | ||||||
| 107 | @Trans actional | |||||
| 108 | public List<Mail Notificati on> findBy ConsentDir Ids(List<L ong> conse ntIds) { | |||||
| 109 | tr y { | |||||
| 110 | if (Null Checker.is NullOrEmpt y(consentI ds)) { | |||||
| 111 | retu rn new Arr ayList<Mai lNotificat ion>(); | |||||
| 112 | } | |||||
| 113 | final Qu ery q = th is.em.crea teQuery("S ELECT m FR OM MailNot ification m WHERE m. consentDir Id.consent DirId IN ( :consentId s) ORDER B Y m.sentDa te ASC"); | |||||
| 114 | q.setPar ameter("co nsentIds", consentId s); | |||||
| 115 | ||||||
| 116 | return ( List<MailN otificatio n>) q.getR esultList( ); | |||||
| 117 | } catch (fin al NoResul tException nre) { | |||||
| 118 | return n ew ArrayLi st<MailNot ification> (); | |||||
| 119 | } | |||||
| 120 | } | |||||
| 121 | ||||||
| 122 | @Trans actional | |||||
| 123 | public List<Mail Notificati on> findBy DelayedCon sentIds(Li st<Long> d elayedCons entIds) { | |||||
| 124 | tr y { | |||||
| 125 | if (Null Checker.is NullOrEmpt y(delayedC onsentIds) ) { | |||||
| 126 | retu rn new Arr ayList<Mai lNotificat ion>(); | |||||
| 127 | } | |||||
| 128 | final Qu ery q = th is.em.crea teQuery("S ELECT m FR OM MailNot ification m WHERE m. delayedCon sentId.del ayedConsen tId IN (:d elayedCons entIds) OR DER BY m.s entDate AS C"); | |||||
| 129 | q.setPar ameter("de layedConse ntIds", de layedConse ntIds); | |||||
| 130 | ||||||
| 131 | return ( List<MailN otificatio n>) q.getR esultList( ); | |||||
| 132 | } catch (fin al NoResul tException nre) { | |||||
| 133 | return n ew ArrayLi st<MailNot ification> (); | |||||
| 134 | } | |||||
| 135 | } | |||||
| 136 | ||||||
| 137 | @Trans actional | |||||
| 138 | public boolean e xistByCons entDirId(L ong consen tDirId, Da te sentDat e) { | |||||
| 139 | fi nal Query q = this.e m.createQu ery("SELEC T COUNT(mn ) FROM Mai lNotificat ion mn WHE RE mn.cons entDirId.c onsentDirI d = :conse ntDirId AN D mn.sentD ate = :sen tDate"); | |||||
| 140 | q. setParamet er("consen tDirId", c onsentDirI d); | |||||
| 141 | q. setParamet er("sentDa te", sentD ate); | |||||
| 142 | ||||||
| 143 | re turn (Long ) q.getSin gleResult( ) > 0; | |||||
| 144 | } | |||||
| 145 | ||||||
| 146 | @Trans actional | |||||
| 147 | public boolean e xistByDela yedConsent Id(Long de layedConse ntId, Date sentDate) { | |||||
| 148 | fi nal Query q = this.e m.createQu ery("SELEC T COUNT(mn ) FROM Mai lNotificat ion mn WHE RE mn.dela yedConsent Id.delayed ConsentId = :delayed ConsentId AND mn.sen tDate = :s entDate"); | |||||
| 149 | q. setParamet er("delaye dConsentId ", delayed ConsentId) ; | |||||
| 150 | q. setParamet er("sentDa te", sentD ate); | |||||
| 151 | ||||||
| 152 | re turn (Long ) q.getSin gleResult( ) > 0; | |||||
| 153 | } | |||||
| 154 | ||||||
| 155 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.