3144. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 6/9/2017 3:49:49 PM Eastern Daylight 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.

3144.1 Files compared

# Location File Last Modified
1 Fri Jun 9 19:49:49 2017 UTC
2 eHealth_Exch (eHealth Exchange Enhancements) Build 3 docs & code_May_2017.zip\VAP_CIF_CODE0502.zip\VAP_CIF_CODE0502\VAP_CIF_CODE0502\nvap-client\src\main\java\gov\va\nvap\svc\consenteval\common XACMLContextUtil.java Fri Apr 21 20:15:58 2017 UTC

3144.2 Comparison summary

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

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

3144.4 Active regular expressions

No regular expressions were active.

3144.5 Comparison detail

        1   package go v.va.nvap. svc.consen teval.comm on;
        2  
        3   import gov .va.nvap.c ommon.vali dation.Nul lChecker;
        4  
        5   import jav a.util.Arr ayList;
        6   import jav a.util.Ite rator;
        7   import jav a.util.Lis t;
        8  
        9   import oas is.names.t c.xacml._2 _0.context .schema.os .Attribute Type;
        10   import oas is.names.t c.xacml._2 _0.context .schema.os .Attribute ValueType;
        11   import oas is.names.t c.xacml._2 _0.context .schema.os .Environme ntType;
        12   import oas is.names.t c.xacml._2 _0.context .schema.os .RequestTy pe;
        13   import oas is.names.t c.xacml._2 _0.context .schema.os .ResourceT ype;
        14   import oas is.names.t c.xacml._2 _0.context .schema.os .SubjectTy pe;
        15  
        16   /**
        17    * 
        18    * @author  Anand Sas try
        19    */
        20   public cla ss XACMLCo ntextUtil  {
        21  
        22           /* *
        23            *  @param at tributeId
        24            *  @param at tributeDat aType
        25            *  @param at tributeVal ue
        26            * /
        27           pu blic stati c void add ActionAttr ibuteValue (final Str ing attrib uteId,
        28                             final  String att ributeData Type, fina l String a ttributeVa lue) {
        29           }
        30  
        31           /* *
        32            *  @param re quest
        33            * /
        34           pu blic stati c void add EmptyEnvir onmentElem ent(final  RequestTyp e request)  {
        35                    if ( !NullCheck er.isNullO rEmpty(req uest)) {
        36                             if (Nu llChecker. isNullOrEm pty(reques t.getEnvir onment()))  {
        37                                      final En vironmentT ype et = n ew Environ mentType() ;
        38                                      request. setEnviron ment(et);
        39                             }
        40                    }
        41  
        42           }
        43  
        44           /* *
        45            *  @param at tributeId
        46            *  @param at tributeDat aType
        47            *  @param at tributeVal ue
        48            *  @param re quest
        49            * /
        50           pu blic stati c void add ResourceAt tributeVal ue(final S tring attr ibuteId,
        51                             final  String att ributeData Type, fina l String a ttributeVa lue,
        52                             final  RequestTyp e request)  {
        53                    if ( !NullCheck er.isNullO rEmpty(att ributeId)
        54                                      && !Null Checker.is NullOrEmpt y(attribut eDataType)
        55                                      && !Null Checker.is NullOrEmpt y(attribut eValue)
        56                                      && !Null Checker.is NullOrEmpt y(request) ) {
        57                             final  List<Strin g> attribu teValues =  new Array List<Strin g>();
        58                             attrib uteValues. add(attrib uteValue);
        59                             XACMLC ontextUtil .addResour ceAttribut eValues(at tributeId,
        60                                               attributeD ataType, a ttributeVa lues, requ est);
        61                    }
        62  
        63           }
        64  
        65           /* *
        66            *  @param at tributeId
        67            *  @param at tributeDat aType
        68            *  @param at tributeVal ues
        69            *  @param re quest
        70            * /
        71           pu blic stati c void add ResourceAt tributeVal ues(final  String att ributeId,
        72                             final  String att ributeData Type, fina l List<Str ing> attri buteValues ,
        73                             final  RequestTyp e request)  {
        74                    if ( !NullCheck er.isNullO rEmpty(att ributeId)
        75                                      && !Null Checker.is NullOrEmpt y(attribut eDataType)
        76                                      && (attr ibuteValue s != null)
        77                                      && !Null Checker.is NullOrEmpt y(request) ) {
        78                    }
        79                    Reso urceType r t = reques t.getResou rce().get( 0);
        80                    if ( NullChecke r.isNullOr Empty(rt))  {
        81                             rt = n ew Resourc eType();
        82                             reques t.getResou rce().add( rt);
        83                    }
        84  
        85                    fina l Iterator <String> a ttributeVa luesIt = a ttributeVa lues.itera tor();
        86                    whil e (attribu teValuesIt .hasNext() ) {
        87                             final  String att ributeValu e = attrib uteValuesI t.next();
        88                             if ((a ttributeVa lue == nul l)
        89                                               || (attrib uteValue.t rim().leng th() == 0) ) {
        90                                      continue ;
        91                             }
        92                             rt.get Attribute( ).add(
        93                                               XACMLConte xtUtil.cre ateAttribu teValueTyp e(attribut eId,
        94                                                                attr ibuteDataT ype, attri buteValue. trim()));
        95                    }
        96  
        97           }
        98  
        99           /* *
        100            *  @param at tributeId
        101            *  @param at tributeDat aType
        102            *  @param at tributeVal ue
        103            *  @param re quest
        104            * /
        105           pu blic stati c void add SubjectAtt ributeValu e(final St ring attri buteId,
        106                             final  String att ributeData Type, fina l String a ttributeVa lue,
        107                             final  RequestTyp e request)  {
        108                    if ( !NullCheck er.isNullO rEmpty(att ributeId)
        109                                      && !Null Checker.is NullOrEmpt y(attribut eDataType)
        110                                      && !Null Checker.is NullOrEmpt y(attribut eValue)
        111                                      && !Null Checker.is NullOrEmpt y(request) ) {
        112                             final  List<Strin g> attribu teValues =  new Array List<Strin g>();
        113                             attrib uteValues. add(attrib uteValue);
        114                             XACMLC ontextUtil .addSubjec tAttribute Values(att ributeId,
        115                                               attributeD ataType, a ttributeVa lues, requ est);
        116                    }
        117  
        118           }
        119  
        120           /* *
        121            *  @param at tributeId
        122            *  @param at tributeDat aType
        123            *  @param at tributeVal ues
        124            *  @param re quest
        125            * /
        126           pu blic stati c void add SubjectAtt ributeValu es(final S tring attr ibuteId,
        127                             final  String att ributeData Type, fina l List<Str ing> attri buteValues ,
        128                             final  RequestTyp e request)  {
        129                    if ( !NullCheck er.isNullO rEmpty(att ributeId)
        130                                      && !Null Checker.is NullOrEmpt y(attribut eDataType)
        131                                      && (attr ibuteValue s != null)
        132                                      && !Null Checker.is NullOrEmpt y(request) ) {
        133                    }
        134                    Subj ectType st  = request .getSubjec t().get(0) ;
        135                    if ( NullChecke r.isNullOr Empty(st))  {
        136                             st = n ew Subject Type();
        137                             reques t.getSubje ct().add(s t);
        138                    }
        139  
        140                    fina l Iterator <String> a ttributeVa luesIt = a ttributeVa lues.itera tor();
        141                    whil e (attribu teValuesIt .hasNext() ) {
        142                             final  String att ributeValu e = attrib uteValuesI t.next();
        143                             if ((a ttributeVa lue == nul l)
        144                                               || (attrib uteValue.t rim().leng th() == 0) ) {
        145                                      continue ;
        146                             }
        147                             st.get Attribute( ).add(
        148                                               XACMLConte xtUtil.cre ateAttribu teValueTyp e(attribut eId,
        149                                                                attr ibuteDataT ype, attri buteValue. trim()));
        150                    }
        151  
        152           }
        153  
        154           pr ivate stat ic Attribu teType cre ateAttribu teValueTyp e(
        155                             final  String att ributeId,  final Stri ng attribu teDataType ,
        156                             final  String att ributeValu e) {
        157                    fina l Attribut eValueType  atv = new  Attribute ValueType( );
        158                    atv. getContent ().add(att ributeValu e);
        159  
        160                    fina l Attribut eType at =  new Attri buteType() ;
        161                    at.s etAttribut eId(attrib uteId);
        162                    at.s etDataType (attribute DataType);
        163                    at.g etAttribut eValue().a dd(atv);
        164  
        165                    retu rn at;
        166           }
        167  
        168           /* *
        169            *  @param re quest
        170            *  @param at tributeId
        171            *  @return
        172            * /
        173           pu blic stati c List<Str ing> extra ctResource AttributeV alues(
        174                             final  RequestTyp e request,  final Str ing attrib uteId) {
        175                    retu rn XACMLCo ntextUtil. getResourc eAttribute Values(req uest,
        176                                      attribut eId, true) ;
        177           }
        178  
        179           /* *
        180            *  @param re quest
        181            *  @param at tributeId
        182            *  @return
        183            * /
        184           pu blic stati c List<Str ing> extra ctSubjectA ttributeVa lues(
        185                             final  RequestTyp e request,  final Str ing attrib uteId) {
        186                    retu rn XACMLCo ntextUtil. getSubject AttributeV alues(requ est, attri buteId,
        187                                      true);
        188           }
        189  
        190           /* *
        191            *  @param re quest
        192            *  @param at tributeId
        193            *  @return
        194            * /
        195           pu blic stati c String g etActionAt tributeVal ue(final R equestType  request,
        196                             final  String att ributeId)  {
        197                    Stri ng retVal  = "";
        198  
        199                    if ( !NullCheck er.isNullO rEmpty(req uest)
        200                                      && !Null Checker.is NullOrEmpt y(request. getAction( ))
        201                                      && !Null Checker.is NullOrEmpt y(request. getAction( )
        202                                                       .g etAttribut e())) {
        203                             final  List<Strin g> retVals  = XACMLCo ntextUtil. getAttribu teValues(
        204                                               request.ge tAction(). getAttribu te(), attr ibuteId, f alse);
        205                             if (!N ullChecker .isNullOrE mpty(retVa ls) && (re tVals.get( 0) != null )) {
        206                                      retVal =  retVals.g et(0).trim ();
        207                             }
        208                    }
        209                    retu rn retVal;
        210           }
        211  
        212           pr ivate stat ic List<St ring> getA ttributeVa lues(
        213                             final  List<Attri buteType>  attributes , final St ring attri buteId,
        214                             final  boolean re moveAttr)  {
        215                    fina l List<Str ing> retVa l = new Ar rayList<St ring>();
        216                    if ( NullChecke r.isNullOr Empty(attr ibutes)
        217                                      || NullC hecker.isN ullOrEmpty (attribute Id)) {
        218                             return  retVal;
        219                    }
        220  
        221                    fina l List<Att ributeType > deleteLi st = new A rrayList<A ttributeTy pe>();
        222                    for  (final Att ributeType  attribute  : attribu tes) {
        223                             if (at tributeId. equalsIgno reCase(att ribute.get AttributeI d())) {
        224                                      if (!Nul lChecker.i sNullOrEmp ty(attribu te.getAttr ibuteValue ())
        225                                                       &&  !NullChec ker.isNull OrEmpty(at tribute
        226                                                                         .getAt tributeVal ue().get(0 ))
        227                                                       &&  !NullChec ker.isNull OrEmpty(at tribute
        228                                                                         .getAt tributeVal ue().get(0 ).getConte nt())) {
        229                                               final Obje ct obj = a ttribute.g etAttribut eValue().g et(0)
        230                                                                .get Content(). get(0);
        231                                               if (!NullC hecker.isN ullOrEmpty (obj)) {
        232                                                       re tVal.add(o bj.toStrin g().trim() );
        233                                               }
        234                                      } // add  to return  list if v alue exist s and is
        235                                               // non-nul l/non-empt y
        236                                               // followi ng will be  true only  for extra ct methods
        237                                      if (remo veAttr) {
        238                                               deleteList .add(attri bute);
        239                                      }
        240                             } // i f (attribu teId.equal sIgnoreCas e(attribut e.getAttri buteId()))  {
        241  
        242                    }
        243  
        244                    // i f deleteLi st exists,  remove el ements sto red in del ete list f rom
        245                    // a ttributes  List
        246                    for  (final Att ributeType  attribute ForDeletio n : delete List) {
        247                             attrib utes.remov e(attribut eForDeleti on);
        248                    }
        249  
        250                    retu rn retVal;
        251           }
        252  
        253           /* *
        254            *  @param re quest
        255            *  @param at tributeId
        256            *  @return
        257            * /
        258           pu blic stati c List<Str ing> getRe sourceAttr ibuteValue s(
        259                             final  RequestTyp e request,  final Str ing attrib uteId) {
        260                    retu rn XACMLCo ntextUtil. getResourc eAttribute Values(req uest,
        261                                      attribut eId, false );
        262           }
        263  
        264           pr ivate stat ic List<St ring> getR esourceAtt ributeValu es(
        265                             final  RequestTyp e request,  final Str ing attrib uteId,
        266                             final  boolean re moveAttr)  {
        267                    fina l List<Str ing> retVa l = new Ar rayList<St ring>();
        268                    if ( NullChecke r.isNullOr Empty(requ est)
        269                                      || NullC hecker.isN ullOrEmpty (request.g etResource ())) {
        270                             return  retVal; / / no resou rces, retu rn empty l ist
        271                    }
        272                    fina l List<Res ourceType>  resourceT ypeList =  request.ge tResource( );
        273                    for  (final Res ourceType  resourceTy pe : resou rceTypeLis t) {
        274                             final  List<Strin g> resourc eTypeAttri buteValues  = XACMLCo ntextUtil
        275                                               .getAttrib uteValues( resourceTy pe.getAttr ibute(),
        276                                                                attr ibuteId, r emoveAttr) ;
        277                             if (!N ullChecker .isNullOrE mpty(resou rceTypeAtt ributeValu es)) {
        278                                      retVal.a ddAll(reso urceTypeAt tributeVal ues);
        279                             }
        280                    } //  iterate t hrough eve r resource . Should o nly be one
        281                    retu rn retVal;
        282           }
        283  
        284           /* *
        285            *  @param re quest
        286            *  @param at tributeId
        287            *  @return
        288            * /
        289           pu blic stati c List<Str ing> getSu bjectAttri buteValues (
        290                             final  RequestTyp e request,  final Str ing attrib uteId) {
        291                    retu rn XACMLCo ntextUtil. getSubject AttributeV alues(requ est, attri buteId,
        292                                      false);
        293           }
        294  
        295           pr ivate stat ic List<St ring> getS ubjectAttr ibuteValue s(
        296                             final  RequestTyp e request,  final Str ing attrib uteId,
        297                             final  boolean re moveAttr)  {
        298                    fina l List<Str ing> retVa l = new Ar rayList<St ring>();
        299                    if ( NullChecke r.isNullOr Empty(requ est)
        300                                      || NullC hecker.isN ullOrEmpty (request.g etSubject( ))) {
        301                             return  retVal; / / no subje cts, retur n empty li st
        302                    }
        303                    fina l List<Sub jectType>  subjectTyp eList = re quest.getS ubject();
        304                    for  (final Sub jectType s ubjectType  : subject TypeList)  {
        305                             final  List<Strin g> subject AttributeV alues = XA CMLContext Util
        306                                               .getAttrib uteValues( subjectTyp e.getAttri bute(),
        307                                                                attr ibuteId, r emoveAttr) ;
        308                             if (!N ullChecker .isNullOrE mpty(subje ctAttribut eValues))  {
        309                                      retVal.a ddAll(subj ectAttribu teValues);
        310                             }
        311                    } //  iterate t hrough eve ry subject . Should o nly be one
        312                    retu rn retVal;
        313           }
        314  
        315           /* *
        316            *  @param re quest
        317            * /
        318           pu blic stati c void val idateAndFi xActionAtt ributes(fi nal Reques tType requ est) {
        319                    if ( !NullCheck er.isNullO rEmpty(req uest)) {
        320                             XACMLC ontextUtil .validateA ndFixDataT ypesInAttr ibutes(req uest
        321                                               .getAction ().getAttr ibute());
        322                    }
        323           }
        324  
        325           //  --------- ---------- ----------
        326           //  Private
        327           //  --------- ---------- ----------
        328  
        329           pr ivate stat ic void va lidateAndF ixDataType sInAttribu tes(
        330                             final  List<Attri buteType>  attributeT ypes) {
        331                    for  (final Att ributeType  attribute Type : att ributeType s) {
        332                             final  String att ributeData Type = att ributeType .getDataTy pe();
        333                             // Sys tem.out.pr intln("att ributeData Type is nu ll - " +
        334                             // att ributeData Type == nu ll);
        335  
        336                             // boo lean nuoe  = NullChec ker.isNull OrEmpty(at tributeDat aType);
        337                             if (Nu llChecker. isNullOrEm pty(attrib uteDataTyp e)) {
        338                                      attribut eType
        339                                                       .s etDataType (XACMLCont extConstan ts.STRING_ ATTR_DATA_ TYPE);
        340                             }
        341                    }
        342           }
        343  
        344           /* *
        345            *  @param re quest
        346            * /
        347           pu blic stati c void val idateAndFi xResourceA ttributes(
        348                             final  RequestTyp e request)  {
        349                    if ( !NullCheck er.isNullO rEmpty(req uest)) {
        350                             final  List<Resou rceType> r esourceTyp eList = re quest.getR esource();
        351  
        352                             final  List<Attri buteType>  attributeT ypes = new  ArrayList <Attribute Type>();
        353                             for (f inal Resou rceType re sourceType  : resourc eTypeList)  {
        354                                      attribut eTypes.add All(resour ceType.get Attribute( ));
        355                             } // i terate thr ough every  Resource
        356                             XACMLC ontextUtil
        357                                               .validateA ndFixDataT ypesInAttr ibutes(att ributeType s);
        358                    }
        359           }
        360  
        361           /* *
        362            *  @param re quest
        363            * /
        364           pu blic stati c void val idateAndFi xSubjectAt tributes(f inal Reque stType req uest) {
        365                    if ( !NullCheck er.isNullO rEmpty(req uest)) {
        366                             final  List<Subje ctType> su bjectTypeL ist = requ est.getSub ject();
        367  
        368                             final  List<Attri buteType>  attributeT ypes = new  ArrayList <Attribute Type>();
        369                             for (f inal Subje ctType sub jectType :  subjectTy peList) {
        370                                      attribut eTypes.add All(subjec tType.getA ttribute() );
        371                             } // i terate thr ough every  subject.  Should onl y be one
        372                             XACMLC ontextUtil
        373                                               .validateA ndFixDataT ypesInAttr ibutes(att ributeType s);
        374                    }
        375           }
        376  
        377   }