Produced by Araxis Merge on 4/23/2019 12:15:00 PM Central 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\AraxisMergeCompare\Pri_un\CCRS\CCRS-PMPM-Rcvr-v6.3.0\CCRS-PMPM-Rcvr-v6.3.0\src\main\java\gov\va\ccrs\receiver\service | FileXferTransRequester.java | Wed Mar 20 20:42:30 2019 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\CCRS\CCRS-PMPM-Rcvr-v6.3.0\CCRS-PMPM-Rcvr-v6.3.0\src\main\java\gov\va\ccrs\receiver\service | FileXferTransRequester.java | Wed Apr 17 02:59:46 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 752 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | package go v.va.ccrs. receiver.s ervice; | |
| 2 | ||
| 3 | import gov .va.ccrs.r eceiver.co nfig.DasPr operties; | |
| 4 | import gov .va.ccrs.r eceiver.en tity.PMPMB atchLog; | |
| 5 | import gov .va.ccrs.r eceiver.en tity.DasOb BatchLog; | |
| 6 | import gov .va.ccrs.r eceiver.en tity.DasOb IdGen; | |
| 7 | import gov .va.ccrs.r eceiver.en tity.const ants.DasOb TransOutco me; | |
| 8 | import gov .va.ccrs.r eceiver.en tity.const ants.DasOb TransState ; | |
| 9 | import gov .va.ccrs.r eceiver.en tity.const ants.DasOb TransType; | |
| 10 | import gov .va.ccrs.r eceiver.re pository.D asObBatchL ogReposito ry; | |
| 11 | import gov .va.ccrs.r eceiver.re pository.D asObIdGenR epository; | |
| 12 | import gov .va.ccrs.r eceiver.ut ils.TextFi leReader; | |
| 13 | //import g ov.va.ccrs .receiver. utils.LogH elper; | |
| 14 | import gov .va.ccrs.r eceiver.ut ils.ObIdGe nerator; | |
| 15 | ||
| 16 | //import o rg.apache. log4j.Logg er; | |
| 17 | import org .apache.lo g4j.Level; | |
| 18 | ||
| 19 | import gov .va.ccrs.h elpers.Cle anPath; | |
| 20 | import gov .va.ccrs.h elpers.Log Helper; | |
| 21 | ||
| 22 | import org .springfra mework.htt p.Response Entity; | |
| 23 | import org .springfra mework.ste reotype.Co ntroller; | |
| 24 | import org .springfra mework.web .client.Re stTemplate ; | |
| 25 | ||
| 26 | import com .google.js on.JsonSan itizer; | |
| 27 | ||
| 28 | import org .springfra mework.bea ns.factory .annotatio n.Autowire d; | |
| 29 | import org .springfra mework.bea ns.factory .annotatio n.Value; | |
| 30 | import org .springfra mework.dat a.domain.S ort; | |
| 31 | import org .springfra mework.dat a.domain.S ort.Direct ion; | |
| 32 | import org .springfra mework.htt p.HttpEnti ty; | |
| 33 | import org .springfra mework.htt p.HttpHead ers; | |
| 34 | import org .springfra mework.htt p.HttpMeth od; | |
| 35 | ||
| 36 | ||
| 37 | import jav a.util.Lis t; | |
| 38 | import jav a.util.Opt ional; | |
| 39 | import jav a.net.URI; | |
| 40 | import jav a.sql.Time stamp; | |
| 41 | ||
| 42 | @Controlle r | |
| 43 | public cla ss FileXfe rTransRequ ester { | |
| 44 | ||
| 45 | pr ivate fina l String D AS_URL = " https://da s-test. DOMAIN . EXT "; | |
| 46 | ||
| 47 | pr ivate fina l String c ontentType Hdr = "Con tent-Type" ; | |
| 48 | pr ivate fina l String c onversatio nIdHdr = " X-Conversa tionID"; | |
| 49 | pr ivate fina l String s enderIdHdr = "X-Rout ingSenderI D"; | |
| 50 | pr ivate fina l String r eceiverIdH dr = "X-Ro utingRecei verIDs"; | |
| 51 | pr ivate fina l String t ransaction IdHdr = "X -Transacti onID"; | |
| 52 | ||
| 53 | pr ivate DasP roperties dasProps; | |
| 54 | pr ivate DasO bBatchLogR epository dasObRepos itory; | |
| 55 | pr ivate DasO bIdGenRepo sitory idG enReposito ry; | |
| 56 | ||
| 57 | // private st atic final Logger lo gger = Log ger.getLog ger(FileXf erTransReq uester.cla ss); | |
| 58 | ||
| 59 | pr ivate fina l String c onvIdPrefi x = "CCRS- RR-"; | |
| 60 | pr ivate fina l String t ransIdPref ix = "CCRS -TRANS-ID- "; | |
| 61 | // public sta tic int tr ansIdSeqNb r = 1001; | |
| 62 | ||
| 63 | @A utowired | |
| 64 | pu blic FileX ferTransRe quester(Da sPropertie s props, D asObBatchL ogReposito ry dasObRe pository, DasObIdGen Repository idGenRepo sitory) { | |
| 65 | this .dasProps = props; | |
| 66 | this .dasObRepo sitory = d asObReposi tory; | |
| 67 | this .idGenRepo sitory = i dGenReposi tory; | |
| 68 | } | |
| 69 | ||
| 70 | ||
| 71 | pu blic int s endPost2Da s(String d ocRefPath, String rr Basename, String doc RefJson) t hrows Exce ption { | |
| 72 | ||
| 73 | Rest Template r estTemplat e = new Re stTemplate (); | |
| 74 | Resp onseEntity <String> r esp = null ; | |
| 75 | ||
| 76 | LogH elper.Log( Level.INFO , "Enter F ileXferTra nsRequeste r.sendPost 2Das metho d"); | |
| 77 | ||
| 78 | DasO bBatchLog dasBatch = new DasOb BatchLog() ; | |
| 79 | Time stamp curr entTime = new Timest amp(System .currentTi meMillis() ); | |
| 80 | ||
| 81 | /* | |
| 82 | sync hronized ( this) { | |
| 83 | ++tran sIdSeqNbr; | |
| 84 | } | |
| 85 | */ | |
| 86 | Long transIdSe qNbr; | |
| 87 | tran sIdSeqNbr = (new ObI dGenerator (this.idGe nRepositor y)).getNex tId(DasObT ransType.O B_RECON_RP T); | |
| 88 | ||
| 89 | Stri ng transId = transId Prefix + t ransIdSeqN br; | |
| 90 | Stri ng convId = convIdPr efix + pad SeqNum(tra nsIdSeqNbr ); | |
| 91 | ||
| 92 | Stri ng dasUrl = null; | |
| 93 | ||
| 94 | if ( dasProps ! = null) { | |
| 95 | LogHel per.Log(Le vel.INFO, "dasProps is not nul l"); | |
| 96 | LogHel per.Log(Le vel.INFO, "dasProps: " + dasPr ops.getUrl ()); | |
| 97 | dasUrl = dasProp s.getUrl() .trim() + "/drs/v1/c crs"; | |
| 98 | } | |
| 99 | else { | |
| 100 | LogHel per.Log(Le vel.INFO, "dasProps is null"); | |
| 101 | // cre ate the co rrect DRS uel for th e CCRS cli ent | |
| 102 | dasUrl = DAS_URL + "/drs/v 1/ccrs"; | |
| 103 | } | |
| 104 | ||
| 105 | LogH elper.Log( Level.INFO , "Calling das on UR L: " + das Url); | |
| 106 | LogH elper.Log( Level.DEBU G, "http h eaders in POST"); | |
| 107 | ||
| 108 | // l oad the he aders rece ived in cc rs/resourc e service for GET ca ll to DAS except swa p values o f sender a nd receive r | |
| 109 | Http Headers he aders = ne w HttpHead ers(); | |
| 110 | ||
| 111 | head ers.set(Cl eanPath.cl eanFilePat h(contentT ypeHdr), C leanPath.c leanFilePa th("applic ation/json +fhir")); | |
| 112 | LogH elper.Log( Level.DEBU G, "name: " + conten tTypeHdr + " value : " + "app lication/j son+fhir") ; | |
| 113 | ||
| 114 | // a lways trac e the conv ersation i d | |
| 115 | head ers.set(Cl eanPath.cl eanFilePat h(conversa tionIdHdr) , CleanPat h.cleanFil ePath(conv Id)); | |
| 116 | LogH elper.Log( Level.INFO , "name: " + convers ationIdHdr + " val ue: " + co nvId); | |
| 117 | ||
| 118 | head ers.set(Cl eanPath.cl eanFilePat h(senderId Hdr), Clea nPath.clea nFilePath( "VA_CCRS") ); | |
| 119 | LogH elper.Log( Level.DEBU G, "name: " + sender IdHdr + " value: " + "VA_CCR S"); | |
| 120 | ||
| 121 | Stri ng ccnId = determine CcnId(rrBa sename); | |
| 122 | head ers.set(Cl eanPath.cl eanFilePat h(receiver IdHdr), Cl eanPath.cl eanFilePat h(ccnId)); | |
| 123 | LogH elper.Log( Level.DEBU G, "name: " + receiv erIdHdr + " value: " + ccnId ); | |
| 124 | ||
| 125 | head ers.set(Cl eanPath.cl eanFilePat h(transact ionIdHdr), CleanPath .cleanFile Path(trans Id)); | |
| 126 | LogH elper.Log( Level.DEBU G, "name: " + transa ctionIdHdr + " val ue: " + tr ansId); | |
| 127 | ||
| 128 | LogH elper.Log( Level.DEBU G, "JSON R eference D ocument: \ n" + docRe fJson + "\ n"); | |
| 129 | ||
| 130 | dasB atch.setTr ansactionT ype(DasObT ransType.O B_RECON_RP T); | |
| 131 | dasB atch.setRe tryCount(0 ); // is th is a retry ????? | |
| 132 | //da sBatch.set ContentTyp e(contentT ype); | |
| 133 | dasB atch.setCo nversation Id(convId) ; // c omma separ ated list | |
| 134 | dasB atch.setTr ansactionI d(transId) ; // comma sep arated lis t | |
| 135 | dasB atch.setSe nderId("VA _CCRS"); | |
| 136 | dasB atch.setRe ceiverId(c cnId); | |
| 137 | dasB atch.setIn itTransTim e(currentT ime); | |
| 138 | dasB atch.setLa stTransTim e(currentT ime); | |
| 139 | dasB atch.setTr ansactionS tate(DasOb TransState .OB_TRANS_ START); | |
| 140 | dasB atch.setTr ansactionO utcome(Das ObTransOut come.OB_PE NDING); | |
| 141 | dasB atch.setDo cRef(docRe fPath + "/ " + rrBase name + "_R efDoc.txt" ); | |
| 142 | ||
| 143 | // i nsert a ne w record | |
| 144 | DasO bBatchLog result = t his.dasObR epository. saveAndFlu sh(dasBatc h); | |
| 145 | ||
| 146 | LogH elper.Log( Level.DEBU G, "Record Inserted - OB_BATCH _LOG_KEY: " + result .getId()); | |
| 147 | ||
| 148 | Http Entity ent ity = new HttpEntity (JsonSanit izer.sanit ize(docRef Json), hea ders); | |
| 149 | ||
| 150 | LogH elper.Log( Level.DEBU G, "about to call DA S"); | |
| 151 | ||
| 152 | try { | |
| 153 | resp = restTempl ate.exchan ge(new URI (CleanPath .cleanFile Path(dasUr l)), HttpM ethod.POST , entity, String.cla ss); | |
| 154 | } | |
| 155 | catc h (Excepti on ex) { | |
| 156 | LogHel per.Log(Le vel.ERROR, "Caught e xception c alling DAS : " + ex.t oString()) ; | |
| 157 | LogHel per.Log(Le vel.INFO, "Exit send Post2Das m ethod"); | |
| 158 | return -1; | |
| 159 | } | |
| 160 | ||
| 161 | LogH elper.Log( Level.INFO , "Status code recei ved:" + re sp.getStat usCode().t oString()) ; | |
| 162 | ||
| 163 | if ( resp.getSt atusCode() .value() > = 200 && r esp.getSta tusCode(). value() < 300) { | |
| 164 | result .setTransa ctionState (DasObTran sState.OB_ REF_DOC_SE NT); | |
| 165 | this.d asObReposi tory.saveA ndFlush(re sult); | |
| 166 | } | |
| 167 | ||
| 168 | LogH elper.Log( Level.INFO , "Exit se ndPost2Das method"); | |
| 169 | retu rn resp.ge tStatusCod e().value( ); | |
| 170 | } | |
| 171 | ||
| 172 | pu blic void procRetryI nterval() throws Exc eption | |
| 173 | { | |
| 174 | LogH elper.Log( Level.INFO , "*** Ent er procRet ryInterval method ** *"); | |
| 175 | ||
| 176 | DasO bBatchLog dasBatch; | |
| 177 | Stri ng rrPath; | |
| 178 | Stri ng rrBasen ame; | |
| 179 | Stri ng docRef; | |
| 180 | Stri ng jsonTex t; | |
| 181 | ||
| 182 | Sort sort = ne w Sort(Dir ection.ASC , "lastTra nsTime"); | |
| 183 | ||
| 184 | List <DasObBatc hLog> dasO bLst = thi s.dasObRep ository.fi ndByTransa ctionTypeA ndTransact ionOutcome (DasObTran sType.OB_R ECON_RPT, DasObTrans Outcome.OB _ABORTED, sort); | |
| 185 | ||
| 186 | if ( dasObLst = = null || dasObLst.s ize() == 0 ) { | |
| 187 | LogHel per.Log(Le vel.DEBUG, "Did NOT find any D AS_OB_BATC H_LOG reco rds for ab orted Reco n Report t ransaction s"); | |
| 188 | // No retry of R econciliat ion Report required | |
| 189 | LogHel per.Log(Le vel.INFO, "*** Exit procRetryI nterval me thod ***") ; | |
| 190 | return ; | |
| 191 | } | |
| 192 | ||
| 193 | // e xecute tra nsaction r etry logic | |
| 194 | else { | |
| 195 | LogHel per.Log(Le vel.DEBUG, "Succeede d lookup D AS_OB_BATC H_LOG reco rd for abo rted Recon Report tr ansactions "); | |
| 196 | LogHel per.Log(Le vel.DEBUG, "Number o f records found: " + dasObLst. size()); | |
| 197 | dasBat ch = dasOb Lst.get(0) ; | |
| 198 | ||
| 199 | docRef = dasBatc h.getDocRe f(); | |
| 200 | LogHel per.Log(Le vel.DEBUG, "docRef: " + docRef ); | |
| 201 | ||
| 202 | int in dex = docR ef.lastInd exOf("/"); | |
| 203 | if (in dex == -1) { | |
| 204 | LogHelpe r.Log(Leve l.DEBUG, " DAS_OB_BAT CH_LOG.doc _ref is ma lformed"); | |
| 205 | // do so mething he re to caus e this rec ord to be skipped in future or retries a re blocked | |
| 206 | unblockR etryQueue( dasBatch); | |
| 207 | LogHelpe r.Log(Leve l.INFO, "* ** Exit pr ocRetryInt erval meth od ***"); | |
| 208 | return; | |
| 209 | } | |
| 210 | ||
| 211 | // ext ract the p ath withou t the trai ling "/" a s sendPost 2Das() cal l expects | |
| 212 | rrPath = docRef .substring (0, index) ; | |
| 213 | LogHel per.Log(Le vel.DEBUG, "rrPath: " + rrPath ); | |
| 214 | ||
| 215 | // ext ract the f ilename fr om the pat h | |
| 216 | rrBasename = docRef. substring( index + 1) ; | |
| 217 | LogHelper. Log(Level. DEBUG, "rr Basename: " + rrBase name); | |
| 218 | ||
| 219 | jsonText = TextFileR eader.read TextFile(d ocRef); | |
| 220 | if (jsonTe xt == null ) { | |
| 221 | LogHel per.Log(Le vel.INFO, "Failed to read docR ef file in qualifyin g record") ; | |
| 222 | // do something here to ca use this r ecord to b e skipped in future or retries are block ed | |
| 223 | unbloc kRetryQueu e(dasBatch ); | |
| 224 | LogHel per.Log(Le vel.INFO, "*** Exit procRetryI nterval me thod ***") ; | |
| 225 | return ; | |
| 226 | } | |
| 227 | ||
| 228 | //LogHelpe r.log(Leve l.DEBUG, " jsonText: " + jsonTe xt); | |
| 229 | } | |
| 230 | ||
| 231 | // O K - we hav e what we need to go ahead and retry the transacti on | |
| 232 | ||
| 233 | Rest Template r estTemplat e = new Re stTemplate (); | |
| 234 | Resp onseEntity <String> r esp = null ; | |
| 235 | ||
| 236 | Time stamp curr entTime = new Timest amp(System .currentTi meMillis() ); | |
| 237 | ||
| 238 | /* | |
| 239 | sync hronized ( this) { | |
| 240 | ++tran sIdSeqNbr; | |
| 241 | } | |
| 242 | */ | |
| 243 | ||
| 244 | LogH elper.Log( Level.DEBU G, "about to call ge tNextId"); | |
| 245 | Long transIdSe qNbr; | |
| 246 | tran sIdSeqNbr = (new ObI dGenerator (idGenRepo sitory)).g etNextId(D asObTransT ype.OB_REC ON_RPT); | |
| 247 | LogH elper.Log( Level.DEBU G, "back f rom call t o getNextI d"); | |
| 248 | ||
| 249 | ||
| 250 | Stri ng transId = transId Prefix + t ransIdSeqN br; | |
| 251 | Stri ng convId = convIdPr efix + pad SeqNum(tra nsIdSeqNbr ); | |
| 252 | ||
| 253 | Stri ng dasUrl = null; | |
| 254 | ||
| 255 | if ( dasProps ! = null) { | |
| 256 | LogHel per.Log(Le vel.INFO, "dasProps is not nul l"); | |
| 257 | LogHel per.Log(Le vel.INFO, "dasProps: " + dasPr ops.getUrl ()); | |
| 258 | dasUrl = dasProp s.getUrl() .trim() + "/drs/v1/c crs"; | |
| 259 | } | |
| 260 | else { | |
| 261 | LogHel per.Log(Le vel.INFO, "dasProps is null"); | |
| 262 | // cre ate the co rrect DRS uel for th e CCRS cli ent | |
| 263 | dasUrl = DAS_URL + "/drs/v 1/ccrs"; | |
| 264 | } | |
| 265 | ||
| 266 | LogH elper.Log( Level.DEBU G, "Callin g das on U RL: " + da sUrl); | |
| 267 | LogH elper.Log( Level.DEBU G, "http h eaders in POST"); | |
| 268 | ||
| 269 | // l oad the he aders rece ived in cc rs/resourc e service for GET ca ll to DAS except swa p values o f sender a nd receive r | |
| 270 | Http Headers he aders = ne w HttpHead ers(); | |
| 271 | ||
| 272 | head ers.set(co ntentTypeH dr, "appli cation/jso n+fhir"); | |
| 273 | LogH elper.Log( Level.DEBU G, "name: " + conten tTypeHdr + " value : " + "app lication/j son+fhir") ; | |
| 274 | ||
| 275 | head ers.set(co nversation IdHdr, con vId); | |
| 276 | LogH elper.Log( Level.DEBU G, "name: " + conver sationIdHd r + " va lue: " + c onvId); | |
| 277 | ||
| 278 | head ers.set(se nderIdHdr, "VA_CCRS" ); | |
| 279 | LogH elper.Log( Level.DEBU G, "name: " + sender IdHdr + " value: " + "VA_CCR S"); | |
| 280 | ||
| 281 | Stri ng ccnId = determine CcnId(rrBa sename); | |
| 282 | head ers.set(re ceiverIdHd r, ccnId); | |
| 283 | LogH elper.Log( Level.DEBU G, "name: " + receiv erIdHdr + " value: " + ccnId ); | |
| 284 | ||
| 285 | head ers.set(tr ansactionI dHdr, tran sId); | |
| 286 | LogH elper.Log( Level.DEBU G, "name: " + transa ctionIdHdr + " val ue: " + tr ansId); | |
| 287 | ||
| 288 | LogH elper.Log( Level.DEBU G, "JSON R eference D ocument: \ n" + jsonT ext + "\n" ); | |
| 289 | ||
| 290 | dasB atch.setRe tryCount(d asBatch.ge tRetryCoun t() + 1); | |
| 291 | dasB atch.setCo nversation Id(convId) ; // c omma separ ated list | |
| 292 | dasB atch.setTr ansactionI d(transId) ; // comma sep arated lis t | |
| 293 | dasB atch.setLa stTransTim e(currentT ime); | |
| 294 | dasB atch.setTr ansactionS tate(DasOb TransState .OB_TRANS_ START); | |
| 295 | dasB atch.setTr ansactionO utcome(Das ObTransOut come.OB_PE NDING); | |
| 296 | ||
| 297 | // t his call w ill lock t he record | |
| 298 | Opti onal<DasOb BatchLog> dasBatchLo ck = this. dasObRepos itory.find ById(dasBa tch.getId( )); | |
| 299 | if ( !dasBatchL ock.isPres ent()) { | |
| 300 | LogHel per.Log(Le vel.INFO, "Impossibl e Database Condition - record missing"); | |
| 301 | LogHel per.Log(Le vel.INFO, "Unable to LOCK DasO bBatchLog record wit h ID: " + dasBatch.g etId()); | |
| 302 | LogHel per.Log(Le vel.INFO, "*** Exit procRetryI nterval me thod ***") ; | |
| 303 | retu rn; | |
| 304 | } | |
| 305 | ||
| 306 | // u pdate the record whi ch implici tly unlock s record a s well | |
| 307 | DasO bBatchLog result = t his.dasObR epository. saveAndFlu sh(dasBatc h); | |
| 308 | ||
| 309 | Http Entity ent ity = new HttpEntity (jsonText, headers); | |
| 310 | ||
| 311 | try { | |
| 312 | resp = restTempl ate.exchan ge(new URI (dasUrl), HttpMethod .POST, ent ity, Strin g.class); | |
| 313 | } | |
| 314 | catc h (Excepti on ex) { | |
| 315 | LogHel per.Log(Le vel.ERROR, "Caught e xception c alling DAS : " + ex.t oString()) ; | |
| 316 | resp = null; | |
| 317 | ||
| 318 | } | |
| 319 | ||
| 320 | if ( resp != nu ll && resp .getStatus Code().val ue() >= 20 0 && resp. getStatusC ode().valu e() < 300) { | |
| 321 | ||
| 322 | result .setTransa ctionState (DasObTran sState.OB_ REF_DOC_SE NT); | |
| 323 | ||
| 324 | // thi s call wil l lock the record | |
| 325 | dasBat chLock = t his.dasObR epository. findById(r esult.getI d()); | |
| 326 | if (!d asBatchLoc k.isPresen t()) { | |
| 327 | LogHelpe r.Log(Leve l.INFO, "I mpossible Database C ondition - record mi ssing"); | |
| 328 | LogHelpe r.Log(Leve l.INFO, "U nable to L OCK DasObB atchLog re cord with ID: " + da sBatch.get Id() + " t o set Tran sactionSta te"); | |
| 329 | LogHelpe r.Log(Leve l.INFO, "* ** Exit pr ocRetryInt erval meth od ***"); | |
| 330 | return ; | |
| 331 | } | |
| 332 | // upd ate the re cord which implicitl y unlocks record as well | |
| 333 | this.d asObReposi tory.saveA ndFlush(re sult); | |
| 334 | LogHel per.Log(Le vel.INFO, "Status co de receive d:" + resp .getStatus Code().toS tring()); | |
| 335 | } | |
| 336 | ||
| 337 | LogH elper.Log( Level.INFO , "*** Exi t procRetr yInterval method *** "); | |
| 338 | } | |
| 339 | ||
| 340 | pr ivate DasO bBatchLog unblockRet ryQueue(Da sObBatchLo g dasBatch ) | |
| 341 | { | |
| 342 | dasB atch.setTr ansactionO utcome(Das ObTransOut come.OB_RE TRY_BLOCKE D); | |
| 343 | retu rn this.da sObReposit ory.saveAn dFlush(das Batch); | |
| 344 | } | |
| 345 | ||
| 346 | pr ivate Stri ng determi neCcnId(St ring basen ame) | |
| 347 | { | |
| 348 | Stri ng ccn = " UNKNOWN"; | |
| 349 | ||
| 350 | if ( basename.c ontains("T PA1")) | |
| 351 | ccn = "CCN_Regio n1"; | |
| 352 | else if (basen ame.contai ns("TPA2") ) | |
| 353 | ccn = "CCN_Regio n2"; | |
| 354 | else if (basen ame.contai ns("TPA3") ) | |
| 355 | ccn = "CCN_Regio n3"; | |
| 356 | else if (basen ame.contai ns("TPA4") ) | |
| 357 | ccn = "CCN_Regio n4"; | |
| 358 | else if (basen ame.contai ns("TPA5") ) | |
| 359 | ccn = "CCN_Regio n5"; | |
| 360 | ||
| 361 | retu rn ccn; | |
| 362 | } | |
| 363 | ||
| 364 | // pad the l ong into a 10 digit string beg inning wit h 0s | |
| 365 | pr ivate Stri ng padSeqN um(Long se qNum) | |
| 366 | { | |
| 367 | Stri ng numStr = seqNum.t oString(); | |
| 368 | ||
| 369 | if ( numStr.len gth() > 9) | |
| 370 | return numStr; | |
| 371 | ||
| 372 | Stri ng zeros = "00000000 00"; | |
| 373 | Stri ng convIdN um = zeros .substring (0, 10-num Str.length ()) + seqN um; | |
| 374 | retu rn convIdN um; | |
| 375 | } | |
| 376 | ||
| 377 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.