110. EPMO Open Source Coordination Office Redaction File Detail Report

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.

110.1 Files compared

# Location File Last Modified
1 Genisis_2.0_v6_bld6.zip\Source Code\UI\Services\src\main\java\gov\va\genisis2\dao\impl AttachmentDAO.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 AttachmentDAO.java Wed Dec 20 22:11:40 2017 UTC

110.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 244
Changed 1 2
Inserted 0 0
Removed 0 0

110.3 Comparison options

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

110.4 Active regular expressions

No regular expressions were active.

110.5 Comparison detail

  1   package go v.va.genis is2.dao.im pl;
  2  
  3   import jav a.util.Lis t;
  4  
  5   import jav ax.persist ence.crite ria.Criter iaBuilder;
  6   import jav ax.persist ence.crite ria.Criter iaQuery;
  7   import jav ax.persist ence.crite ria.Predic ate;
  8   import jav ax.persist ence.crite ria.Root;
  9  
  10   import org .hibernate .Criteria;
  11   import org .hibernate .Session;
  12   import org .hibernate .SessionFa ctory;
  13   import org .hibernate .criterion .Projectio ns;
  14   import org .slf4j.Log ger;
  15   import org .slf4j.Log gerFactory ;
  16   import org .springfra mework.bea ns.factory .annotatio n.Autowire d;
  17   import org .springfra mework.ste reotype.Re pository;
  18   import org .springfra mework.tra nsaction.a nnotation. Transactio nal;
  19  
  20   import gov .va.genisi s2.dao.IAt tachmentDA O;
  21   import gov .va.genisi s2.excepti ons.Genisi sDAOExcept ion;
  22   import gov .va.genisi s2.model.A ttachment;
  23  
  24   /**
  25    * @author   PII
  26    * 
  27    */
  28   /**
  29    * The Cla ss Attachm entDAO.
  30    * 
  31    * The Att achmentDAO  data acce ss object  (DAO) is a n object t hat provid es an
  32    * abstrac t interfac e to some  type of da tabase or  other pers istence me chanism.
  33    * By mapp ing applic ation call s to the p ersistence  layer, At tachmentDA O provide
  34    * some sp ecific dat a operatio ns without  exposing  details of  the datab ase.
  35    */
  36   @Repositor y
  37   @Transacti onal(value  = "transa ctionManag er")
  38   public cla ss Attachm entDAO imp lements IA ttachmentD AO {
  39  
  40           /* * The LOGG ER. */
  41           pr ivate stat ic final L ogger LOGG ER = Logge rFactory.g etLogger(A ttachmentD AO.class);
  42  
  43           @A utowired
  44           pr ivate Sess ionFactory  sessionFa ctory;
  45  
  46           @O verride
  47           pu blic int s ubmitOrMod ify(Attach ment entit y) throws  GenisisDAO Exception  {
  48                    if ( LOGGER.isI nfoEnabled ()) {
  49                             LOGGER .info("sub mitOrModif y (Attachm ent) ");
  50                    }
  51  
  52                    Inte ger attach ementId;
  53                    if ( entity.get Attachment Id() == 0)  {
  54                             attach ementId =  this.maxRo wValueAtta chment();
  55                             entity .setAttach mentId(att achementId );
  56                    }
  57                    try  {
  58                             Sessio n session  = sessionF actory.get CurrentSes sion();
  59                             sessio n.saveOrUp date(entit y);
  60                             sessio n.flush();
  61                    } ca tch (Excep tion ex) {
  62                             LOGGER .error("Ex ception oc curred on  submitOrMo dify Attac hment.", e x);
  63                             throw  new Genisi sDAOExcept ion("Excep tion occur red on sub mitOrModif y Attachme nt.", ex);
  64                    }
  65                    retu rn entity. getAttachm entId();
  66           }
  67  
  68           @O verride
  69           pu blic List< Attachment > getAttac hmentByReq uestId(int  requestId ) throws G enisisDAOE xception {
  70  
  71                    if ( LOGGER.isI nfoEnabled ()) {
  72                             LOGGER .info("get Attachment ByRequestI d ");
  73                    }
  74  
  75                    List <Attachmen t> listAtt achment =  null;
  76                    try  {
  77                             Sessio n session  = sessionF actory.get CurrentSes sion();
  78                             Criter iaBuilder  criteriaBu ilder = se ssion.getC riteriaBui lder();
  79                             Criter iaQuery<At tachment>  query = cr iteriaBuil der.create Query(Atta chment.cla ss);
  80                             Root<A ttachment>  root = qu ery.from(A ttachment. class);
  81                             Predic ate condit ion1 = cri teriaBuild er.equal(r oot.get("r equest").g et("id"),  requestId) ;
  82                             Predic ate condit ions = cri teriaBuild er.and(con dition1);
  83                             query. where(cond itions);
  84                             listAt tachment =  session.c reateQuery (query).ge tResultLis t();
  85                    } ca tch (Excep tion ex) {
  86                             LOGGER .error("Ex ception oc curred whi le queryin g  getAtta chmentByRe questId.",  ex);
  87                             throw  new Genisi sDAOExcept ion("Excep tion occur red while  querying   getAttachm entByReque stId.", ex );
  88                    }
  89                    retu rn listAtt achment;
  90           }
  91  
  92           /* *
  93            *  This meth od is used  to get ma x value re cord from  the table.
  94            *  
  95            *  @return i nt This re turns max  value reco rd plus on e.
  96            * /
  97           pr ivate int  maxRowValu eAttachmen t() {
  98                    // T ODO: creat eCriteria  Deprecated
  99                    int  maxRowVal  = 1;
  100                    Inte ger result  = 0;
  101                    try  {
  102                             Sessio n session  = sessionF actory.get CurrentSes sion();
  103                             @Suppr essWarning s("depreca tion")
  104                             Criter ia criteri a = sessio n.createCr iteria(Att achment.cl ass).setPr ojection(P rojections .max("atta chmentId") );
  105                             result  = (Intege r) criteri a.uniqueRe sult();
  106                    } ca tch (Excep tion ex) {
  107                             LOGGER .error("Ex ception oc curred on  maxRowValu e().", ex) ;
  108                    }
  109                    if ( result !=  null) {
  110                             maxRow Val = resu lt.intValu e() + 1;
  111                    }
  112                    retu rn maxRowV al;
  113           }
  114  
  115           /* *
  116            *  @param se ssionFacto ry
  117            *              the sess ionFactory  to set
  118            * /
  119           pu blic void  setSession Factory(Se ssionFacto ry session Factory) {
  120                    this .sessionFa ctory = se ssionFacto ry;
  121           }
  122  
  123   }