16. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 3/1/2018 12:13:14 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.

16.1 Files compared

# Location File Last Modified
1 ehealth_xchange_cif.zip\NHIN_adapter\AdapterCommonEJB\src\test\java\gov\va\med\nhin\adapter\datamanager ExecuteTransform.java Thu Feb 22 14:27:30 2018 UTC
2 ehealth_xchange_cif.zip\NHIN_adapter\AdapterCommonEJB\src\test\java\gov\va\med\nhin\adapter\datamanager ExecuteTransform.java Tue Feb 27 14:23:23 2018 UTC

16.2 Comparison summary

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

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

16.4 Active regular expressions

No regular expressions were active.

16.5 Comparison detail

  1   package go v.va.med.n hin.adapte r.datamana ger;
  2  
  3   import gov .va.med.nh in.adapter .datamanag er.config. QueryType;
  4   import gov .va.med.nh in.adapter .datamanag er.config. ReferenceT ype;
  5   import gov .va.med.nh in.adapter .datamanag er.parsers .JAXBDataP arser;
  6   import gov .va.med.nh in.adapter .datamanag er.transla tors.Filte rDataTrans lator;
  7   import gov .va.med.nh in.adapter .results.F MDateTimeT ype;
  8   import gov .va.med.nh in.adapter .utils.con fig.Proper tiesType;
  9   import gov .va.med.nh in.adapter .utils.con fig.Proper tyType;
  10   import gov .va.med.nh in.adapter .xmlutils. XMLTemplat e;
  11   import gov .va.med.nh in.adapter .xmlutils. XMLTemplat eFactory;
  12  
  13   import jav a.io.Buffe redReader;
  14   import jav a.io.ByteA rrayInputS tream;
  15   import jav a.io.ByteA rrayOutput Stream;
  16   import jav a.io.File;
  17   import jav a.io.FileF ilter;
  18   import jav a.io.FileR eader;
  19   import jav a.io.IOExc eption;
  20   import jav a.text.Sim pleDateFor mat;
  21   import jav a.util.Arr ayList;
  22   import jav a.util.Col lections;
  23   import jav a.util.Dat e;
  24   import jav a.util.Enu meration;
  25   import jav a.util.Has hMap;
  26   import jav a.util.Lis t;
  27   import jav a.util.Map ;
  28   import jav a.util.log ging.FileH andler;
  29   import jav a.util.log ging.Handl er;
  30   import jav a.util.log ging.Level ;
  31  
  32   import jav ax.xml.bin d.JAXBExce ption;
  33   import jav ax.xml.tra nsform.Tra nsformer;
  34   import jav ax.xml.tra nsform.Tra nsformerEx ception;
  35   import jav ax.xml.tra nsform.Tra nsformerFa ctory;
  36   import jav ax.xml.tra nsform.dom .DOMSource ;
  37   import jav ax.xml.tra nsform.str eam.Stream Result;
  38  
  39   import org .apache.co mmons.cli. BasicParse r;
  40   import org .apache.co mmons.cli. CommandLin e;
  41   import org .apache.co mmons.cli. CommandLin eParser;
  42   import org .apache.co mmons.cli. Options;
  43   import org .apache.co mmons.lang .NumberUti ls;
  44   import org .apache.co mmons.lang .RandomStr ingUtils;
  45  
  46   //import c om.google. gson.Gson;
  47  
  48   public cla ss Execute Transform  {
  49  
  50           pr ivate stat ic final M ap<String,  String> B ILLY_SOURC E_TO_PROPE RTY = Coll ections
  51                             .unmod ifiableMap (new HashM ap<String,  String>()  {
  52                                      {
  53                                               put("VPR_O rders", "f utureOrder s");
  54                                               put("VPR_R adiologies ", "future Radiology" );
  55                                               put("VPR_P rocedures" , "futureP rocedures" );
  56                                               put("VPR_A ppointment s", "appoi ntments");
  57                                               put("VPR_V isits", "v isits");
  58                                               put("VPR_V itals", "v itals");
  59                                               put("VPR_P ANELS", "l abs");
  60                                               put("VPR_M eds", "med ications") ;
  61                                               put("VPR_S urgeries",  "surgerie s");
  62                                               //put("VPR _AdvanceDi rective",  "documents ");
  63                                               //put("VPR _Discharge Summary",  "discharge Summaries" );
  64                                               //put("VPR _Demograph ics", "dem ographics" );
  65                                               put("VPR_R adiologies ", "radiol ogies");
  66                                               put("VPR_O rders", "f utureOrder s");
  67                                               //put("VPR _Pathologi es", "path ologies");
  68                                               put("VPR_V itals", "v itals");
  69                                               put("VPR_D emographic s", "parti cipants");
  70                                              
  71                                               //  put("V PR_Clinica lProcedure Notes", "c linicalPro cedureNote s");
  72                                              
  73                                               //put("VPR _Payers",  "insurance Policies") ;
  74                                              
  75                                              
  76                                              
  77                                              
  78                                       
  79                                              
  80                                              
  81                                              
  82                                              
  83                                              
  84                                              
  85                                              
  86                                      }
  87                             });
  88           
  89           pr ivate stat ic final M ap<String,  String> S OURCE_TO_P ROPERTY =  Collection s
  90                             .unmod ifiableMap (new HashM ap<String,  String>()  {
  91                                      {
  92                                               put("VistA .findOrder s2", "futu reOrders") ;
  93                                               put("VistA .findRadio logy2", "f utureRadio logy");
  94                                               put("VistA .findFutur eProcedure s2", "futu reProcedur es");
  95                                               put("VistA .findAppoi ntments2",  "appointm ents");
  96                                               put("VistA .findVisit s2", "visi ts");
  97                                               put("VistA .findVital s2", "vita ls");
  98                                               put("VistA .findLabs2 ", "labs") ;
  99                                               put("VistA .findMedic ations2",  "medicatio ns");
  100                                               put("VistA .findSurge ries", "su rgeries");
  101                                               put("VistA .findAdvan ceDirectiv e", "docum ents");
  102                                               put("VistA .findDisch argeSummar y", "disch argeSummar ies");
  103                                               put("MPI.f indDemogra phics", "d emographic s");
  104                                               put("VistA .findRadio logies", " radiologie s");
  105                                               put("VistA .findOrder s2", "futu reOrders") ;
  106                                               put("VistA .findPatho logies", " pathologie s");
  107                                               put("VistA .findVital s2", "vita ls");
  108                                               put("VistA .findDemog raphics2",  "particip ants");
  109                                              
  110                                               put("VistA .findClini calProcedu reNotes",  "clinicalP rocedureNo tes");
  111                                              
  112                                               put("VistA .findPayer s", "insur ancePolici es");
  113                                              
  114                                              
  115                                              
  116                                              
  117                                       
  118                                              
  119                                              
  120                                              
  121                                              
  122                                              
  123                                              
  124                                              
  125                                      }
  126                             });
  127  
  128           @S uppressWar nings("raw types")
  129           pr ivate stat ic void ru n(String[]  queries)  throws Tra nsformerEx ception {
  130                    Mapp edDataProx y mdp = ne w MappedDa taProxy();
  131  
  132                    mdp. setObject( new java.u til.HashMa p());
  133  
  134                    for  (String qu eryName :  queries) {
  135                             DataQu eryImpl da taQuery =  dataManage r.getQuery (queryName );
  136                             dataQu ery.setPar ameter("ic n", "10126 38925V2046 24");
  137                             List r esults = n ull;
  138                             try
  139                             {
  140                                      results  = dataQuer y.getResul ts();
  141                             }
  142                             catch  (Exception  e1)
  143                             {
  144                                      // TODO  Auto-gener ated catch  block
  145                                      System.o ut.println (queryName  + " faile d to load  results");
  146                                      //e1.pri ntStackTra ce();
  147                             }
  148                             if (re sults != n ull)
  149                                      mdp.set( SOURCE_TO_ PROPERTY.g et(dataQue ry.getName ()), resul ts);
  150                    }
  151                    
  152                    
  153  
  154                    //
  155                    
  156  
  157  
  158                    mdp. set("docum entUniqueI d", "docum entUniqueI d");
  159                    mdp. set("creat ionTime",  createFMDa teTimeType ().toStrin g());
  160                    mdp. set("patie ntId", "pa tientId");
  161                    mdp. set("authe nticatorOI D", "authe nticatorOI D");
  162                    mdp. set("authe nticatorNa me", "auth enticatorN ame");
  163                    mdp. set("begin Date", cre ateFMDateT imeType(). toString() );
  164                    mdp. set("endDa te", creat eFMDateTim eType().to String());
  165                    
  166   //               Gson  gson = ne w Gson(); 
  167   //               Stri ng json =  gson.toJso n(mdp.getO bject()); 
  168   //               
  169   //               Syst em.out.pri ntln(json) ;
  170  
  171                    org. w3c.dom.Do cument doc ument = xm lTemplate. fillIn(mdp .getObject ());
  172                    
  173                    org. w3c.dom.El ement e =  document.g etElementB yId("endEn counterDes cription1" );
  174                    
  175                    
  176                     
  177                    File Out("resul ts.xml", d ocument);
  178  
  179           }
  180  
  181           st atic DataM anagerImpl  dataManag er = null;
  182           
  183           st atic XMLTe mplate xml Template =  null;
  184  
  185            
  186           @S uppressWar nings({ "r awtypes",  "unchecked " })
  187           st atic void  initialize (String da taConfigPa th,String  mappingPat h,final St ring extra ctLocation ){
  188                    
  189                     
  190                    
  191                    data Manager =  DataManage rFactory
  192                                      .getData Manager("D M-Common",  dataConfi gPath);
  193  
  194                    // S et all the  adapters  for vista  to mock xm l local on es
  195                    for  (QueryType  queryType  : dataMan ager.confi g.getQueri es().getQu ery()) {
  196                             for (S tring quer yName : qu eryType.ge tName()) {
  197                              
  198  
  199                                               DataQueryI mpl dq = d ataManager .getQuery( queryName) ;
  200  
  201                                               DataAdapte r mockVist aAdapter =  new DataA dapter() {
  202                                               public Lis t getData( DataQuery  dataQuery)  {
  203                                                                List  list = ne w ArrayLis t<String>( );
  204  
  205                                                                try  {
  206                                                                         
  207                                                                         if (da taQuery.ge tName().st artsWith(" MPI.")) {
  208                                                                                  String r esult = re adFile(ext ractLocati on+dataQue ry.getName ()
  209                                                                                                   +  ".txt");
  210                                                                                  
  211                                                                                  list.add (result);
  212                                                                                  
  213                                                                         }
  214                                                                         
  215                                                                         if (da taQuery.ge tName().st artsWith(" VistA."))  {
  216                                                                                  String r esult = re adFile(ext ractLocati on+dataQue ry.getName ()
  217                                                                                                   +  ".xml");
  218                                                                                  
  219                                                                                  list.add (result);
  220                                                                                  
  221                                                                         }
  222  
  223                                                                } ca tch (IOExc eption e)  {
  224                                                                         return  list;
  225                                                                }
  226                                                                retu rn list;
  227                                                       }
  228                                               };
  229                                               dataManage r.setDataA dapter(dq. getQueryTy pe().getAd apter()
  230                                                                .get Name(), mo ckVistaAda pter);
  231                     
  232                                      
  233                                      
  234                             }
  235                    }
  236                    
  237                    data Manager.se tTranslati onDef("STS Translate" ,"gov.va.m ed.nhin.ad apter.data manager.tr anslators. PassThroug hTranslato r");
  238                    data Manager.se tTranslati onDef("STS Lookup","g ov.va.med. nhin.adapt er.dataman ager.trans lators.Pas sThroughTr anslator") ;
  239                    data Manager.se tTranslati onDef("Loo kup","gov. va.med.nhi n.adapter. datamanage r.translat ors.PassTh roughTrans lator");
  240           
  241                    
  242            
  243            
  244                    
  245                    
  246                    
  247                    
  248                    
  249                     xml Template =  XMLTempla teFactory
  250                                               .getXMLTem plate(mapp ingPath);
  251  
  252           }
  253  
  254           /* *
  255            *  @param ar gs
  256            *  @throws E xception
  257            * /
  258           pu blic stati c void mai n(String[]  args) thr ows Except ion {
  259  
  260                    Comm andLinePar ser parser  = new Bas icParser() ;
  261  
  262                    Opti ons option s = new Op tions();
  263  
  264                    opti ons.addOpt ion("dc",  "dataconfi g", true,  "Location  of DataCon fig.xml");
  265  
  266                    opti ons.addOpt ion("m", " mapping",  true, "Loc ation of M apping Fil e");
  267                    
  268                    opti ons.addOpt ion("e", " extracts",  true, "Lo cation of  Extract Fi les");
  269  
  270                    Comm andLine cm d = parser .parse(opt ions, args );
  271  
  272                    Stri ng dataCon figPath =  null;
  273                    if ( cmd.hasOpt ion("dc")) {
  274                             dataCo nfigPath =  cmd.getOp tionValue( "dc");
  275                    } el se {
  276                              dataConfig Path = ".. /AdapterBu ndle/src/m ain/resour ces/config / D N   N_Adapter/ dataManage rConfig.xm l";
  277                    }
  278                    
  279                    Stri ng mapping Path = nul l;
  280                    if ( cmd.hasOpt ion("m") )  {
  281                             mappin gPath = cm d.getOptio nValue("m" );
  282                    } el se {
  283                              mappingPat   = "../Adap terBundle/ src/main/r esources/c onfig/ D N   N_Adapter/ cccd-mappi ng.xml";
  284                    }
  285                    
  286                    Stri ng extract FileLocati on=null;
  287                    if ( cmd.hasOpt ion("e") )  {
  288                             extrac tFileLocat ion = cmd. getOptionV alue("e");
  289                    } el se {                                                                               
  290                             extrac tFileLocat ion = "src /test/reso urces/";
  291                    }
  292                    
  293  
  294                    init ialize(dat aConfigPat h,mappingP ath,extrac tFileLocat ion);
  295                    
  296   //               run( "VistA.fin dSurgeries ");
  297   //               run( "VistA.fin dVisits2") ;
  298                    
  299           //       run( "VistA.fin dDischarge Summary");
  300                    
  301           //       run( "MPI.findD emographic s");
  302           //       run( "MPI.findD emographic s");
  303                    
  304   //               Stri ng[] queri es={"MPI.f indDemogra phics","Vi stA.findDi schargeSum mary","Vis tA.findSur geries","V istA.findV isits2","V istA.findO rders2","V istA.findR adiologies ","VistA.f indAdvance Directive" };
  305  
  306   //               Stri ng[] queri es = {"Vis tA.findRad iologies", "VistA.fin dLabs2","V istA.findP athologies "};
  307   //               Stri ng[] queri es ={"Vist A.findDisc hargeSumma ry"};
  308                    
  309                     Fil e dir = ne w File(ext ractFileLo cation);
  310                      Fi le[] direc toryListin g = dir.li stFiles();
  311                      
  312                      Ar rayList<St ring> file s = new Ar rayList<St ring>();
  313                      if  (director yListing ! = null) {
  314                         for (File  child : di rectoryLis ting) {
  315                              int d ot = child .getName() .lastIndex Of(".");
  316                                 
  317                    //     System.o ut.println ();
  318                              files .add(child .getName() .substring (0,dot));
  319                         }
  320                      }  else {
  321                         // Handle  the case w here dir i s not real ly a direc tory.
  322                         // Checkin g dir.isDi rectory()  above woul d not be s ufficient
  323                         // to avoi d race con ditions wi th another  process t hat delete s
  324                         // directo ries.
  325                      }
  326                     
  327                      
  328                      St ring[] que ries = new  String[fi les.size() ];
  329                      qu eries = fi les.toArra y(queries) ;
  330                      
  331   //               Stri ng[] queri es = {"Vis tA.findRad iologies"} ; //"VistA .findPayer s","VistA. findClinic alProcedur eNotes" };
  332   //               , ,  "VistA.fin dDemograph ics2","Vis tA.findCli nicalProce dureNotes"
  333   //                                 "MPI.fin dDemograph ics", "Vis tA.findDis chargeSumm ary",
  334   //                                 "VistA.f indLabs2",  "VistA.fi ndPatholog ies",
  335   //                                 "VistA.f indRadiolo gies", "Vi stA.findVi sits2",
  336   //                                 "VistA.f indAdvance Directive" , "VistA.f indFutureR adiologies ",
  337   //                                 "VistA.f indOrders2 ", "VistA. findProced ures2",
  338   //                                 "VistA.f indSurgeri es" };
  339                    
  340                    run( queries);
  341                    
  342  
  343           }
  344  
  345           pr ivate stat ic final L evel FINES T = null;
  346  
  347           /*
  348            *  Lifted fr om GUAVA
  349            * /
  350           pu blic stati c String g etFileExte nsion(Stri ng fileNam e) {
  351  
  352                    int  dotIndex =  fileName. lastIndexO f('.');
  353                    retu rn (dotInd ex == -1)  ? "" : fil eName.subs tring(dotI ndex + 1);
  354           }
  355  
  356           pu blic stati c String g etNameWith outExtensi on(String  fileName)  {
  357  
  358                    int  dotIndex =  fileName. lastIndexO f('.');
  359                    retu rn (dotInd ex == -1)  ? fileName  : fileNam e.substrin g(0, dotIn dex);
  360           }
  361  
  362           st atic Strin g readFile (String fi leName) th rows IOExc eption {
  363                    Buff eredReader  br = new  BufferedRe ader(new F ileReader( fileName)) ;
  364                    try  {
  365                             String Builder sb  = new Str ingBuilder ();
  366                             String  line = br .readLine( );
  367  
  368                             while  (line != n ull) {
  369                                      sb.appen d(line);
  370                                      sb.appen d("\n");
  371                                      line = b r.readLine ();
  372                             }
  373                             return  sb.toStri ng();
  374                    } fi nally {
  375                             br.clo se();
  376                    }
  377           }
  378  
  379           pr ivate stat ic String  getReturnP roperty(St ring extra ctName) {
  380  
  381                    if ( "allergies ".equals(e xtractName )) {
  382                             return  "results[ 0].allergy ";
  383                    }
  384  
  385                    if ( "noknownal lergies".e quals(extr actName))  {
  386                             return  "results[ 0].allergy ";
  387                    }
  388  
  389                    if ( "documents ".equals(e xtractName )) {
  390                             return  "results[ 0].documen t";
  391                    }
  392  
  393                    if ( "medicatio ns".equals (extractNa me)) {
  394                             return  "results[ 0].med";
  395                    }
  396  
  397                    if ( "visits".e quals(extr actName))  {
  398                             return  "results[ 0].visit";
  399                    }
  400  
  401                    if ( "immunizat ions".equa ls(extract Name)) {
  402                             return  "results[ 0].immuniz ation";
  403                    }
  404  
  405                    if ( "labs".equ als(extrac tName)) {
  406                             return  "results[ 0].lab";
  407                    }
  408  
  409                    if ( "vitals".e quals(extr actName))  {
  410                             return  "results[ 0].vital";
  411                    }
  412  
  413                    if ( "problems" .equals(ex tractName) ) {
  414                             return  "results[ 0].problem ";
  415                    }
  416  
  417                    if ( "procedure s".equals( extractNam e)) {
  418                             return  "results[ 0].procedu re";
  419                    }
  420  
  421                    if ( "factors". equals(ext ractName))  {
  422                             return  "results[ 0].factor" ;
  423                    }
  424  
  425                    if ( "demograph ics".equal s(extractN ame)) {
  426                             return  "results[ 0].demogra phics";
  427                    }
  428  
  429                    if ( "demograph icsExt".eq uals(extra ctName)) {
  430                             return  "results[ 0].demogra phicsExt";
  431                    }
  432  
  433                    if ( "insurance s".equals( extractNam e)) {
  434                             return  "results[ 0].insuran ce";
  435                    }
  436  
  437                    if ( "appointme nts".equal s(extractN ame)) {
  438                             return  "results[ 0].appoint ment";
  439                    }
  440  
  441                    if ( "futurepro cedures".e quals(extr actName))  {
  442                             return  "results[ 0].procedu re";
  443                    }
  444  
  445                    if ( "futurerad iology".eq uals(extra ctName)) {
  446                             return  "results[ 0].procedu re";
  447                    }
  448  
  449                    if ( "orders".e quals(extr actName))  {
  450                             return  "results[ 0].order";
  451                    }
  452  
  453                    if ( "reminders ".equals(e xtractName )) {
  454                             return  "results[ 0].reminde r";
  455                    }
  456  
  457                    retu rn "";
  458  
  459           }
  460  
  461           st atic Simpl eDateForma t resultFo rmat = new  SimpleDat eFormat("y yyyMMddmms s");
  462  
  463           st atic Simpl eDateForma t DATE_FOR MAT = new  SimpleDate Format("yy yyMMddHHmm ss");
  464  
  465           pr ivate stat ic FMDateT imeType cr eateFMDate TimeType()  {
  466                    FMDa teTimeType  fMDateTim eType = ne w FMDateTi meType();
  467  
  468                    fMDa teTimeType .setValue( NumberUtil s.createBi gDecimal(D ATE_FORMAT
  469                                      .format( new Date(M ath.abs(Sy stem.curre ntTimeMill is()
  470                                                       -  Long.value Of(RandomS tringUtils .randomNum eric(10))
  471                                                                         .longV alue())))) );
  472                    retu rn fMDateT imeType;
  473           }
  474  
  475           @S uppressWar nings("raw types")
  476           pr ivate stat ic void pa rseAndFill In(File sc enario) th rows Excep tion {
  477  
  478                    Stri ng locatio n = "resul ts" + Syst em.getProp erty("file .separator ")
  479                                      + scenar io.getName () + Syste m.getPrope rty("file. separator" )
  480                                      + scenar io.getName () + resul tFormat.fo rmat(new D ate());
  481  
  482                    File  theDir =  new File(" results");  // Defini ng Directo ry/Folder  Name
  483  
  484                    if ( !theDir.ex ists()) {  // Checks  that Direc tory/Folde r Doesn't  Exists!
  485                             theDir .mkdir();
  486                    }
  487  
  488                    theD ir = new F ile("resul ts" + Syst em.getProp erty("file .separator ")
  489                                      + scenar io.getName ()); // De fining Dir ectory/Fol der Name
  490  
  491                    if ( !theDir.ex ists()) {  // Checks  that Direc tory/Folde r Doesn't  Exists!
  492                             theDir .mkdir();
  493                    }
  494  
  495                    java .util.logg ing.LogMan ager.getLo gManager() .reset();
  496  
  497                    Enum eration<St ring> name s = java.u til.loggin g.LogManag er
  498                                      .getLogM anager().g etLoggerNa mes();
  499  
  500                    Hand ler handle r = new Fi leHandler( location +  "Log.xml" );
  501                    ;
  502  
  503                    whil e (names.h asMoreElem ents()) {
  504                             String  loggerNam e = names. nextElemen t();
  505  
  506                             java.u til.loggin g.LogManag er.getLogM anager().g etLogger(l oggerName)
  507                                               .addHandle r(handler) ;
  508                             java.u til.loggin g.LogManag er.getLogM anager().g etLogger(l oggerName)
  509                                               .setLevel( FINEST);
  510  
  511                    }
  512  
  513                    XMLT emplate xm lTemplate  = XMLTempl ateFactory
  514                                      .getXMLT emplate("c ccd-mappin g.xml");
  515  
  516                    File [] files =  scenario. listFiles( new FileFi lter() {
  517                             public  boolean a ccept(File  file) {
  518  
  519                                      return f ile.isFile ()
  520                                                       &&  getFileEx tension(fi le.getName ()).equals IgnoreCase (
  521                                                                         "XML") ;
  522                             }
  523                    });
  524  
  525                    Mapp edDataProx y mdp = ne w MappedDa taProxy();
  526  
  527                    mdp. setObject( new java.u til.HashMa p());
  528  
  529                    for  (File file  : files)  {
  530                             if (fi le.isFile( )) {
  531  
  532                                      JAXBData Parser jdp  = new JAX BDataParse r();
  533  
  534                                      Referenc eType rt =  new Refer enceType() ;
  535  
  536                                      rt.setPr operties(n ew Propert iesType()) ;
  537  
  538                                      Property Type pt =  new Proper tyType();
  539                                      pt.setNa me("classN ame");
  540                                      pt.setVa lue("gov.v a.med.nhin .adapter.r esults.Res ultsType") ;
  541  
  542                                      rt.getPr operties() .getProper ty().add(p t);
  543  
  544                                      pt = new  PropertyT ype();
  545                                      pt.setNa me("return Property") ;
  546                                      pt.setVa lue(getRet urnPropert y(getNameW ithoutExte nsion(file
  547                                                       .g etName())) );
  548  
  549                                      rt.getPr operties() .getProper ty().add(p t);
  550  
  551                                      Referenc e<String>  reference  = new Refe rence<Stri ng>(rt, nu ll,
  552                                                       nu ll);
  553                                      System.o ut.println (file.getN ame());
  554                                      String x mlString =  readFile( file.getAb solutePath ());
  555                                      List<Str ing> l = n ew ArrayLi st<String> ();
  556                                      l.add(xm lString);
  557  
  558                                      FilterDa taTranslat or fdt = n ew FilterD ataTransla tor();
  559  
  560                                      Object i nput;
  561                                      Object r esult;
  562  
  563                                      List ll  = jdp.pars e(l, refer ence, null );
  564  
  565                                      // pt =  new Proper tyType();
  566                                      // pt.se tName("whe reProperty ");
  567                                      // pt.se tValue("ro le");
  568                                      //
  569                                      // rt.ge tPropertie s().getPro perty().ad d(pt);
  570                                      //
  571                                      // pt =  new Proper tyType();
  572                                      // pt.se tName("whe reProperty Value");
  573                                      // pt.se tValue("P" );
  574                                      //
  575                                      // rt.ge tPropertie s().getPro perty().ad d(pt);
  576                                      //
  577                                      // pt =  new Proper tyType();
  578                                      // pt.se tName("res ultPropert y");
  579                                      // pt.se tValue("na me");
  580                                      //
  581                                      // rt.ge tPropertie s().getPro perty().ad d(pt);
  582                                      //
  583                                      // for ( Object o :  ll) {
  584                                      //
  585                                      // WrapD ynaBean as df = new W rapDynaBea n(o);
  586                                      //
  587                                      // asdf. set("asdfa sdf", "asd fasdf");
  588                                      //
  589                                      // // Pr opertyUtil s.setPrope rty(asdf,  "asdfasdf" ,
  590                                      // "asdf asdfasdf") ;
  591                                      //
  592                                      // // Sy stem.out.p rintln(Pro pertyUtils .getProper ty(o,
  593                                      // "prov iders"));
  594                                      // //
  595                                      // //
  596                                      // Syste m.out.prin tln("aaaaa aaaaaaaaaa aaaaaaaaaa aaaaaaaaaa a--------- ------->"
  597                                      // +
  598                                      // // fd t.translat e(Property Utils.getP roperty(o,
  599                                      // "prov iders.prov ider"), nu ll, refere nce, null) );
  600                                      // }
  601  
  602                                      // rt.Re ference<St ring> tran slation =  new Refere nce<String >(rt,
  603                                      // null,  null);
  604                                      // DataQ uery dataQ uery;
  605                                      // fdt.t ranslate(i nput, resu lt, transl ation, dat aQuery);
  606  
  607                                      /*
  608                                       * <fiel d> <name>p rimaryProv ider</name >
  609                                       * <sour ce>provide rs</source > <fieldTy pe>STRING< /fieldType >
  610                                       * <tran slations>  <reference > <name>Fi lter</name >
  611                                       * <util s:properti es> <utils :property>
  612                                       * <util s:name>whe reProperty </utils:na me>
  613                                       * <util s:value>ro le</utils: value> </u tils:prope rty>
  614                                       * <util s:property > <utils:n ame>whereP ropertyVal ue</utils: name>
  615                                       * <util s:value>P< /utils:val ue> </util s:property >
  616                                       * <util s:property > <utils:n ame>result Property</ utils:name >
  617                                       * <util s:value>na me</utils: value> </u tils:prope rty>
  618                                       * </uti ls:propert ies> </ref erence> </ translatio ns> </fiel d>
  619                                       */
  620  
  621                                      if ("dem ographics" .equals(ge tNameWitho utExtensio n(file
  622                                                       .g etName()))
  623                                                       ||  "demograp hicsExt"
  624                                                                         .equal s(getNameW ithoutExte nsion(file .getName() ))) {
  625                                               mdp.set(ge tNameWitho utExtensio n(file.get Name()), l l.get(0));
  626                                      } else {
  627  
  628                                               mdp.set(ge tNameWitho utExtensio n(file.get Name()), l l);
  629  
  630                                      }
  631  
  632                             }
  633                    }
  634  
  635                    mdp. set("docum entUniqueI d", "docum entUniqueI d");
  636                    mdp. set("creat ionTime",  createFMDa teTimeType ().toStrin g());
  637                    mdp. set("patie ntId", "pa tientId");
  638                    mdp. set("authe nticatorOI D", "authe nticatorOI D");
  639                    mdp. set("authe nticatorNa me", "auth enticatorN ame");
  640                    mdp. set("begin Date", cre ateFMDateT imeType(). toString() );
  641                    mdp. set("endDa te", creat eFMDateTim eType().to String());
  642  
  643                    org. w3c.dom.Do cument doc ument = xm lTemplate. fillIn(mdp .getObject ());
  644                    File Out(locati on + ".xml ", documen t);
  645  
  646           }
  647  
  648           /* *
  649            *  @param ar gs
  650            *  @throws J AXBExcepti on
  651            *  @throws T ransformer Exception
  652            *  @throws I OException
  653            * /
  654           pu blic stati c void mai n2(String[ ] args) th rows Excep tion {
  655  
  656                    Stri ng xmlLoca tion;
  657                    if ( args.lengt h == 1) {
  658                             xmlLoc ation = ar gs[0];
  659                    } el se {
  660                             xmlLoc ation = ". ";
  661                    }
  662  
  663                    File  fl = new  File(xmlLo cation);
  664                    File [] files =  fl.listFi les(new Fi leFilter()  {
  665                             public  boolean a ccept(File  file) {
  666  
  667                                      return f ile.isDire ctory();
  668                             }
  669                    });
  670  
  671                    for  (File file  : files)  {
  672                             parseA ndFillIn(f ile);
  673                    }
  674  
  675           }
  676  
  677           @S uppressWar nings("unu sed")
  678           pr ivate stat ic void Sy stemOut(or g.w3c.dom. Document d ocument)
  679                             throws  Transform erExceptio n {
  680  
  681                    Tran sformerFac tory tFact ory = Tran sformerFac tory.newIn stance();
  682                    Tran sformer tr ansformer  = tFactory .newTransf ormer();
  683  
  684                    DOMS ource sour ce = new D OMSource(d ocument);
  685                    Byte ArrayOutpu tStream ba os = new B yteArrayOu tputStream ();
  686  
  687                    Stre amResult r esult = ne w StreamRe sult(baos) ;
  688                    tran sformer.tr ansform(so urce, resu lt);
  689  
  690                    Syst em.out.pri ntln(baos. toString() );
  691  
  692                    new  ByteArrayI nputStream (baos.toBy teArray()) ;
  693  
  694           }
  695  
  696           pr ivate stat ic void Fi leOut(Stri ng fileNam e, org.w3c .dom.Docum ent docume nt)
  697                             throws  Transform erExceptio n {
  698  
  699                    Tran sformerFac tory tFact ory = Tran sformerFac tory.newIn stance();
  700                    Tran sformer tr ansformer  = tFactory .newTransf ormer();
  701  
  702                    DOMS ource sour ce = new D OMSource(d ocument);
  703  
  704                    Stre amResult s treamResul t = new St reamResult (new File( fileName)) ;
  705                    tran sformer.tr ansform(so urce, stre amResult);
  706  
  707                    Byte ArrayOutpu tStream ba os = new B yteArrayOu tputStream ();
  708  
  709                    Stre amResult r esult = ne w StreamRe sult(baos) ;
  710                    tran sformer.tr ansform(so urce, resu lt);
  711  
  712                    new  ByteArrayI nputStream (baos.toBy teArray()) ;
  713  
  714           }
  715  
  716   }