Produced by Araxis Merge on 12/20/2017 5:56:12 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_v6_bld6.zip\Source Code\UI\Services\src\main\java\gov\va\genisis2\dao\impl | UserRoleTypeDao.java | Thu Dec 14 19:57:16 2017 UTC |
| 2 | Genisis_2.0_v6_bld6.zip\Source Code\UI\Services\src\main\java\gov\va\genisis2\dao\impl | UserRoleTypeDao.java | Wed Dec 20 22:12:53 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 186 |
| 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.genis is2.dao.im pl; | |
| 2 | ||
| 3 | import jav ax.persist ence.NoRes ultExcepti on; | |
| 4 | import jav ax.persist ence.crite ria.Criter iaBuilder; | |
| 5 | import jav ax.persist ence.crite ria.Criter iaQuery; | |
| 6 | import jav ax.persist ence.crite ria.Predic ate; | |
| 7 | import jav ax.persist ence.crite ria.Root; | |
| 8 | ||
| 9 | import org .hibernate .Session; | |
| 10 | import org .hibernate .SessionFa ctory; | |
| 11 | import org .slf4j.Log ger; | |
| 12 | import org .slf4j.Log gerFactory ; | |
| 13 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 14 | import org .springfra mework.ste reotype.Re pository; | |
| 15 | import org .springfra mework.tra nsaction.a nnotation. Transactio nal; | |
| 16 | ||
| 17 | import gov .va.genisi s2.common. enums.Comm onEnum; | |
| 18 | import gov .va.genisi s2.dao.IUs erRoleType Dao; | |
| 19 | import gov .va.genisi s2.excepti ons.ErrorE num; | |
| 20 | import gov .va.genisi s2.excepti ons.Genisi sDAOExcept ion; | |
| 21 | import gov .va.genisi s2.model.U serRoleTyp e; | |
| 22 | ||
| 23 | /** | |
| 24 | * | |
| 25 | * The Use rRoleType data acces s object ( DAO) is an object th at provide s an | |
| 26 | * abstrac t interfac e to some type of da tabase or other pers istence me chanism. | |
| 27 | * By mapp ing applic ation call s to the p ersistence layer, Us erRoleType DAO | |
| 28 | * provide some spec ific data operations without e xposing de tails of t he | |
| 29 | * databas e. | |
| 30 | * | |
| 31 | * @author P II | |
| 32 | * | |
| 33 | */ | |
| 34 | @Repositor y | |
| 35 | @Transacti onal(value = "transa ctionManag er") | |
| 36 | public cla ss UserRol eTypeDao e xtends Abs tactHibern ateDao imp lements IU serRoleTyp eDao { | |
| 37 | ||
| 38 | pr ivate stat ic final L ogger LOGG ER = Logge rFactory.g etLogger(U serRoleTyp eDao.class ); | |
| 39 | ||
| 40 | @A utowired | |
| 41 | pr ivate Sess ionFactory sessionFa ctory; | |
| 42 | ||
| 43 | @O verride | |
| 44 | pu blic UserR oleType sa veOrUpdate UserRoleTy pe(UserRol eType user RoleType) throws Gen isisDAOExc eption { | |
| 45 | if ( userRoleTy pe == null ) { | |
| 46 | throw new Genisi sDAOExcept ion("userR oleType en tity is nu ll"); | |
| 47 | } | |
| 48 | ||
| 49 | User RoleType p ersistentU serRoleTyp e; | |
| 50 | try { | |
| 51 | Sessio n session = sessionF actory.get CurrentSes sion(); | |
| 52 | if (us erRoleType .getId() < = 0) { | |
| 53 | userRole Type.setId (getMaxRow Value(sess ion, UserR oleType.cl ass, Commo nEnum.STAT US_ID.getT ext())); | |
| 54 | } | |
| 55 | persis tentUserRo leType = ( UserRoleTy pe) update Data(sessi on, userRo leType); | |
| 56 | } ca tch (Excep tion ex) { | |
| 57 | LOGGER .error("Ex ception oc cured on c reateUserR oleType.", ex); | |
| 58 | throw new Genisi sDAOExcept ion("Excep tion occur ed on crea teUserRole Type.", ex ); | |
| 59 | } | |
| 60 | ||
| 61 | retu rn persist entUserRol eType; | |
| 62 | } | |
| 63 | ||
| 64 | @O verride | |
| 65 | pu blic UserR oleType ge tUserRoleT ypeByUserI d(int user Id) throws GenisisDA OException { | |
| 66 | User RoleType u serRoleTyp e = null; | |
| 67 | ||
| 68 | try { | |
| 69 | Sessio n session = sessionF actory.get CurrentSes sion(); | |
| 70 | Criter iaBuilder criteriaBu ilder = se ssion.getC riteriaBui lder(); | |
| 71 | Criter iaQuery<Us erRoleType > query = criteriaBu ilder.crea teQuery(Us erRoleType .class); | |
| 72 | Root<U serRoleTyp e> root = query.from (UserRoleT ype.class) ; | |
| 73 | Predic ate condit ion = crit eriaBuilde r.equal(ro ot.get(Com monEnum.US ER_ID.getT ext()), us erId); | |
| 74 | query. where(cond ition); | |
| 75 | userRo leType = s ession.cre ateQuery(q uery).getS ingleResul t(); | |
| 76 | } ca tch (NoRes ultExcepti on e) { | |
| 77 | // Swa llow excep tion | |
| 78 | LOGGER .error(Err orEnum.USE RROLETYPE_ DAO_EXP_GE TUSERROLET YPE.getErr orMessage( ), userId, e); | |
| 79 | } ca tch (Excep tion ex) { | |
| 80 | LOGGER .error(Err orEnum.USE RROLETYPE_ DAO_EXP_GE TUSERROLET YPE.getErr orMessage( ), userId, ex); | |
| 81 | throw new Genisi sDAOExcept ion(ex.get Class().ge tSimpleNam e(), ex); | |
| 82 | } | |
| 83 | ||
| 84 | retu rn userRol eType; | |
| 85 | } | |
| 86 | ||
| 87 | /* * | |
| 88 | * @param se ssionFacto ry | |
| 89 | * the sess ionFactory to set | |
| 90 | * / | |
| 91 | pu blic void setSession Factory(Se ssionFacto ry session Factory) { | |
| 92 | this .sessionFa ctory = se ssionFacto ry; | |
| 93 | } | |
| 94 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.