221. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/5/2017 12:06:42 PM Central 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.

221.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingBaseWebFacade\main\src\java\gov\va\med\imaging\exchange\business\taglib\image ImageHRefTag.java Mon Dec 4 21:35:30 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingBaseWebFacade\main\src\java\gov\va\med\imaging\exchange\business\taglib\image ImageHRefTag.java Mon Dec 4 22:01:17 2017 UTC

221.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 414
Changed 2 4
Inserted 0 0
Removed 0 0

221.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

221.4 Active regular expressions

No regular expressions were active.

221.5 Comparison detail

  1   /**
  2    * Package : MAG - Vi stA Imagin g
  3    * WARNING : Per VHA  Directive  2004-038,  this routi ne should  not be mod ified.
  4    * Date Cr eated: Feb  4, 2008
  5    * Site Na me:  Washi ngton OI F ield Offic e, Silver  Spring, MD
  6    * @author         
BECKEC
  7    * @versio n 1.0
  8    *
  9    * ------- ---------- ---------- ---------- ---------- ---------- -------
  10    * Propert y of the U S Governme nt.
  11    * No perm ission to  copy or re distribute  this soft ware is gi ven.
  12    * Use of  unreleased  versions  of this so ftware req uires the  user
  13    * to exec ute a writ ten test a greement w ith the Vi stA Imagin g
  14    * Develop ment Offic e of the D epartment  of Veteran s Affairs,
  15    * telepho ne (301) 7 34-0100.
  16    * 
  17    * The Foo d and Drug  Administr ation clas sifies thi s software  as
  18    * a Class  II medica l device.   As such,  it may not  be change d
  19    * in any  way.  Modi fications  to this so ftware may  result in  an
  20    * adulter ated medic al device  under 21CF R820, the  use of whi ch
  21    * is cons idered to  be a viola tion of US  Federal S tatutes.
  22    * ------- ---------- ---------- ---------- ---------- ---------- -------
  23    */
  24   package go v.va.med.i maging.exc hange.busi ness.tagli b.image;
  25  
  26   import gov .va.med.im aging.exce ptions.URN FormatExce ption;
  27   import gov .va.med.im aging.exch ange.busin ess.Image;
  28   import gov .va.med.im aging.exch ange.enums .ImageForm at;
  29   import gov .va.med.im aging.exch ange.enums .ImageQual ity;
  30  
  31   import jav ax.servlet .jsp.JspEx ception;
  32  
  33   import org .apache.lo gging.log4 j.LogManag er;
  34   import org .apache.lo gging.log4 j.Logger;
  35  
  36   /**
  37    * This ta g will gen erate a St ring that  can be use d as an hr ef to an i mage.
  38    * It need s, by defa ult, only  the applic ation path  (servlet  mapping )  of the WAI  servlet.
  39    * The ima ge specifi cation is  determined  by the su rrounding  AbstractIm ageTag.
  40    * The qua lity and a ccept type  may be se t using ta g properti es, or if  left blank
  41    * will be  defaulted .
  42    * 
  43    * @author         
BECKEC
  44    */
  45   public cla ss ImageHR efTag 
  46   extends Ab stractImag ePropertyT ag
  47   {
  48           pr ivate stat ic final l ong serial VersionUID  = 1L;
  49           
  50           pr ivate Logg er logger  = LogManag er.getLogg er(this.ge tClass());
  51           
  52           pr ivate fina l static S tring imag eUrnParame terKey = " <imageUrn> ";
  53           pr ivate fina l static S tring imag eQualityPa rameterKey  = "<image Quality>";
  54           pr ivate fina l static S tring cont entTypePar ameterKey  = "<conten tType>";
  55  
  56           pr ivate fina l static S tring defa ultContext Base = "";
  57           pr ivate fina l static S tring defa ultQuerySt ringPatter n = 
  58                    "ima geUrn=" +  imageUrnPa rameterKey  + 
  59                    "&im ageQuality =" + image QualityPar ameterKey 
  60                    "&co ntentType= " + conten tTypeParam eterKey;
  61           
  62           pr ivate Stri ng context Base = def aultContex tBase;
  63           pr ivate Stri ng applica tionPath;
  64           pr ivate Stri ng querySt ringPatter n = defaul tQueryStri ngPattern;
  65           pr ivate Imag eQuality i mageQualit y = ImageQ uality.THU MBNAIL;
  66           pr ivate Imag eFormat co ntentType  = ImageFor mat.JPEG;
  67           
  68           /* *
  69            *  Set/Get t he context  portion o f the URL.   This pro perty is o ptional
  70            *  and, if n ot specifi ed will de fault to a  zero-leng th string.
  71            *  
  72            *  @return
  73            * /
  74           pu blic Strin g getConte xtBase()
  75       {
  76           re turn conte xtBase ==  null || co ntextBase. length() = = 0 ? defa ultContext Base : con textBase;
  77       }
  78           pu blic void  setContext Base(Strin g contextB ase)
  79       {
  80           th is.context Base = con textBase;
  81       }
  82  
  83           /* *
  84            *  This prop erty must  be specifi ed.
  85            *  The porti on of the  URL that s pecifies t he path wi thin the a pplication .
  86            *  The conte xtPath sho uld be use d to speci fy the hos t, port an d applicat ion name i f
  87            *  the path  is externa l to the a pplication  (else lef t blank).
  88            *  @return
  89            * /
  90           pu blic Strin g getAppli cationPath ()
  91       {
  92           re turn appli cationPath ;
  93       }
  94           pu blic void  setApplica tionPath(S tring appl icationPat h)
  95       {
  96           th is.applica tionPath =  applicati onPath;
  97       }
  98  
  99           /* *
  100            *  The href  is formed  by substit uting the  enclosing  image tags  identifyi ng informa tion
  101            *  into the  UrlRegex s tring.  Th e regex sh ould inclu de the fol lowing tag s where th e values
  102            *  are to be  substitut ed:
  103            *  <imageUrn >
  104            *  <imageQua lity>
  105            *  <contentT ype>
  106            *  
  107            *  If this p roperty is  not speci fied then  the follow ing values  is used: 
  108            *  "imageUrn =<imageUrn >&imageQua lity=<imag eQuality>& contentTyp e=<content Type>;
  109            *  
  110            *  @return
  111            * /
  112           pu blic Strin g getQuery StringPatt ern()
  113       {
  114           re turn query StringPatt ern == nul l || query StringPatt ern.length () == 0 ?  defaultQue ryStringPa ttern : qu eryStringP attern;
  115       }
  116           pu blic void  setQuerySt ringPatter n(String u rlRegex)
  117       {
  118           th is.querySt ringPatter n = urlReg ex;
  119       }
  120  
  121           /* *
  122            *  Specifies  the image  quality d esired in  the respon se stream.
  123            *  Must be o ne of:
  124            *  "THUMBNAI L"
  125            *  "REFERENC E"
  126            *  "DIAGNOST IC"
  127            *  "DIAGNOST ICUNCOMPRE SSED"
  128            *  or an int eger numbe r from 1 t o 100
  129            *  
  130            *  @return
  131            * /
  132           pu blic Strin g getImage Quality()
  133       {
  134           re turn image Quality.na me();      // 16Sep20 08 CTB nam e() change d from toS tring()
  135       }
  136           pu blic void  setImageQu ality(Stri ng imageQu alityExter nalForm)
  137       {
  138                    try
  139                    {
  140                             this.i mageQualit y = ImageQ uality.val ueOf(image QualityExt ernalForm) ;
  141                    }
  142                    catc h(IllegalA rgumentExc eption iaX )
  143                    {
  144                             try
  145                {
  146                         int qualit yQValue =  Integer.pa rseInt(ima geQualityE xternalFor m);
  147                         this.image Quality =  ImageQuali ty.getImag eQuality(q ualityQVal ue);
  148                } 
  149                             catch  (NumberFor matExcepti on e)
  150                {
  151                                      logger.w arn(
  152                                               "Image Qua lity '" +  imageQuali tyExternal Form + 
  153                                               "' is neit her a vali d ImageQua lity or nu mber betwe en 1 and 1 00, defaul ting to DI AGNOSTIC." );
  154                                      this.ima geQuality  = ImageQua lity.DIAGN OSTIC;
  155                }
  156                    }
  157       }
  158           /* *
  159            *  
  160            *  @return
  161            * /
  162           pu blic Strin g getConte ntType()
  163       {
  164           re turn conte ntType.toS tring();
  165       }
  166           
  167           pu blic void  setContent Type(Strin g contentT ypeExterna lForm)
  168       {
  169           tr y
  170           {
  171                    this .contentTy pe = Image Format.val ueOf(conte ntTypeExte rnalForm);
  172           } 
  173           ca tch (Illeg alArgument Exception  iaX)
  174           {
  175                             logger .warn(
  176                                      "Content  Type '" +  contentTy peExternal Form + 
  177                                      "' is no t a valid  ImageForma t, default ing to DIC OMJPEG2000 .");
  178                    this .contentTy pe = Image Format.DIC OMJPEG2000 ;
  179           }
  180       }
  181           /* *
  182            *  @see gov. va.med.ima ging.excha nge.busine ss.taglib. image.Abst ractImageP ropertyTag #getElemen tValue()
  183            * /
  184           @O verride
  185           pr otected St ring getEl ementValue () 
  186           th rows JspEx ception
  187           {
  188                    Stri ng querySt ring = get QueryStrin gPattern() ;
  189                    
  190                    Imag e image =  this.getIm age();
  191                    Stri ng imageUr nExternal  = null;
  192                    imag eUrnExtern al = image .getImageU rn().toStr ing();
  193                    quer yString =  queryStrin g.replace( imageUrnPa rameterKey , imageUrn External);
  194                    quer yString =  queryStrin g.replace( imageQuali tyParamete rKey, Inte ger.toStri ng(imageQu ality.getC anonical() ) );
  195                    quer yString =  queryStrin g.replace( contentTyp eParameter Key, conte ntType.get Mime());
  196                    
  197                    Stri ngBuilder  sb = new S tringBuild er();
  198                    if(g etContextB ase() != n ull && get ContextBas e().length () > 0)
  199                             sb.app end(getCon textBase() );
  200                    if(s b.length()  == 0 || ' /' != sb.c harAt(sb.l ength()-1) )
  201                             sb.app end("/");
  202                    sb.a ppend(getA pplication Path());
  203                    sb.a ppend("?") ;
  204                    sb.a ppend(quer yString);
  205                    
  206                    retu rn sb.toSt ring();
  207           }
  208  
  209   }