337. EPMO Open Source Coordination Office Redaction File Detail Report

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

337.1 Files compared

# Location File Last Modified
1 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\PathologyFederationCommon\main\src\java\gov\va\med\imaging\federation\pathology\rest\translator PathologyFederationRestTranslator.java Mon Dec 4 21:35:28 2017 UTC
2 IV-eHMP_CIF.zip\IMAG_Source\VISA\Java\PathologyFederationCommon\main\src\java\gov\va\med\imaging\federation\pathology\rest\translator PathologyFederationRestTranslator.java Mon Dec 4 22:04:58 2017 UTC

337.2 Comparison summary

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

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

337.4 Active regular expressions

No regular expressions were active.

337.5 Comparison detail

  1   /**
  2    * 
  3     Package:  MAG - Vis tA Imaging
  4     WARNING:  Per VHA D irective 2 004-038, t his routin e should n ot be modi fied.
  5     Date Cre ated: Jun  20, 2012
  6     Site Nam e:  Washin gton OI Fi eld Office , Silver S pring, MD
  7       Developer:          
WERFEJ
  8     Descript ion: 
  9  
  10           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  11           ;;  Property  of the US  Government .
  12           ;;  No permis sion to co py or redi stribute t his softwa re is give n.
  13           ;;  Use of un released v ersions of  this soft ware requi res the us er
  14           ;;   to execu te a writt en test ag reement wi th the Vis tA Imaging
  15           ;;   Developm ent Office  of the De partment o f Veterans  Affairs,
  16           ;;   telephon e (301) 73 4-0100.
  17           ;;
  18           ;;  The Food  and Drug A dministrat ion classi fies this  software a s
  19           ;;  a Class I I medical  device.  A s such, it  may not b e changed
  20           ;;  in any wa y.  Modifi cations to  this soft ware may r esult in a n
  21           ;;  adulterat ed medical  device un der 21CFR8 20, the us e of which
  22           ;;  is consid ered to be  a violati on of US F ederal Sta tutes.
  23           ;;  +-------- ---------- ---------- ---------- ---------- ---------- ---------- +
  24  
  25    */
  26   package go v.va.med.i maging.fed eration.pa thology.re st.transla tor;
  27  
  28   import gov .va.med.UR NFactory;
  29   import gov .va.med.im aging.core .interface s.exceptio ns.MethodE xception;
  30   import gov .va.med.im aging.exce ptions.URN FormatExce ption;
  31   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eConsultat ionUpdateS tatusType;
  32   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eReportFie ldType;
  33   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eReserveRe sultType;
  34   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eSaveSuppl ementalRep ortType;
  35   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eSupplemen talReportT ype;
  36   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eTemplateF ieldType;
  37   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eTemplateT ype;
  38   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationAcq uisitionSi teType;
  39   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eAssistanc eType;
  40   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eSpecimenT ype;
  41   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eType;
  42   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCas eUpdateAtt ributeResu ltType;
  43   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCon sultationT ype;
  44   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCpt CodeResult Type;
  45   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationCpt CodeType;
  46   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationEle ctronicSig natureNeed StatusType ;
  47   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationEle ctronicSig natureNeed Type;
  48   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationFie ldType;
  49   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationFie ldValueTyp e;
  50   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationRea dingSiteTy pe;
  51   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationRea dingSiteTy peType;
  52   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationSav eCaseRepor tResultTyp e;
  53   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationSit eType;
  54   import gov .va.med.im aging.fede ration.pat hology.res t.types.Pa thologyFed erationSno medCodeTyp e;
  55   import gov .va.med.im aging.path ology.Abst ractPathol ogySite;
  56   import gov .va.med.im aging.path ology.Path ologyAcqui sitionSite ;
  57   import gov .va.med.im aging.path ology.Path ologyCase;
  58   import gov .va.med.im aging.path ology.Path ologyCaseC onsultatio n;
  59   import gov .va.med.im aging.path ology.Path ologyCaseR eportField ;
  60   import gov .va.med.im aging.path ology.Path ologyCaseS pecimen;
  61   import gov .va.med.im aging.path ology.Path ologyCaseS upplementa lReport;
  62   import gov .va.med.im aging.path ology.Path ologyCaseT emplate;
  63   import gov .va.med.im aging.path ology.Path ologyCaseT emplateFie ld;
  64   import gov .va.med.im aging.path ology.Path ologyCaseU RN;
  65   import gov .va.med.im aging.path ology.Path ologyCaseU pdateAttri buteResult ;
  66   import gov .va.med.im aging.path ology.Path ologyCptCo de;
  67   import gov .va.med.im aging.path ology.Path ologyCptCo deResult;
  68   import gov .va.med.im aging.path ology.Path ologyField URN;
  69   import gov .va.med.im aging.path ology.Path ologyField Value;
  70   import gov .va.med.im aging.path ology.Path ologyReadi ngSite;
  71   import gov .va.med.im aging.path ology.Path ologySaveC aseReportR esult;
  72   import gov .va.med.im aging.path ology.Path ologySite;
  73   import gov .va.med.im aging.path ology.Path ologySnome dCode;
  74   import gov .va.med.im aging.path ology.enum s.Patholog yCaseAssis tance;
  75   import gov .va.med.im aging.path ology.enum s.Patholog yCaseConsu ltationUpd ateStatus;
  76   import gov .va.med.im aging.path ology.enum s.Patholog yCaseReser veResult;
  77   import gov .va.med.im aging.path ology.enum s.Patholog yElectroni cSignature Need;
  78   import gov .va.med.im aging.path ology.enum s.Patholog yElectroni cSignature NeedStatus ;
  79   import gov .va.med.im aging.path ology.enum s.Patholog yField;
  80   import gov .va.med.im aging.rest .types.Res tCoreTrans lator;
  81   import gov .va.med.im aging.rest .types.Res tStringArr ayType;
  82   import gov .va.med.im aging.rest .types.Res tStringTyp e;
  83  
  84   import jav a.util.Arr ayList;
  85   import jav a.util.Dat e;
  86   import jav a.util.Has hMap;
  87   import jav a.util.Lis t;
  88   import jav a.util.Map ;
  89   import jav a.util.Map .Entry;
  90  
  91   import org .apache.lo gging.log4 j.LogManag er;
  92   import org .apache.lo gging.log4 j.Logger;
  93  
  94   /**
  95    * Transla tor for Pa thology Fe deration o bjects
  96    * 
  97    * @author         
WERFEJ
  98    *
  99    */
  100   public cla ss Patholo gyFederati onRestTran slator
  101   {
  102           pr ivate fina l static L ogger logg er = LogMa nager.getL ogger(Path ologyFeder ationRestT ranslator. class);
  103           
  104           pr ivate stat ic Map<gov .va.med.im aging.path ology.enum s.Patholog yReadingSi teType, Pa thologyFed erationRea dingSiteTy peType> re adingSiteT ypeMap;
  105           pr ivate stat ic Map<gov .va.med.im aging.path ology.enum s.Patholog yCaseAssis tance, Pat hologyFede rationCase Assistance Type> case Assistance TypeMap;
  106           pr ivate stat ic Map<gov .va.med.im aging.path ology.enum s.Patholog yField, Pa thologyFed erationFie ldType> fi eldTypeMap ;
  107           pr ivate stat ic Map<gov .va.med.im aging.path ology.enum s.Patholog yElectroni cSignature NeedStatus , Patholog yFederatio nElectroni cSignature NeedStatus Type> elec tronicSign atureNeede dTypeMap;
  108           pr ivate stat ic Map<gov .va.med.im aging.path ology.enum s.Patholog yCaseConsu ltationUpd ateStatus,  Pathology Federation CaseConsul tationUpda teStatusTy pe> caseCo nsultation StatusType Map;
  109           pr ivate stat ic Map<gov .va.med.im aging.path ology.enum s.Patholog yCaseReser veResult,  PathologyF ederationC aseReserve ResultType > caseRese rveResultT ypeMap;
  110           
  111           st atic
  112           {
  113                    read ingSiteTyp eMap = new  HashMap<g ov.va.med. imaging.pa thology.en ums.Pathol ogyReading SiteType,  PathologyF ederationR eadingSite TypeType>( );
  114                    read ingSiteTyp eMap.put(g ov.va.med. imaging.pa thology.en ums.Pathol ogyReading SiteType.i nterpretat ion, Patho logyFedera tionReadin gSiteTypeT ype.interp retation);
  115                    read ingSiteTyp eMap.put(g ov.va.med. imaging.pa thology.en ums.Pathol ogyReading SiteType.c onsultatio n, Patholo gyFederati onReadingS iteTypeTyp e.consulta tion);
  116                    read ingSiteTyp eMap.put(g ov.va.med. imaging.pa thology.en ums.Pathol ogyReading SiteType.b oth, Patho logyFedera tionReadin gSiteTypeT ype.both);
  117                    
  118                    case Assistance TypeMap =  new HashMa p<Patholog yCaseAssis tance, Pat hologyFede rationCase Assistance Type>();
  119                    case Assistance TypeMap.pu t(Patholog yCaseAssis tance.cons ultation,  PathologyF ederationC aseAssista nceType.co nsultation );
  120                    case Assistance TypeMap.pu t(Patholog yCaseAssis tance.inte rpretation , Patholog yFederatio nCaseAssis tanceType. interpreta tion);
  121                    
  122                    fiel dTypeMap =  new HashM ap<Patholo gyField, P athologyFe derationFi eldType>() ;
  123                    fiel dTypeMap.p ut(Patholo gyField.di sease, Pat hologyFede rationFiel dType.dise ase);
  124                    fiel dTypeMap.p ut(Patholo gyField.et iology, Pa thologyFed erationFie ldType.eti ology);
  125                    fiel dTypeMap.p ut(Patholo gyField.fu nction, Pa thologyFed erationFie ldType.fun ction);
  126                    fiel dTypeMap.p ut(Patholo gyField.lo cation, Pa thologyFed erationFie ldType.loc ation);
  127                    fiel dTypeMap.p ut(Patholo gyField.mo rphology,  PathologyF ederationF ieldType.m orphology) ;
  128                    fiel dTypeMap.p ut(Patholo gyField.pr ocedure, P athologyFe derationFi eldType.pr ocedure);
  129                    fiel dTypeMap.p ut(Patholo gyField.to pography,  PathologyF ederationF ieldType.t opography) ;
  130                    fiel dTypeMap.p ut(Patholo gyField.us ers, Patho logyFedera tionFieldT ype.users) ;
  131                    fiel dTypeMap.p ut(Patholo gyField.wo rkload, Pa thologyFed erationFie ldType.wor kload);
  132                    
  133                    elec tronicSign atureNeede dTypeMap =  new HashM ap<Patholo gyElectron icSignatur eNeedStatu s, Patholo gyFederati onElectron icSignatur eNeedStatu sType>();
  134                    elec tronicSign atureNeede dTypeMap.p ut(Patholo gyElectron icSignatur eNeedStatu s.authoriz ed_needs_s ignature, 
  135                                      Patholog yFederatio nElectroni cSignature NeedStatus Type.autho rized_need s_signatur e);
  136                    elec tronicSign atureNeede dTypeMap.p ut(Patholo gyElectron icSignatur eNeedStatu s.not_enab led, 
  137                                      Patholog yFederatio nElectroni cSignature NeedStatus Type.not_e nabled);
  138                    elec tronicSign atureNeede dTypeMap.p ut(Patholo gyElectron icSignatur eNeedStatu s.not_auth orized,
  139                                      Patholog yFederatio nElectroni cSignature NeedStatus Type.not_a uthorized) ;
  140                    
  141                    case Consultati onStatusTy peMap = ne w HashMap< PathologyC aseConsult ationUpdat eStatus, P athologyFe derationCa seConsulta tionUpdate StatusType >();
  142                    case Consultati onStatusTy peMap.put( PathologyC aseConsult ationUpdat eStatus.co mpleted, P athologyFe derationCa seConsulta tionUpdate StatusType .completed );
  143                    case Consultati onStatusTy peMap.put( PathologyC aseConsult ationUpdat eStatus.re called, Pa thologyFed erationCas eConsultat ionUpdateS tatusType. recalled);
  144                    case Consultati onStatusTy peMap.put( PathologyC aseConsult ationUpdat eStatus.pe nding, Pat hologyFede rationCase Consultati onUpdateSt atusType.p ending);
  145                    case Consultati onStatusTy peMap.put( PathologyC aseConsult ationUpdat eStatus.re fused, Pat hologyFede rationCase Consultati onUpdateSt atusType.r efused);           
  146                    
  147                    case ReserveRes ultTypeMap  = new Has hMap<Patho logyCaseRe serveResul t, Patholo gyFederati onCaseRese rveResultT ype>();
  148                    case ReserveRes ultTypeMap .put(Patho logyCaseRe serveResul t.case_res erved, Pat hologyFede rationCase ReserveRes ultType.ca se_reserve d);
  149                    case ReserveRes ultTypeMap .put(Patho logyCaseRe serveResul t.reservat ion_ended,  Pathology Federation CaseReserv eResultTyp e.reservat ion_ended) ;
  150           }
  151           
  152           pu blic stati c Patholog yFederatio nElectroni cSignature NeedType t ranslate(P athologyEl ectronicSi gnatureNee d electron icSignatur eNeed)
  153           {
  154                    if(e lectronicS ignatureNe ed == null )
  155                             return  null;
  156                    retu rn new Pat hologyFede rationElec tronicSign atureNeedT ype(transl ate(electr onicSignat ureNeed.ge tStatus())
  157                                      electron icSignatur eNeed.getM essage());
  158           }
  159           
  160           pu blic stati c Patholog yElectroni cSignature Need trans late(Patho logyFedera tionElectr onicSignat ureNeedTyp e electron icSignatur eNeed)
  161           {
  162                    if(e lectronicS ignatureNe ed == null )
  163                             return  null;
  164                    retu rn new Pat hologyElec tronicSign atureNeed( translate( electronic SignatureN eed.getSta tus()), 
  165                                      electron icSignatur eNeed.getM essage());
  166           }
  167           
  168           pu blic stati c Patholog yFederatio nCptCodeRe sultType[]  translate CptCodeRes ults(List< PathologyC ptCodeResu lt> cptCod es)
  169           {
  170                    if(c ptCodes ==  null)
  171                             return  null;
  172                    
  173                    Path ologyFeder ationCptCo deResultTy pe[] resul t = new Pa thologyFed erationCpt CodeResult Type[cptCo des.size() ];
  174                    for( int i = 0;  i < cptCo des.size() ; i++)
  175                    {
  176                             Pathol ogyCptCode Result cpt CodeResult  = cptCode s.get(i);
  177                             result [i] = new  PathologyF ederationC ptCodeResu ltType(cpt CodeResult .getCptCod e(), cptCo deResult.i sSuccessfu llyAdded() ,
  178                                               cptCodeRes ult.getDes cription() );
  179                    }
  180                    
  181                    retu rn result;
  182           }
  183           
  184           pu blic stati c List<Pat hologyCptC odeResult>  translate (Pathology Federation CptCodeRes ultType []  cptCodes)
  185           {
  186                    if(c ptCodes ==  null)
  187                             return  null;
  188                    List <Pathology CptCodeRes ult> resul t = new Ar rayList<Pa thologyCpt CodeResult >();
  189                    for( PathologyF ederationC ptCodeResu ltType cpt Code : cpt Codes)
  190                    {
  191                             result .add(new P athologyCp tCodeResul t(cptCode. getCptCode (), cptCod e.isSucces sfullyAdde d(), cptCo de.getDesc ription()) );
  192                    }
  193                    
  194                    retu rn result;
  195           }
  196           
  197           pu blic stati c Patholog yCaseURN t ranslateCa seId(RestS tringType  caseId)
  198           th rows Metho dException
  199           {
  200                    if(c aseId == n ull)
  201                             throw  new Method Exception( "Null case  ID return ed");
  202                    try
  203                    {
  204                             return  URNFactor y.create(c aseId.getV alue(), Pa thologyCas eURN.class );
  205                    }
  206                    catc h(URNForma tException  urnfX)
  207                    {
  208                             throw  new Method Exception( urnfX);
  209                    }
  210           }
  211           
  212           pu blic stati c List<Pat hologyFiel dURN> tran slateField Ids(RestSt ringArrayT ype fieldI ds)
  213           th rows Metho dException
  214           {
  215                    if(f ieldIds ==  null)
  216                             return  null;
  217                    List <Pathology FieldURN>  result = n ew ArrayLi st<Patholo gyFieldURN >();
  218                    for( String fie ldId : fie ldIds.getV alue())
  219                    {
  220                             try
  221                             {
  222                                      result.a dd(URNFact ory.create (fieldId,  PathologyF ieldURN.cl ass));
  223                             }
  224                             catch( URNFormatE xception u rnfX)
  225                             {
  226                                      throw ne w MethodEx ception(ur nfX);
  227                             }
  228                    }
  229                    retu rn result;
  230           }
  231           
  232           pu blic stati c RestStri ngArrayTyp e translat eFieldIds( List<Patho logyFieldU RN> fieldU rns)
  233           {
  234                    if(f ieldUrns = = null)
  235                             return  null;
  236                    Stri ng [] resu lt = new S tring[fiel dUrns.size ()];
  237                    for( int i = 0;  i < field Urns.size( ); i++)
  238                    {
  239                             result [i] = fiel dUrns.get( i).toStrin g();
  240                    }
  241                    
  242                    retu rn new Res tStringArr ayType(res ult);
  243           }
  244           
  245           pu blic stati c List<Pat hologyCase URN> trans lateCaseId s(RestStri ngArrayTyp e caseUrns )
  246           th rows Metho dException
  247           {
  248                    if(c aseUrns ==  null)
  249                             return  null;
  250                    List <Pathology CaseURN> r esult = ne w ArrayLis t<Patholog yCaseURN>( );
  251                    for( String urn  : caseUrn s.getValue ())
  252                    {
  253                             try
  254                             {
  255                                      result.a dd(URNFact ory.create (urn, Path ologyCaseU RN.class)) ;
  256                             }
  257                             catch( URNFormatE xception u rnfX)
  258                             {
  259                                      throw ne w MethodEx ception(ur nfX);
  260                             }
  261                    }
  262                    retu rn result;
  263           }
  264           
  265           pu blic stati c Patholog yFederatio nCptCodeTy pe [] tran slateCptCo des(List<P athologyCp tCode> cpt Codes)
  266           {
  267                    if(c ptCodes ==  null)
  268                             return  null;
  269                    Path ologyFeder ationCptCo deType []  result = n ew Patholo gyFederati onCptCodeT ype[cptCod es.size()] ;
  270                    for( int i = 0;  i < cptCo des.size() ; i++)
  271                    {
  272                             result [i] = tran slate(cptC odes.get(i ));
  273                    }
  274                    retu rn result;
  275           }
  276           
  277           pr ivate stat ic Patholo gyFederati onCptCodeT ype transl ate(Pathol ogyCptCode  cptCode)
  278           {
  279                    retu rn new Pat hologyFede rationCptC odeType(cp tCode.getC ptCode(), 
  280                                      cptCode. getDescrip tion(), cp tCode.getM ultiplyFac tor(), 
  281                                      cptCode. getDateEnt ered(), cp tCode.getU ser());
  282           }
  283           
  284           pu blic stati c List<Pat hologyCptC ode> trans late(Patho logyFedera tionCptCod eType [] c ptCodes)
  285           {
  286                    if(c ptCodes ==  null)
  287                             return  null;
  288                    List <Pathology CptCode> r esult = ne w ArrayLis t<Patholog yCptCode>( );
  289                    for( PathologyF ederationC ptCodeType  cptCode :  cptCodes)
  290                    {
  291                             result .add(trans late(cptCo de));
  292                    }
  293                    
  294                    retu rn result;
  295           }
  296           
  297           pr ivate stat ic Patholo gyCptCode  translate( PathologyF ederationC ptCodeType  cptCode)
  298           {
  299                    retu rn new Pat hologyCptC ode(cptCod e.getCptCo de(), cptC ode.getDes cription() , cptCode. getMultipl yFactor(),
  300                                      cptCode. getDateEnt ered(), cp tCode.getU ser());
  301           }
  302           
  303           pu blic stati c RestStri ngArrayTyp e translat eCaseUrns( List<Patho logyCaseUR N> caseUrn s)
  304           {
  305                    if(c aseUrns ==  null)
  306                             return  null;
  307                    Stri ng [] resu lt = new S tring[case Urns.size( )];
  308                    for( int i = 0;  i < caseU rns.size() ; i++)
  309                    {
  310                             result [i] = case Urns.get(i ).toString ();
  311                    }
  312                    
  313                    retu rn new Res tStringArr ayType(res ult);
  314           }
  315           
  316           pu blic stati c Patholog yFederatio nSiteType  [] transla teAllPatho logySites( List<Patho logySite>  sites)
  317           {
  318                    if(s ites == nu ll)
  319                             return  null;
  320                    Path ologyFeder ationSiteT ype [] res ult = new  PathologyF ederationS iteType[si tes.size() ];
  321                    for( int i = 0;  i < sites .size(); i ++)
  322                    {
  323                             result [i] = tran slate(site s.get(i));
  324                    }
  325                    
  326                    retu rn result;
  327           }
  328           
  329           pr ivate stat ic Patholo gyFederati onSiteType  translate (Pathology Site site)
  330           {
  331                    retu rn new Pat hologyFede rationSite Type(site. getSiteId( ), 
  332                                      site.get SiteName() , site.get StationNum ber(), sit e.getSiteA bbr());
  333           }
  334           
  335           pu blic stati c List<Pat hologySite > translat e(Patholog yFederatio nSiteType  [] sites)
  336           {
  337                    if(s ites == nu ll)
  338                             return  null;
  339                    List <Pathology Site> resu lt = new A rrayList<P athologySi te>();
  340                    for( PathologyF ederationS iteType si te : sites )
  341                    {
  342                             result .add(trans late(site) );
  343                    }
  344                    
  345                    retu rn result;
  346           }
  347           
  348           pr ivate stat ic Patholo gySite tra nslate(Pat hologyFede rationSite Type site)
  349           {
  350                    retu rn new Pat hologySite (site.getS iteId(), s ite.getSit eName(), s ite.getSta tionNumber (), site.g etSiteAbbr ());
  351           }
  352           
  353           pu blic stati c Patholog yFederatio nCaseSaveS upplementa lReportTyp e translat e(String r eportConte nts, Date  date)
  354           {
  355                    retu rn new Pat hologyFede rationCase SaveSupple mentalRepo rtType(rep ortContent s, date);
  356           }
  357           
  358           pu blic stati c List<Pat hologyCase ReportFiel d> transla teCaseRepo rtFields(P athologyFe derationCa seReportFi eldType []  fields)
  359           {
  360                    if(f ields == n ull)
  361                             return  null;
  362                    List <Pathology CaseReport Field> res ult = new  ArrayList< PathologyC aseReportF ield>();
  363                    for( PathologyF ederationC aseReportF ieldType f ield : fie lds)
  364                    {
  365                             result .add(trans late(field ));
  366                    }
  367                    
  368                    retu rn result;
  369           }
  370           
  371           pr ivate stat ic Patholo gyCaseRepo rtField tr anslate(Pa thologyFed erationCas eReportFie ldType fie ld)
  372           {
  373                    List <String> v alues = ne w ArrayLis t<String>( );
  374                    for( String val ue : field .getValues ())
  375                    {
  376                             values .add(value );
  377                    }
  378                    retu rn new Pat hologyCase ReportFiel d(field.ge tFieldNumb er(), valu es);
  379           }
  380           
  381           pu blic stati c Patholog yFederatio nCaseRepor tFieldType  [] transl ateCaseRep ortFields( List<Patho logyCaseRe portField>  fields)
  382           {
  383                    if(f ields == n ull)
  384                             return  null;
  385                    
  386                    Path ologyFeder ationCaseR eportField Type [] re sult = new  Pathology Federation CaseReport FieldType[ fields.siz e()];
  387                    
  388                    for( int i = 0;  i < field s.size();  i++)
  389                    {
  390                             result [i] = tran slate(fiel ds.get(i)) ;
  391                    }
  392                    
  393                    retu rn result;
  394           }
  395           
  396           pr ivate stat ic Patholo gyFederati onCaseRepo rtFieldTyp e translat e(Patholog yCaseRepor tField fie ld)
  397           {
  398                    retu rn new Pat hologyFede rationCase ReportFiel dType(fiel d.getField Number(),  field.getV alues().to Array(new  String[fie ld.getValu es().size( )]));
  399           }
  400           
  401           pu blic stati c Patholog yFederatio nCaseConsu ltationUpd ateStatusT ype transl ate(Pathol ogyCaseCon sultationU pdateStatu s fieldTyp e)
  402           {
  403                    for(  Entry<gov .va.med.im aging.path ology.enum s.Patholog yCaseConsu ltationUpd ateStatus,  Pathology Federation CaseConsul tationUpda teStatusTy pe> entry  : Patholog yFederatio nRestTrans lator.case Consultati onStatusTy peMap.entr ySet() )
  404                             if( en try.getKey () == fiel dType )
  405                                      return e ntry.getVa lue();
  406                    
  407                    retu rn null;
  408           }
  409           
  410           pu blic stati c Patholog yCaseConsu ltationUpd ateStatus  translate( PathologyF ederationC aseConsult ationUpdat eStatusTyp e fieldTyp e)
  411           {
  412                    for(  Entry<gov .va.med.im aging.path ology.enum s.Patholog yCaseConsu ltationUpd ateStatus,  Pathology Federation CaseConsul tationUpda teStatusTy pe> entry  : Patholog yFederatio nRestTrans lator.case Consultati onStatusTy peMap.entr ySet() )
  413                             if( en try.getVal ue() == fi eldType )
  414                                      return e ntry.getKe y();
  415                    
  416                    retu rn null;
  417           }
  418           
  419           pu blic stati c Patholog yFederatio nFieldValu eType [] t ranslateFi eldValues( List<Patho logyFieldV alue> fiel dValues)
  420           {
  421                    if(f ieldValues  == null)
  422                             return  null;
  423                    
  424                    Path ologyFeder ationField ValueType  [] result  = new Path ologyFeder ationField ValueType[ fieldValue s.size()];
  425                    for( int i = 0;  i < field Values.siz e(); i++)
  426                    {
  427                             result [i] = tran slate(fiel dValues.ge t(i));
  428                    }
  429                    
  430                    retu rn result;
  431           }
  432           
  433           pr ivate stat ic Patholo gyFederati onFieldVal ueType tra nslate(Pat hologyFiel dValue fie ldValue)
  434           {
  435                    retu rn new Pat hologyFede rationFiel dValueType (fieldValu e.getField Urn().toSt ring(), fi eldValue.g etName());
  436           }
  437           
  438           pu blic stati c List<Pat hologyFiel dValue> tr anslate(Pa thologyFed erationFie ldValueTyp e [] field Values)
  439           th rows Metho dException
  440           {
  441                    if(f ieldValues  == null)
  442                             return  null;
  443                    List <Pathology FieldValue > result =  new Array List<Patho logyFieldV alue>();
  444                    for( PathologyF ederationF ieldValueT ype fieldV alue : fie ldValues)
  445                    {
  446                             result .add(trans late(field Value));
  447                    }
  448                    retu rn result;
  449           }
  450           
  451           pr ivate stat ic Patholo gyFieldVal ue transla te(Patholo gyFederati onFieldVal ueType fie ldValue)
  452           th rows Metho dException
  453           {
  454                    try
  455                    {
  456                             Pathol ogyFieldUR N fieldUrn  = URNFact ory.create (fieldValu e.getField Id(), Path ologyField URN.class) ;
  457                             return  new Patho logyFieldV alue(field Urn, field Value.getN ame());
  458                    }
  459                    catc h(URNForma tException  urnfX)
  460                    {
  461                             logger .error("UR NFormatExc eption tra nslating p athology f ield value ", urnfX);
  462                             throw  new Method Exception( urnfX);
  463                    }
  464           }
  465           
  466           pu blic stati c Patholog yFederatio nCaseTempl ateType tr anslate(Pa thologyCas eTemplate  template)
  467           {
  468                    if(t emplate ==  null)
  469                             return  null;
  470                    
  471                    List <Pathology CaseTempla teField> f ields = te mplate.get Fields();
  472                    
  473                    Path ologyFeder ationCaseT emplateFie ldType []  result = n ew Patholo gyFederati onCaseTemp lateFieldT ype[fields .size()];
  474                    for( int i = 0;  i < field s.size();  i++)
  475                    {
  476                             result [i] = tran slate(fiel ds.get(i)) ;
  477                    }
  478                    retu rn new Pat hologyFede rationCase TemplateTy pe(result) ;
  479           }
  480           
  481           pr ivate stat ic Patholo gyFederati onCaseTemp lateFieldT ype transl ate(Pathol ogyCaseTem plateField  field)
  482           {
  483                    Rest StringArra yType valu es = RestC oreTransla tor.transl ateStrings (field.get Values());
  484                    retu rn new Pat hologyFede rationCase TemplateFi eldType(fi eld.getFie ldNumber() , field.ge tLabel(), 
  485                                      values);
  486           }
  487           
  488           pu blic stati c Patholog yCaseTempl ate transl ate(Pathol ogyFederat ionCaseTem plateType  template)
  489           {
  490                    if(t emplate ==  null)
  491                             return  null;
  492                    
  493                    List <Pathology CaseTempla teField> f ields = ne w ArrayLis t<Patholog yCaseTempl ateField>( );
  494                    for( PathologyF ederationC aseTemplat eFieldType  field : t emplate.ge tFields())
  495                    {
  496                             fields .add(trans late(field ));
  497                    }
  498                    
  499                    retu rn new Pat hologyCase Template(f ields);
  500           }
  501           
  502           pr ivate stat ic Patholo gyCaseTemp lateField  translate( PathologyF ederationC aseTemplat eFieldType  field)
  503           {
  504                    List <String> v alues = ne w ArrayLis t<String>( );
  505                    // J ersey seem s to conve rt empty s tring arra ys into nu ll respons es
  506                    if(f ield.getVa lues().get Value() !=  null)
  507                    {                         
  508                             for(St ring value  : field.g etValues() .getValue( ))
  509                                      values.a dd(value);
  510                    }
  511                    retu rn new Pat hologyCase TemplateFi eld(field. getFieldNu mber(), fi eld.getLab el(), valu es); 
  512           }
  513           
  514           pu blic stati c Patholog yFederatio nCaseSuppl ementalRep ortType []  translate Supplement alReports( List<Patho logyCaseSu pplemental Report> su pplemental Reports)
  515           {
  516                    if(s upplementa lReports = = null)
  517                             return  null;
  518           
  519                    Path ologyFeder ationCaseS upplementa lReportTyp e [] resul t = 
  520                             new Pa thologyFed erationCas eSupplemen talReportT ype[supple mentalRepo rts.size() ];
  521                    
  522                    for( int i = 0;  i < suppl ementalRep orts.size( ); i++)
  523                    {
  524                             result [i] = tran slate(supp lementalRe ports.get( i));
  525                    }
  526                    
  527                    retu rn result;
  528           }
  529           
  530           pr ivate stat ic Patholo gyFederati onCaseSupp lementalRe portType t ranslate(P athologyCa seSuppleme ntalReport  supplemen talReport)
  531           {
  532                    retu rn new Pat hologyFede rationCase Supplement alReportTy pe(supplem entalRepor t.getSuppl ementalRep ortDate(),
  533                                      suppleme ntalReport .isVerifie d(), suppl ementalRep ort.getVer ifiedProvi der(), sup plementalR eport.getV alues());
  534           }
  535           
  536           pu blic stati c List<Pat hologyCase Supplement alReport>  translate( PathologyF ederationC aseSupplem entalRepor tType [] s upplementa lReports)
  537           {
  538                    if(s upplementa lReports = = null)
  539                             return  null;
  540                    List <Pathology CaseSupple mentalRepo rt> result  = new Arr ayList<Pat hologyCase Supplement alReport>( );
  541                    for( PathologyF ederationC aseSupplem entalRepor tType supp lementalRe port : sup plementalR eports)
  542                    {
  543                             result .add(trans late(suppl ementalRep ort));
  544                    }
  545                    retu rn result;           
  546           }
  547  
  548           pr ivate stat ic Patholo gyCaseSupp lementalRe port trans late(Patho logyFedera tionCaseSu pplemental ReportType  supplemen talReport)
  549           {
  550                    retu rn new Pat hologyCase Supplement alReport(s upplementa lReport.ge tSupplemen talReportD ate(),
  551                                      suppleme ntalReport .isVerifie d(), suppl ementalRep ort.getVer ifiedProvi der(), 
  552                                      suppleme ntalReport .getValues ());
  553           }
  554           
  555           pu blic stati c Patholog yFederatio nSnomedCod eType [] t ranslateSn omedCodes( List<Patho logySnomed Code> snom edCodes)
  556           {
  557                    if(s nomedCodes  == null)
  558                             return  null;
  559                    Path ologyFeder ationSnome dCodeType  [] result  = new Path ologyFeder ationSnome dCodeType[ snomedCode s.size()];
  560                    for( int i = 0;  i < snome dCodes.siz e(); i++)
  561                    {
  562                             result [i] = tran slate(snom edCodes.ge t(i));
  563                    }
  564                    
  565                    retu rn result;
  566           }
  567           
  568           pr ivate stat ic Patholo gyFederati onSnomedCo deType tra nslate(Pat hologySnom edCode sno medCode)
  569           {
  570                    retu rn new Pat hologyFede rationSnom edCodeType (snomedCod e.getTissu eId(), sno medCode.ge tTissueCod e(), snome dCode.getT issue(),
  571                                      translat e(snomedCo de.getFiel d()), snom edCode.get SnomedCode (), snomed Code.getSn omedValue( ), snomedC ode.getSno medId(),
  572                                      snomedCo de.getEtio logyId(),  snomedCode .getEtiolo gySnomedCo de(), snom edCode.get EtiologySn omedValue( ));
  573           }
  574           
  575           pu blic stati c List<Pat hologySnom edCode> tr anslate(Pa thologyFed erationSno medCodeTyp e [] snome dCodes)
  576           {
  577                    if(s nomedCodes  == null)
  578                             return  null;
  579                    List <Pathology SnomedCode > result =  new Array List<Patho logySnomed Code>();
  580                    for( PathologyF ederationS nomedCodeT ype snomed Code : sno medCodes)
  581                    {
  582                             result .add(trans late(snome dCode));
  583                    }
  584                    retu rn result;
  585           }
  586           
  587           pr ivate stat ic Patholo gySnomedCo de transla te(Patholo gyFederati onSnomedCo deType sno medCode)
  588           {
  589                    if(s nomedCode. getEtiolog ySnomedVal ue() != nu ll && snom edCode.get EtiologySn omedValue( ).length()  > 0)
  590                    {
  591                             return  Pathology SnomedCode .createMor phologySno medCode(sn omedCode.g etTissueId (), snomed Code.getTi ssueCode() ,
  592                                               snomedCode .getTissue (),snomedC ode.getSno medId(), s nomedCode. getSnomedC ode(), sno medCode.ge tSnomedVal ue(),
  593                                               snomedCode .getEtiolo gyId(), sn omedCode.g etEtiology SnomedCode (), snomed Code.getEt iologySnom edValue()) ;
  594                    }
  595                    else  if(snomed Code.getFi eld() == P athologyFe derationFi eldType.mo rphology)
  596                    {
  597                             return  Pathology SnomedCode .createMor phologySno medCode(sn omedCode.g etTissueId (), snomed Code.getTi ssueCode() , snomedCo de.getTiss ue(),
  598                                               snomedCode .getSnomed Id(), snom edCode.get SnomedCode (), snomed Code.getSn omedValue( ));
  599                    }
  600                    else  if(snomed Code.getSn omedValue( ) != null  && snomedC ode.getSno medValue() .length()  > 0)
  601                    {
  602                             return  Pathology SnomedCode .createSno medCode(sn omedCode.g etTissueId (), snomed Code.getTi ssueCode() , snomedCo de.getTiss ue(),
  603                                               snomedCode .getSnomed Id(), tran slate(snom edCode.get Field()),  snomedCode .getSnomed Code(), sn omedCode.g etSnomedVa lue());
  604                    }
  605                    else
  606                    {
  607                             return  Pathology SnomedCode .createTis sue(snomed Code.getTi ssueId(),  snomedCode .getTissue Code(), sn omedCode.g etTissue() );
  608                    }
  609                                      
  610           }
  611           
  612           pu blic stati c Patholog yElectroni cSignature NeedStatus  translate (Pathology Federation Electronic SignatureN eedStatusT ype electr onicSignat ureNeededT ype)
  613           {
  614                    for(  Entry<gov .va.med.im aging.path ology.enum s.Patholog yElectroni cSignature NeedStatus , Patholog yFederatio nElectroni cSignature NeedStatus Type> entr y : Pathol ogyFederat ionRestTra nslator.el ectronicSi gnatureNee dedTypeMap .entrySet( ) )
  615                             if( en try.getVal ue() == el ectronicSi gnatureNee dedType )
  616                                      return e ntry.getKe y();
  617                    
  618                    retu rn null;
  619           }
  620           
  621           pu blic stati c Patholog yFederatio nElectroni cSignature NeedStatus Type trans late(Patho logyElectr onicSignat ureNeedSta tus electr onicSignat ureNeededT ype)
  622           {
  623                    for(  Entry<gov .va.med.im aging.path ology.enum s.Patholog yElectroni cSignature NeedStatus , Patholog yFederatio nElectroni cSignature NeedStatus Type> entr y : Pathol ogyFederat ionRestTra nslator.el ectronicSi gnatureNee dedTypeMap .entrySet( ) )
  624                             if( en try.getKey () == elec tronicSign atureNeede dType )
  625                                      return e ntry.getVa lue();
  626                    
  627                    retu rn null;
  628           }
  629           
  630           pu blic stati c Patholog yField tra nslate(Pat hologyFede rationFiel dType fiel dType)
  631           {
  632                    for(  Entry<gov .va.med.im aging.path ology.enum s.Patholog yField, Pa thologyFed erationFie ldType> en try : Path ologyFeder ationRestT ranslator. fieldTypeM ap.entrySe t() )
  633                             if( en try.getVal ue() == fi eldType )
  634                                      return e ntry.getKe y();
  635                    
  636                    retu rn null;
  637           }
  638           
  639           pu blic stati c Patholog yFederatio nFieldType  translate (Pathology Field fiel d)
  640           {
  641                    for(  Entry<gov .va.med.im aging.path ology.enum s.Patholog yField, Pa thologyFed erationFie ldType> en try : Path ologyFeder ationRestT ranslator. fieldTypeM ap.entrySe t() )
  642                             if( en try.getKey () == fiel d )
  643                                      return e ntry.getVa lue();
  644                    
  645                    retu rn null;
  646           }
  647           
  648           pu blic stati c Patholog yFederatio nCaseSpeci menType []  translate CaseSpecim ens(List<P athologyCa seSpecimen > specimen s)
  649           {
  650                    if(s pecimens = = null)
  651                             return  null;
  652                    Path ologyFeder ationCaseS pecimenTyp e [] resul t = new Pa thologyFed erationCas eSpecimenT ype[specim ens.size() ];
  653                    for( int i = 0;  i < speci mens.size( ); i++)
  654                    {
  655                             result [i] = tran slate(spec imens.get( i));
  656                    }
  657                    retu rn result;
  658           }
  659           
  660           pr ivate stat ic Patholo gyFederati onCaseSpec imenType t ranslate(P athologyCa seSpecimen  specimen)
  661           {
  662                    retu rn new Pat hologyFede rationCase SpecimenTy pe(specime n.getSpeci men(), 
  663                                      specimen .getSmearP rep(), spe cimen.getS tain(), sp ecimen.get NumSlides( ), 
  664                                      specimen .getLastSt ainDate()) ;
  665           }
  666           
  667           pu blic stati c Patholog yFederatio nCaseType[ ] translat eCases(Lis t<Patholog yCase> cas es)
  668           {
  669                    if(c ases == nu ll)
  670                             return  null;
  671                    Path ologyFeder ationCaseT ype[] resu lt = new P athologyFe derationCa seType[cas es.size()] ;
  672                    for( int i = 0;  i < cases .size(); i ++)
  673                    {
  674                             result [i] = tran slate(case s.get(i));
  675                    }
  676                    retu rn result;
  677           }
  678           
  679           pr ivate stat ic Patholo gyFederati onCaseType  translate (Pathology Case patho logyCase)
  680           {
  681                    Path ologyFeder ationCaseT ype result  = new Pat hologyFede rationCase Type(patho logyCase.g etPatholog yCaseUrn() .toString( ),
  682                                      patholog yCase.getA ccessionNu mber(), pa thologyCas e.getReser ved(), pat hologyCase .getReserv edBy(), pa thologyCas e.getPatie ntName(),
  683                                      RestCore Translator .translate (pathology Case.getPa tientIdent ifier()),
  684                                      patholog yCase.getP riority(), pathologyC ase.isSlid esAvailabl e(), patho logyCase.g etSpecimen TakenDate( ), 
  685                                      patholog yCase.getS tatus(), p athologyCa se.getSite Abbr(), pa thologyCas e.getSpeci menCount() , patholog yCase.getP atientSsn( ), 
  686                                      patholog yCase.getM ethod(), p athologyCa se.isNoteA ttached(),  pathology Case.isPat ientSensit ive(), 
  687                                      patholog yCase.getN umberOfIma ges());
  688                    
  689                    if(p athologyCa se.getCons ultations( ) != null)
  690                    {
  691                             List<P athologyCa seConsulta tion> cons ultations  = patholog yCase.getC onsultatio ns();
  692                             result .setConsul tations(tr anslateCon sultations (consultat ions));
  693                    }
  694                    
  695                    retu rn result;
  696           }
  697           
  698           pr ivate stat ic Patholo gyFederati onConsulta tionType [ ] translat eConsultat ions(List< PathologyC aseConsult ation> con sultations )
  699           {
  700                    Path ologyFeder ationConsu ltationTyp e [] resul t = new Pa thologyFed erationCon sultationT ype [consu ltations.s ize()];
  701                    for( int i = 0;  i < consu ltations.s ize(); i++ )
  702                    {
  703                             result [i] = tran slate(cons ultations. get(i));
  704                    }
  705                    retu rn result;
  706           }
  707           
  708           pr ivate stat ic Patholo gyFederati onConsulta tionType t ranslate(P athologyCa seConsulta tion consu ltation)
  709           {
  710                    retu rn new Pat hologyFede rationCons ultationTy pe(consult ation.getP athologyCa seConsulta tionUrn(). toString()
  711                                      consulta tion.getTy pe(), cons ultation.g etReservat ionDate(),  consultat ion.getInt erpretingS tation(), 
  712                                      consulta tion.getSi teAbbr(),  consultati on.getStat us());
  713           }
  714           
  715           pu blic stati c Patholog yFederatio nCaseAssis tanceType  translate( PathologyC aseAssista nce caseAs sistance)
  716           {
  717                    for(  Entry<Pat hologyCase Assistance , Patholog yFederatio nCaseAssis tanceType>  entry : P athologyFe derationRe stTranslat or.caseAss istanceTyp eMap.entry Set() )
  718                             if( en try.getKey () == case Assistance )
  719                                      return e ntry.getVa lue();
  720                    
  721                    retu rn null;
  722           }
  723           
  724           pu blic stati c Patholog yCaseAssis tance tran slate(Path ologyFeder ationCaseA ssistanceT ype caseAs sistance)
  725           {
  726                    for(  Entry<Pat hologyCase Assistance , Patholog yFederatio nCaseAssis tanceType>  entry : P athologyFe derationRe stTranslat or.caseAss istanceTyp eMap.entry Set() )
  727                             if( en try.getVal ue() == ca seAssistan ce)
  728                                      return e ntry.getKe y();
  729                    
  730                    retu rn null;
  731           }
  732           
  733           pu blic stati c List<Str ing> trans lateString ArrayToLis t(String [ ] input)
  734           {
  735                    if(i nput == nu ll)
  736                             return  null;
  737                    List <String> r esult = ne w ArrayLis t<String>( );
  738                    for( String in  : input)
  739                             result .add(in);
  740                    retu rn result;
  741           }
  742           
  743           pu blic stati c String[]  translate StringList ToArray(Li st<String>  input)
  744           {
  745                    if(i nput == nu ll)
  746                             return  null;
  747                    Stri ng [] resu lt = new S tring[inpu t.size()];
  748                    for( int i = 0;  i < input .size(); i ++)
  749                    {
  750                             result [i] = inpu t.get(i);
  751                    }
  752                    retu rn result;
  753           }
  754           
  755           pu blic stati c String t ranslateSt ringListTo DelimitedS tring(List <String> i nput, Stri ng delimit er)
  756           {
  757                    Stri ngBuilder  sb = new S tringBuild er();
  758                    Stri ng prefix  = "";
  759                    for( String in  : input)
  760                    {
  761                             sb.app end(prefix );
  762                             sb.app end(in);
  763                             prefix  = delimit er;
  764                    }
  765                    retu rn sb.toSt ring();
  766           }
  767           
  768           pu blic stati c Patholog yFederatio nCaseUpdat eAttribute ResultType  translate (Pathology CaseUpdate AttributeR esult attr ibute)
  769           {
  770                    if(a ttribute = = null)
  771                             return  null;
  772                    if(a ttribute.i sSuccess() )
  773                             return  new Patho logyFedera tionCaseUp dateAttrib uteResultT ype(true,  null);
  774                    retu rn new Pat hologyFede rationCase UpdateAttr ibuteResul tType(fals e, attribu te.getErro rMessage() );
  775           }
  776           
  777           pu blic stati c Patholog yCaseUpdat eAttribute Result tra nslate(Pat hologyFede rationCase UpdateAttr ibuteResul tType attr ibute)
  778           {
  779                    if(a ttribute = = null)
  780                             return  null;
  781                    if(a ttribute.i sSuccess() )
  782                             return  Pathology CaseUpdate AttributeR esult.crea teSuccessf ulLockResu lt();
  783                    retu rn Patholo gyCaseUpda teAttribut eResult.cr eateFailed LockResult (attribute .getErrorM essage());
  784           }
  785           
  786           pr ivate stat ic Patholo gyFederati onReadingS iteTypeTyp e translat e(gov.va.m ed.imaging .pathology .enums.Pat hologyRead ingSiteTyp e readingS iteType)
  787           {
  788                    for(  Entry<gov .va.med.im aging.path ology.enum s.Patholog yReadingSi teType, Pa thologyFed erationRea dingSiteTy peType> en try : Path ologyFeder ationRestT ranslator. readingSit eTypeMap.e ntrySet()  )
  789                             if( en try.getKey () == read ingSiteTyp e )
  790                                      return e ntry.getVa lue();
  791                    
  792                    retu rn null;
  793           }
  794           
  795           pr ivate stat ic gov.va. med.imagin g.patholog y.enums.Pa thologyRea dingSiteTy pe transla te(Patholo gyFederati onReadingS iteTypeTyp e readingS iteType)
  796           {
  797                    for(  Entry<gov .va.med.im aging.path ology.enum s.Patholog yReadingSi teType, Pa thologyFed erationRea dingSiteTy peType> en try : Path ologyFeder ationRestT ranslator. readingSit eTypeMap.e ntrySet()  )
  798                             if(ent ry.getValu e() == rea dingSiteTy pe)
  799                                      return e ntry.getKe y();
  800                    
  801                    retu rn null;
  802           }
  803           
  804           
  805           /*
  806           pu blic stati c Patholog yFederatio nAbstractS iteType []  translate PathologyS ites(List< AbstractPa thologySit e> sites)
  807           th rows Metho dException
  808           {
  809                    if(s ites == nu ll)
  810                             return  null;
  811                    Path ologyFeder ationAbstr actSiteTyp e [] resul t = new Pa thologyFed erationAbs tractSiteT ype[sites. size()];
  812                    for( int i = 0;  i < sites .size(); i ++)
  813                    {
  814                             result [i] = tran slate(site s.get(i));
  815                    }
  816                    retu rn result;
  817           }
  818           
  819           
  820           pr ivate stat ic Patholo gyFederati onAbstract SiteType t ranslate(A bstractPat hologySite  site)
  821           th rows Metho dException
  822           {
  823                    if(s ite instan ceof Patho logyAcquis itionSite)
  824                    {
  825                             Pathol ogyAcquisi tionSite a cqSite = ( PathologyA cquisition Site)site;
  826                             return  new Patho logyFedera tionAcquis itionSiteT ype(acqSit e.getSiteI d(), acqSi te.getSite Name(), 
  827                                               acqSite.ge tSiteAbbr( ), acqSite .isActive( ), acqSite .getPrimar ySiteStati onNumber()
  828                                               acqSite.ge tPrimarySi teName(),  acqSite.ge tPrimarySi teAbbr());
  829                    }
  830                    else  if(site i nstanceof  PathologyR eadingSite )
  831                    {
  832                             Pathol ogyReading Site readS ite = (Pat hologyRead ingSite)si te;
  833                             return  new Patho logyFedera tionReadin gSiteType( readSite.g etSiteId() , readSite .getSiteNa me(), 
  834                                               readSite.g etSiteAbbr (), readSi te.isActiv e(), trans late(readS ite.getRea dingSiteTy pe()));
  835                    }
  836                    thro w new Meth odExceptio n("Site no t an acqui sition or  reading si te!");
  837           }        */
  838           /*
  839           pu blic stati c List<Abs tractPatho logySite>  translate( PathologyF ederationR eadingSite Type [] re adingSites )
  840           th rows Metho dException
  841           {
  842                    if(r eadingSite s == null)
  843                             return  null;
  844                    List <AbstractP athologySi te> result  = new Arr ayList<Abs tractPatho logySite>( );
  845                    for( PathologyF ederationA bstractSit eType site  : sites)
  846                    {
  847                             result .add(trans late(site) );
  848                    }
  849                    
  850                    retu rn result;
  851           }
  852           
  853           pr ivate stat ic Abstrac tPathology Site trans late(Patho logyFedera tionAbstra ctSiteType  site)
  854           th rows Metho dException
  855           {
  856                    if(s ite instan ceof Patho logyFedera tionAcquis itionSiteT ype)
  857                    {
  858                             Pathol ogyFederat ionAcquisi tionSiteTy pe acqSite  = (Pathol ogyFederat ionAcquisi tionSiteTy pe)site;
  859                             return  translate (acqSite);
  860                    }
  861                    else  if(site i nstanceof  PathologyF ederationR eadingSite Type)
  862                    {
  863                             Pathol ogyFederat ionReading SiteType r eadingSite  = (Pathol ogyFederat ionReading SiteType)s ite;
  864                             return  translate (readingSi te);                    
  865                    }
  866                    thro w new Meth odExceptio n("Site no t an acqui sition or  reading si te!");
  867           }* /
  868           
  869           pu blic stati c Patholog yFederatio nAcquisiti onSiteType  [] transl ateAbstrac tSitesToAc quisitionS ites(List< AbstractPa thologySit e> acquisi tionSites)
  870           {
  871                    if(a cquisition Sites == n ull)
  872                             return  null;
  873                    Path ologyFeder ationAcqui sitionSite Type [] re sult = new  Pathology Federation Acquisitio nSiteType  [acquisiti onSites.si ze()];
  874                    for( int i = 0;  i < acqui sitionSite s.size();  i++)
  875                    {
  876                             Pathol ogyAcquisi tionSite a cquisition Site = (Pa thologyAcq uisitionSi te)acquisi tionSites. get(i);
  877                             result [i] = tran slate(acqu isitionSit e);
  878                    }
  879                    retu rn result;
  880           }
  881           
  882           /*
  883           pu blic stati c Patholog yFederatio nAcquisiti onSiteType  [] transl ateAcquisi tionSiteLi st(List<Pa thologyAcq uisitionSi te> acquis itionSites )
  884           {
  885                    if(a cquisition Sites == n ull)
  886                             return  null;
  887                    Path ologyFeder ationAcqui sitionSite Type [] re sult = new  Pathology Federation Acquisitio nSiteType  [acquisiti onSites.si ze()];
  888                    for( int i = 0;  i < acqui sitionSite s.size();  i++)
  889                    {
  890                             result [i] = tran slate(acqu isitionSit es.get(i)) ;
  891                    }
  892                    retu rn result;
  893           }* /
  894           
  895           pu blic stati c Patholog yFederatio nAcquisiti onSiteType  translate (Pathology Acquisitio nSite acqu isitionSit e)
  896           {
  897                    retu rn new Pat hologyFede rationAcqu isitionSit eType(acqu isitionSit e.getSiteI d(), acqui sitionSite .getSiteNa me(), 
  898                                      acquisit ionSite.ge tSiteAbbr( ), acquisi tionSite.i sActive(),  acquisiti onSite.get PrimarySit eStationNu mber(),
  899                                      acquisit ionSite.ge tPrimarySi teName(),  acquisitio nSite.getP rimarySite Abbr());
  900           }
  901           
  902           pu blic stati c List<Pat hologyAcqu isitionSit e> transla te(Patholo gyFederati onAcquisit ionSiteTyp e [] acqui sitionSite s)
  903           {
  904                    if(a cquisition Sites == n ull)
  905                             return  null;
  906                    List <Pathology Acquisitio nSite> res ult = new  ArrayList< PathologyA cquisition Site>();
  907                    for( PathologyF ederationA cquisition SiteType a cquisition Site : acq uisitionSi tes)
  908                    {
  909                             result .add(trans late(acqui sitionSite ));
  910                    }
  911                    retu rn result;
  912           }
  913           
  914           pu blic stati c Patholog yAcquisiti onSite tra nslate(Pat hologyFede rationAcqu isitionSit eType acqu isitionSit e)
  915           {
  916                    retu rn new Pat hologyAcqu isitionSit e(acquisit ionSite.ge tSiteId(),  acquisiti onSite.get SiteName()
  917                                      acquisit ionSite.ge tSiteAbbr( ), acquisi tionSite.i sActive(),  acquisiti onSite.get PrimarySit eId(), 
  918                                      acquisit ionSite.ge tPrimarySi teName(),  acquisitio nSite.getP rimarySite Abbr());
  919           }
  920  
  921           pu blic stati c List<Pat hologyRead ingSite> t ranslate(P athologyFe derationRe adingSiteT ype [] rea dingSites)
  922           {
  923                    if(r eadingSite s == null)
  924                             return  null;
  925                    List <Pathology ReadingSit e> result  = new Arra yList<Path ologyReadi ngSite>();
  926                    for( PathologyF ederationR eadingSite Type readi ngSite : r eadingSite s)
  927                    {
  928                             result .add(trans late(readi ngSite));
  929                    }
  930                    retu rn result;
  931           }
  932           
  933           pu blic stati c Patholog yReadingSi te transla te(Patholo gyFederati onReadingS iteType re adingSite)
  934           {
  935                    retu rn new Pat hologyRead ingSite(re adingSite. getSiteId( ), reading Site.getSi teName(), 
  936                                      readingS ite.getSit eAbbr(), r eadingSite .isActive( ), transla te(reading Site.getRe adingSiteT ype()));
  937           }
  938           
  939           pu blic stati c Patholog yFederatio nReadingSi teType []  translateA bstractSit esToReadin gSites(Lis t<Abstract PathologyS ite> readi ngSites)
  940           {
  941                    if(r eadingSite s == null)
  942                             return  null;
  943                    Path ologyFeder ationReadi ngSiteType  [] result  = new Pat hologyFede rationRead ingSiteTyp e [reading Sites.size ()];
  944                    for( int i = 0;  i < readi ngSites.si ze(); i++)
  945                    {
  946                             Pathol ogyReading Site readi ngSite = ( PathologyR eadingSite )readingSi tes.get(i) ;
  947                             result [i] = tran slate(read ingSite); 
  948                    }
  949                    retu rn result;
  950           }
  951           
  952           /*
  953           pu blic stati c Patholog yFederatio nReadingSi teType []  translateR eadingSite List(List< PathologyR eadingSite > readingS ites)
  954           {
  955                    if(r eadingSite s == null)
  956                             return  null;
  957                    Path ologyFeder ationReadi ngSiteType  [] result  = new Pat hologyFede rationRead ingSiteTyp e [reading Sites.size ()];
  958                    for( int i = 0;  i < readi ngSites.si ze(); i++)
  959                    {
  960                             result [i] = tran slate(read ingSites.g et(i)); 
  961                    }
  962                    retu rn result;
  963           }* /
  964           
  965           pu blic stati c Patholog yFederatio nReadingSi teType tra nslate(Pat hologyRead ingSite re adingSite)
  966           {
  967                    retu rn new Pat hologyFede rationRead ingSiteTyp e(readingS ite.getSit eId(), 
  968                                      readingS ite.getSit eName(), r eadingSite .getSiteAb br(), read ingSite.is Active(), 
  969                                      translat e(readingS ite.getRea dingSiteTy pe()));
  970           }
  971           
  972           pu blic stati c List<Pat hologyCase Specimen>  translate( PathologyF ederationC aseSpecime nType [] s pecimens)
  973           {
  974                    if(s pecimens = = null)
  975                             return  null;
  976                    List <Pathology CaseSpecim en> result  = new Arr ayList<Pat hologyCase Specimen>( );
  977                    for( PathologyF ederationC aseSpecime nType spec imen : spe cimens)
  978                    {
  979                             result .add(trans late(speci men));
  980                    }
  981                    
  982                    retu rn result;
  983           }
  984           
  985           pr ivate stat ic Patholo gyCaseSpec imen trans late(Patho logyFedera tionCaseSp ecimenType  specimen)
  986           {
  987                    Path ologyCaseS pecimen re sult = new  Pathology CaseSpecim en(specime n.getSpeci men());
  988                    resu lt.setLast StainDate( specimen.g etLastStai nDate());
  989                    resu lt.setNumS lides(spec imen.getNu mSlides()) ;
  990                    resu lt.setSmea rPrep(spec imen.getSm earPrep()) ;
  991                    resu lt.setStai n(specimen .getStain( ));
  992                    retu rn result;
  993           }
  994  
  995           pu blic stati c List<Pat hologyCase > translat e(Patholog yFederatio nCaseType  [] cases) 
  996           th rows Metho dException
  997           {
  998                    if(c ases == nu ll)
  999                             return  null;
  1000                    List <Pathology Case> resu lt = new A rrayList<P athologyCa se>();
  1001                    for( PathologyF ederationC aseType c  : cases)
  1002                    {
  1003                             result .add(trans late(c));
  1004                    }
  1005                    
  1006                    retu rn result;
  1007           }
  1008           
  1009           pr ivate stat ic Patholo gyCase tra nslate(Pat hologyFede rationCase Type caseT ype) 
  1010           th rows Metho dException
  1011           {
  1012                    try
  1013                    {
  1014                             Pathol ogyCaseURN  pathology CaseUrn =  URNFactory .create(ca seType.get PathologyC aseId(), P athologyCa seURN.clas s);
  1015                             return  new Patho logyCase(p athologyCa seUrn, cas eType.getA ccessionNu mber(), ca seType.get Reserved() , caseType .getReserv edBy(),
  1016                                               caseType.g etPatientN ame(),
  1017                                               RestCoreTr anslator.t ranslate(c aseType.ge tPatientId entifier() ),
  1018                                               caseType.g etPriority (), caseTy pe.isSlide sAvailable (), 
  1019                                               caseType.g etSpecimen TakenDate( ), caseTyp e.getStatu s(), caseT ype.getSit eAbbr(), c aseType.ge tSpecimenC ount(), ca seType.get PatientSsn (), 
  1020                                               caseType.g etMethod() , caseType .isNoteAtt ached(), c aseType.is PatientSen sitive(),  caseType.g etNumberOf Images());
  1021                    }
  1022                    catc h(URNForma tException  urnfX)
  1023                    {
  1024                             logger .error("UR NFormatExc eption tra nslating p athology c ases", urn fX);
  1025                             throw  new Method Exception( urnfX);
  1026                    }
  1027           }
  1028  
  1029           pu blic stati c Patholog yCaseReser veResult t ranslate(P athologyFe derationCa seReserveR esultType  caseReserv eResult)
  1030           {
  1031                    for(  Entry<Pat hologyCase ReserveRes ult, Patho logyFedera tionCaseRe serveResul tType> ent ry : Patho logyFedera tionRestTr anslator.c aseReserve ResultType Map.entryS et() )
  1032                             if( en try.getVal ue() == ca seReserveR esult)
  1033                                      return e ntry.getKe y();
  1034                    
  1035                    retu rn null;
  1036           }
  1037           
  1038           pu blic stati c Patholog yFederatio nCaseReser veResultTy pe transla te(Patholo gyCaseRese rveResult  caseReserv eResult)
  1039           {
  1040                    for(  Entry<Pat hologyCase ReserveRes ult, Patho logyFedera tionCaseRe serveResul tType> ent ry : Patho logyFedera tionRestTr anslator.c aseReserve ResultType Map.entryS et() )
  1041                             if( en try.getKey () == case ReserveRes ult)
  1042                                      return e ntry.getVa lue();
  1043                    
  1044                    retu rn null;
  1045           }
  1046           
  1047           pu blic stati c Patholog yFederatio nSaveCaseR eportResul tType tran slate(Path ologySaveC aseReportR esult save CaseReport Result)
  1048           {
  1049                    retu rn new Pat hologyFede rationSave CaseReport ResultType (saveCaseR eportResul t.isReleas ed(), save CaseReport Result.get Message()) ;
  1050           }
  1051           
  1052           pu blic stati c Patholog ySaveCaseR eportResul t translat e(Patholog yFederatio nSaveCaseR eportResul tType save CaseReport Result)
  1053           {
  1054                    if(s aveCaseRep ortResult. isReleased ())
  1055                             return  Pathology SaveCaseRe portResult .createRel easedResul t(saveCase ReportResu lt.getMess age());
  1056                    retu rn Patholo gySaveCase ReportResu lt.createU nreleasedR esult();
  1057           }
  1058   }