260. EPMO Open Source Coordination Office Redaction File Detail Report

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

260.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCommon\main\src\java\gov\va\med\interactive Command.java Mon Dec 4 21:34:26 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\ImagingCommon\main\src\java\gov\va\med\interactive Command.java Mon Dec 4 22:02:06 2017 UTC

260.2 Comparison summary

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

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

260.4 Active regular expressions

No regular expressions were active.

260.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.i nteractive ;
  5  
  6   import jav a.lang.ref lect.Metho d;
  7   import org .apache.lo gging.log4 j.LogManag er;
  8   import org .apache.lo gging.log4 j.Logger;
  9  
  10   /**
  11    * @author         
BECKEC
  12    *
  13    */
  14   public abs tract clas s Command< M>
  15   {
  16           pr ivate fina l Logger l ogger = nu ll; //LogM anager.get Logger(thi s.getClass ());
  17           
  18           pr ivate Comm andFactory <M> comman dFactory;
  19           pr ivate Stri ng[] comma ndParamete rValues;
  20           
  21           /* *
  22            *  A Command Processor  that takes  no parame ters may c all this
  23            *  (the defa ult no-arg ) construc tor.
  24            *   
  25            *  @return
  26            * /
  27           pu blic Comma nd()
  28           {
  29                    this .commandPa rameterVal ues = null ;
  30           }
  31           
  32           /* *
  33            *  A Command Processor  that takes  any param eters must  implement  a constru ctor
  34            *  overridin g this for m.
  35            *  
  36            *  @param co mmandParam eterValues
  37            * /
  38           pu blic Comma nd (String [] command ParameterV alues)
  39           {
  40                    this .commandPa rameterVal ues = comm andParamet erValues;
  41           }
  42  
  43           pr otected St ring[] get CommandPar ameterValu es()
  44           {
  45                    retu rn command ParameterV alues;
  46           }
  47           
  48           /* *
  49            *  
  50            *  @param co mmandParam eterValues
  51            *  @return
  52            * /
  53           pr otected vo id validat eParameter s(String[]  commandPa rameterVal ues)
  54           th rows Comma ndValidati onExceptio n
  55           {
  56                    Comm andParamet ersDescrip tion<?>[]  parameters Descs = ge tInstanceC ommandPara metersDesc ription();
  57                    if(p arametersD escs == nu ll)
  58                             return ;          // can't r eally vali date witho ut the des cription
  59  
  60                    Comm andValidat ionExcepti ons except ions = new  CommandVa lidationEx ceptions() ;
  61                    int  parameterI ndex = 0;
  62                    for( CommandPar ametersDes cription<? > paramete rDesc : pa rametersDe scs)
  63                    {
  64                             if(par ameterDesc .isRequire d() && par ameterInde x >= comma ndParamete rValues.le ngth)
  65                                      exceptio ns.add(new  CommandVa lidationEx ception("R equired fi eld '" + p arameterDe sc.getPara meterName( ) + "' is  not presen t."));
  66                             
  67                             
  68                             ++para meterIndex ;
  69                    }
  70                    
  71                    if(e xceptions. size() > 0 )
  72                             throw  exceptions ;
  73           }
  74           
  75           pr ivate Obje ct[] typec heckedPara meters;
  76           pr otected sy nchronized  Object[]  getTypeche ckedParame ters() 
  77           th rows Comma ndValidati onExceptio n
  78           {
  79                    if(t his.typech eckedParam eters == n ull)
  80                             create TypeChecke dParameter s(getComma ndParamete rValues()) ;
  81                    
  82                    retu rn this.ty pecheckedP arameters;
  83           }
  84           
  85           /* *
  86            *  Get the C ommandPara metersDesc ription fr om the com mand that  has the gi ven index.
  87            *  
  88            *  @param na me
  89            *  @return
  90            * /
  91           pr otected Co mmandParam etersDescr iption<?>  getCommand Parameters Descriptio n(int inde x)
  92           {
  93                    try
  94                    {
  95                             Class< ?> clazz =  this.getC lass();
  96                             Method  parameter Descriptio nsMethod =  clazz.get Method("ge tCommandPa rametersDe scription" , (Class<? >[])null);
  97                             Comman dParameter sDescripti on<?>[] co mmandParam etersDescr iption = 
  98                                      (Command Parameters Descriptio n[])( para meterDescr iptionsMet hod.invoke (null, (Ob ject[])nul l) );
  99                             
  100                             return  commandPa rametersDe scription[ index];
  101                    }
  102                    catc h (Excepti on x)
  103                    {
  104                             return  null;
  105                    }
  106           }
  107           
  108           /* *
  109            *  Get the C ommandPara metersDesc ription fr om the com mand that  has the gi ven name.
  110            *  
  111            *  @param na me
  112            *  @return
  113            * /
  114           pr otected Co mmandParam etersDescr iption<?>  getCommand Parameters Descriptio n(String n ame)
  115           {
  116                    Comm andParamet ersDescrip tion<?>[]  commandPar ametersDes cription =  getComman dsParamete rsDescript ions();
  117  
  118                    if(c ommandPara metersDesc ription !=  null)
  119                             for( C ommandPara metersDesc ription<?>  commandPa rameterDes cription :  commandPa rametersDe scription  )
  120                                      if( name .equals(co mmandParam eterDescri ption.getP arameterNa me()) )
  121                                               return com mandParame terDescrip tion;
  122  
  123                    retu rn null;
  124           }
  125  
  126           pr ivate Comm andParamet ersDescrip tion<?>[]  cpdxs = nu ll;
  127           pr ivate sync hronized C ommandPara metersDesc ription<?> [] getComm andsParame tersDescri ptions() 
  128           {
  129                    if(c pdxs == nu ll)
  130                             try
  131                             {
  132                                      Class<?>  clazz = t his.getCla ss();
  133                                      Method p arameterDe scriptions Method = c lazz.getMe thod("getC ommandPara metersDesc ription",  (Class<?>[ ])null);
  134                                      CommandP arametersD escription <?>[] comm andParamet ersDescrip tion = 
  135                                               (CommandPa rametersDe scription[ ])( parame terDescrip tionsMetho d.invoke(n ull, (Obje ct[])null)  );
  136                                      cpdxs =  commandPar ametersDes cription;
  137                             }
  138                             catch  (Exception  x)
  139                             {
  140                                      cpdxs =  null;
  141                             }
  142                             
  143                    retu rn cpdxs;
  144           }
  145           
  146           /* *
  147            *  
  148            *  @param cp x
  149            *  @return
  150            * /
  151           pr otected in t getComma ndParamete rsDescript ionIndex(f inal Comma ndParamete rsDescript ion<?> cpx )
  152           {
  153                    Comm andParamet ersDescrip tion<?>[]  commandPar ametersDes cription =  getComman dsParamete rsDescript ions();
  154  
  155                    int  index = 0;
  156                    if(c ommandPara metersDesc ription !=  null)
  157                             for( C ommandPara metersDesc ription<?>  commandPa rameterDes cription :  commandPa rametersDe scription  )
  158                             {
  159                                      if( comm andParamet erDescript ion.equals (cpx) )
  160                                               return ind ex;
  161                                      ++index;
  162                             }
  163                    retu rn -1;
  164           }
  165           /* *
  166            *  
  167            *  @param co mmandParam eterValues
  168            *  @return
  169            *  @throws C ommandVali dationExce ption 
  170            * /
  171           pr ivate void  createTyp eCheckedPa rameters(f inal Strin g[] comman dParameter Values) 
  172           th rows Comma ndValidati onExceptio n
  173           {
  174                    Comm andParamet ersDescrip tion<?>[]  parameters Descs = ge tInstanceC ommandPara metersDesc ription();
  175                    if(p arametersD escs == nu ll)
  176                             return ;
  177                    
  178                    this .typecheck edParamete rs = new O bject[para metersDesc s.length];
  179                    int  parameterI ndex = 0;
  180                    for(  CommandPa rametersDe scription< ?> paramet ersDesc :  parameters Descs)
  181                    {
  182                             String  source =  (parameter Index < co mmandParam eterValues .length) ?  commandPa rameterVal ues[parame terIndex]  : null;
  183                             
  184                             this.t ypechecked Parameters [parameter Index] = p arametersD esc.getVal ue(source)
  185                             ++para meterIndex ;
  186                    }
  187                    
  188                    retu rn;
  189           }
  190  
  191           /* *
  192            *  If the co mmand has  a static g etCommandP arametersD escription  method th en call it
  193            *  and retur n the resu lt else re turn null.
  194            *  
  195            *  @return
  196            * /
  197           pu blic Comma ndParamete rsDescript ion<?>[] g etInstance CommandPar ametersDes cription()
  198           {
  199                    try
  200                    {
  201                             Method  staticPar ametersDes criptionAc cessor = t his.getCla ss().getMe thod("getC ommandPara metersDesc ription",  (Class[])n ull);
  202                             return  (CommandP arametersD escription []) static Parameters Descriptio nAccessor. invoke(nul l, (Object [])null);
  203                    } 
  204                    catc h (Excepti on x)
  205                    {
  206                             return  null;
  207                    }
  208           }
  209  
  210           pu blic boole an isParam eterExists (int index )
  211           {
  212                    retu rn index <  this.getC ommandPara meterValue s().length ;
  213           }
  214           
  215           pu blic boole an isParam eterExists (String na me)
  216           {
  217                    Comm andParamet ersDescrip tion<?> cp x = this.g etCommandP arametersD escription (name);
  218                    int  index = th is.getComm andParamet ersDescrip tionIndex( cpx);
  219                    
  220                    retu rn isParam eterExists (index);
  221           }
  222           
  223           /* *
  224            *  
  225            *  @param <T >
  226            *  @param in dex
  227            *  @param ex pectedClas s
  228            *  @return
  229            *  @throws C ommandType Validation Exception
  230            * /
  231           @S uppressWar nings("unc hecked")
  232           pu blic <T ex tends Obje ct> T getP arameterVa lue(int in dex, Class <T> expect edClass) 
  233           th rows Comma ndTypeVali dationExce ption
  234           {
  235                    Comm andParamet ersDescrip tion<?> cp x = this.g etCommandP arametersD escription (index);
  236                    if(  cpx != nul l && expec tedClass.i sAssignabl eFrom(cpx. getParamet erClass())  && index  < this.get CommandPar ameterValu es().lengt h)
  237                             return  (T)cpx.ge tValue(thi s.getComma ndParamete rValues()[ index]);
  238                    else
  239                             return  null;
  240           }
  241           
  242           /* *
  243            *  
  244            *  @param <T >
  245            *  @param na me
  246            *  @param ex pectedClas s
  247            *  @return
  248            *  @throws C ommandType Validation Exception
  249            * /
  250           @S uppressWar nings("unc hecked")
  251           pu blic <T ex tends Obje ct> T getP arameterVa lue(String  name, Cla ss<T> expe ctedClass)
  252           th rows Comma ndTypeVali dationExce ption
  253           {
  254                    Comm andParamet ersDescrip tion<?> cp x = this.g etCommandP arametersD escription (name);
  255                    if(c px == null )
  256                             return  (T)( Bool ean.class  == expecte dClass ? B oolean.FAL SE : null  );
  257                    
  258                    int  index = ge tCommandPa rametersDe scriptionI ndex(cpx);
  259                    if(i ndex >= 0)
  260                             return
  261                                      this.get CommandPar ameterValu es() != nu ll &&
  262                                      this.get CommandPar ameterValu es().lengt h > index  ?
  263                                               (T)cpx.get Value(this .getComman dParameter Values()[i ndex]) :
  264                                               ( Boolean. class.equa ls(cpx.get ParameterC lass()) ?  (T)Boolean .FALSE : n ull );
  265                    else
  266                             return  null;
  267           }
  268           
  269           /* *
  270            *  @return t he command Factory
  271            * /
  272           pu blic Comma ndFactory< M> getComm andFactory ()
  273           {
  274                    retu rn this.co mmandFacto ry;
  275           }
  276  
  277           /* *
  278            *  @param co mmandFacto ry the com mandFactor y to set
  279            * /
  280           pu blic void  setCommand Factory(Co mmandFacto ry<M> comm andFactory )
  281           {
  282                    this .commandFa ctory = co mmandFacto ry;
  283           }
  284  
  285           pr otected Lo gger getLo gger()
  286           {
  287                    retu rn LogMana ger.getLog ger(this.g etClass()) ;
  288                    //re turn this. logger;
  289           }
  290  
  291           pu blic abstr act void p rocessComm and(Comman dProcessor <M> proces sor, M man agedObject )
  292           th rows Excep tion;
  293           
  294           pu blic boole an exitAft erProcessi ng(){retur n false;}
  295   }