118. EPMO Open Source Coordination Office Redaction File Detail Report

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

118.1 Files compared

# Location File Last Modified
1 ehealth_xchange_cif.zip\NHIN_adapter\AdapterSubscriptionServiceWEB\src\main\java\gov\va\med\nhin\adapter\subscription\web\resource EHXSubscription.java Thu Feb 22 14:27:26 2018 UTC
2 ehealth_xchange_cif.zip\NHIN_adapter\AdapterSubscriptionServiceWEB\src\main\java\gov\va\med\nhin\adapter\subscription\web\resource EHXSubscription.java Tue Feb 27 14:30:15 2018 UTC

118.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 6 940
Changed 5 10
Inserted 0 0
Removed 0 0

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

118.4 Active regular expressions

No regular expressions were active.

118.5 Comparison detail

  1   /*
  2    * To chan ge this li cense head er, choose  License H eaders in  Project Pr operties.
  3    * To chan ge this te mplate fil e, choose  Tools | Te mplates
  4    * and ope n the temp late in th e editor.
  5    */
  6   package go v.va.med.n hin.adapte r.subscrip tion.web.r esource;
  7  
  8   import ca. uhn.fhir.m odel.api.a nnotation. Block;
  9   import ca. uhn.fhir.m odel.api.a nnotation. Child;
  10   import ca. uhn.fhir.m odel.api.a nnotation. Descriptio n;
  11   import ca. uhn.fhir.m odel.api.a nnotation. Extension;
  12   import ca. uhn.fhir.m odel.api.a nnotation. ResourceDe f;
  13   import ca. uhn.fhir.u til.Elemen tUtil;
  14   import jav a.util.Arr ayList;
  15   import jav a.util.For matter;
  16   import jav a.util.Lis t;
  17   import jav a.util.reg ex.Matcher ;
  18   import jav a.util.reg ex.Pattern ;
  19   import org .hl7.fhir. dstu3.mode l.Backbone Element;
  20   import org .hl7.fhir. dstu3.mode l.BooleanT ype;
  21   import org .hl7.fhir. dstu3.mode l.EnumFact ory;
  22   import org .hl7.fhir. dstu3.mode l.Enumerat ion;
  23   import org .hl7.fhir. dstu3.mode l.StringTy pe;
  24   import org .hl7.fhir. dstu3.mode l.Subscrip tion;
  25  
  26   /**
  27    *
  28    * @author  david
  29    */
  30   @ResourceD ef(name =  "Subscript ion", prof ile = "htt p://ehx. DNS     /Structure Definition /EHXSubscr iption")
  31   public cla ss EHXSubs cription e xtends Sub scription
  32   {
  33       @Child (name = "a nnouncePat ient")
  34         @Extension (url = "ht tp://ehx. DNS     /Structure Definition /EHXSubscr iption/ann ouncePatie nt", defin edLocally  = true, is Modifier =  false)
  35       @Descr iption(sho rtDefiniti on = "Spec ify if the  patient s hould be a nnounced t o all eHX  partners." )
  36       privat e BooleanT ype announ cePatient;
  37  
  38       @Child (name = "a utoDocRetr ieve")
  39         @Extension (url = "ht tp://ehx. DNS     /Structure Definition /EHXSubscr iption/aut oDocRetrie ve", defin edLocally  = true, is Modifier =  false)
  40       @Descr iption(sho rtDefiniti on = "Spec ify if doc uments sho uld be aut omatically  retrieved .  Set to  true in pr efetch sit uations.")
  41       privat e BooleanT ype autoDo cRetrieve;
  42  
  43       @Child (name = "a ssertions" )
  44         @Extension (url = "ht tp://ehx. DNS     /Structure Definition /EHXSubscr iption/ass ertions",  definedLoc ally = tru e, isModif ier = fals e)
  45       @Descr iption(sho rtDefiniti on = "Asse rtions abo ut entity  that creat ed the sub scription. ")
  46       privat e Assertio ns asserti ons;
  47  
  48       @Child (name = "n hioStatus" , max = Ch ild.MAX_UN LIMITED)
  49         @Extension (url = "ht tp://ehx. DNS     /Structure Definition /EHXSubscr iption/nhi oStatus",  definedLoc ally = tru e, isModif ier = fals e)
  50       @Descr iption(sho rtDefiniti on = "Stat us of NHIO s that wer e part of  the proces sing of th is subscri ption.")
  51       privat e List<NHI OStatus> n hioStatuse s;
  52  
  53       /**
  54        * It  is importa nt to over ride the i sEmpty() m ethod, add ing a chec k for any
  55        * new ly added f ields.
  56        */
  57       @Overr ide
  58       public  boolean i sEmpty()
  59       {
  60           re turn super .isEmpty()
  61                   && El ementUtil. isEmpty(an nouncePati ent, autoD ocRetrieve , assertio ns, nhioSt atuses);
  62       }
  63  
  64       public  BooleanTy pe getAnno uncePatien t()
  65       {
  66           re turn annou ncePatient ;
  67       }
  68  
  69       public  void setA nnouncePat ient(Boole anType ann ouncePatie nt)
  70       {
  71           th is.announc ePatient =  announceP atient;
  72       }
  73  
  74       public  BooleanTy pe getAuto DocRetriev e()
  75       {
  76           re turn autoD ocRetrieve ;
  77       }
  78  
  79       public  void setA utoDocRetr ieve(Boole anType aut oDocRetrie ve)
  80       {
  81           th is.autoDoc Retrieve =  autoDocRe trieve;
  82       }
  83  
  84       public  Assertion s getAsser tions()
  85       {
  86           re turn asser tions;
  87       }
  88  
  89       public  void setA ssertions( Assertions  assertion s)
  90       {
  91           th is.asserti ons = asse rtions;
  92       }
  93  
  94       public  boolean h asAllAsser tions()
  95       {
  96           re turn !Elem entUtil.is Empty(asse rtions)
  97                   && as sertions.i sFull();
  98       }
  99  
  100       public  boolean h asPatientI D()
  101       {
  102           re turn (null  != getPat ientID());
  103       }
  104  
  105       public  String ge tPatientID ()
  106       {
  107           fi nal Patter n patienti d = Patter n.compile( "DocumentR eference\\ ?patient=P atient/(\\ d{10}V\\d{ 6})");
  108           Ma tcher m =  patientid. matcher(ge tCriteria( ));
  109           re turn (m.ma tches() ?  m.group(1)  : null);
  110       }
  111  
  112       public  boolean a llDone()
  113       {
  114           bo olean ret  = true;
  115  
  116           fo r (EHXSubs cription.N HIOStatus  s : getNHI OStatuses( )) {
  117                ret = re t &= s.get Status() = = NHIOStat us.StatusT ype.DONE;
  118                if (!ret ) {
  119                    brea k;
  120                }
  121           }
  122  
  123           re turn ret;
  124       }
  125  
  126       public  boolean i sAnnounce( )
  127       {
  128           re turn !Elem entUtil.is Empty(getA nnouncePat ient())
  129                   && ge tAnnounceP atient().b ooleanValu e();
  130       }
  131  
  132       public  boolean i sAutoDocRe trieve()
  133       {
  134           re turn !Elem entUtil.is Empty(getA utoDocRetr ieve())
  135                   && ge tAutoDocRe trieve().b ooleanValu e();
  136       }
  137  
  138       public  void setN HIOStatuse s(List<NHI OStatus> n hioStatuse s)
  139       {
  140           th is.nhioSta tuses = nh ioStatuses ;
  141       }
  142  
  143       public  List<NHIO Status> ge tNHIOStatu ses()
  144       {
  145           re turn nhioS tatuses;
  146       }
  147  
  148       public  void addN HIOStatus( String hci d, NHIOSta tus.Status Type statu s, NHIOSta tus.Proces singStageT ype proces singStage)
  149       {
  150           NH IOStatus n hioStatus  = new NHIO Status();
  151           nh ioStatus.s etHCID(hci d);
  152           nh ioStatus.s etStatus(s tatus);
  153           nh ioStatus.s etProcessi ngStage(pr ocessingSt age);
  154           if  (nhioStat uses == nu ll) {
  155                nhioStat uses = new  ArrayList <>();
  156           }
  157           nh ioStatuses .add(nhioS tatus);
  158       }
  159  
  160       public  void upda teNHIOStat us(String  hcid, NHIO Status.Sta tusType st atus, NHIO Status.Pro cessingSta geType pro cessingSta ge, List<S tring> err ors)
  161       {
  162           if  (!Element Util.isEmp ty(nhioSta tuses)) {
  163                nhioStat uses.forEa ch((n) ->  {
  164                    if ( n.getHCID( ).equals(h cid)) {
  165                         n.setProce ssingStage (processin gStage);
  166                         n.setStatu s(status);
  167                         if (errors  != null)  {
  168                             errors .forEach(( err) -> {
  169                                 n. addError(e rr);
  170                             });
  171                         }
  172                    }
  173                });
  174           }
  175       }
  176  
  177       @Block
  178       public  static cl ass Assert ions exten ds Backbon eElement
  179       {
  180           @C hild(name  = "userID" )
  181           @E xtension(u rl = "user ID", defin edLocally  = true, is Modifier =  false)
  182           @D escription (shortDefi nition = " User/Syste m ID that  triggered  subscripti on.")
  183           pr ivate Stri ngType use rID;
  184  
  185           @C hild(name  = "userNam e")
  186           @E xtension(u rl = "user Name", def inedLocall y = true,  isModifier  = false)
  187           @D escription (shortDefi nition = " User/Syste m name tha t triggere d subscrip tion.")
  188           pr ivate Stri ngType use rName;
  189  
  190           @C hild(name  = "systemI D")
  191           @E xtension(u rl = "syst emID", def inedLocall y = true,  isModifier  = false)
  192           @D escription (shortDefi nition = " System ID  of system  that trigg ered the r equest.")
  193           pr ivate Stri ngType sys temID;
  194  
  195           @C hild(name  = "organiz ationID")
  196           @E xtension(u rl = "orga nizationID ", defined Locally =  true, isMo difier = f alse)
  197           @D escription (shortDefi nition = " ID of orga nization t hat trigge red subscr iption.")
  198           pr ivate Stri ngType org anizationI D;
  199  
  200           @C hild(name  = "organiz ationName" )
  201           @E xtension(u rl = "orga nizationNa me", defin edLocally  = true, is Modifier =  false)
  202           @D escription (shortDefi nition = " Name of or ganization  that trig gered subs cription." )
  203           pr ivate Stri ngType org anizationN ame;
  204  
  205           @C hild(name  = "purpose OfUse")
  206           @E xtension(u rl = "purp oseOfUse",  definedLo cally = tr ue, isModi fier = fal se)
  207           @D escription (shortDefi nition = " Purpose of  subscript ion.")
  208           pr ivate Stri ngType pur poseOfUse;
  209  
  210           @C hild(name  = "role")
  211           @E xtension(u rl = "role ", defined Locally =  true, isMo difier = f alse)
  212           @D escription (shortDefi nition = " User role  SNOMED cod e.")
  213           pr ivate Stri ngType rol e;
  214  
  215           @O verride
  216           pu blic Asser tions copy ()
  217           {
  218                Assertio ns asserti ons = new  Assertions ();
  219                assertio ns.purpose OfUse = pu rposeOfUse ;
  220                assertio ns.role =  role;
  221                assertio ns.userID  = userID;
  222                assertio ns.userNam e = userNa me;
  223                assertio ns.organiz ationID =  organizati onID;
  224                assertio ns.organiz ationName  = organiza tionName;
  225                assertio ns.systemI D = system ID;
  226                return a ssertions;
  227           }
  228  
  229           @O verride
  230           pu blic boole an isEmpty ()
  231           {
  232                return s uper.isEmp ty()
  233                       & & ElementU til.isEmpt y(userID,  userName,  systemID,  organizati onID, orga nizationNa me, purpos eOfUse, ro le);
  234           }
  235  
  236           pu blic boole an isFull( )
  237           {
  238                return ! (ElementUt il.isEmpty (userID)
  239                          || Elemen tUtil.isEm pty(userNa me)
  240                          || Elemen tUtil.isEm pty(system ID)
  241                          || Elemen tUtil.isEm pty(organi zationID)
  242                          || Elemen tUtil.isEm pty(organi zationName )
  243                          || Elemen tUtil.isEm pty(purpos eOfUse)
  244                          || Elemen tUtil.isEm pty(role)) ;
  245           }
  246  
  247           pu blic Strin gType getU serID()
  248           {
  249                return u serID;
  250           }
  251  
  252           pu blic void  setUserID( StringType  userID)
  253           {
  254                this.use rID = user ID;
  255           }
  256  
  257           pu blic Strin gType getU serName()
  258           {
  259                return u serName;
  260           }
  261  
  262           pu blic void  setUserNam e(StringTy pe userNam e)
  263           {
  264                this.use rName = us erName;
  265           }
  266  
  267           pu blic Strin gType getS ystemID()
  268           {
  269                return s ystemID;
  270           }
  271  
  272           pu blic void  setSystemI D(StringTy pe systemI D)
  273           {
  274                this.sys temID = sy stemID;
  275           }
  276  
  277           pu blic Strin gType getO rganizatio nID()
  278           {
  279                return o rganizatio nID;
  280           }
  281  
  282           pu blic void  setOrganiz ationID(St ringType o rganizatio nID)
  283           {
  284                this.org anizationI D = organi zationID;
  285           }
  286  
  287           pu blic Strin gType getO rganizatio nName()
  288           {
  289                return o rganizatio nName;
  290           }
  291  
  292           pu blic void  setOrganiz ationName( StringType  organizat ionName)
  293           {
  294                this.org anizationN ame = orga nizationNa me;
  295           }
  296  
  297           pu blic Strin gType getP urposeOfUs e()
  298           {
  299                return p urposeOfUs e;
  300           }
  301  
  302           pu blic void  setPurpose OfUse(Stri ngType pur poseOfUse)
  303           {
  304                this.pur poseOfUse  = purposeO fUse;
  305           }
  306  
  307           pu blic Strin gType getR ole()
  308           {
  309                return r ole;
  310           }
  311  
  312           pu blic void  setRole(St ringType r ole)
  313           {
  314                this.rol e = role;
  315           }
  316  
  317           pu blic Strin g toString ()
  318           {
  319                StringBu ilder sb =  new Strin gBuilder() ;
  320                Formatte r f = new  Formatter( sb);
  321                f.format ("{userID:  %s, userN ame: %s, s ystemID: % s, organiz ationID: % s, organiz ationName:  %s, purpo seOfUse: % s, role: % s}",
  322                          userID, u serName, s ystemID, o rganizatio nID, organ izationNam e, purpose OfUse, rol e);
  323                return s b.toString ();
  324           }
  325       }
  326  
  327       @Block
  328       public  static cl ass NHIOSt atus exten ds Backbon eElement
  329       {
  330           pu blic enum  StatusType
  331           {
  332                NEW,
  333                PROCESSI NG,
  334                DONE
  335           };
  336  
  337           pu blic stati c class St atusTypeEn umFactory  implements  EnumFacto ry<StatusT ype>
  338           {
  339                @Overrid e
  340                public S tatusType  fromCode(S tring stri ng) throws  IllegalAr gumentExce ption
  341                {
  342                    retu rn StatusT ype.valueO f(string);
  343                }
  344  
  345                @Overrid e
  346                public S tring toCo de(StatusT ype t)
  347                {
  348                    retu rn t.toStr ing();
  349                }
  350  
  351                @Overrid e
  352                public S tring toSy stem(Statu sType t)
  353                {
  354                    retu rn t.toStr ing();
  355                }
  356           }
  357           
  358           pu blic enum  Processing StageType
  359           {
  360                STARTING ,
  361                ANNOUNCE ,
  362                ANNOUNCE _SUCCESS,
  363                ANNOUNCE _FAILURE,
  364                DOCUMENT _QUERY,
  365                DOCUMENT _QUERY_SUC CESS,
  366                DOCUMENT _QUERY_FAI LURE,
  367                DOCUMENT _RETRIEVE,
  368                DOCUMENT _RETRIEVE_ SUCCESS,
  369                DOCUMENT _RETRIEVE_ FAILURE,
  370           };
  371  
  372           pu blic stati c class Pr ocessingSt ageTypeEnu mFactory i mplements  EnumFactor y<Processi ngStageTyp e>
  373           {
  374                @Overrid e
  375                public P rocessingS tageType f romCode(St ring strin g) throws  IllegalArg umentExcep tion
  376                {
  377                    retu rn Process ingStageTy pe.valueOf (string);
  378                }
  379  
  380                @Overrid e
  381                public S tring toCo de(Process ingStageTy pe t)
  382                {
  383                    retu rn t.toStr ing();
  384                }
  385  
  386                @Overrid e
  387                public S tring toSy stem(Proce ssingStage Type t)
  388                {
  389                    retu rn t.toStr ing();
  390                }
  391           }
  392           
  393           @C hild(name  = "hcid")
  394           @E xtension(u rl = "hcid ", defined Locally =  true, isMo difier = f alse)
  395           pr ivate Stri ngType hci d;
  396  
  397           @C hild(name  = "status" )
  398           @E xtension(u rl = "stat us", defin edLocally  = true, is Modifier =  false)
  399           pr ivate Enum eration<St atusType>  status;
  400  
  401           @C hild(name  = "type")
  402           @E xtension(u rl = "type ", defined Locally =  true, isMo difier = f alse)
  403           pr ivate Enum eration<Pr ocessingSt ageType> p rocessingS tage;
  404  
  405           @C hild(name  = "error")
  406           @E xtension(u rl = "erro r", define dLocally =  true, isM odifier =  false)
  407           pr ivate List <StringTyp e> errors;
  408           
  409           @O verride
  410           pu blic boole an isEmpty ()
  411           {
  412                return s uper.isEmp ty()
  413                       & & ElementU til.isEmpt y(hcid, st atus, proc essingStag e);
  414           }
  415  
  416           @O verride
  417           pu blic NHIOS tatus copy ()
  418           {
  419                NHIOStat us nhioSta tus = new  NHIOStatus ();
  420                nhioStat us.hcid =  hcid;
  421                nhioStat us.status  = this.sta tus;
  422                nhioStat us.process ingStage =  processin gStage;
  423                nhioStat us.errors  = errors;
  424                return n hioStatus;
  425           }
  426  
  427           pu blic Strin g getHCID( )
  428           {
  429                return h cid.getVal ue();
  430           }
  431  
  432           pu blic void  setHCID(St ring hcid)
  433           {
  434                this.hci d = new St ringType(h cid);
  435           }
  436  
  437           pu blic Statu sType getS tatus()
  438           {
  439                return s tatus.getV alue();
  440           }
  441  
  442           pu blic void  setStatus( StatusType  status)
  443           {
  444                this.sta tus = new  Enumeratio n<>(new St atusTypeEn umFactory( ), status) ;
  445           }
  446  
  447           pu blic Proce ssingStage Type getPr ocessingSt age()
  448           {
  449                return p rocessingS tage.getVa lue();
  450           }
  451  
  452           pu blic void  setProcess ingStage(P rocessingS tageType t ype)
  453           {
  454                this.pro cessingSta ge = new E numeration <>(new Pro cessingSta geTypeEnum Factory(),  type);
  455           }
  456  
  457           pu blic List< StringType > getError ()
  458           {
  459                return e rrors;
  460           }
  461  
  462           pu blic void  setError(L ist<String Type> erro rs)
  463           {
  464                this.err ors = erro rs;
  465           }
  466           
  467           pu blic void  addError(S tring erro r)
  468           {
  469                if (erro rs == null ) {
  470                    erro rs = new A rrayList<> ();
  471                }
  472                errors.a dd(new Str ingType(er ror));
  473           }
  474       }
  475   }