2. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 7/12/2019 1:29:56 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.

2.1 Files compared

# Location File Last Modified
1 ES5_7_docs_code_July_2019.zip CCNClient.java Fri Jul 12 13:47:40 2019 UTC
2 ES5_7_docs_code_July_2019.zip CCNClient.java Fri Jul 12 17:22:58 2019 UTC

2.2 Comparison summary

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

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

2.4 Active regular expressions

No regular expressions were active.

2.5 Comparison detail

  1   /**
  2    * 
  3    */
  4   package go v.va.med.e sr.webserv ices.clien t.ccn;
  5  
  6   import jav a.io.Buffe redReader;
  7   import jav a.io.File;
  8   import jav a.io.FileR eader;
  9   import jav a.io.IOExc eption;
  10  
  11   import jav a.io.Input StreamRead er;
  12   import jav a.io.Outpu tStream;
  13   import jav a.net.Http URLConnect ion;
  14   import jav a.net.URL;
  15   import jav a.security .MessageDi gest;
  16   import jav a.security .NoSuchAlg orithmExce ption;
  17   import jav a.util.Cal endar;
  18   import jav a.util.UUI D;
  19   import jav ax.xml.bin d.Datatype Converter;
  20   import org .apache.lo g4j.Logger ;
  21   import org .json.*;
  22   import org .apache.co mmons.io.I OUtils;
  23  
  24   import gov .va.med.es r.ccn.inbo undRequest .CcnServic eInfoMessa ge;
  25   import gov .va.med.es r.jms.ccn. outboundRe sponse.Ccn HttpRespon seObject;
  26  
  27   /**
  28    * This is  the adapt er class t hat abstra cts all th e service  API detail s into an  ES API tha t ES can u se.  
  29    * Key par ameters in clude ICN  and two Si mpleAddres s objects,  before an d after su bmission.   
  30    * Two wor king CIS s ervice ope rations ar e ReadActi veContactI nfo and Su bmitContac tInfoUpdat e.
  31    */
  32  
  33   public cla ss CCNClie nt {
  34  
  35       privat e static f inal Logge r logger =  Logger.ge tLogger(CC NClient.cl ass);
  36  
  37       privat e String c cnRestUrl;
  38       privat e String c cnSenderId ;
  39       privat e String c cnReceivin gIds;
  40       privat e String c cnContentT ype;
  41       privat e String c cnDocument Directory;
  42       privat e String c cnDocument DirectoryF romDas;
  43           pr ivate Stri ng ccnUrlO fESRDocume nts;
  44       privat e String c cnUrlOfBin aryDAS;
  45       privat e String c cnUrlOfAtt achedFiles InDAS;
  46  
  47           pu blic stati c String F AILURE = " FAILURE";
  48       public  static St ring SUCCE SS = "SUCC ESS";
  49       
  50       public  String ge tCcnDocume ntDirector yFromDas()  {
  51           lo gger.debug ("In the C CNClient t he getCcnD ocumentDir ectoryFrom Das is "+c cnDocument DirectoryF romDas);
  52                    retu rn ccnDocu mentDirect oryFromDas ;
  53           }
  54  
  55           pu blic void  setCcnDocu mentDirect oryFromDas (String cc nDocumentD irectoryFr omDas) {
  56                    logg er.debug(" In the CCN Client the  setCcnDoc umentDirec toryFromDa s is "+ccn DocumentDi rectoryFro mDas);
  57                    this .ccnDocume ntDirector yFromDas =  ccnDocume ntDirector yFromDas;
  58           }
  59       
  60       
  61  
  62           pu blic Strin g getCcnUr lOfAttache dFilesInDA S() {
  63                    retu rn ccnUrlO fAttachedF ilesInDAS;
  64           }
  65  
  66           pu blic void  setCcnUrlO fAttachedF ilesInDAS( String ccn UrlOfAttac hedFilesIn DAS) {
  67                    this .ccnUrlOfA ttachedFil esInDAS =  ccnUrlOfAt tachedFile sInDAS;
  68           }
  69  
  70       
  71   //    priv ate String  directory Location =  "/u02/bat chProcess/ CCN/ToDAS" ;
  72       public  String ge tCcnUrlOfB inaryDAS()  {
  73                    retu rn ccnUrlO fBinaryDAS ;
  74           }
  75  
  76           pu blic void  setCcnUrlO fBinaryDAS (String cc nUrlOfBina ryDAS) {
  77                    this .ccnUrlOfB inaryDAS =  ccnUrlOfB inaryDAS;
  78           }
  79       
  80       public  void setC cnRestUrl( String res tURL) {
  81           lo gger.debug ("In the C CNClient t he restURL  is "+rest URL);
  82           th is.ccnRest Url = rest URL;
  83       }
  84       
  85       public  String ge tCcnRestUr l(){
  86           re turn this. ccnRestUrl ;
  87       }
  88       
  89       public  void setC cnSenderId (String se nderId) {
  90           lo gger.debug ("In the C CNClient t he setCcnS enderId is  "+senderI d);
  91           th is.ccnSend erId = sen derId;
  92       }   
  93       
  94       public  void setC cnReceivin gIds(Strin g receivin gIds) {
  95           lo gger.debug ("In the C CNClient t he setCcnR eceivingId s is "+rec eivingIds) ;
  96           th is.ccnRece ivingIds =  receiving Ids;
  97       } 
  98       
  99       public  void setC cnContentT ype(String  ccnConten tType) {
  100           lo gger.debug ("In the C CNClient t he setCcnR eceivingId s is "+ccn ContentTyp e);
  101           th is.ccnCont entType =  ccnContent Type;
  102       }  
  103       
  104       public  void setC cnDocument Directory( String ccn DocumentDi rectory){
  105           lo gger.debug ("In the C CNClient t he setCcnD ocumentDir ectory is  "+ccnDocum entDirecto ry);
  106           th is.ccnDocu mentDirect ory = ccnD ocumentDir ectory; 
  107           lo gger.debug ("In the C CNClient t he this.se tCcnDocume ntDirector y is "+thi s.ccnDocum entDirecto ry);
  108       }
  109       
  110       public  String ge tCcnDocume ntDirector y(){
  111           re turn this. ccnDocumen tDirectory ;
  112       }
  113  
  114       public  void setC cnUrlOfESR Documents( String ccn UrlOfESRDo cuments){
  115           lo gger.debug ("In the C CNClient t he setCcnU rlOfESRDoc ument is " +ccnUrlOfE SRDocument s);
  116           th is.ccnUrlO fESRDocume nts = ccnU rlOfESRDoc uments;        
  117       }    
  118  
  119     
  120       
  121       /**
  122        * Thi s method s ends messa ge to DAS
  123        */
  124       
  125       public  CcnHttpRe sponseObje ct sendMes sageToDAS1 (CcnServic eInfoMessa ge o ) thr ows Except ion{
  126           
  127           Cc nHttpRespo nseObject  ccnHttpRes ponseObj =  null;
  128           
  129                    Stri ng URL = t his.ccnRes tUrl; 
  130                    //th is is the  url for DA S on local
  131                    
  132                    Buff eredReader  in = null ;
  133                    Http URLConnect ion conn =  null;
  134                    Outp utStream o s = null;
  135                    
  136                    fina l String S enderId =  this.ccnSe nderId;
  137                    fina l String R eceivingId s = this.c cnReceivin gIds;
  138                    fina l String C ontentType  = this.cc nContentTy pe;
  139                    fina l String D ocumentDir ectory = t his.ccnDoc umentDirec tory;
  140                    fina l String D ocumentDir ectoryFrom Das = this .ccnDocume ntDirector yFromDas;
  141                    fina l String u rlForFile  = this.ccn RestUrl;
  142                    fina l String c cnUrlOfESR Documents  = this.ccn UrlOfESRDo cuments;
  143                    fina l String c cnUrlOfBin aryDAS  =  this.ccnUr lOfBinaryD AS;
  144                    //th e Receivin gIds value  come from  the JSON  Message se nt across  the WebLog ic CCN Req uest Bridg e,
  145                    //no t from the  applicati onContext- ccn.xml wh ich come f rom the de ployenvspe cific.prop erties fil e.
  146                    fina l String c cnReceivin gIds = o.g etReceivin gIds();
  147                    
  148                    Stri ng sReturn  = "";
  149             
  150                    try{
  151                             String  filename  = o.getFil eName();
  152                             //the  FileURL st ring to pa ss into cr eateFHIRJs onRequest
  153                             //the  url will l ook someth ing like t he followi ng 
  154                              //https:// DNS . URL : PORT /esr/ccnFi les/theNam eOfTheFile .txt
  155                             //this  is the ur l that is  put into t he JSON re quest mess age that t he VA
  156                             //will  obtain th e document .
  157                             String  sURLofFil e = ccnUrl OfESRDocum ents + o.g etFileName ();
  158                             
  159                             logger .debug("Fi le URL:" +  sURLofFil e);
  160                             
  161                             //get  the file
  162                             String  completeF ileName =  DocumentDi rectory+ge tOperating SystemFile Separator( )+filename ;
  163                             
  164                             logger .debug("Co mplete Fil e Name:" +  completeF ileName);
  165  
  166                             try {
  167                                 lo gger.debug ("Getting  filesize a nd file ha sh...");
  168  
  169                                 St ring strFi le = readF ile(comple teFileName );
  170                                 St ring sFSiz e = getFil eSize(strF ile);
  171                                 St ring sFile ContentsHa sh = getMe ssageDiges t(strFile. getBytes() );
  172                                 
  173                                 lo gger.debug ("File Siz e is: " +  sFSize );
  174                                 lo gger.debug ("File Has h is: " +  sFileConte ntsHash );
  175                             }
  176                             catch(  Exception  ex) {
  177                                 lo gger.debug ("Exceptio n getting  filesize a nd file ha sh:", ex);
  178                             }
  179                             //crea te the FHI R Message  to send to  DAS for I nitial "Se eding" req uest
  180                             String  input = c reateFHIRJ sonRequest (sURLofFil e, sFSize,  sFileCont entsHash,  gov.va.med .fw.util.S tringUtils .stripXSS( o.getDocRe fId()));
  181  
  182                             logger .debug( "J SON reques t is: " +  input );
  183  
  184                             URL re stURL = ne w URL(URL) ;
  185                             
  186                             conn =  (HttpURLC onnection) restURL.op enConnecti on();
  187                             conn.s etDoOutput (true);
  188                             conn.s etDoInput( true);
  189  
  190                             conn.s etRequestM ethod("POS T");
  191                             conn.s etRequestP roperty("C ontent-Typ e","applic ation/json +fhir");
  192                             conn.s etRequestP roperty("X -Conversat ionID", go v.va.med.f w.util.Str ingUtils.s tripXSS(o. getDocRefI d()));
  193                             conn.s etRequestP roperty("X -RoutingSe nderID", S enderId);
  194                             conn.s etRequestP roperty("X -RoutingRe ceiverIDs" , gov.va.m ed.fw.util .StringUti ls.stripXS S(o.getRec eivingIds( )));
  195                             conn.s etRequestP roperty("X -Transacti onID", gov .va.med.fw .util.Stri ngUtils.st ripXSS(o.g etDocRefId ()));
  196  
  197                             os = c onn.getOut putStream( );
  198                             os.wri te(input.g etBytes()) ;
  199                             os.flu sh();
  200                             
  201                             
  202                             //200, 201,202 is  the corre ct respons e code is  a succesfu l message  has been r eturned.
  203                             String  sHttpResp onseCode =  ""+conn.g etResponse Code();
  204                             if (!G eneralUtil s.isHttpRe sponseCode Ok(sHttpRe sponseCode )){
  205                                      logger.e rror("In t he CCNClie nt did not  get a 201  response  "+conn.get ResponseCo de());
  206                                      throw ne w RuntimeE xception(" Failed: HT TPErrorCod e "+conn.g etResponse Code());
  207                             } 
  208                             
  209                             in = n ew Buffere dReader( n ew InputSt reamReader (conn.getI nputStream ()));
  210                             
  211                             String  inputLine ;
  212                             while(  ( inputLi ne = in.re adLine())  != null){
  213                                      sReturn  = inputLin e;
  214                             }
  215                             logger .debug("In  the CCNCl ient the r esponse fr om the ini tial Seedi ng request  http resp onse is "+ sReturn);
  216                //parse  the return ed message  into the 
  217                             ccnHtt pResponseO bj =    pa rseHttpRet urnJSON(sR eturn);
  218                             
  219                    }//e nd of try
  220                    catc h(JSONExce ption e1){
  221                             logger .error("In  Aa the CC NClient th e JSONExce ption is " +e1.toStri ng());
  222                             if (cc nHttpRespo nseObj !=  null) {
  223                                      ccnHttpR esponseObj .setHttpRe sponseCode ("NoCodeJS ONExceptio n");
  224                                      ccnHttpR esponseObj .setHttpRe sponesMess age(e1.toS tring());
  225                                      ccnHttpR esponseObj .setDocRef Id(o.getDo cRefId());
  226                                      ccnHttpR esponseObj .setRespon seTime(get LatestDate ("yyyy-MM- ddTHH:mm:s s"));
  227                                      ccnHttpR esponseObj .setRespon seStatus(t his.FAILUR E);              
  228                             }
  229                    }
  230                    catc h(Exceptio n e){
  231                    
  232                             String  sCode = " ";
  233                             sCode  = parseStr ingForErro rCode(e.to String());
  234                             //if s Code is no t a Number  then make  sCode "Un knownCode"
  235                             logger .error("In  Aa the CC NClient th e Exceptio n is "+e.t oString()) ;
  236                             ccnHtt pResponseO bj  = new  CcnHttpRes ponseObjec t();
  237                             if (is StringANum ber(sCode) ){
  238                                      ccnHttpR esponseObj .setHttpRe sponseCode (sCode);
  239                             } else  {
  240                                ccn HttpRespon seObj.setH ttpRespons eCode("Unk nownCode") ;
  241                             }
  242                             ccnHtt pResponseO bj.setHttp ResponesMe ssage(e.to String());
  243                             ccnHtt pResponseO bj.setDocR efId(o.get DocRefId() );
  244                             ccnHtt pResponseO bj.setResp onseTime(g etLatestDa te("yyyy-M M-ddTHH:mm :ss"));
  245                             ccnHtt pResponseO bj.setResp onseStatus (this.FAIL URE);                       
  246  
  247                    } fi nally{
  248                             
  249                             if (os  != null)  {
  250                                      IOUtils. closeQuiet ly(os);
  251                             }
  252                             
  253                             if (co nn != null ){
  254                                      try {
  255                                               conn.disco nnect();;
  256                                      } catch  (Exception  e) {
  257                                               logger.err or("In the  CCNClient  the Excep tion is "+ e.toString ());
  258                                               e.printSta ckTrace();
  259                                      }
  260                             }
  261                             
  262                             
  263                             if (in  != null){
  264                                      try {
  265                                               in.close() ;
  266                                      } catch  (IOExcepti on e) {
  267                                               e.printSta ckTrace();
  268                                      }
  269                             }
  270                    }
  271  
  272           re turn ccnHt tpResponse Obj;
  273           
  274       }//end  of method
  275       
  276  
  277           /* *
  278            *  @param ar gs
  279            *  @throws E CISFault 
  280            *  Executive  test driv er that em ulates the  ES Bridge  and Queue s
  281            * /
  282           pu blic stati c void mai n(String[]  args) thr ows Except ion {
  283  
  284                    Syst em.out.pri ntln("Test s complete d!!!");
  285           }
  286           
  287       privat e static v oid log(St ring msg)  {
  288           if (logger.is TraceEnabl ed()) {
  289                    logg er.trace(m sg);
  290           }
  291       }
  292    
  293           /* *
  294            *  The file  to be read  in order  to obtain  the file s ize and cr eate the h ash to the  JSON Requ est.
  295            *  @return
  296            * /
  297           pu blic stati c String r eadFile(St ring compl etePathAnd FileName){
  298                    File  f1 = null ;
  299                    File Reader fr  = null;
  300                    Buff eredReader  br = null ;
  301                    Stri ng sFileSt r = "";
  302                    Stri ngBuffer s b = new St ringBuffer ();
  303                    try{
  304                             
  305                             //Stri ng s1 = Do cumentDire ctory+getO peratingSy stemFileSe parator()+ nameOfFile ;
  306                             //logg er.debug(" In the  me thod of CC NClient co mplete fil e path "+s 1);
  307                             
  308                             //fr =  new FileR eader(Docu mentDirect ory+getOpe ratingSyst emFileSepa rator()+na meOfFile);
  309                             fr = n ew FileRea der(comple tePathAndF ileName);
  310                             br = n ew Buffere dReader(fr );
  311                             
  312                             String  inputLine  ;
  313                             
  314                             while(  ( inputLi ne = br.re adLine())   !=null     ){
  315                                      sb.appen d(inputLin e);
  316                             }
  317                             
  318                    }cat ch(Excepti on e1){
  319                             logger .error("In  the CCNCl ient metho d getMessa geDigest E xception m ethod "+e1 .toString( ));
  320                    } fi nally {
  321                       i f (fr != n ull) {
  322                           IOUtils. closeQuiet ly(fr);
  323                       }
  324                    }
  325                    
  326                    retu rn sb.toSt ring();
  327                    
  328           }/ /end of me thod
  329           
  330           /* *
  331            *  As part o f the HFIR  items in  the JSON R equest a i nt of the  file size  must be pr ovided.
  332            *  @param sF ile
  333            *  @return
  334            * /
  335           pu blic stati c String g etFileSize (String sF ileContent s){
  336                    
  337                    int  iFileSize  = 0;
  338                    if ( sFileConte nts != nul l){
  339                             iFileS ize = sFil eContents. length();
  340                    }
  341                    
  342                    retu rn ""+iFil eSize;
  343                    
  344           }/ /end of me thod
  345           
  346           /* *
  347            *  As part o f the HFIR  message t he content  must have  a SHA-1 d igest.
  348            *  @param bF ile1
  349            *  @return
  350            * /
  351           pu blic stati c String g etMessageD igest(byte [] bFile1) {
  352                    
  353                    byte [] passbyt e;
  354                    Stri ng sReturn  = "";
  355                    
  356                    try  {
  357                             
  358                             Messag eDigest md  = Message Digest.get Instance(" SHA-1");
  359                             passby te = md.di gest(bFile 1);
  360                             //now  make base6 4
  361                             //this  is for Ja va 6 to ma ke a base6 4
  362                             sRetur n = Dataty peConverte r.printBas e64Binary( passbyte);
  363                             
  364                    } ca tch (NoSuc hAlgorithm Exception  e1) {
  365                             logger .error("In  the CCNCl ient metho d getMessa geDigest E xception m ethod "+e1 .toString( ));
  366                    }
  367                    
  368                    retu rn sReturn ;
  369                    
  370           }/ /end of me thod
  371           
  372           /* *
  373            *  This meth od provide s the corr ect file s eparator f or the dir ectory to  file to ob tain from  the 
  374            *  file syst em.
  375            *  @return
  376            * /     
  377           pr ivate stat ic String  getOperati ngSystemFi leSeparato r(){
  378                    
  379                    retu rn System. getPropert y("file.se parator");
  380                    
  381           }/ /end of me thod
  382           
  383           
  384           pu blic stati c String g enerateBas e64UUID(){
  385                    
  386                    UUID  uuid = UU ID.randomU UID();
  387                    retu rn uuid.to String();
  388                    
  389           }/ /end of me thod         
  390           
  391           /* *
  392            *  This is t he method  that creat es the JSO N Request  String to  send to DA S
  393            *  
  394            *  @param Fi leUrl
  395            *  @param fi lesize
  396            *  @param th eHashOfThe FileConten ts
  397            *  @return
  398            * /
  399           pu blic stati c String c reateFHIRJ sonRequest (String Fi leUrl, Str ing filesi ze, String  theHashOf TheFileCon tents,
  400                             String  docRefId)  {
  401  
  402                    Stri ng sReturn  = "";
  403                    Stri ngBuffer s b = new St ringBuffer (10000);
  404  
  405                    try  {
  406  
  407                             sb.app end("{");
  408                             sb.app end("\"id\ ":");
  409                             sb.app end("\"");
  410                             sb.app end("Docum entReferen ce/");
  411                             sb.app end(docRef Id);
  412                             sb.app end("\"");
  413                             sb.app end(",");
  414                             sb.app end("\"res ourceType\ ": \"Docum entReferen ce\",");
  415                             sb.app end("\"tex t\": {");
  416                             sb.app end("\"fhi r_comments \":[{");
  417                             sb.app end("\"div \":");
  418                             sb.app end("\"Thi s is a tex t file wit h insuranc e related  seeding re quest info rmation, c aret delim ited.\"");
  419                             sb.app end("}]");
  420                             sb.app end("},");
  421                             sb.app end("\"sta tus\": \"g enerated\" ,");
  422                             sb.app end("\"ind exed\":");
  423                             sb.app end("\"");
  424                             sb.app end(getLat estDate("y yyy-MM-ddT HH:mm:ss") );
  425                             sb.app end("\",") ;
  426  
  427                             sb.app end("\"typ e\": {");
  428                             sb.app end("\"cod ing\":[{") ;
  429                             sb.app end("\"sys tem\":");
  430                             sb.app end("\"htt p://loinc. org\",");
  431                             sb.app end("\"cod e\": \"LP1 73405-4\"" );
  432                             sb.app end("}]");
  433                             sb.app end("},");
  434  
  435                             sb.app end("\"con tent\": [" );
  436                             sb.app end("{");
  437                             sb.app end("\"att achment\":  {");
  438                             sb.app end("\"con tentType\" : \"applic ation/text \",");
  439                             sb.app end("\"dat a\": \"\", ");
  440                             sb.app end("\"url \": ");
  441                             sb.app end("\"");
  442                             sb.app end(FileUr l);
  443                             sb.app end("\",") ;
  444                             sb.app end("\"lan guage\": \ "en-US\"," );
  445                             sb.app end("\"siz e\": ");
  446                             sb.app end(filesi ze);
  447                             sb.app end(",");
  448                             sb.app end("\"has h\": ");
  449                             sb.app end("\"");
  450                             sb.app end(theHas hOfTheFile Contents);
  451                             sb.app end("\",") ;
  452                             sb.app end("\"tit le\": \"Th e Health-I nsurance R elated See ding Reque st File.\" ");
  453                             sb.app end("}");
  454                             sb.app end("}");
  455                             sb.app end("]");
  456                             sb.app end("}");
  457  
  458                    } ca tch (Excep tion e) {
  459                             logger .error("In  the CCNCl ient metho d createFH IRJsonRequ est Except ion method  " + e.toS tring());
  460                    }
  461  
  462                    retu rn sb.toSt ring();
  463  
  464           }/ / end of m ethod
  465           
  466  
  467           /* *
  468            *  This meth od creates  the Index ed and Cre ated value  for the H RIF.
  469            *  @param sD ateFormat  - "yyyy-MM -dd'T'HH:m m:ss:ss" o r "yyyy-MM -ddTHH:mm: ss" as an  example
  470            *  @return
  471            * /
  472           pu blic stati c String g etLatestDa te(String  sDateForma t){
  473                    Stri ng sReturn  = "";
  474                    Cale ndar cal =  Calendar. getInstanc e();
  475                    
  476                    try{
  477                             java.t ext.DateFo rmat df =  new java.t ext.Simple DateFormat ("yyyy-MM- dd'T'HH:mm :ss:ss");
  478                             df.set TimeZone(j ava.util.T imeZone.ge tTimeZone( "Zulu"));
  479                             sRetur n = df.for mat(cal.ge tTime());
  480                             
  481                    }cat ch(Excepti on e){
  482                             logger .error("In  the CCNCl ient metho d getLates tDate Exce ption meth od "+e.toS tring());
  483                    }
  484                    
  485                    retu rn sReturn ;
  486                    
  487           }/ /end of th e method
  488           
  489           
  490           /* *
  491            *  This meth od parses  the return ed Seeding Request Re sponse Fro m DAS
  492            *  The retur ned JSON m essage wil l look som ething lik e the foll owing:
  493            *  {"code":2 01,"messag e":"SUCCES S:Request  Processed:  utFDocRef Seeeding"} ";
  494            *  The "Proc essed" is  the X-Conv ersationID  POST Head er. This h eader name
  495            *  has the v alue of th e document  Reference  Id you su bmitted to  DAS.
  496            *  @param js onMessage
  497            * /
  498           
  499           pu blic CcnHt tpResponse Object par seHttpRetu rnJSON(Str ing jsonMe ssage) thr ows Except ion, JSONE xception {
  500                    
  501   logger.deb ug("In CCN Client par seHttpRetu reJSON jso nMessage " +jsonMessa ge );
  502                    CcnH ttpRespons eObject cc nHttpRespo nseObj = n ull;
  503                    try{
  504                             
  505                             JSONOb ject json  = new JSON Object(jso nMessage);
  506                             
  507                             if (js on == null ){
  508                                      return n ull;
  509                             }
  510  
  511                             ccnHtt pResponseO bj = new C cnHttpResp onseObject ();
  512  
  513                             String  sCode = j son.get("c ode").toSt ring();
  514                             ccnHtt pResponseO bj.setHttp ResponseCo de(sCode);
  515                             
  516                             //if ( sCode.trim ().equals( "201")){
  517                             if (Ge neralUtils .isHttpRes ponseCodeO k(sCode)){
  518                                      ccnHttpR esponseObj .setRespon seStatus(t his.SUCCES S);
  519                             } else  {
  520                                      ccnHttpR esponseObj .setRespon seStatus(t his.FAILUR E);
  521                             }
  522                             
  523  
  524                             String  sMessage  = (String) json.get(" message");
  525                             if (sM essage !=  null){
  526                                  S tring[] sM essageArr  = sMessage .split(":" );
  527                     //t he thrid e lement sho uld be the  document  ref id
  528                                  
  529                                  c cnHttpResp onseObj.se tDocRefId( sMessageAr r[2].trim( ).toString ().trim()) ;
  530                             }
  531                             ccnHtt pResponseO bj.setResp onseTime(g etLatestDa te("yyyy-M M-ddTHH:mm :ss"));
  532                             
  533                    } ca tch(JSONEx ception e1 ){
  534                             throw  new Except ion("JSONE xception " +e1.toStri ng());
  535                    }
  536                    catc h(Exceptio n e){
  537                             logger .error("Ex ception In  the CCNCl ient the p arseHttpRe turnJSON " +e.toStrin g());
  538                         throw new  Exception( "Exception " + e.toSt ring());
  539                    }
  540                    
  541                    retu rn ccnHttp ResponseOb j;
  542  
  543           }/ /end of me thod
  544           
  545           
  546           /* *
  547            *  This stri ng will lo ok like th e followin
  548            *  java.lang .RuntimeEx ception: F ailed: HTT PErrorCode >500
  549            *  This is t he retured  String fr omt the th row new Ru ntimeExcep tion
  550            *  This meth od attempt s to obtai nt he erro r code so  parse on t he ">" cha racter
  551            * /
  552           pr ivate Stri ng parseSt ringForErr orCode(Str ing s){
  553                    
  554                    Stri ng sReturn  = "";
  555                    
  556                    try{
  557                             
  558                             String [] sArr =  s.split("> ");
  559                             if (sA rr != null ){
  560                                      if (sArr .length >  1){
  561                                               //get the  second ele ment which  is the ht tp error c ode
  562                                               sReturn =  sArr[1];
  563                                      }
  564                             }
  565                                      
  566                                      
  567                    }cat ch(Excepti on e){
  568                             sRetur n = "";
  569                    }
  570  
  571                    retu rn sReturn ;
  572                                      
  573           }/ /end of me thod
  574           
  575           
  576           /* *
  577            *  This meth od is used  to determ ine if the  Http Resp onse Code  is a Numbe r
  578            *  @param s
  579            *  @return
  580            * /
  581           pr ivate bool ean isStri ngANumber( String s){
  582                    
  583                    bool ean b = tr ue;
  584                    
  585                    for  (char c :  s.toCharAr ray()){
  586                             if (!C haracter.i sDigit(c)) {
  587                                      b = fals e;
  588                                 br eak;      
  589                             }
  590                    }
  591                    
  592                    retu rn b;
  593                    
  594           }/ /end of me thod
  595           
  596  
  597           
  598   }//end of  class